comparison src/xdisp.c @ 83531:a387c138b28e

Merged from emacs@sv.gnu.org Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-305 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-306 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-307 Update from CVS: lispref/display.texi (Forcing Redisplay): Fix typo. * emacs@sv.gnu.org/emacs--devo--0--patch-308 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-309 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-310 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-311 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-312 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-313 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-314 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-315 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-316 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-317 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-318 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-319 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-320 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-321 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-322 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-323 lisp/play/cookie1.el (cookie): Work properly when there's only one entry * emacs@sv.gnu.org/emacs--devo--0--patch-324 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-325 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-326 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-327 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-328 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-329 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-330 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-105 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-106 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-107 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-108 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-109 Clean up merge mistakes * emacs@sv.gnu.org/gnus--rel--5.10--patch-110 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-571
author Karoly Lorentey <lorentey@elte.hu>
date Tue, 27 Jun 2006 15:06:36 +0000
parents 46b1096093f5 ee60680fee73
children b19aaf4ab0ee
comparison
equal deleted inserted replaced
83530:46b1096093f5 83531:a387c138b28e
901 static int display_string P_ ((unsigned char *, Lisp_Object, Lisp_Object, 901 static int display_string P_ ((unsigned char *, Lisp_Object, Lisp_Object,
902 int, int, struct it *, int, int, int, int)); 902 int, int, struct it *, int, int, int, int));
903 static void compute_line_metrics P_ ((struct it *)); 903 static void compute_line_metrics P_ ((struct it *));
904 static void run_redisplay_end_trigger_hook P_ ((struct it *)); 904 static void run_redisplay_end_trigger_hook P_ ((struct it *));
905 static int get_overlay_strings P_ ((struct it *, int)); 905 static int get_overlay_strings P_ ((struct it *, int));
906 static int get_overlay_strings_1 P_ ((struct it *, int, int));
906 static void next_overlay_string P_ ((struct it *)); 907 static void next_overlay_string P_ ((struct it *));
907 static void reseat P_ ((struct it *, struct text_pos, int)); 908 static void reseat P_ ((struct it *, struct text_pos, int));
908 static void reseat_1 P_ ((struct it *, struct text_pos, int)); 909 static void reseat_1 P_ ((struct it *, struct text_pos, int));
909 static void back_to_previous_visible_line_start P_ ((struct it *)); 910 static void back_to_previous_visible_line_start P_ ((struct it *));
910 void reseat_at_previous_visible_line_start P_ ((struct it *)); 911 void reseat_at_previous_visible_line_start P_ ((struct it *));
2894 POS, make sure to pop the iterator because it will be in 2895 POS, make sure to pop the iterator because it will be in
2895 front of that overlay string. When POS is ZV, we've thereby 2896 front of that overlay string. When POS is ZV, we've thereby
2896 also ``processed'' overlay strings at ZV. */ 2897 also ``processed'' overlay strings at ZV. */
2897 while (it->sp) 2898 while (it->sp)
2898 pop_it (it); 2899 pop_it (it);
2899 it->current.overlay_string_index = -1; 2900 xassert (it->current.overlay_string_index == -1);
2900 it->method = GET_FROM_BUFFER; 2901 xassert (it->method == GET_FROM_BUFFER);
2901 if (CHARPOS (pos->pos) == ZV) 2902 if (CHARPOS (pos->pos) == ZV)
2902 it->overlay_strings_at_end_processed_p = 1; 2903 it->overlay_strings_at_end_processed_p = 1;
2903 } 2904 }
2904 #endif /* 0 */ 2905 #endif /* 0 */
2905 2906
3006 handled = p->handler (it); 3007 handled = p->handler (it);
3007 3008
3008 if (handled == HANDLED_RECOMPUTE_PROPS) 3009 if (handled == HANDLED_RECOMPUTE_PROPS)
3009 break; 3010 break;
3010 else if (handled == HANDLED_RETURN) 3011 else if (handled == HANDLED_RETURN)
3011 return; 3012 {
3013 /* We still want to show before and after strings from
3014 overlays even if the actual buffer text is replaced. */
3015 if (!handle_overlay_change_p || it->sp > 1)
3016 return;
3017 if (!get_overlay_strings_1 (it, 0, 0))
3018 return;
3019 it->ignore_overlay_strings_at_pos_p = 1;
3020 it->string_from_display_prop_p = 0;
3021 handle_overlay_change_p = 0;
3022 handled = HANDLED_RECOMPUTE_PROPS;
3023 break;
3024 }
3012 else if (handled == HANDLED_OVERLAY_STRING_CONSUMED) 3025 else if (handled == HANDLED_OVERLAY_STRING_CONSUMED)
3013 handle_overlay_change_p = 0; 3026 handle_overlay_change_p = 0;
3014 } 3027 }
3015 3028
3016 if (handled != HANDLED_RECOMPUTE_PROPS) 3029 if (handled != HANDLED_RECOMPUTE_PROPS)
4458 IT_CHARPOS (*it) = end; 4471 IT_CHARPOS (*it) = end;
4459 IT_BYTEPOS (*it) = CHAR_TO_BYTE (end); 4472 IT_BYTEPOS (*it) = CHAR_TO_BYTE (end);
4460 } 4473 }
4461 return HANDLED_RECOMPUTE_PROPS; 4474 return HANDLED_RECOMPUTE_PROPS;
4462 } 4475 }
4476
4477 push_it (it);
4463 it->method = GET_FROM_COMPOSITION; 4478 it->method = GET_FROM_COMPOSITION;
4464 it->cmp_id = id; 4479 it->cmp_id = id;
4465 it->cmp_len = COMPOSITION_LENGTH (prop); 4480 it->cmp_len = COMPOSITION_LENGTH (prop);
4466 /* For a terminal, draw only the first character of the 4481 /* For a terminal, draw only the first character of the
4467 components. */ 4482 components. */
4527 they were before overlay strings were processed, and 4542 they were before overlay strings were processed, and
4528 continue to deliver from current_buffer. */ 4543 continue to deliver from current_buffer. */
4529 int display_ellipsis_p = it->stack[it->sp - 1].display_ellipsis_p; 4544 int display_ellipsis_p = it->stack[it->sp - 1].display_ellipsis_p;
4530 4545
4531 pop_it (it); 4546 pop_it (it);
4532 xassert (it->stop_charpos >= BEGV 4547 xassert (it->sp > 0
4533 && it->stop_charpos <= it->end_charpos); 4548 || it->method == GET_FROM_COMPOSITION
4534 it->string = Qnil; 4549 || (NILP (it->string)
4550 && it->method == GET_FROM_BUFFER
4551 && it->stop_charpos >= BEGV
4552 && it->stop_charpos <= it->end_charpos));
4535 it->current.overlay_string_index = -1; 4553 it->current.overlay_string_index = -1;
4536 SET_TEXT_POS (it->current.string_pos, -1, -1);
4537 it->n_overlay_strings = 0; 4554 it->n_overlay_strings = 0;
4538 it->method = GET_FROM_BUFFER;
4539 4555
4540 /* If we're at the end of the buffer, record that we have 4556 /* If we're at the end of the buffer, record that we have
4541 processed the overlay strings there already, so that 4557 processed the overlay strings there already, so that
4542 next_element_from_buffer doesn't try it again. */ 4558 next_element_from_buffer doesn't try it again. */
4543 if (IT_CHARPOS (*it) >= it->end_charpos) 4559 if (IT_CHARPOS (*it) >= it->end_charpos)
4789 /* Get the first chunk of overlay strings at IT's current buffer 4805 /* Get the first chunk of overlay strings at IT's current buffer
4790 position, or at CHARPOS if that is > 0. Value is non-zero if at 4806 position, or at CHARPOS if that is > 0. Value is non-zero if at
4791 least one overlay string was found. */ 4807 least one overlay string was found. */
4792 4808
4793 static int 4809 static int
4794 get_overlay_strings (it, charpos) 4810 get_overlay_strings_1 (it, charpos, compute_stop_p)
4795 struct it *it; 4811 struct it *it;
4796 int charpos; 4812 int charpos;
4797 { 4813 {
4798 /* Get the first OVERLAY_STRING_CHUNK_SIZE overlay strings to 4814 /* Get the first OVERLAY_STRING_CHUNK_SIZE overlay strings to
4799 process. This fills IT->overlay_strings with strings, and sets 4815 process. This fills IT->overlay_strings with strings, and sets
4811 if (it->n_overlay_strings) 4827 if (it->n_overlay_strings)
4812 { 4828 {
4813 /* Make sure we know settings in current_buffer, so that we can 4829 /* Make sure we know settings in current_buffer, so that we can
4814 restore meaningful values when we're done with the overlay 4830 restore meaningful values when we're done with the overlay
4815 strings. */ 4831 strings. */
4816 compute_stop_pos (it); 4832 if (compute_stop_p)
4833 compute_stop_pos (it);
4817 xassert (it->face_id >= 0); 4834 xassert (it->face_id >= 0);
4818 4835
4819 /* Save IT's settings. They are restored after all overlay 4836 /* Save IT's settings. They are restored after all overlay
4820 strings have been processed. */ 4837 strings have been processed. */
4821 xassert (it->sp == 0); 4838 xassert (!compute_stop_p || it->sp == 0);
4822 push_it (it); 4839 push_it (it);
4823 4840
4824 /* Set up IT to deliver display elements from the first overlay 4841 /* Set up IT to deliver display elements from the first overlay
4825 string. */ 4842 string. */
4826 IT_STRING_CHARPOS (*it) = IT_STRING_BYTEPOS (*it) = 0; 4843 IT_STRING_CHARPOS (*it) = IT_STRING_BYTEPOS (*it) = 0;
4828 it->stop_charpos = 0; 4845 it->stop_charpos = 0;
4829 xassert (STRINGP (it->string)); 4846 xassert (STRINGP (it->string));
4830 it->end_charpos = SCHARS (it->string); 4847 it->end_charpos = SCHARS (it->string);
4831 it->multibyte_p = STRING_MULTIBYTE (it->string); 4848 it->multibyte_p = STRING_MULTIBYTE (it->string);
4832 it->method = GET_FROM_STRING; 4849 it->method = GET_FROM_STRING;
4833 } 4850 return 1;
4834 else 4851 }
4835 { 4852
4836 it->string = Qnil; 4853 it->current.overlay_string_index = -1;
4837 it->current.overlay_string_index = -1; 4854 return 0;
4838 it->method = GET_FROM_BUFFER; 4855 }
4839 } 4856
4857 static int
4858 get_overlay_strings (it, charpos)
4859 struct it *it;
4860 int charpos;
4861 {
4862 it->string = Qnil;
4863 it->method = GET_FROM_BUFFER;
4864
4865 (void) get_overlay_strings_1 (it, charpos, 1);
4840 4866
4841 CHECK_IT (it); 4867 CHECK_IT (it);
4842 4868
4843 /* Value is non-zero if we found at least one overlay string. */ 4869 /* Value is non-zero if we found at least one overlay string. */
4844 return STRINGP (it->string); 4870 return STRINGP (it->string);
4859 push_it (it) 4885 push_it (it)
4860 struct it *it; 4886 struct it *it;
4861 { 4887 {
4862 struct iterator_stack_entry *p; 4888 struct iterator_stack_entry *p;
4863 4889
4864 xassert (it->sp < 2); 4890 xassert (it->sp < IT_STACK_SIZE);
4865 p = it->stack + it->sp; 4891 p = it->stack + it->sp;
4866 4892
4867 p->stop_charpos = it->stop_charpos; 4893 p->stop_charpos = it->stop_charpos;
4868 xassert (it->face_id >= 0); 4894 xassert (it->face_id >= 0);
4869 p->face_id = it->face_id; 4895 p->face_id = it->face_id;
4870 p->string = it->string; 4896 p->string = it->string;
4871 p->pos = it->current; 4897 p->method = it->method;
4898 switch (p->method)
4899 {
4900 case GET_FROM_IMAGE:
4901 p->u.image.object = it->object;
4902 p->u.image.image_id = it->image_id;
4903 p->u.image.slice = it->slice;
4904 break;
4905 case GET_FROM_COMPOSITION:
4906 p->u.comp.object = it->object;
4907 p->u.comp.c = it->c;
4908 p->u.comp.len = it->len;
4909 p->u.comp.cmp_id = it->cmp_id;
4910 p->u.comp.cmp_len = it->cmp_len;
4911 break;
4912 case GET_FROM_STRETCH:
4913 p->u.stretch.object = it->object;
4914 break;
4915 }
4916 p->position = it->position;
4917 p->current = it->current;
4872 p->end_charpos = it->end_charpos; 4918 p->end_charpos = it->end_charpos;
4873 p->string_nchars = it->string_nchars; 4919 p->string_nchars = it->string_nchars;
4874 p->area = it->area; 4920 p->area = it->area;
4875 p->multibyte_p = it->multibyte_p; 4921 p->multibyte_p = it->multibyte_p;
4876 p->slice = it->slice;
4877 p->space_width = it->space_width; 4922 p->space_width = it->space_width;
4878 p->font_height = it->font_height; 4923 p->font_height = it->font_height;
4879 p->voffset = it->voffset; 4924 p->voffset = it->voffset;
4880 p->string_from_display_prop_p = it->string_from_display_prop_p; 4925 p->string_from_display_prop_p = it->string_from_display_prop_p;
4881 p->display_ellipsis_p = 0; 4926 p->display_ellipsis_p = 0;
4898 xassert (it->sp > 0); 4943 xassert (it->sp > 0);
4899 --it->sp; 4944 --it->sp;
4900 p = it->stack + it->sp; 4945 p = it->stack + it->sp;
4901 it->stop_charpos = p->stop_charpos; 4946 it->stop_charpos = p->stop_charpos;
4902 it->face_id = p->face_id; 4947 it->face_id = p->face_id;
4948 it->current = p->current;
4949 it->position = p->position;
4903 it->string = p->string; 4950 it->string = p->string;
4904 it->current = p->pos; 4951 if (NILP (it->string))
4952 SET_TEXT_POS (it->current.string_pos, -1, -1);
4953 it->method = p->method;
4954 switch (it->method)
4955 {
4956 case GET_FROM_IMAGE:
4957 it->image_id = p->u.image.image_id;
4958 it->object = p->u.image.object;
4959 it->slice = p->u.image.slice;
4960 break;
4961 case GET_FROM_COMPOSITION:
4962 it->object = p->u.comp.object;
4963 it->c = p->u.comp.c;
4964 it->len = p->u.comp.len;
4965 it->cmp_id = p->u.comp.cmp_id;
4966 it->cmp_len = p->u.comp.cmp_len;
4967 break;
4968 case GET_FROM_STRETCH:
4969 it->object = p->u.comp.object;
4970 break;
4971 }
4905 it->end_charpos = p->end_charpos; 4972 it->end_charpos = p->end_charpos;
4906 it->string_nchars = p->string_nchars; 4973 it->string_nchars = p->string_nchars;
4907 it->area = p->area; 4974 it->area = p->area;
4908 it->multibyte_p = p->multibyte_p; 4975 it->multibyte_p = p->multibyte_p;
4909 it->slice = p->slice;
4910 it->space_width = p->space_width; 4976 it->space_width = p->space_width;
4911 it->font_height = p->font_height; 4977 it->font_height = p->font_height;
4912 it->voffset = p->voffset; 4978 it->voffset = p->voffset;
4913 it->string_from_display_prop_p = p->string_from_display_prop_p; 4979 it->string_from_display_prop_p = p->string_from_display_prop_p;
4914 } 4980 }
5036 struct it *it; 5102 struct it *it;
5037 { 5103 {
5038 while (IT_CHARPOS (*it) > BEGV) 5104 while (IT_CHARPOS (*it) > BEGV)
5039 { 5105 {
5040 back_to_previous_line_start (it); 5106 back_to_previous_line_start (it);
5107
5041 if (IT_CHARPOS (*it) <= BEGV) 5108 if (IT_CHARPOS (*it) <= BEGV)
5042 break; 5109 break;
5043 5110
5044 /* If selective > 0, then lines indented more than that values 5111 /* If selective > 0, then lines indented more than that values
5045 are invisible. */ 5112 are invisible. */
5055 Qinvisible, it->window); 5122 Qinvisible, it->window);
5056 if (TEXT_PROP_MEANS_INVISIBLE (prop)) 5123 if (TEXT_PROP_MEANS_INVISIBLE (prop))
5057 continue; 5124 continue;
5058 } 5125 }
5059 5126
5060 /* If newline has a display property that replaces the newline with something 5127 if (IT_CHARPOS (*it) <= BEGV)
5061 else (image or text), find start of overlay or interval and continue search 5128 break;
5062 from that point. */ 5129
5063 if (IT_CHARPOS (*it) > BEGV) 5130 {
5064 { 5131 struct it it2;
5065 struct it it2 = *it; 5132 int pos;
5066 int pos; 5133 int beg, end;
5067 int beg, end; 5134 Lisp_Object val, overlay;
5068 Lisp_Object val, overlay; 5135
5069 5136 /* If newline is part of a composition, continue from start of composition */
5070 pos = --IT_CHARPOS (it2); 5137 if (find_composition (IT_CHARPOS (*it), -1, &beg, &end, &val, Qnil)
5071 --IT_BYTEPOS (it2); 5138 && beg < IT_CHARPOS (*it))
5072 it2.sp = 0; 5139 goto replaced;
5073 if (handle_display_prop (&it2) == HANDLED_RETURN 5140
5074 && !NILP (val = get_char_property_and_overlay 5141 /* If newline is replaced by a display property, find start of overlay
5075 (make_number (pos), Qdisplay, Qnil, &overlay)) 5142 or interval and continue search from that point. */
5076 && (OVERLAYP (overlay) 5143 it2 = *it;
5077 ? (beg = OVERLAY_POSITION (OVERLAY_START (overlay))) 5144 pos = --IT_CHARPOS (it2);
5078 : get_property_and_range (pos, Qdisplay, &val, &beg, &end, Qnil))) 5145 --IT_BYTEPOS (it2);
5079 { 5146 it2.sp = 0;
5080 if (beg < BEGV) 5147 if (handle_display_prop (&it2) == HANDLED_RETURN
5081 beg = BEGV; 5148 && !NILP (val = get_char_property_and_overlay
5082 IT_CHARPOS (*it) = beg; 5149 (make_number (pos), Qdisplay, Qnil, &overlay))
5083 IT_BYTEPOS (*it) = buf_charpos_to_bytepos (current_buffer, beg); 5150 && (OVERLAYP (overlay)
5084 continue; 5151 ? (beg = OVERLAY_POSITION (OVERLAY_START (overlay)))
5085 } 5152 : get_property_and_range (pos, Qdisplay, &val, &beg, &end, Qnil)))
5086 } 5153 goto replaced;
5087 5154
5088 break; 5155 /* Newline is not replaced by anything -- so we are done. */
5089 } 5156 break;
5157
5158 replaced:
5159 if (beg < BEGV)
5160 beg = BEGV;
5161 IT_CHARPOS (*it) = beg;
5162 IT_BYTEPOS (*it) = buf_charpos_to_bytepos (current_buffer, beg);
5163 }
5164 }
5165
5166 it->continuation_lines_width = 0;
5090 5167
5091 xassert (IT_CHARPOS (*it) >= BEGV); 5168 xassert (IT_CHARPOS (*it) >= BEGV);
5092 xassert (IT_CHARPOS (*it) == BEGV 5169 xassert (IT_CHARPOS (*it) == BEGV
5093 || FETCH_BYTE (IT_BYTEPOS (*it) - 1) == '\n'); 5170 || FETCH_BYTE (IT_BYTEPOS (*it) - 1) == '\n');
5094 CHECK_IT (it); 5171 CHECK_IT (it);
5217 it->current.overlay_string_index = -1; 5294 it->current.overlay_string_index = -1;
5218 IT_STRING_CHARPOS (*it) = -1; 5295 IT_STRING_CHARPOS (*it) = -1;
5219 IT_STRING_BYTEPOS (*it) = -1; 5296 IT_STRING_BYTEPOS (*it) = -1;
5220 it->string = Qnil; 5297 it->string = Qnil;
5221 it->method = GET_FROM_BUFFER; 5298 it->method = GET_FROM_BUFFER;
5222 /* RMS: I added this to fix a bug in move_it_vertically_backward 5299 it->object = it->w->buffer;
5223 where it->area continued to relate to the starting point
5224 for the backward motion. Bug report from
5225 Nick Roberts <nick@nick.uklinux.net> on 19 May 2003.
5226 However, I am not sure whether reseat still does the right thing
5227 in general after this change. */
5228 it->area = TEXT_AREA; 5300 it->area = TEXT_AREA;
5229 it->multibyte_p = !NILP (current_buffer->enable_multibyte_characters); 5301 it->multibyte_p = !NILP (current_buffer->enable_multibyte_characters);
5230 it->sp = 0; 5302 it->sp = 0;
5303 it->string_from_display_prop_p = 0;
5231 it->face_before_selective_p = 0; 5304 it->face_before_selective_p = 0;
5232 5305
5233 if (set_stop_p) 5306 if (set_stop_p)
5234 it->stop_charpos = CHARPOS (pos); 5307 it->stop_charpos = CHARPOS (pos);
5235 } 5308 }
5704 } 5777 }
5705 break; 5778 break;
5706 5779
5707 case GET_FROM_COMPOSITION: 5780 case GET_FROM_COMPOSITION:
5708 xassert (it->cmp_id >= 0 && it->cmp_id < n_compositions); 5781 xassert (it->cmp_id >= 0 && it->cmp_id < n_compositions);
5709 if (STRINGP (it->string)) 5782 xassert (it->sp > 0);
5783 pop_it (it);
5784 if (it->method == GET_FROM_STRING)
5710 { 5785 {
5711 IT_STRING_BYTEPOS (*it) += it->len; 5786 IT_STRING_BYTEPOS (*it) += it->len;
5712 IT_STRING_CHARPOS (*it) += it->cmp_len; 5787 IT_STRING_CHARPOS (*it) += it->cmp_len;
5713 it->method = GET_FROM_STRING; 5788 it->object = it->string;
5714 goto consider_string_end; 5789 goto consider_string_end;
5715 } 5790 }
5716 else 5791 else if (it->method == GET_FROM_BUFFER)
5717 { 5792 {
5718 IT_BYTEPOS (*it) += it->len; 5793 IT_BYTEPOS (*it) += it->len;
5719 IT_CHARPOS (*it) += it->cmp_len; 5794 IT_CHARPOS (*it) += it->cmp_len;
5720 it->method = GET_FROM_BUFFER; 5795 it->object = it->w->buffer;
5721 } 5796 }
5722 break; 5797 break;
5723 5798
5724 case GET_FROM_C_STRING: 5799 case GET_FROM_C_STRING:
5725 /* Current display element of IT is from a C string. */ 5800 /* Current display element of IT is from a C string. */
5745 if (it->s) 5820 if (it->s)
5746 it->method = GET_FROM_C_STRING; 5821 it->method = GET_FROM_C_STRING;
5747 else if (STRINGP (it->string)) 5822 else if (STRINGP (it->string))
5748 it->method = GET_FROM_STRING; 5823 it->method = GET_FROM_STRING;
5749 else 5824 else
5750 it->method = GET_FROM_BUFFER; 5825 {
5826 it->method = GET_FROM_BUFFER;
5827 it->object = it->w->buffer;
5828 }
5751 5829
5752 it->dpvec = NULL; 5830 it->dpvec = NULL;
5753 it->current.dpvec_index = -1; 5831 it->current.dpvec_index = -1;
5754 5832
5755 /* Skip over characters which were displayed via IT->dpvec. */ 5833 /* Skip over characters which were displayed via IT->dpvec. */
5793 string, this time an overlay string, or a buffer. */ 5871 string, this time an overlay string, or a buffer. */
5794 if (IT_STRING_CHARPOS (*it) == SCHARS (it->string) 5872 if (IT_STRING_CHARPOS (*it) == SCHARS (it->string)
5795 && it->sp > 0) 5873 && it->sp > 0)
5796 { 5874 {
5797 pop_it (it); 5875 pop_it (it);
5798 if (STRINGP (it->string)) 5876 if (it->method == GET_FROM_STRING)
5799 goto consider_string_end; 5877 goto consider_string_end;
5800 it->method = GET_FROM_BUFFER;
5801 } 5878 }
5802 } 5879 }
5803 break; 5880 break;
5804 5881
5805 case GET_FROM_IMAGE: 5882 case GET_FROM_IMAGE:
5807 /* The position etc with which we have to proceed are on 5884 /* The position etc with which we have to proceed are on
5808 the stack. The position may be at the end of a string, 5885 the stack. The position may be at the end of a string,
5809 if the `display' property takes up the whole string. */ 5886 if the `display' property takes up the whole string. */
5810 xassert (it->sp > 0); 5887 xassert (it->sp > 0);
5811 pop_it (it); 5888 pop_it (it);
5812 it->image_id = 0; 5889 if (it->method == GET_FROM_STRING)
5813 if (STRINGP (it->string)) 5890 goto consider_string_end;
5814 {
5815 it->method = GET_FROM_STRING;
5816 goto consider_string_end;
5817 }
5818 it->method = GET_FROM_BUFFER;
5819 break; 5891 break;
5820 5892
5821 default: 5893 default:
5822 /* There are no other methods defined, so this should be a bug. */ 5894 /* There are no other methods defined, so this should be a bug. */
5823 abort (); 5895 abort ();
6036 face we find after the invisible text. Remember what it 6108 face we find after the invisible text. Remember what it
6037 was in IT->saved_face_id, and signal that it's there by 6109 was in IT->saved_face_id, and signal that it's there by
6038 setting face_before_selective_p. */ 6110 setting face_before_selective_p. */
6039 it->saved_face_id = it->face_id; 6111 it->saved_face_id = it->face_id;
6040 it->method = GET_FROM_BUFFER; 6112 it->method = GET_FROM_BUFFER;
6113 it->object = it->w->buffer;
6041 reseat_at_next_visible_line_start (it, 1); 6114 reseat_at_next_visible_line_start (it, 1);
6042 it->face_before_selective_p = 1; 6115 it->face_before_selective_p = 1;
6043 } 6116 }
6044 6117
6045 return get_next_display_element (it); 6118 return get_next_display_element (it);
6224 it->position = (STRINGP (it->string) 6297 it->position = (STRINGP (it->string)
6225 ? it->current.string_pos 6298 ? it->current.string_pos
6226 : it->current.pos); 6299 : it->current.pos);
6227 if (STRINGP (it->string)) 6300 if (STRINGP (it->string))
6228 it->object = it->string; 6301 it->object = it->string;
6302 else
6303 it->object = it->w->buffer;
6229 return 1; 6304 return 1;
6230 } 6305 }
6231 6306
6232 6307
6233 6308
11685 cursor = 0; 11760 cursor = 0;
11686 } 11761 }
11687 } 11762 }
11688 else 11763 else
11689 { 11764 {
11690 string_before_pos = last_pos; 11765 if (string_start == NULL)
11691 string_start = glyph; 11766 {
11692 string_start_x = x; 11767 string_before_pos = last_pos;
11768 string_start = glyph;
11769 string_start_x = x;
11770 }
11693 /* Skip all glyphs from string. */ 11771 /* Skip all glyphs from string. */
11694 do 11772 do
11695 { 11773 {
11696 Lisp_Object cprop; 11774 Lisp_Object cprop;
11697 int pos; 11775 int pos;
11745 are from string. As there's no easy way to know the 11823 are from string. As there's no easy way to know the
11746 character position of the current glyph, find the correct 11824 character position of the current glyph, find the correct
11747 glyph on point by scanning from string_start again. */ 11825 glyph on point by scanning from string_start again. */
11748 Lisp_Object limit; 11826 Lisp_Object limit;
11749 Lisp_Object string; 11827 Lisp_Object string;
11828 struct glyph *stop = glyph;
11750 int pos; 11829 int pos;
11751 11830
11752 limit = make_number (pt_old + 1); 11831 limit = make_number (pt_old + 1);
11753 end = glyph;
11754 glyph = string_start; 11832 glyph = string_start;
11755 x = string_start_x; 11833 x = string_start_x;
11756 string = glyph->object; 11834 string = glyph->object;
11757 pos = string_buffer_position (w, string, string_before_pos); 11835 pos = string_buffer_position (w, string, string_before_pos);
11758 /* If STRING is from overlay, LAST_POS == 0. We skip such glyphs 11836 /* If STRING is from overlay, LAST_POS == 0. We skip such glyphs
11759 because we always put cursor after overlay strings. */ 11837 because we always put cursor after overlay strings. */
11760 while (pos == 0 && glyph < end) 11838 while (pos == 0 && glyph < stop)
11761 { 11839 {
11762 string = glyph->object; 11840 string = glyph->object;
11763 SKIP_GLYPHS (glyph, end, x, EQ (glyph->object, string)); 11841 SKIP_GLYPHS (glyph, stop, x, EQ (glyph->object, string));
11764 if (glyph < end) 11842 if (glyph < stop)
11765 pos = string_buffer_position (w, glyph->object, string_before_pos); 11843 pos = string_buffer_position (w, glyph->object, string_before_pos);
11766 } 11844 }
11767 11845
11768 while (glyph < end) 11846 while (glyph < stop)
11769 { 11847 {
11770 pos = XINT (Fnext_single_char_property_change 11848 pos = XINT (Fnext_single_char_property_change
11771 (make_number (pos), Qdisplay, Qnil, limit)); 11849 (make_number (pos), Qdisplay, Qnil, limit));
11772 if (pos > pt_old) 11850 if (pos > pt_old)
11773 break; 11851 break;
11774 /* Skip glyphs from the same string. */ 11852 /* Skip glyphs from the same string. */
11775 string = glyph->object; 11853 string = glyph->object;
11776 SKIP_GLYPHS (glyph, end, x, EQ (glyph->object, string)); 11854 SKIP_GLYPHS (glyph, stop, x, EQ (glyph->object, string));
11777 /* Skip glyphs from an overlay. */ 11855 /* Skip glyphs from an overlay. */
11778 while (glyph < end 11856 while (glyph < stop
11779 && ! string_buffer_position (w, glyph->object, pos)) 11857 && ! string_buffer_position (w, glyph->object, pos))
11780 { 11858 {
11781 string = glyph->object; 11859 string = glyph->object;
11782 SKIP_GLYPHS (glyph, end, x, EQ (glyph->object, string)); 11860 SKIP_GLYPHS (glyph, stop, x, EQ (glyph->object, string));
11783 } 11861 }
11784 } 11862 }
11785 11863
11786 /* If we reached the end of the line, and end was from a string, 11864 /* If we reached the end of the line, and end was from a string,
11787 cursor is not on this line. */ 11865 cursor is not on this line. */