diff options
| author | Eli Zaretskii | 2018-03-30 15:57:57 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2018-03-30 15:57:57 +0300 |
| commit | 842b3d7412eaed6b2c9f90c3361abb4932ec0b1d (patch) | |
| tree | 5ce71a56c410c3c843b4c5a824466aaba9765d73 /src | |
| parent | 733279abedc598a927e66c6f6ac10d1bd9271e79 (diff) | |
| download | emacs-842b3d7412eaed6b2c9f90c3361abb4932ec0b1d.tar.gz emacs-842b3d7412eaed6b2c9f90c3361abb4932ec0b1d.zip | |
Fix C-p and C-n when wrap-prefix is too wide
* src/xdisp.c (move_it_in_display_line_to): Avoid looping in
previous/next-line when wrap-prefix is set to a too-wide
stretch of whitespace. (Bug#30432)
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index df5335e4acc..50fd6857784 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -9209,9 +9209,25 @@ move_it_in_display_line_to (struct it *it, | |||
| 9209 | prev_method = it->method; | 9209 | prev_method = it->method; |
| 9210 | if (it->method == GET_FROM_BUFFER) | 9210 | if (it->method == GET_FROM_BUFFER) |
| 9211 | prev_pos = IT_CHARPOS (*it); | 9211 | prev_pos = IT_CHARPOS (*it); |
| 9212 | |||
| 9213 | /* Detect overly-wide wrap-prefixes made of (space ...) display | ||
| 9214 | properties. When such a wrap prefix reaches past the right | ||
| 9215 | margin of the window, we need to avoid the call to | ||
| 9216 | set_iterator_to_next below, so that it->line_wrap is left at | ||
| 9217 | its TRUNCATE value wisely set by handle_line_prefix. | ||
| 9218 | Otherwise, set_iterator_to_next will pop the iterator stack, | ||
| 9219 | restore it->line_wrap, and we might miss the opportunity to | ||
| 9220 | exit the loop and return. */ | ||
| 9221 | bool overwide_wrap_prefix = | ||
| 9222 | CONSP (it->object) && EQ (XCAR (it->object), Qspace) | ||
| 9223 | && it->sp > 0 && it->method == GET_FROM_STRETCH | ||
| 9224 | && it->current_x >= it->last_visible_x | ||
| 9225 | && it->continuation_lines_width > 0 | ||
| 9226 | && it->line_wrap == TRUNCATE && it->stack[0].line_wrap != TRUNCATE; | ||
| 9212 | /* The current display element has been consumed. Advance | 9227 | /* The current display element has been consumed. Advance |
| 9213 | to the next. */ | 9228 | to the next. */ |
| 9214 | set_iterator_to_next (it, true); | 9229 | if (!overwide_wrap_prefix) |
| 9230 | set_iterator_to_next (it, true); | ||
| 9215 | if (IT_CHARPOS (*it) < CHARPOS (this_line_min_pos)) | 9231 | if (IT_CHARPOS (*it) < CHARPOS (this_line_min_pos)) |
| 9216 | SET_TEXT_POS (this_line_min_pos, IT_CHARPOS (*it), IT_BYTEPOS (*it)); | 9232 | SET_TEXT_POS (this_line_min_pos, IT_CHARPOS (*it), IT_BYTEPOS (*it)); |
| 9217 | if (IT_CHARPOS (*it) < to_charpos) | 9233 | if (IT_CHARPOS (*it) < to_charpos) |