From 9f851fbd286f08f82e7648460134b52fa8172403 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Thu, 22 Mar 2012 15:08:17 +0800 Subject: [PATCH] For line prefixes, use default face; don't inherit from previous line. * src/dispextern.h (struct it): New member string_from_prefix_prop_p. * src/xdisp.c (push_prefix_prop): Renamed from push_display_prop. Mark string as coming from a prefix property. (handle_face_prop): Use default face for prefix strings. (pop_it, reseat_1): Save and restore string_from_prefix_prop_p. Fixes: debbugs:4281 --- src/ChangeLog | 9 +++++++++ src/dispextern.h | 5 +++++ src/xdisp.c | 13 ++++++++++--- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 7a97859ba63..e3407a45514 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2012-03-22 Chong Yidong + + * dispextern.h (struct it): New member string_from_prefix_prop_p. + + * xdisp.c (push_prefix_prop): Renamed from push_display_prop. + Mark string as coming from a prefix property. + (handle_face_prop): Use default face for prefix strings (Bug#4281). + (pop_it, reseat_1): Save and restore string_from_prefix_prop_p. + 2012-03-21 Chong Yidong * xfaces.c (Vface_remapping_alist): Doc fix. diff --git a/src/dispextern.h b/src/dispextern.h index 2c59f4f8ead..2d4aee0cb94 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -2152,6 +2152,10 @@ struct it Don't handle some `display' properties in these strings. */ unsigned string_from_display_prop_p : 1; + /* 1 means `string' comes from a `line-prefix' or `wrap-prefix' + property. */ + unsigned string_from_prefix_prop_p : 1; + /* 1 means we are iterating an object that came from a value of a `display' property. */ unsigned from_disp_prop_p : 1; @@ -2272,6 +2276,7 @@ struct it bidi_dir_t paragraph_embedding; unsigned multibyte_p : 1; unsigned string_from_display_prop_p : 1; + unsigned string_from_prefix_prop_p : 1; unsigned display_ellipsis_p : 1; unsigned avoid_cursor_p : 1; unsigned bidi_p:1; diff --git a/src/xdisp.c b/src/xdisp.c index 71162960faa..0d23d72dd7b 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -3673,7 +3673,9 @@ handle_face_prop (struct it *it) with, so that overlay strings appear in the same face as surrounding text, unless they specify their own faces. */ - base_face_id = underlying_face_id (it); + base_face_id = it->string_from_prefix_prop_p + ? DEFAULT_FACE_ID + : underlying_face_id (it); } new_face_id = face_at_string_position (it->w, @@ -5576,6 +5578,7 @@ push_it (struct it *it, struct text_pos *position) p->font_height = it->font_height; p->voffset = it->voffset; p->string_from_display_prop_p = it->string_from_display_prop_p; + p->string_from_prefix_prop_p = it->string_from_prefix_prop_p; p->display_ellipsis_p = 0; p->line_wrap = it->line_wrap; p->bidi_p = it->bidi_p; @@ -5685,6 +5688,7 @@ pop_it (struct it *it) it->font_height = p->font_height; it->voffset = p->voffset; it->string_from_display_prop_p = p->string_from_display_prop_p; + it->string_from_prefix_prop_p = p->string_from_prefix_prop_p; it->line_wrap = p->line_wrap; it->bidi_p = p->bidi_p; it->paragraph_embedding = p->paragraph_embedding; @@ -6115,6 +6119,8 @@ reseat_1 (struct it *it, struct text_pos pos, int set_stop_p) it->multibyte_p = !NILP (BVAR (current_buffer, enable_multibyte_characters)); it->sp = 0; it->string_from_display_prop_p = 0; + it->string_from_prefix_prop_p = 0; + it->from_disp_prop_p = 0; it->face_before_selective_p = 0; if (it->bidi_p) @@ -18539,7 +18545,7 @@ cursor_row_p (struct glyph_row *row) `line-prefix' and `wrap-prefix' properties. */ static int -push_display_prop (struct it *it, Lisp_Object prop) +push_prefix_prop (struct it *it, Lisp_Object prop) { struct text_pos pos = STRINGP (it->string) ? it->current.string_pos : it->current.pos; @@ -18563,6 +18569,7 @@ push_display_prop (struct it *it, Lisp_Object prop) } it->string = prop; + it->string_from_prefix_prop_p = 1; it->multibyte_p = STRING_MULTIBYTE (it->string); it->current.overlay_string_index = -1; IT_STRING_CHARPOS (*it) = IT_STRING_BYTEPOS (*it) = 0; @@ -18649,7 +18656,7 @@ handle_line_prefix (struct it *it) if (NILP (prefix)) prefix = Vline_prefix; } - if (! NILP (prefix) && push_display_prop (it, prefix)) + if (! NILP (prefix) && push_prefix_prop (it, prefix)) { /* If the prefix is wider than the window, and we try to wrap it, it would acquire its own wrap prefix, and so on till the -- 2.39.5