diff options
| author | Jimmy Aguilar Mena | 2019-09-09 16:10:57 +0200 |
|---|---|---|
| committer | Jimmy Aguilar Mena | 2019-10-14 14:18:40 +0200 |
| commit | eb259473db50e5083296b9dd1468e378c94ce7f1 (patch) | |
| tree | 4c157535f03b150f700af34e293fcf4209af47c9 | |
| parent | b5cd6871c0b9ba4443793217c2f9a63423a6e58d (diff) | |
| download | emacs-eb259473db50e5083296b9dd1468e378c94ce7f1.tar.gz emacs-eb259473db50e5083296b9dd1468e378c94ce7f1.zip | |
Changed handle_face_prop_general prototype.
* src/xdisp.h (handle_face_prop_general): Changed function prototype
to receive different arguments.
| -rw-r--r-- | src/xdisp.c | 97 |
1 files changed, 40 insertions, 57 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index ee1a089af59..ad4d69938c8 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -4148,14 +4148,15 @@ handle_fontified_prop (struct it *it) | |||
| 4148 | Faces | 4148 | Faces |
| 4149 | ***********************************************************************/ | 4149 | ***********************************************************************/ |
| 4150 | 4150 | ||
| 4151 | static enum prop_handled | 4151 | static int |
| 4152 | handle_face_prop_general (struct it *it, int *face_id_ptr, | 4152 | handle_face_prop_general (struct it *it, int initial_face_id, |
| 4153 | enum lface_attribute_index attr_filter) | 4153 | enum lface_attribute_index attr_filter) |
| 4154 | { | 4154 | { |
| 4155 | int new_face_id; | 4155 | int new_face_id; |
| 4156 | ptrdiff_t next_stop; | 4156 | ptrdiff_t next_stop; |
| 4157 | const bool is_string = STRINGP (it->string); | ||
| 4157 | 4158 | ||
| 4158 | if (!STRINGP (it->string)) | 4159 | if (!is_string) |
| 4159 | { | 4160 | { |
| 4160 | new_face_id | 4161 | new_face_id |
| 4161 | = face_at_buffer_position (it->w, | 4162 | = face_at_buffer_position (it->w, |
| @@ -4164,39 +4165,7 @@ handle_face_prop_general (struct it *it, int *face_id_ptr, | |||
| 4164 | (IT_CHARPOS (*it) | 4165 | (IT_CHARPOS (*it) |
| 4165 | + TEXT_PROP_DISTANCE_LIMIT), | 4166 | + TEXT_PROP_DISTANCE_LIMIT), |
| 4166 | false, it->base_face_id, attr_filter); | 4167 | false, it->base_face_id, attr_filter); |
| 4167 | 4168 | } | |
| 4168 | /* Is this a start of a run of characters with box face? | ||
| 4169 | Caveat: this can be called for a freshly initialized | ||
| 4170 | iterator; face_id is -1 in this case. We know that the new | ||
| 4171 | face will not change until limit, i.e. if the new face has a | ||
| 4172 | box, all characters up to limit will have one. But, as | ||
| 4173 | usual, we don't know whether limit is really the end. */ | ||
| 4174 | if (new_face_id != *face_id_ptr) | ||
| 4175 | { | ||
| 4176 | struct face *new_face = FACE_FROM_ID (it->f, new_face_id); | ||
| 4177 | /* If it->face_id is -1, old_face below will be NULL, see | ||
| 4178 | the definition of FACE_FROM_ID_OR_NULL. This will happen | ||
| 4179 | if this is the initial call that gets the face. */ | ||
| 4180 | struct face *old_face = FACE_FROM_ID_OR_NULL (it->f, *face_id_ptr); | ||
| 4181 | |||
| 4182 | /* If the value of face_id of the iterator is -1, we have to | ||
| 4183 | look in front of IT's position and see whether there is a | ||
| 4184 | face there that's different from new_face_id. */ | ||
| 4185 | if (!old_face && IT_CHARPOS (*it) > BEG) | ||
| 4186 | { | ||
| 4187 | int prev_face_id = face_before_it_pos (it); | ||
| 4188 | |||
| 4189 | old_face = FACE_FROM_ID_OR_NULL (it->f, prev_face_id); | ||
| 4190 | } | ||
| 4191 | |||
| 4192 | /* If the new face has a box, but the old face does not, | ||
| 4193 | this is the start of a run of characters with box face, | ||
| 4194 | i.e. this character has a shadow on the left side. */ | ||
| 4195 | it->start_of_box_run_p = (new_face->box != FACE_NO_BOX | ||
| 4196 | && (old_face == NULL || !old_face->box)); | ||
| 4197 | it->face_box_p = new_face->box != FACE_NO_BOX; | ||
| 4198 | } | ||
| 4199 | } | ||
| 4200 | else | 4169 | else |
| 4201 | { | 4170 | { |
| 4202 | int base_face_id; | 4171 | int base_face_id; |
| @@ -4275,40 +4244,53 @@ handle_face_prop_general (struct it *it, int *face_id_ptr, | |||
| 4275 | bufpos, | 4244 | bufpos, |
| 4276 | &next_stop, | 4245 | &next_stop, |
| 4277 | base_face_id, false); | 4246 | base_face_id, false); |
| 4247 | } | ||
| 4248 | |||
| 4249 | /* Is this a start of a run of characters with box face? | ||
| 4250 | Caveat: this can be called for a freshly initialized | ||
| 4251 | iterator; face_id is -1 in this case. We know that the new | ||
| 4252 | face will not change until limit, i.e. if the new face has a | ||
| 4253 | box, all characters up to limit will have one. But, as | ||
| 4254 | usual, we don't know whether limit is really the end. */ | ||
| 4255 | if (new_face_id != initial_face_id) | ||
| 4256 | { | ||
| 4257 | struct face *new_face = FACE_FROM_ID (it->f, new_face_id); | ||
| 4258 | /* If it->face_id is -1, old_face below will be NULL, see | ||
| 4259 | the definition of FACE_FROM_ID_OR_NULL. This will happen | ||
| 4260 | if this is the initial call that gets the face. */ | ||
| 4261 | struct face *old_face = FACE_FROM_ID_OR_NULL (it->f, initial_face_id); | ||
| 4278 | 4262 | ||
| 4279 | /* Is this a start of a run of characters with box? Caveat: | 4263 | /* If the value of face_id of the iterator is -1, we have to |
| 4280 | this can be called for a freshly allocated iterator; face_id | 4264 | look in front of IT's position and see whether there is a |
| 4281 | is -1 is this case. We know that the new face will not | 4265 | face there that's different from new_face_id. */ |
| 4282 | change until the next check pos, i.e. if the new face has a | 4266 | if (!is_string |
| 4283 | box, all characters up to that position will have a | 4267 | && !old_face |
| 4284 | box. But, as usual, we don't know whether that position | 4268 | && IT_CHARPOS (*it) > BEG) |
| 4285 | is really the end. */ | ||
| 4286 | if (new_face_id != *face_id_ptr) | ||
| 4287 | { | 4269 | { |
| 4288 | struct face *new_face = FACE_FROM_ID (it->f, new_face_id); | 4270 | int prev_face_id = face_before_it_pos (it); |
| 4289 | struct face *old_face = FACE_FROM_ID_OR_NULL (it->f, *face_id_ptr); | ||
| 4290 | 4271 | ||
| 4291 | /* If new face has a box but old face hasn't, this is the | 4272 | old_face = FACE_FROM_ID_OR_NULL (it->f, prev_face_id); |
| 4292 | start of a run of characters with box, i.e. it has a | ||
| 4293 | shadow on the left side. */ | ||
| 4294 | it->start_of_box_run_p | ||
| 4295 | = new_face->box && (old_face == NULL || !old_face->box); | ||
| 4296 | it->face_box_p = new_face->box != FACE_NO_BOX; | ||
| 4297 | } | 4273 | } |
| 4274 | |||
| 4275 | /* If the new face has a box, but the old face does not, | ||
| 4276 | this is the start of a run of characters with box face, | ||
| 4277 | i.e. this character has a shadow on the left side. */ | ||
| 4278 | it->start_of_box_run_p = (new_face->box != FACE_NO_BOX | ||
| 4279 | && (old_face == NULL || !old_face->box)); | ||
| 4280 | it->face_box_p = new_face->box != FACE_NO_BOX; | ||
| 4298 | } | 4281 | } |
| 4299 | 4282 | ||
| 4300 | *face_id_ptr = new_face_id; | 4283 | return new_face_id; |
| 4301 | return HANDLED_NORMALLY; | ||
| 4302 | } | 4284 | } |
| 4303 | 4285 | ||
| 4304 | 4286 | ||
| 4305 | /* Set up iterator IT from face properties at its current position. | 4287 | /* Set up iterator IT from face properties at its current position. |
| 4306 | Called from handle_stop. */ | 4288 | Called from handle_stop. */ |
| 4307 | |||
| 4308 | static enum prop_handled | 4289 | static enum prop_handled |
| 4309 | handle_face_prop (struct it *it) | 4290 | handle_face_prop (struct it *it) |
| 4310 | { | 4291 | { |
| 4311 | return handle_face_prop_general (it, &(it->face_id), 0); | 4292 | it->face_id = handle_face_prop_general (it, it->face_id, 0); |
| 4293 | return HANDLED_NORMALLY; | ||
| 4312 | } | 4294 | } |
| 4313 | 4295 | ||
| 4314 | 4296 | ||
| @@ -21593,7 +21575,8 @@ extend_face_to_end_of_line (struct it *it) | |||
| 21593 | || WINDOW_RIGHT_MARGIN_WIDTH (it->w) > 0)) | 21575 | || WINDOW_RIGHT_MARGIN_WIDTH (it->w) > 0)) |
| 21594 | return; | 21576 | return; |
| 21595 | 21577 | ||
| 21596 | handle_face_prop_general (it, &(it->extend_face_id), LFACE_EXTEND_INDEX); | 21578 | it->extend_face_id |
| 21579 | = handle_face_prop_general (it, it->extend_face_id, LFACE_EXTEND_INDEX); | ||
| 21597 | 21580 | ||
| 21598 | /* Face extension extends the background and box of IT->extend_face_id | 21581 | /* Face extension extends the background and box of IT->extend_face_id |
| 21599 | to the end of the line. If the background equals the background | 21582 | to the end of the line. If the background equals the background |