From 662f91a795c0b5480b1733a99ef478c94d6f1426 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 22 Jul 2021 21:23:48 +0300 Subject: [PATCH] Fix display of line/wrap-prefix when there's a display property at BOL * src/xdisp.c (get_line_prefix_it_property): New function. (handle_line_prefix): Call 'get_line_prefix_it_property' instead of 'get_it_property', to examine also the property of the buffer text underlying the display or overlay string. (Bug#49695) --- src/xdisp.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/xdisp.c b/src/xdisp.c index 50ab2f8e051..70d15aee68c 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -22763,6 +22763,22 @@ get_it_property (struct it *it, Lisp_Object prop) return Fget_char_property (position, prop, object); } +/* Return the line-prefix/wrap-prefix property, checking both the + current IT->OBJECT and the underlying buffer text. */ + +static Lisp_Object +get_line_prefix_it_property (struct it *it, Lisp_Object prop) +{ + Lisp_Object prefix = get_it_property (it, prop); + + /* If we are looking at a display or overlay string, check also the + underlying buffer text. */ + if (NILP (prefix) && it->sp > 0 && STRINGP (it->object)) + return Fget_char_property (make_fixnum (IT_CHARPOS (*it)), prop, + it->w->contents); + return prefix; +} + /* See if there's a line- or wrap-prefix, and if so, push it on IT. */ static void @@ -22772,13 +22788,13 @@ handle_line_prefix (struct it *it) if (it->continuation_lines_width > 0) { - prefix = get_it_property (it, Qwrap_prefix); + prefix = get_line_prefix_it_property (it, Qwrap_prefix); if (NILP (prefix)) prefix = Vwrap_prefix; } else { - prefix = get_it_property (it, Qline_prefix); + prefix = get_line_prefix_it_property (it, Qline_prefix); if (NILP (prefix)) prefix = Vline_prefix; } -- 2.39.2