aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2018-03-20 19:05:21 +0200
committerEli Zaretskii2018-06-02 12:25:50 +0300
commit9804482b026144237f10ae2fdd8a35e3fecb6d12 (patch)
tree155711ddde6ee2a40f8f665f07cbaa9e8a7802cb
parent5ee9ccf5c9d3f0b863439ac815c03c7b3e33a288 (diff)
downloademacs-9804482b026144237f10ae2fdd8a35e3fecb6d12.tar.gz
emacs-9804482b026144237f10ae2fdd8a35e3fecb6d12.zip
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)
-rw-r--r--src/xdisp.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 6ca115087c3..2142d771e2d 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -21957,9 +21957,24 @@ display_line (struct it *it, int cursor_vpos)
21957 break; 21957 break;
21958 } 21958 }
21959 21959
21960 /* Detect overly-wide wrap-prefixes made of (space ...) display
21961 properties. When such a wrap prefix reaches past the right
21962 margin of the window, we need to avoid the call to
21963 set_iterator_to_next below, so that it->line_wrap is left at
21964 its TRUNCATE value wisely set by handle_line_prefix.
21965 Otherwise, set_iterator_to_next will pop the iterator stack,
21966 restore it->line_wrap, and redisplay might infloop. */
21967 bool overwide_wrap_prefix =
21968 CONSP (it->object) && EQ (XCAR (it->object), Qspace)
21969 && it->sp > 0 && it->method == GET_FROM_STRETCH
21970 && it->current_x >= it->last_visible_x
21971 && it->continuation_lines_width > 0
21972 && it->line_wrap == TRUNCATE && it->stack[0].line_wrap != TRUNCATE;
21973
21960 /* Proceed with next display element. Note that this skips 21974 /* Proceed with next display element. Note that this skips
21961 over lines invisible because of selective display. */ 21975 over lines invisible because of selective display. */
21962 set_iterator_to_next (it, true); 21976 if (!overwide_wrap_prefix)
21977 set_iterator_to_next (it, true);
21963 21978
21964 /* If we truncate lines, we are done when the last displayed 21979 /* If we truncate lines, we are done when the last displayed
21965 glyphs reach past the right margin of the window. */ 21980 glyphs reach past the right margin of the window. */