diff options
| author | Kim F. Storm | 2005-02-16 23:45:03 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2005-02-16 23:45:03 +0000 |
| commit | a6f82cc4ec7ae5b4360e4dd11fae44dd739a8c52 (patch) | |
| tree | 0007bd2621cfb4d34300b48b0c17a392e8e697a3 /src | |
| parent | 6a88f968f938203d39d3561dd08abe28e9435058 (diff) | |
| download | emacs-a6f82cc4ec7ae5b4360e4dd11fae44dd739a8c52.tar.gz emacs-a6f82cc4ec7ae5b4360e4dd11fae44dd739a8c52.zip | |
(check_it, init_from_display_pos, handle_stop)
(setup_for_ellipsis, handle_single_display_spec)
(handle_composition_prop, next_overlay_string)
(get_overlay_strings, reseat_1, reseat_to_string)
(next_element_from_ellipsis, BUFFER_POS_REACHED_P)
(in_display_vector_p, display_line, get_next_display_element):
Change it->method from function pointer to enum.
(get_next_element): New array to map it->method to function.
(get_next_display_element): Use it.
(set_iterator_to_next): Use switch instead of if/else chain.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 138 |
1 files changed, 77 insertions, 61 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index c0489aa5ecb..f7a3b6dc914 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -827,7 +827,6 @@ static char *decode_mode_spec_coding P_ ((Lisp_Object, char *, int)); | |||
| 827 | static int invisible_text_between_p P_ ((struct it *, int, int)); | 827 | static int invisible_text_between_p P_ ((struct it *, int, int)); |
| 828 | #endif | 828 | #endif |
| 829 | 829 | ||
| 830 | static int next_element_from_ellipsis P_ ((struct it *)); | ||
| 831 | static void pint2str P_ ((char *, int, int)); | 830 | static void pint2str P_ ((char *, int, int)); |
| 832 | static void pint2hrstr P_ ((char *, int, int)); | 831 | static void pint2hrstr P_ ((char *, int, int)); |
| 833 | static struct text_pos run_window_scroll_functions P_ ((Lisp_Object, | 832 | static struct text_pos run_window_scroll_functions P_ ((Lisp_Object, |
| @@ -902,6 +901,7 @@ static void reseat_1 P_ ((struct it *, struct text_pos, int)); | |||
| 902 | static void back_to_previous_visible_line_start P_ ((struct it *)); | 901 | static void back_to_previous_visible_line_start P_ ((struct it *)); |
| 903 | void reseat_at_previous_visible_line_start P_ ((struct it *)); | 902 | void reseat_at_previous_visible_line_start P_ ((struct it *)); |
| 904 | static void reseat_at_next_visible_line_start P_ ((struct it *, int)); | 903 | static void reseat_at_next_visible_line_start P_ ((struct it *, int)); |
| 904 | static int next_element_from_ellipsis P_ ((struct it *)); | ||
| 905 | static int next_element_from_display_vector P_ ((struct it *)); | 905 | static int next_element_from_display_vector P_ ((struct it *)); |
| 906 | static int next_element_from_string P_ ((struct it *)); | 906 | static int next_element_from_string P_ ((struct it *)); |
| 907 | static int next_element_from_c_string P_ ((struct it *)); | 907 | static int next_element_from_c_string P_ ((struct it *)); |
| @@ -2043,7 +2043,7 @@ static void | |||
| 2043 | check_it (it) | 2043 | check_it (it) |
| 2044 | struct it *it; | 2044 | struct it *it; |
| 2045 | { | 2045 | { |
| 2046 | if (it->method == next_element_from_string) | 2046 | if (it->method == GET_FROM_STRING) |
| 2047 | { | 2047 | { |
| 2048 | xassert (STRINGP (it->string)); | 2048 | xassert (STRINGP (it->string)); |
| 2049 | xassert (IT_STRING_CHARPOS (*it) >= 0); | 2049 | xassert (IT_STRING_CHARPOS (*it) >= 0); |
| @@ -2051,7 +2051,7 @@ check_it (it) | |||
| 2051 | else | 2051 | else |
| 2052 | { | 2052 | { |
| 2053 | xassert (IT_STRING_CHARPOS (*it) < 0); | 2053 | xassert (IT_STRING_CHARPOS (*it) < 0); |
| 2054 | if (it->method == next_element_from_buffer) | 2054 | if (it->method == GET_FROM_BUFFER) |
| 2055 | { | 2055 | { |
| 2056 | /* Check that character and byte positions agree. */ | 2056 | /* Check that character and byte positions agree. */ |
| 2057 | xassert (IT_CHARPOS (*it) == BYTE_TO_CHAR (IT_BYTEPOS (*it))); | 2057 | xassert (IT_CHARPOS (*it) == BYTE_TO_CHAR (IT_BYTEPOS (*it))); |
| @@ -2561,7 +2561,7 @@ init_from_display_pos (it, w, pos) | |||
| 2561 | property for an image, the iterator will be set up for that | 2561 | property for an image, the iterator will be set up for that |
| 2562 | image, and we have to undo that setup first before we can | 2562 | image, and we have to undo that setup first before we can |
| 2563 | correct the overlay string index. */ | 2563 | correct the overlay string index. */ |
| 2564 | if (it->method == next_element_from_image) | 2564 | if (it->method == GET_FROM_IMAGE) |
| 2565 | pop_it (it); | 2565 | pop_it (it); |
| 2566 | 2566 | ||
| 2567 | /* We already have the first chunk of overlay strings in | 2567 | /* We already have the first chunk of overlay strings in |
| @@ -2584,7 +2584,7 @@ init_from_display_pos (it, w, pos) | |||
| 2584 | it->string = it->overlay_strings[relative_index]; | 2584 | it->string = it->overlay_strings[relative_index]; |
| 2585 | xassert (STRINGP (it->string)); | 2585 | xassert (STRINGP (it->string)); |
| 2586 | it->current.string_pos = pos->string_pos; | 2586 | it->current.string_pos = pos->string_pos; |
| 2587 | it->method = next_element_from_string; | 2587 | it->method = GET_FROM_STRING; |
| 2588 | } | 2588 | } |
| 2589 | 2589 | ||
| 2590 | #if 0 /* This is bogus because POS not having an overlay string | 2590 | #if 0 /* This is bogus because POS not having an overlay string |
| @@ -2600,7 +2600,7 @@ init_from_display_pos (it, w, pos) | |||
| 2600 | while (it->sp) | 2600 | while (it->sp) |
| 2601 | pop_it (it); | 2601 | pop_it (it); |
| 2602 | it->current.overlay_string_index = -1; | 2602 | it->current.overlay_string_index = -1; |
| 2603 | it->method = next_element_from_buffer; | 2603 | it->method = GET_FROM_BUFFER; |
| 2604 | if (CHARPOS (pos->pos) == ZV) | 2604 | if (CHARPOS (pos->pos) == ZV) |
| 2605 | it->overlay_strings_at_end_processed_p = 1; | 2605 | it->overlay_strings_at_end_processed_p = 1; |
| 2606 | } | 2606 | } |
| @@ -2714,7 +2714,7 @@ handle_stop (it) | |||
| 2714 | { | 2714 | { |
| 2715 | /* Don't check for overlay strings below when set to deliver | 2715 | /* Don't check for overlay strings below when set to deliver |
| 2716 | characters from a display vector. */ | 2716 | characters from a display vector. */ |
| 2717 | if (it->method == next_element_from_display_vector) | 2717 | if (it->method == GET_FROM_DISPLAY_VECTOR) |
| 2718 | handle_overlay_change_p = 0; | 2718 | handle_overlay_change_p = 0; |
| 2719 | 2719 | ||
| 2720 | /* Handle overlay changes. */ | 2720 | /* Handle overlay changes. */ |
| @@ -3372,7 +3372,7 @@ setup_for_ellipsis (it, len) | |||
| 3372 | /* Remember the current face id in case glyphs specify faces. | 3372 | /* Remember the current face id in case glyphs specify faces. |
| 3373 | IT's face is restored in set_iterator_to_next. */ | 3373 | IT's face is restored in set_iterator_to_next. */ |
| 3374 | it->saved_face_id = it->face_id; | 3374 | it->saved_face_id = it->face_id; |
| 3375 | it->method = next_element_from_display_vector; | 3375 | it->method = GET_FROM_DISPLAY_VECTOR; |
| 3376 | it->ellipsis_p = 1; | 3376 | it->ellipsis_p = 1; |
| 3377 | } | 3377 | } |
| 3378 | 3378 | ||
| @@ -3737,7 +3737,7 @@ handle_single_display_spec (it, spec, object, position, | |||
| 3737 | it->image_id = -1; /* no image */ | 3737 | it->image_id = -1; /* no image */ |
| 3738 | it->position = start_pos; | 3738 | it->position = start_pos; |
| 3739 | it->object = NILP (object) ? it->w->buffer : object; | 3739 | it->object = NILP (object) ? it->w->buffer : object; |
| 3740 | it->method = next_element_from_image; | 3740 | it->method = GET_FROM_IMAGE; |
| 3741 | it->face_id = face_id; | 3741 | it->face_id = face_id; |
| 3742 | 3742 | ||
| 3743 | /* Say that we haven't consumed the characters with | 3743 | /* Say that we haven't consumed the characters with |
| @@ -3820,7 +3820,7 @@ handle_single_display_spec (it, spec, object, position, | |||
| 3820 | it->current.overlay_string_index = -1; | 3820 | it->current.overlay_string_index = -1; |
| 3821 | IT_STRING_CHARPOS (*it) = IT_STRING_BYTEPOS (*it) = 0; | 3821 | IT_STRING_CHARPOS (*it) = IT_STRING_BYTEPOS (*it) = 0; |
| 3822 | it->end_charpos = it->string_nchars = SCHARS (it->string); | 3822 | it->end_charpos = it->string_nchars = SCHARS (it->string); |
| 3823 | it->method = next_element_from_string; | 3823 | it->method = GET_FROM_STRING; |
| 3824 | it->stop_charpos = 0; | 3824 | it->stop_charpos = 0; |
| 3825 | it->string_from_display_prop_p = 1; | 3825 | it->string_from_display_prop_p = 1; |
| 3826 | /* Say that we haven't consumed the characters with | 3826 | /* Say that we haven't consumed the characters with |
| @@ -3830,7 +3830,7 @@ handle_single_display_spec (it, spec, object, position, | |||
| 3830 | } | 3830 | } |
| 3831 | else if (CONSP (value) && EQ (XCAR (value), Qspace)) | 3831 | else if (CONSP (value) && EQ (XCAR (value), Qspace)) |
| 3832 | { | 3832 | { |
| 3833 | it->method = next_element_from_stretch; | 3833 | it->method = GET_FROM_STRETCH; |
| 3834 | it->object = value; | 3834 | it->object = value; |
| 3835 | it->current.pos = it->position = start_pos; | 3835 | it->current.pos = it->position = start_pos; |
| 3836 | } | 3836 | } |
| @@ -3841,7 +3841,7 @@ handle_single_display_spec (it, spec, object, position, | |||
| 3841 | it->image_id = lookup_image (it->f, value); | 3841 | it->image_id = lookup_image (it->f, value); |
| 3842 | it->position = start_pos; | 3842 | it->position = start_pos; |
| 3843 | it->object = NILP (object) ? it->w->buffer : object; | 3843 | it->object = NILP (object) ? it->w->buffer : object; |
| 3844 | it->method = next_element_from_image; | 3844 | it->method = GET_FROM_IMAGE; |
| 3845 | 3845 | ||
| 3846 | /* Say that we haven't consumed the characters with | 3846 | /* Say that we haven't consumed the characters with |
| 3847 | `display' property yet. The call to pop_it in | 3847 | `display' property yet. The call to pop_it in |
| @@ -4097,7 +4097,7 @@ handle_composition_prop (it) | |||
| 4097 | 4097 | ||
| 4098 | if (id >= 0) | 4098 | if (id >= 0) |
| 4099 | { | 4099 | { |
| 4100 | it->method = next_element_from_composition; | 4100 | it->method = GET_FROM_COMPOSITION; |
| 4101 | it->cmp_id = id; | 4101 | it->cmp_id = id; |
| 4102 | it->cmp_len = COMPOSITION_LENGTH (prop); | 4102 | it->cmp_len = COMPOSITION_LENGTH (prop); |
| 4103 | /* For a terminal, draw only the first character of the | 4103 | /* For a terminal, draw only the first character of the |
| @@ -4172,7 +4172,7 @@ next_overlay_string (it) | |||
| 4172 | it->current.overlay_string_index = -1; | 4172 | it->current.overlay_string_index = -1; |
| 4173 | SET_TEXT_POS (it->current.string_pos, -1, -1); | 4173 | SET_TEXT_POS (it->current.string_pos, -1, -1); |
| 4174 | it->n_overlay_strings = 0; | 4174 | it->n_overlay_strings = 0; |
| 4175 | it->method = next_element_from_buffer; | 4175 | it->method = GET_FROM_BUFFER; |
| 4176 | 4176 | ||
| 4177 | /* If we're at the end of the buffer, record that we have | 4177 | /* If we're at the end of the buffer, record that we have |
| 4178 | processed the overlay strings there already, so that | 4178 | processed the overlay strings there already, so that |
| @@ -4201,7 +4201,7 @@ next_overlay_string (it) | |||
| 4201 | it->string = it->overlay_strings[i]; | 4201 | it->string = it->overlay_strings[i]; |
| 4202 | it->multibyte_p = STRING_MULTIBYTE (it->string); | 4202 | it->multibyte_p = STRING_MULTIBYTE (it->string); |
| 4203 | SET_TEXT_POS (it->current.string_pos, 0, 0); | 4203 | SET_TEXT_POS (it->current.string_pos, 0, 0); |
| 4204 | it->method = next_element_from_string; | 4204 | it->method = GET_FROM_STRING; |
| 4205 | it->stop_charpos = 0; | 4205 | it->stop_charpos = 0; |
| 4206 | } | 4206 | } |
| 4207 | 4207 | ||
| @@ -4466,13 +4466,13 @@ get_overlay_strings (it, charpos) | |||
| 4466 | xassert (STRINGP (it->string)); | 4466 | xassert (STRINGP (it->string)); |
| 4467 | it->end_charpos = SCHARS (it->string); | 4467 | it->end_charpos = SCHARS (it->string); |
| 4468 | it->multibyte_p = STRING_MULTIBYTE (it->string); | 4468 | it->multibyte_p = STRING_MULTIBYTE (it->string); |
| 4469 | it->method = next_element_from_string; | 4469 | it->method = GET_FROM_STRING; |
| 4470 | } | 4470 | } |
| 4471 | else | 4471 | else |
| 4472 | { | 4472 | { |
| 4473 | it->string = Qnil; | 4473 | it->string = Qnil; |
| 4474 | it->current.overlay_string_index = -1; | 4474 | it->current.overlay_string_index = -1; |
| 4475 | it->method = next_element_from_buffer; | 4475 | it->method = GET_FROM_BUFFER; |
| 4476 | } | 4476 | } |
| 4477 | 4477 | ||
| 4478 | CHECK_IT (it); | 4478 | CHECK_IT (it); |
| @@ -4850,7 +4850,7 @@ reseat_1 (it, pos, set_stop_p) | |||
| 4850 | IT_STRING_CHARPOS (*it) = -1; | 4850 | IT_STRING_CHARPOS (*it) = -1; |
| 4851 | IT_STRING_BYTEPOS (*it) = -1; | 4851 | IT_STRING_BYTEPOS (*it) = -1; |
| 4852 | it->string = Qnil; | 4852 | it->string = Qnil; |
| 4853 | it->method = next_element_from_buffer; | 4853 | it->method = GET_FROM_BUFFER; |
| 4854 | /* RMS: I added this to fix a bug in move_it_vertically_backward | 4854 | /* RMS: I added this to fix a bug in move_it_vertically_backward |
| 4855 | where it->area continued to relate to the starting point | 4855 | where it->area continued to relate to the starting point |
| 4856 | for the backward motion. Bug report from | 4856 | for the backward motion. Bug report from |
| @@ -4916,7 +4916,7 @@ reseat_to_string (it, s, string, charpos, precision, field_width, multibyte) | |||
| 4916 | it->string = string; | 4916 | it->string = string; |
| 4917 | it->s = NULL; | 4917 | it->s = NULL; |
| 4918 | it->end_charpos = it->string_nchars = SCHARS (string); | 4918 | it->end_charpos = it->string_nchars = SCHARS (string); |
| 4919 | it->method = next_element_from_string; | 4919 | it->method = GET_FROM_STRING; |
| 4920 | it->current.string_pos = string_pos (charpos, string); | 4920 | it->current.string_pos = string_pos (charpos, string); |
| 4921 | } | 4921 | } |
| 4922 | else | 4922 | else |
| @@ -4938,7 +4938,7 @@ reseat_to_string (it, s, string, charpos, precision, field_width, multibyte) | |||
| 4938 | it->end_charpos = it->string_nchars = strlen (s); | 4938 | it->end_charpos = it->string_nchars = strlen (s); |
| 4939 | } | 4939 | } |
| 4940 | 4940 | ||
| 4941 | it->method = next_element_from_c_string; | 4941 | it->method = GET_FROM_C_STRING; |
| 4942 | } | 4942 | } |
| 4943 | 4943 | ||
| 4944 | /* PRECISION > 0 means don't return more than PRECISION characters | 4944 | /* PRECISION > 0 means don't return more than PRECISION characters |
| @@ -4969,6 +4969,20 @@ reseat_to_string (it, s, string, charpos, precision, field_width, multibyte) | |||
| 4969 | Iteration | 4969 | Iteration |
| 4970 | ***********************************************************************/ | 4970 | ***********************************************************************/ |
| 4971 | 4971 | ||
| 4972 | /* Map enum it_method value to corresponding next_element_from_* function. */ | ||
| 4973 | |||
| 4974 | static int (* get_next_element[NUM_IT_METHODS]) P_ ((struct it *it)) = | ||
| 4975 | { | ||
| 4976 | next_element_from_buffer, | ||
| 4977 | next_element_from_display_vector, | ||
| 4978 | next_element_from_composition, | ||
| 4979 | next_element_from_string, | ||
| 4980 | next_element_from_c_string, | ||
| 4981 | next_element_from_image, | ||
| 4982 | next_element_from_stretch | ||
| 4983 | }; | ||
| 4984 | |||
| 4985 | |||
| 4972 | /* Load IT's display element fields with information about the next | 4986 | /* Load IT's display element fields with information about the next |
| 4973 | display element from the current position of IT. Value is zero if | 4987 | display element from the current position of IT. Value is zero if |
| 4974 | end of buffer (or C string) is reached. */ | 4988 | end of buffer (or C string) is reached. */ |
| @@ -4984,7 +4998,7 @@ get_next_display_element (it) | |||
| 4984 | int success_p; | 4998 | int success_p; |
| 4985 | 4999 | ||
| 4986 | get_next: | 5000 | get_next: |
| 4987 | success_p = (*it->method) (it); | 5001 | success_p = (*get_next_element[it->method]) (it); |
| 4988 | 5002 | ||
| 4989 | if (it->what == IT_CHARACTER) | 5003 | if (it->what == IT_CHARACTER) |
| 4990 | { | 5004 | { |
| @@ -5018,7 +5032,7 @@ get_next_display_element (it) | |||
| 5018 | it->current.dpvec_index = 0; | 5032 | it->current.dpvec_index = 0; |
| 5019 | it->dpvec_face_id = -1; | 5033 | it->dpvec_face_id = -1; |
| 5020 | it->saved_face_id = it->face_id; | 5034 | it->saved_face_id = it->face_id; |
| 5021 | it->method = next_element_from_display_vector; | 5035 | it->method = GET_FROM_DISPLAY_VECTOR; |
| 5022 | it->ellipsis_p = 0; | 5036 | it->ellipsis_p = 0; |
| 5023 | } | 5037 | } |
| 5024 | else | 5038 | else |
| @@ -5176,7 +5190,7 @@ get_next_display_element (it) | |||
| 5176 | it->current.dpvec_index = 0; | 5190 | it->current.dpvec_index = 0; |
| 5177 | it->dpvec_face_id = face_id; | 5191 | it->dpvec_face_id = face_id; |
| 5178 | it->saved_face_id = it->face_id; | 5192 | it->saved_face_id = it->face_id; |
| 5179 | it->method = next_element_from_display_vector; | 5193 | it->method = GET_FROM_DISPLAY_VECTOR; |
| 5180 | it->ellipsis_p = 0; | 5194 | it->ellipsis_p = 0; |
| 5181 | goto get_next; | 5195 | goto get_next; |
| 5182 | } | 5196 | } |
| @@ -5238,8 +5252,9 @@ set_iterator_to_next (it, reseat_p) | |||
| 5238 | moving the iterator to a new position might set them. */ | 5252 | moving the iterator to a new position might set them. */ |
| 5239 | it->start_of_box_run_p = it->end_of_box_run_p = 0; | 5253 | it->start_of_box_run_p = it->end_of_box_run_p = 0; |
| 5240 | 5254 | ||
| 5241 | if (it->method == next_element_from_buffer) | 5255 | switch (it->method) |
| 5242 | { | 5256 | { |
| 5257 | case GET_FROM_BUFFER: | ||
| 5243 | /* The current display element of IT is a character from | 5258 | /* The current display element of IT is a character from |
| 5244 | current_buffer. Advance in the buffer, and maybe skip over | 5259 | current_buffer. Advance in the buffer, and maybe skip over |
| 5245 | invisible lines that are so because of selective display. */ | 5260 | invisible lines that are so because of selective display. */ |
| @@ -5252,32 +5267,32 @@ set_iterator_to_next (it, reseat_p) | |||
| 5252 | IT_CHARPOS (*it) += 1; | 5267 | IT_CHARPOS (*it) += 1; |
| 5253 | xassert (IT_BYTEPOS (*it) == CHAR_TO_BYTE (IT_CHARPOS (*it))); | 5268 | xassert (IT_BYTEPOS (*it) == CHAR_TO_BYTE (IT_CHARPOS (*it))); |
| 5254 | } | 5269 | } |
| 5255 | } | 5270 | break; |
| 5256 | else if (it->method == next_element_from_composition) | 5271 | |
| 5257 | { | 5272 | case GET_FROM_COMPOSITION: |
| 5258 | xassert (it->cmp_id >= 0 && it ->cmp_id < n_compositions); | 5273 | xassert (it->cmp_id >= 0 && it->cmp_id < n_compositions); |
| 5259 | if (STRINGP (it->string)) | 5274 | if (STRINGP (it->string)) |
| 5260 | { | 5275 | { |
| 5261 | IT_STRING_BYTEPOS (*it) += it->len; | 5276 | IT_STRING_BYTEPOS (*it) += it->len; |
| 5262 | IT_STRING_CHARPOS (*it) += it->cmp_len; | 5277 | IT_STRING_CHARPOS (*it) += it->cmp_len; |
| 5263 | it->method = next_element_from_string; | 5278 | it->method = GET_FROM_STRING; |
| 5264 | goto consider_string_end; | 5279 | goto consider_string_end; |
| 5265 | } | 5280 | } |
| 5266 | else | 5281 | else |
| 5267 | { | 5282 | { |
| 5268 | IT_BYTEPOS (*it) += it->len; | 5283 | IT_BYTEPOS (*it) += it->len; |
| 5269 | IT_CHARPOS (*it) += it->cmp_len; | 5284 | IT_CHARPOS (*it) += it->cmp_len; |
| 5270 | it->method = next_element_from_buffer; | 5285 | it->method = GET_FROM_BUFFER; |
| 5271 | } | 5286 | } |
| 5272 | } | 5287 | break; |
| 5273 | else if (it->method == next_element_from_c_string) | 5288 | |
| 5274 | { | 5289 | case GET_FROM_C_STRING: |
| 5275 | /* Current display element of IT is from a C string. */ | 5290 | /* Current display element of IT is from a C string. */ |
| 5276 | IT_BYTEPOS (*it) += it->len; | 5291 | IT_BYTEPOS (*it) += it->len; |
| 5277 | IT_CHARPOS (*it) += 1; | 5292 | IT_CHARPOS (*it) += 1; |
| 5278 | } | 5293 | break; |
| 5279 | else if (it->method == next_element_from_display_vector) | 5294 | |
| 5280 | { | 5295 | case GET_FROM_DISPLAY_VECTOR: |
| 5281 | /* Current display element of IT is from a display table entry. | 5296 | /* Current display element of IT is from a display table entry. |
| 5282 | Advance in the display table definition. Reset it to null if | 5297 | Advance in the display table definition. Reset it to null if |
| 5283 | end reached, and continue with characters from buffers/ | 5298 | end reached, and continue with characters from buffers/ |
| @@ -5291,11 +5306,11 @@ set_iterator_to_next (it, reseat_p) | |||
| 5291 | if (it->dpvec + it->current.dpvec_index == it->dpend) | 5306 | if (it->dpvec + it->current.dpvec_index == it->dpend) |
| 5292 | { | 5307 | { |
| 5293 | if (it->s) | 5308 | if (it->s) |
| 5294 | it->method = next_element_from_c_string; | 5309 | it->method = GET_FROM_C_STRING; |
| 5295 | else if (STRINGP (it->string)) | 5310 | else if (STRINGP (it->string)) |
| 5296 | it->method = next_element_from_string; | 5311 | it->method = GET_FROM_STRING; |
| 5297 | else | 5312 | else |
| 5298 | it->method = next_element_from_buffer; | 5313 | it->method = GET_FROM_BUFFER; |
| 5299 | 5314 | ||
| 5300 | it->dpvec = NULL; | 5315 | it->dpvec = NULL; |
| 5301 | it->current.dpvec_index = -1; | 5316 | it->current.dpvec_index = -1; |
| @@ -5312,9 +5327,9 @@ set_iterator_to_next (it, reseat_p) | |||
| 5312 | /* Recheck faces after display vector */ | 5327 | /* Recheck faces after display vector */ |
| 5313 | it->stop_charpos = IT_CHARPOS (*it); | 5328 | it->stop_charpos = IT_CHARPOS (*it); |
| 5314 | } | 5329 | } |
| 5315 | } | 5330 | break; |
| 5316 | else if (it->method == next_element_from_string) | 5331 | |
| 5317 | { | 5332 | case GET_FROM_STRING: |
| 5318 | /* Current display element is a character from a Lisp string. */ | 5333 | /* Current display element is a character from a Lisp string. */ |
| 5319 | xassert (it->s == NULL && STRINGP (it->string)); | 5334 | xassert (it->s == NULL && STRINGP (it->string)); |
| 5320 | IT_STRING_BYTEPOS (*it) += it->len; | 5335 | IT_STRING_BYTEPOS (*it) += it->len; |
| @@ -5339,34 +5354,35 @@ set_iterator_to_next (it, reseat_p) | |||
| 5339 | && it->sp > 0) | 5354 | && it->sp > 0) |
| 5340 | { | 5355 | { |
| 5341 | pop_it (it); | 5356 | pop_it (it); |
| 5342 | if (!STRINGP (it->string)) | 5357 | if (STRINGP (it->string)) |
| 5343 | it->method = next_element_from_buffer; | ||
| 5344 | else | ||
| 5345 | goto consider_string_end; | 5358 | goto consider_string_end; |
| 5359 | it->method = GET_FROM_BUFFER; | ||
| 5346 | } | 5360 | } |
| 5347 | } | 5361 | } |
| 5348 | } | 5362 | break; |
| 5349 | else if (it->method == next_element_from_image | 5363 | |
| 5350 | || it->method == next_element_from_stretch) | 5364 | case GET_FROM_IMAGE: |
| 5351 | { | 5365 | case GET_FROM_STRETCH: |
| 5352 | /* The position etc with which we have to proceed are on | 5366 | /* The position etc with which we have to proceed are on |
| 5353 | the stack. The position may be at the end of a string, | 5367 | the stack. The position may be at the end of a string, |
| 5354 | if the `display' property takes up the whole string. */ | 5368 | if the `display' property takes up the whole string. */ |
| 5369 | xassert (it->sp > 0); | ||
| 5355 | pop_it (it); | 5370 | pop_it (it); |
| 5356 | it->image_id = 0; | 5371 | it->image_id = 0; |
| 5357 | if (STRINGP (it->string)) | 5372 | if (STRINGP (it->string)) |
| 5358 | { | 5373 | { |
| 5359 | it->method = next_element_from_string; | 5374 | it->method = GET_FROM_STRING; |
| 5360 | goto consider_string_end; | 5375 | goto consider_string_end; |
| 5361 | } | 5376 | } |
| 5362 | else | 5377 | it->method = GET_FROM_BUFFER; |
| 5363 | it->method = next_element_from_buffer; | 5378 | break; |
| 5379 | |||
| 5380 | default: | ||
| 5381 | /* There are no other methods defined, so this should be a bug. */ | ||
| 5382 | abort (); | ||
| 5364 | } | 5383 | } |
| 5365 | else | ||
| 5366 | /* There are no other methods defined, so this should be a bug. */ | ||
| 5367 | abort (); | ||
| 5368 | 5384 | ||
| 5369 | xassert (it->method != next_element_from_string | 5385 | xassert (it->method != GET_FROM_STRING |
| 5370 | || (STRINGP (it->string) | 5386 | || (STRINGP (it->string) |
| 5371 | && IT_STRING_CHARPOS (*it) >= 0)); | 5387 | && IT_STRING_CHARPOS (*it) >= 0)); |
| 5372 | } | 5388 | } |
| @@ -5578,7 +5594,7 @@ next_element_from_ellipsis (it) | |||
| 5578 | was in IT->saved_face_id, and signal that it's there by | 5594 | was in IT->saved_face_id, and signal that it's there by |
| 5579 | setting face_before_selective_p. */ | 5595 | setting face_before_selective_p. */ |
| 5580 | it->saved_face_id = it->face_id; | 5596 | it->saved_face_id = it->face_id; |
| 5581 | it->method = next_element_from_buffer; | 5597 | it->method = GET_FROM_BUFFER; |
| 5582 | reseat_at_next_visible_line_start (it, 1); | 5598 | reseat_at_next_visible_line_start (it, 1); |
| 5583 | it->face_before_selective_p = 1; | 5599 | it->face_before_selective_p = 1; |
| 5584 | } | 5600 | } |
| @@ -5823,8 +5839,8 @@ move_it_in_display_line_to (it, to_charpos, to_x, op) | |||
| 5823 | ((op & MOVE_TO_POS) != 0 \ | 5839 | ((op & MOVE_TO_POS) != 0 \ |
| 5824 | && BUFFERP (it->object) \ | 5840 | && BUFFERP (it->object) \ |
| 5825 | && IT_CHARPOS (*it) >= to_charpos \ | 5841 | && IT_CHARPOS (*it) >= to_charpos \ |
| 5826 | && (it->method == next_element_from_buffer || \ | 5842 | && (it->method == GET_FROM_BUFFER || \ |
| 5827 | (it->method == next_element_from_display_vector && \ | 5843 | (it->method == GET_FROM_DISPLAY_VECTOR && \ |
| 5828 | it->dpvec + it->current.dpvec_index + 1 >= it->dpend))) | 5844 | it->dpvec + it->current.dpvec_index + 1 >= it->dpend))) |
| 5829 | 5845 | ||
| 5830 | 5846 | ||
| @@ -6507,7 +6523,7 @@ int | |||
| 6507 | in_display_vector_p (it) | 6523 | in_display_vector_p (it) |
| 6508 | struct it *it; | 6524 | struct it *it; |
| 6509 | { | 6525 | { |
| 6510 | return (it->method == next_element_from_display_vector | 6526 | return (it->method == GET_FROM_DISPLAY_VECTOR |
| 6511 | && it->current.dpvec_index > 0 | 6527 | && it->current.dpvec_index > 0 |
| 6512 | && it->dpvec + it->current.dpvec_index != it->dpend); | 6528 | && it->dpvec + it->current.dpvec_index != it->dpend); |
| 6513 | } | 6529 | } |
| @@ -15248,7 +15264,7 @@ display_line (it) | |||
| 15248 | 15264 | ||
| 15249 | /* Record whether this row ends inside an ellipsis. */ | 15265 | /* Record whether this row ends inside an ellipsis. */ |
| 15250 | row->ends_in_ellipsis_p | 15266 | row->ends_in_ellipsis_p |
| 15251 | = (it->method == next_element_from_display_vector | 15267 | = (it->method == GET_FROM_DISPLAY_VECTOR |
| 15252 | && it->ellipsis_p); | 15268 | && it->ellipsis_p); |
| 15253 | 15269 | ||
| 15254 | /* Save fringe bitmaps in this row. */ | 15270 | /* Save fringe bitmaps in this row. */ |