Mercurial > emacs
comparison src/xdisp.c @ 92663:b3b2c224528e
(GET_NEXT_DISPLAY_ELEMENT): New macro.
(get_next_display_element, next_element_from_string)
(next_element_from_ellipsis, next_element_from_buffer): Use it.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Sat, 08 Mar 2008 22:39:56 +0000 |
parents | ad3ad47174cb |
children | d999f30304bc |
comparison
equal
deleted
inserted
replaced
92662:4b12e6633ee4 | 92663:b3b2c224528e |
---|---|
5711 next_element_from_c_string, | 5711 next_element_from_c_string, |
5712 next_element_from_image, | 5712 next_element_from_image, |
5713 next_element_from_stretch | 5713 next_element_from_stretch |
5714 }; | 5714 }; |
5715 | 5715 |
5716 #define GET_NEXT_DISPLAY_ELEMENT(it) (*get_next_element[(it)->method]) (it) | |
5716 | 5717 |
5717 /* Load IT's display element fields with information about the next | 5718 /* Load IT's display element fields with information about the next |
5718 display element from the current position of IT. Value is zero if | 5719 display element from the current position of IT. Value is zero if |
5719 end of buffer (or C string) is reached. */ | 5720 end of buffer (or C string) is reached. */ |
5720 | 5721 |
5731 function pointer `method' used here turns out to be faster than | 5732 function pointer `method' used here turns out to be faster than |
5732 using a sequence of if-statements. */ | 5733 using a sequence of if-statements. */ |
5733 int success_p; | 5734 int success_p; |
5734 | 5735 |
5735 get_next: | 5736 get_next: |
5736 success_p = (*get_next_element[it->method]) (it); | 5737 success_p = GET_NEXT_DISPLAY_ELEMENT (it); |
5737 | 5738 |
5738 if (it->what == IT_CHARACTER) | 5739 if (it->what == IT_CHARACTER) |
5739 { | 5740 { |
5740 /* Map via display table or translate control characters. | 5741 /* Map via display table or translate control characters. |
5741 IT->c, IT->len etc. have been set to the next character by | 5742 IT->c, IT->len etc. have been set to the next character by |
6261 { | 6262 { |
6262 handle_stop (it); | 6263 handle_stop (it); |
6263 | 6264 |
6264 /* Since a handler may have changed IT->method, we must | 6265 /* Since a handler may have changed IT->method, we must |
6265 recurse here. */ | 6266 recurse here. */ |
6266 return get_next_display_element (it); | 6267 return GET_NEXT_DISPLAY_ELEMENT (it); |
6267 } | 6268 } |
6268 | 6269 |
6269 if (it->current.overlay_string_index >= 0) | 6270 if (it->current.overlay_string_index >= 0) |
6270 { | 6271 { |
6271 /* Get the next character from an overlay string. In overlay | 6272 /* Get the next character from an overlay string. In overlay |
6399 it->object = it->w->buffer; | 6400 it->object = it->w->buffer; |
6400 reseat_at_next_visible_line_start (it, 1); | 6401 reseat_at_next_visible_line_start (it, 1); |
6401 it->face_before_selective_p = 1; | 6402 it->face_before_selective_p = 1; |
6402 } | 6403 } |
6403 | 6404 |
6404 return get_next_display_element (it); | 6405 return GET_NEXT_DISPLAY_ELEMENT (it); |
6405 } | 6406 } |
6406 | 6407 |
6407 | 6408 |
6408 /* Deliver an image display element. The iterator IT is already | 6409 /* Deliver an image display element. The iterator IT is already |
6409 filled with image information (done in handle_display_prop). Value | 6410 filled with image information (done in handle_display_prop). Value |
6463 it->overlay_strings_at_end_processed_p = 1; | 6464 it->overlay_strings_at_end_processed_p = 1; |
6464 overlay_strings_follow_p = get_overlay_strings (it, 0); | 6465 overlay_strings_follow_p = get_overlay_strings (it, 0); |
6465 } | 6466 } |
6466 | 6467 |
6467 if (overlay_strings_follow_p) | 6468 if (overlay_strings_follow_p) |
6468 success_p = get_next_display_element (it); | 6469 success_p = GET_NEXT_DISPLAY_ELEMENT (it); |
6469 else | 6470 else |
6470 { | 6471 { |
6471 it->what = IT_EOB; | 6472 it->what = IT_EOB; |
6472 it->position = it->current.pos; | 6473 it->position = it->current.pos; |
6473 success_p = 0; | 6474 success_p = 0; |
6474 } | 6475 } |
6475 } | 6476 } |
6476 else | 6477 else |
6477 { | 6478 { |
6478 handle_stop (it); | 6479 handle_stop (it); |
6479 return get_next_display_element (it); | 6480 return GET_NEXT_DISPLAY_ELEMENT (it); |
6480 } | 6481 } |
6481 } | 6482 } |
6482 else | 6483 else |
6483 { | 6484 { |
6484 /* No face changes, overlays etc. in sight, so just return a | 6485 /* No face changes, overlays etc. in sight, so just return a |