aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c140
1 files changed, 92 insertions, 48 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 4c1068119ea..f6518e08599 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -4556,6 +4556,7 @@ next_overlay_string (it)
4556 4556
4557 pop_it (it); 4557 pop_it (it);
4558 xassert (it->sp > 0 4558 xassert (it->sp > 0
4559 || it->method == GET_FROM_COMPOSITION
4559 || (NILP (it->string) 4560 || (NILP (it->string)
4560 && it->method == GET_FROM_BUFFER 4561 && it->method == GET_FROM_BUFFER
4561 && it->stop_charpos >= BEGV 4562 && it->stop_charpos >= BEGV
@@ -4903,18 +4904,31 @@ push_it (it)
4903 p->stop_charpos = it->stop_charpos; 4904 p->stop_charpos = it->stop_charpos;
4904 xassert (it->face_id >= 0); 4905 xassert (it->face_id >= 0);
4905 p->face_id = it->face_id; 4906 p->face_id = it->face_id;
4906 p->image_id = it->image_id; 4907 p->string = it->string;
4907 p->method = it->method; 4908 p->method = it->method;
4908 if (it->method == GET_FROM_IMAGE) 4909 switch (p->method)
4909 p->string = it->object; 4910 {
4910 else 4911 case GET_FROM_IMAGE:
4911 p->string = it->string; 4912 p->u.image.object = it->object;
4913 p->u.image.image_id = it->image_id;
4914 p->u.image.slice = it->slice;
4915 break;
4916 case GET_FROM_COMPOSITION:
4917 p->u.comp.object = it->object;
4918 p->u.comp.c = it->c;
4919 p->u.comp.len = it->len;
4920 p->u.comp.cmp_id = it->cmp_id;
4921 p->u.comp.cmp_len = it->cmp_len;
4922 break;
4923 case GET_FROM_STRETCH:
4924 p->u.stretch.object = it->object;
4925 break;
4926 }
4912 p->pos = it->current; 4927 p->pos = it->current;
4913 p->end_charpos = it->end_charpos; 4928 p->end_charpos = it->end_charpos;
4914 p->string_nchars = it->string_nchars; 4929 p->string_nchars = it->string_nchars;
4915 p->area = it->area; 4930 p->area = it->area;
4916 p->multibyte_p = it->multibyte_p; 4931 p->multibyte_p = it->multibyte_p;
4917 p->slice = it->slice;
4918 p->space_width = it->space_width; 4932 p->space_width = it->space_width;
4919 p->font_height = it->font_height; 4933 p->font_height = it->font_height;
4920 p->voffset = it->voffset; 4934 p->voffset = it->voffset;
@@ -4941,23 +4955,33 @@ pop_it (it)
4941 p = it->stack + it->sp; 4955 p = it->stack + it->sp;
4942 it->stop_charpos = p->stop_charpos; 4956 it->stop_charpos = p->stop_charpos;
4943 it->face_id = p->face_id; 4957 it->face_id = p->face_id;
4944 it->method = p->method;
4945 it->image_id = p->image_id;
4946 it->current = p->pos; 4958 it->current = p->pos;
4947 if (it->method == GET_FROM_IMAGE) 4959 it->string = p->string;
4948 {
4949 it->object = it->string;
4950 it->string = Qnil;
4951 }
4952 else
4953 it->string = p->string;
4954 if (NILP (it->string)) 4960 if (NILP (it->string))
4955 SET_TEXT_POS (it->current.string_pos, -1, -1); 4961 SET_TEXT_POS (it->current.string_pos, -1, -1);
4962 it->method = p->method;
4963 switch (it->method)
4964 {
4965 case GET_FROM_IMAGE:
4966 it->image_id = p->u.image.image_id;
4967 it->object = p->u.image.object;
4968 it->slice = p->u.image.slice;
4969 break;
4970 case GET_FROM_COMPOSITION:
4971 it->object = p->u.comp.object;
4972 it->c = p->u.comp.c;
4973 it->len = p->u.comp.len;
4974 it->cmp_id = p->u.comp.cmp_id;
4975 it->cmp_len = p->u.comp.cmp_len;
4976 break;
4977 case GET_FROM_STRETCH:
4978 it->object = p->u.comp.object;
4979 break;
4980 }
4956 it->end_charpos = p->end_charpos; 4981 it->end_charpos = p->end_charpos;
4957 it->string_nchars = p->string_nchars; 4982 it->string_nchars = p->string_nchars;
4958 it->area = p->area; 4983 it->area = p->area;
4959 it->multibyte_p = p->multibyte_p; 4984 it->multibyte_p = p->multibyte_p;
4960 it->slice = p->slice;
4961 it->space_width = p->space_width; 4985 it->space_width = p->space_width;
4962 it->font_height = p->font_height; 4986 it->font_height = p->font_height;
4963 it->voffset = p->voffset; 4987 it->voffset = p->voffset;
@@ -5108,35 +5132,43 @@ back_to_previous_visible_line_start (it)
5108 continue; 5132 continue;
5109 } 5133 }
5110 5134
5111 /* If newline has a display property that replaces the newline with something 5135 if (IT_CHARPOS (*it) <= BEGV)
5112 else (image or text), find start of overlay or interval and continue search 5136 break;
5113 from that point. */
5114 if (IT_CHARPOS (*it) > BEGV)
5115 {
5116 struct it it2 = *it;
5117 int pos;
5118 int beg, end;
5119 Lisp_Object val, overlay;
5120
5121 pos = --IT_CHARPOS (it2);
5122 --IT_BYTEPOS (it2);
5123 it2.sp = 0;
5124 if (handle_display_prop (&it2) == HANDLED_RETURN
5125 && !NILP (val = get_char_property_and_overlay
5126 (make_number (pos), Qdisplay, Qnil, &overlay))
5127 && (OVERLAYP (overlay)
5128 ? (beg = OVERLAY_POSITION (OVERLAY_START (overlay)))
5129 : get_property_and_range (pos, Qdisplay, &val, &beg, &end, Qnil)))
5130 {
5131 if (beg < BEGV)
5132 beg = BEGV;
5133 IT_CHARPOS (*it) = beg;
5134 IT_BYTEPOS (*it) = buf_charpos_to_bytepos (current_buffer, beg);
5135 continue;
5136 }
5137 }
5138 5137
5139 break; 5138 {
5139 struct it it2;
5140 int pos;
5141 int beg, end;
5142 Lisp_Object val, overlay;
5143
5144 /* If newline is part of a composition, continue from start of composition */
5145 if (find_composition (IT_CHARPOS (*it), -1, &beg, &end, &val, Qnil)
5146 && beg < IT_CHARPOS (*it))
5147 goto replaced;
5148
5149 /* If newline is replaced by a display property, find start of overlay
5150 or interval and continue search from that point. */
5151 it2 = *it;
5152 pos = --IT_CHARPOS (it2);
5153 --IT_BYTEPOS (it2);
5154 it2.sp = 0;
5155 if (handle_display_prop (&it2) == HANDLED_RETURN
5156 && !NILP (val = get_char_property_and_overlay
5157 (make_number (pos), Qdisplay, Qnil, &overlay))
5158 && (OVERLAYP (overlay)
5159 ? (beg = OVERLAY_POSITION (OVERLAY_START (overlay)))
5160 : get_property_and_range (pos, Qdisplay, &val, &beg, &end, Qnil)))
5161 goto replaced;
5162
5163 /* Newline is not replaced by anything -- so we are done. */
5164 break;
5165
5166 replaced:
5167 if (beg < BEGV)
5168 beg = BEGV;
5169 IT_CHARPOS (*it) = beg;
5170 IT_BYTEPOS (*it) = buf_charpos_to_bytepos (current_buffer, beg);
5171 }
5140 } 5172 }
5141 5173
5142 it->continuation_lines_width = 0; 5174 it->continuation_lines_width = 0;
@@ -5272,6 +5304,7 @@ reseat_1 (it, pos, set_stop_p)
5272 IT_STRING_BYTEPOS (*it) = -1; 5304 IT_STRING_BYTEPOS (*it) = -1;
5273 it->string = Qnil; 5305 it->string = Qnil;
5274 it->method = GET_FROM_BUFFER; 5306 it->method = GET_FROM_BUFFER;
5307 it->object = it->w->buffer;
5275 it->area = TEXT_AREA; 5308 it->area = TEXT_AREA;
5276 it->multibyte_p = !NILP (current_buffer->enable_multibyte_characters); 5309 it->multibyte_p = !NILP (current_buffer->enable_multibyte_characters);
5277 it->sp = 0; 5310 it->sp = 0;
@@ -5759,6 +5792,7 @@ set_iterator_to_next (it, reseat_p)
5759 IT_STRING_BYTEPOS (*it) += it->len; 5792 IT_STRING_BYTEPOS (*it) += it->len;
5760 IT_STRING_CHARPOS (*it) += it->cmp_len; 5793 IT_STRING_CHARPOS (*it) += it->cmp_len;
5761 it->method = GET_FROM_STRING; 5794 it->method = GET_FROM_STRING;
5795 it->object = it->string;
5762 goto consider_string_end; 5796 goto consider_string_end;
5763 } 5797 }
5764 else 5798 else
@@ -5766,6 +5800,7 @@ set_iterator_to_next (it, reseat_p)
5766 IT_BYTEPOS (*it) += it->len; 5800 IT_BYTEPOS (*it) += it->len;
5767 IT_CHARPOS (*it) += it->cmp_len; 5801 IT_CHARPOS (*it) += it->cmp_len;
5768 it->method = GET_FROM_BUFFER; 5802 it->method = GET_FROM_BUFFER;
5803 it->object = it->w->buffer;
5769 } 5804 }
5770 break; 5805 break;
5771 5806
@@ -5795,7 +5830,10 @@ set_iterator_to_next (it, reseat_p)
5795 else if (STRINGP (it->string)) 5830 else if (STRINGP (it->string))
5796 it->method = GET_FROM_STRING; 5831 it->method = GET_FROM_STRING;
5797 else 5832 else
5798 it->method = GET_FROM_BUFFER; 5833 {
5834 it->method = GET_FROM_BUFFER;
5835 it->object = it->w->buffer;
5836 }
5799 5837
5800 it->dpvec = NULL; 5838 it->dpvec = NULL;
5801 it->current.dpvec_index = -1; 5839 it->current.dpvec_index = -1;
@@ -6080,6 +6118,7 @@ next_element_from_ellipsis (it)
6080 setting face_before_selective_p. */ 6118 setting face_before_selective_p. */
6081 it->saved_face_id = it->face_id; 6119 it->saved_face_id = it->face_id;
6082 it->method = GET_FROM_BUFFER; 6120 it->method = GET_FROM_BUFFER;
6121 it->object = it->w->buffer;
6083 reseat_at_next_visible_line_start (it, 1); 6122 reseat_at_next_visible_line_start (it, 1);
6084 it->face_before_selective_p = 1; 6123 it->face_before_selective_p = 1;
6085 } 6124 }
@@ -6268,6 +6307,8 @@ next_element_from_composition (it)
6268 : it->current.pos); 6307 : it->current.pos);
6269 if (STRINGP (it->string)) 6308 if (STRINGP (it->string))
6270 it->object = it->string; 6309 it->object = it->string;
6310 else
6311 it->object = it->w->buffer;
6271 return 1; 6312 return 1;
6272} 6313}
6273 6314
@@ -11709,9 +11750,12 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
11709 } 11750 }
11710 else 11751 else
11711 { 11752 {
11712 string_before_pos = last_pos; 11753 if (string_start == NULL)
11713 string_start = glyph; 11754 {
11714 string_start_x = x; 11755 string_before_pos = last_pos;
11756 string_start = glyph;
11757 string_start_x = x;
11758 }
11715 /* Skip all glyphs from string. */ 11759 /* Skip all glyphs from string. */
11716 do 11760 do
11717 { 11761 {