aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2018-03-30 15:57:57 +0300
committerEli Zaretskii2018-06-02 12:27:22 +0300
commit7782550b3f1ae359c241f02e6b2edc4fe50cab72 (patch)
treefa75c28a5e98776ab8e8a09ea012d9ab24f16bcb /src
parent9804482b026144237f10ae2fdd8a35e3fecb6d12 (diff)
downloademacs-7782550b3f1ae359c241f02e6b2edc4fe50cab72.tar.gz
emacs-7782550b3f1ae359c241f02e6b2edc4fe50cab72.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) (cherry picked from commit 842b3d7412eaed6b2c9f90c3361abb4932ec0b1d)
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 2142d771e2d..d28c1140678 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -9211,9 +9211,25 @@ move_it_in_display_line_to (struct it *it,
9211 prev_method = it->method; 9211 prev_method = it->method;
9212 if (it->method == GET_FROM_BUFFER) 9212 if (it->method == GET_FROM_BUFFER)
9213 prev_pos = IT_CHARPOS (*it); 9213 prev_pos = IT_CHARPOS (*it);
9214
9215 /* Detect overly-wide wrap-prefixes made of (space ...) display
9216 properties. When such a wrap prefix reaches past the right
9217 margin of the window, we need to avoid the call to
9218 set_iterator_to_next below, so that it->line_wrap is left at
9219 its TRUNCATE value wisely set by handle_line_prefix.
9220 Otherwise, set_iterator_to_next will pop the iterator stack,
9221 restore it->line_wrap, and we might miss the opportunity to
9222 exit the loop and return. */
9223 bool overwide_wrap_prefix =
9224 CONSP (it->object) && EQ (XCAR (it->object), Qspace)
9225 && it->sp > 0 && it->method == GET_FROM_STRETCH
9226 && it->current_x >= it->last_visible_x
9227 && it->continuation_lines_width > 0
9228 && it->line_wrap == TRUNCATE && it->stack[0].line_wrap != TRUNCATE;
9214 /* The current display element has been consumed. Advance 9229 /* The current display element has been consumed. Advance
9215 to the next. */ 9230 to the next. */
9216 set_iterator_to_next (it, true); 9231 if (!overwide_wrap_prefix)
9232 set_iterator_to_next (it, true);
9217 if (IT_CHARPOS (*it) < CHARPOS (this_line_min_pos)) 9233 if (IT_CHARPOS (*it) < CHARPOS (this_line_min_pos))
9218 SET_TEXT_POS (this_line_min_pos, IT_CHARPOS (*it), IT_BYTEPOS (*it)); 9234 SET_TEXT_POS (this_line_min_pos, IT_CHARPOS (*it), IT_BYTEPOS (*it));
9219 if (IT_CHARPOS (*it) < to_charpos) 9235 if (IT_CHARPOS (*it) < to_charpos)