emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-26 9804482: Avoid redisplay problems with too wide w


From: Eli Zaretskii
Subject: [Emacs-diffs] emacs-26 9804482: Avoid redisplay problems with too wide wrap-prefix
Date: Sat, 2 Jun 2018 05:26:51 -0400 (EDT)

branch: emacs-26
commit 9804482b026144237f10ae2fdd8a35e3fecb6d12
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Avoid redisplay problems with too wide wrap-prefix
    
    * src/xdisp.c (display_line): Avoid looping in redisplay when
    wrap-prefix is set to a too-wide stretch of whitespace.
    (Bug#30432)
    
    (cherry picked from commit 2a1fe08307402d6217d073f8ab7737750d253dd4)
---
 src/xdisp.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/xdisp.c b/src/xdisp.c
index 6ca1150..2142d77 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -21957,9 +21957,24 @@ display_line (struct it *it, int cursor_vpos)
          break;
        }
 
+      /* Detect overly-wide wrap-prefixes made of (space ...) display
+        properties.  When such a wrap prefix reaches past the right
+        margin of the window, we need to avoid the call to
+        set_iterator_to_next below, so that it->line_wrap is left at
+        its TRUNCATE value wisely set by handle_line_prefix.
+        Otherwise, set_iterator_to_next will pop the iterator stack,
+        restore it->line_wrap, and redisplay might infloop.  */
+      bool overwide_wrap_prefix =
+       CONSP (it->object) && EQ (XCAR (it->object), Qspace)
+       && it->sp > 0 && it->method == GET_FROM_STRETCH
+       && it->current_x >= it->last_visible_x
+       && it->continuation_lines_width > 0
+       && it->line_wrap == TRUNCATE && it->stack[0].line_wrap != TRUNCATE;
+
       /* Proceed with next display element.  Note that this skips
         over lines invisible because of selective display.  */
-      set_iterator_to_next (it, true);
+      if (!overwide_wrap_prefix)
+       set_iterator_to_next (it, true);
 
       /* If we truncate lines, we are done when the last displayed
         glyphs reach past the right margin of the window.  */



reply via email to

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