aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKim F. Storm2004-11-26 14:38:55 +0000
committerKim F. Storm2004-11-26 14:38:55 +0000
commit064fd8ec6763d84731c2c9a8111b76d1019cd684 (patch)
treea129cb27dbe5e865f74305e2629f03a28c883d70 /src
parentf33cc5a9a5a82f57887191d730f8550e5ab5ec1c (diff)
downloademacs-064fd8ec6763d84731c2c9a8111b76d1019cd684.tar.gz
emacs-064fd8ec6763d84731c2c9a8111b76d1019cd684.zip
Undo recent changes for restoring it->saved_face_id. Instead,
set it when it->method is set to next_element_from_display_vector. (setup_for_ellipsis): Add LEN argument. Callers changed. Set it->saved_face_id. (get_next_display_element): Use loop instead of recursion. Set it->saved_face_id. Combine duplicate code for ctr chars. (next_element_from_display_vector): Do not set it->saved_face_id. (next_element_from_ellipsis): Use setup_for_ellipsis.
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c109
1 files changed, 39 insertions, 70 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 36892a219c0..c4c39fd0d6f 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -807,7 +807,7 @@ static struct glyph_slice null_glyph_slice = { 0, 0, 0, 0 };
807 807
808/* Function prototypes. */ 808/* Function prototypes. */
809 809
810static void setup_for_ellipsis P_ ((struct it *)); 810static void setup_for_ellipsis P_ ((struct it *, int));
811static void mark_window_display_accurate_1 P_ ((struct window *, int)); 811static void mark_window_display_accurate_1 P_ ((struct window *, int));
812static int single_display_prop_string_p P_ ((Lisp_Object, Lisp_Object)); 812static int single_display_prop_string_p P_ ((Lisp_Object, Lisp_Object));
813static int display_prop_string_p P_ ((Lisp_Object, Lisp_Object)); 813static int display_prop_string_p P_ ((Lisp_Object, Lisp_Object));
@@ -3227,7 +3227,7 @@ handle_invisible_prop (it)
3227 it->stack[it->sp - 1].display_ellipsis_p = display_ellipsis_p; 3227 it->stack[it->sp - 1].display_ellipsis_p = display_ellipsis_p;
3228 } 3228 }
3229 else if (display_ellipsis_p) 3229 else if (display_ellipsis_p)
3230 setup_for_ellipsis (it); 3230 setup_for_ellipsis (it, 0);
3231 } 3231 }
3232 } 3232 }
3233 3233
@@ -3235,14 +3235,17 @@ handle_invisible_prop (it)
3235} 3235}
3236 3236
3237 3237
3238/* Make iterator IT return `...' next. */ 3238/* Make iterator IT return `...' next.
3239 Replaces LEN characters from buffer. */
3239 3240
3240static void 3241static void
3241setup_for_ellipsis (it) 3242setup_for_ellipsis (it, len)
3242 struct it *it; 3243 struct it *it;
3244 int len;
3243{ 3245{
3244 if (it->dp 3246 /* Use the display table definition for `...'. Invalid glyphs
3245 && VECTORP (DISP_INVIS_VECTOR (it->dp))) 3247 will be handled by the method returning elements from dpvec. */
3248 if (it->dp && VECTORP (DISP_INVIS_VECTOR (it->dp)))
3246 { 3249 {
3247 struct Lisp_Vector *v = XVECTOR (DISP_INVIS_VECTOR (it->dp)); 3250 struct Lisp_Vector *v = XVECTOR (DISP_INVIS_VECTOR (it->dp));
3248 it->dpvec = v->contents; 3251 it->dpvec = v->contents;
@@ -3255,12 +3258,12 @@ setup_for_ellipsis (it)
3255 it->dpend = default_invis_vector + 3; 3258 it->dpend = default_invis_vector + 3;
3256 } 3259 }
3257 3260
3258 /* The ellipsis display does not replace the display of the 3261 it->dpvec_char_len = len;
3259 character at the new position. Indicate this by setting
3260 IT->dpvec_char_len to zero. */
3261 it->dpvec_char_len = 0;
3262
3263 it->current.dpvec_index = 0; 3262 it->current.dpvec_index = 0;
3263
3264 /* Remember the current face id in case glyphs specify faces.
3265 IT's face is restored in set_iterator_to_next. */
3266 it->saved_face_id = it->face_id;
3264 it->method = next_element_from_display_vector; 3267 it->method = next_element_from_display_vector;
3265} 3268}
3266 3269
@@ -4048,7 +4051,7 @@ next_overlay_string (it)
4048 /* If we have to display `...' for invisible text, set 4051 /* If we have to display `...' for invisible text, set
4049 the iterator up for that. */ 4052 the iterator up for that. */
4050 if (display_ellipsis_p) 4053 if (display_ellipsis_p)
4051 setup_for_ellipsis (it); 4054 setup_for_ellipsis (it, 0);
4052 } 4055 }
4053 else 4056 else
4054 { 4057 {
@@ -4840,7 +4843,10 @@ get_next_display_element (it)
4840 we hit the end of what we iterate over. Performance note: the 4843 we hit the end of what we iterate over. Performance note: the
4841 function pointer `method' used here turns out to be faster than 4844 function pointer `method' used here turns out to be faster than
4842 using a sequence of if-statements. */ 4845 using a sequence of if-statements. */
4843 int success_p = (*it->method) (it); 4846 int success_p;
4847
4848 get_next:
4849 success_p = (*it->method) (it);
4844 4850
4845 if (it->what == IT_CHARACTER) 4851 if (it->what == IT_CHARACTER)
4846 { 4852 {
@@ -4872,14 +4878,14 @@ get_next_display_element (it)
4872 it->dpvec = v->contents; 4878 it->dpvec = v->contents;
4873 it->dpend = v->contents + v->size; 4879 it->dpend = v->contents + v->size;
4874 it->current.dpvec_index = 0; 4880 it->current.dpvec_index = 0;
4881 it->saved_face_id = it->face_id;
4875 it->method = next_element_from_display_vector; 4882 it->method = next_element_from_display_vector;
4876 success_p = get_next_display_element (it);
4877 } 4883 }
4878 else 4884 else
4879 { 4885 {
4880 set_iterator_to_next (it, 0); 4886 set_iterator_to_next (it, 0);
4881 success_p = get_next_display_element (it);
4882 } 4887 }
4888 goto get_next;
4883 } 4889 }
4884 4890
4885 /* Translate control characters into `\003' or `^C' form. 4891 /* Translate control characters into `\003' or `^C' form.
@@ -4915,6 +4921,7 @@ get_next_display_element (it)
4915 IT->ctl_chars with glyphs for what we have to 4921 IT->ctl_chars with glyphs for what we have to
4916 display. Then, set IT->dpvec to these glyphs. */ 4922 display. Then, set IT->dpvec to these glyphs. */
4917 GLYPH g; 4923 GLYPH g;
4924 int ctl_len;
4918 4925
4919 if (it->c < 128 && it->ctl_arrow_p) 4926 if (it->c < 128 && it->ctl_arrow_p)
4920 { 4927 {
@@ -4929,14 +4936,7 @@ get_next_display_element (it)
4929 4936
4930 g = FAST_MAKE_GLYPH (it->c ^ 0100, 0); 4937 g = FAST_MAKE_GLYPH (it->c ^ 0100, 0);
4931 XSETINT (it->ctl_chars[1], g); 4938 XSETINT (it->ctl_chars[1], g);
4932 4939 ctl_len = 2;
4933 /* Set up IT->dpvec and return first character from it. */
4934 it->dpvec_char_len = it->len;
4935 it->dpvec = it->ctl_chars;
4936 it->dpend = it->dpvec + 2;
4937 it->current.dpvec_index = 0;
4938 it->method = next_element_from_display_vector;
4939 get_next_display_element (it);
4940 } 4940 }
4941 else 4941 else
4942 { 4942 {
@@ -4985,16 +4985,17 @@ get_next_display_element (it)
4985 g = FAST_MAKE_GLYPH ((str[i] & 7) + '0', 0); 4985 g = FAST_MAKE_GLYPH ((str[i] & 7) + '0', 0);
4986 XSETINT (it->ctl_chars[i * 4 + 3], g); 4986 XSETINT (it->ctl_chars[i * 4 + 3], g);
4987 } 4987 }
4988 4988 ctl_len = len * 4;
4989 /* Set up IT->dpvec and return the first character
4990 from it. */
4991 it->dpvec_char_len = it->len;
4992 it->dpvec = it->ctl_chars;
4993 it->dpend = it->dpvec + len * 4;
4994 it->current.dpvec_index = 0;
4995 it->method = next_element_from_display_vector;
4996 get_next_display_element (it);
4997 } 4989 }
4990
4991 /* Set up IT->dpvec and return first character from it. */
4992 it->dpvec_char_len = it->len;
4993 it->dpvec = it->ctl_chars;
4994 it->dpend = it->dpvec + ctl_len;
4995 it->current.dpvec_index = 0;
4996 it->saved_face_id = it->face_id;
4997 it->method = next_element_from_display_vector;
4998 goto get_next;
4998 } 4999 }
4999 } 5000 }
5000 5001
@@ -5184,11 +5185,14 @@ set_iterator_to_next (it, reseat_p)
5184 && IT_STRING_CHARPOS (*it) >= 0)); 5185 && IT_STRING_CHARPOS (*it) >= 0));
5185} 5186}
5186 5187
5187
5188/* Load IT's display element fields with information about the next 5188/* Load IT's display element fields with information about the next
5189 display element which comes from a display table entry or from the 5189 display element which comes from a display table entry or from the
5190 result of translating a control character to one of the forms `^C' 5190 result of translating a control character to one of the forms `^C'
5191 or `\003'. IT->dpvec holds the glyphs to return as characters. */ 5191 or `\003'.
5192
5193 IT->dpvec holds the glyphs to return as characters.
5194 IT->saved_face_id holds the face id before the display vector--
5195 it is restored into IT->face_idin set_iterator_to_next. */
5192 5196
5193static int 5197static int
5194next_element_from_display_vector (it) 5198next_element_from_display_vector (it)
@@ -5197,10 +5201,6 @@ next_element_from_display_vector (it)
5197 /* Precondition. */ 5201 /* Precondition. */
5198 xassert (it->dpvec && it->current.dpvec_index >= 0); 5202 xassert (it->dpvec && it->current.dpvec_index >= 0);
5199 5203
5200 /* Remember the current face id in case glyphs specify faces.
5201 IT's face is restored in set_iterator_to_next. */
5202 it->saved_face_id = it->face_id;
5203
5204 if (INTEGERP (*it->dpvec) 5204 if (INTEGERP (*it->dpvec)
5205 && GLYPH_CHAR_VALID_P (XFASTINT (*it->dpvec))) 5205 && GLYPH_CHAR_VALID_P (XFASTINT (*it->dpvec)))
5206 { 5206 {
@@ -5384,28 +5384,7 @@ next_element_from_ellipsis (it)
5384 struct it *it; 5384 struct it *it;
5385{ 5385{
5386 if (it->selective_display_ellipsis_p) 5386 if (it->selective_display_ellipsis_p)
5387 { 5387 setup_for_ellipsis (it, it->len);
5388 if (it->dp && VECTORP (DISP_INVIS_VECTOR (it->dp)))
5389 {
5390 /* Use the display table definition for `...'. Invalid glyphs
5391 will be handled by the method returning elements from dpvec. */
5392 struct Lisp_Vector *v = XVECTOR (DISP_INVIS_VECTOR (it->dp));
5393 it->dpvec_char_len = it->len;
5394 it->dpvec = v->contents;
5395 it->dpend = v->contents + v->size;
5396 it->current.dpvec_index = 0;
5397 it->method = next_element_from_display_vector;
5398 }
5399 else
5400 {
5401 /* Use default `...' which is stored in default_invis_vector. */
5402 it->dpvec_char_len = it->len;
5403 it->dpvec = default_invis_vector;
5404 it->dpend = default_invis_vector + 3;
5405 it->current.dpvec_index = 0;
5406 it->method = next_element_from_display_vector;
5407 }
5408 }
5409 else 5388 else
5410 { 5389 {
5411 /* The face at the current position may be different from the 5390 /* The face at the current position may be different from the
@@ -5776,8 +5755,6 @@ move_it_in_display_line_to (it, to_charpos, to_x, op)
5776 result = MOVE_NEWLINE_OR_CR; 5755 result = MOVE_NEWLINE_OR_CR;
5777 break; 5756 break;
5778 } 5757 }
5779 if (it->method == next_element_from_display_vector)
5780 it->face_id = it->saved_face_id;
5781 } 5758 }
5782#endif /* HAVE_WINDOW_SYSTEM */ 5759#endif /* HAVE_WINDOW_SYSTEM */
5783 } 5760 }
@@ -5862,8 +5839,6 @@ move_it_in_display_line_to (it, to_charpos, to_x, op)
5862 result = MOVE_NEWLINE_OR_CR; 5839 result = MOVE_NEWLINE_OR_CR;
5863 break; 5840 break;
5864 } 5841 }
5865 if (it->method == next_element_from_display_vector)
5866 it->face_id = it->saved_face_id;
5867 } 5842 }
5868#endif /* HAVE_WINDOW_SYSTEM */ 5843#endif /* HAVE_WINDOW_SYSTEM */
5869 result = MOVE_LINE_TRUNCATED; 5844 result = MOVE_LINE_TRUNCATED;
@@ -14633,8 +14608,6 @@ display_line (it)
14633 { 14608 {
14634 move_it_in_display_line_to (it, ZV, it->first_visible_x, 14609 move_it_in_display_line_to (it, ZV, it->first_visible_x,
14635 MOVE_TO_POS | MOVE_TO_X); 14610 MOVE_TO_POS | MOVE_TO_X);
14636 if (it->method == next_element_from_display_vector)
14637 it->face_id = it->saved_face_id;
14638 } 14611 }
14639 14612
14640 /* Get the initial row height. This is either the height of the 14613 /* Get the initial row height. This is either the height of the
@@ -14794,8 +14767,6 @@ display_line (it)
14794 row->continued_p = 0; 14767 row->continued_p = 0;
14795 row->exact_window_width_line_p = 1; 14768 row->exact_window_width_line_p = 1;
14796 } 14769 }
14797 else if (it->method == next_element_from_display_vector)
14798 it->face_id = it->saved_face_id;
14799 } 14770 }
14800#endif /* HAVE_WINDOW_SYSTEM */ 14771#endif /* HAVE_WINDOW_SYSTEM */
14801 } 14772 }
@@ -14976,8 +14947,6 @@ display_line (it)
14976 row->exact_window_width_line_p = 1; 14947 row->exact_window_width_line_p = 1;
14977 goto at_end_of_line; 14948 goto at_end_of_line;
14978 } 14949 }
14979 if (it->method == next_element_from_display_vector)
14980 it->face_id = it->saved_face_id;
14981 } 14950 }
14982 } 14951 }
14983#endif /* HAVE_WINDOW_SYSTEM */ 14952#endif /* HAVE_WINDOW_SYSTEM */