emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 662f91a: Fix display of line/wrap-prefix when there's a display p


From: Eli Zaretskii
Subject: master 662f91a: Fix display of line/wrap-prefix when there's a display property at BOL
Date: Thu, 22 Jul 2021 14:25:47 -0400 (EDT)

branch: master
commit 662f91a795c0b5480b1733a99ef478c94d6f1426
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    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 50ab2f8..70d15ae 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;
     }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]