diff options
| author | Eli Zaretskii | 2018-03-20 19:05:21 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2018-03-20 19:05:21 +0200 |
| commit | 2a1fe08307402d6217d073f8ab7737750d253dd4 (patch) | |
| tree | 3993f175cad5d4feb815da6a701770390b7bd126 /src | |
| parent | db64a866f6971c5d63565253c0c8d8db15d4a4dc (diff) | |
| download | emacs-2a1fe08307402d6217d073f8ab7737750d253dd4.tar.gz emacs-2a1fe08307402d6217d073f8ab7737750d253dd4.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)
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 4778f532cd4..df5335e4acc 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -21969,9 +21969,24 @@ display_line (struct it *it, int cursor_vpos) | |||
| 21969 | break; | 21969 | break; |
| 21970 | } | 21970 | } |
| 21971 | 21971 | ||
| 21972 | /* Detect overly-wide wrap-prefixes made of (space ...) display | ||
| 21973 | properties. When such a wrap prefix reaches past the right | ||
| 21974 | margin of the window, we need to avoid the call to | ||
| 21975 | set_iterator_to_next below, so that it->line_wrap is left at | ||
| 21976 | its TRUNCATE value wisely set by handle_line_prefix. | ||
| 21977 | Otherwise, set_iterator_to_next will pop the iterator stack, | ||
| 21978 | restore it->line_wrap, and redisplay might infloop. */ | ||
| 21979 | bool overwide_wrap_prefix = | ||
| 21980 | CONSP (it->object) && EQ (XCAR (it->object), Qspace) | ||
| 21981 | && it->sp > 0 && it->method == GET_FROM_STRETCH | ||
| 21982 | && it->current_x >= it->last_visible_x | ||
| 21983 | && it->continuation_lines_width > 0 | ||
| 21984 | && it->line_wrap == TRUNCATE && it->stack[0].line_wrap != TRUNCATE; | ||
| 21985 | |||
| 21972 | /* Proceed with next display element. Note that this skips | 21986 | /* Proceed with next display element. Note that this skips |
| 21973 | over lines invisible because of selective display. */ | 21987 | over lines invisible because of selective display. */ |
| 21974 | set_iterator_to_next (it, true); | 21988 | if (!overwide_wrap_prefix) |
| 21989 | set_iterator_to_next (it, true); | ||
| 21975 | 21990 | ||
| 21976 | /* If we truncate lines, we are done when the last displayed | 21991 | /* If we truncate lines, we are done when the last displayed |
| 21977 | glyphs reach past the right margin of the window. */ | 21992 | glyphs reach past the right margin of the window. */ |