[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master bedb3cb: Avoid infloop in redisplay when wrap-prefix is too wide
From: |
Eli Zaretskii |
Subject: |
master bedb3cb: Avoid infloop in redisplay when wrap-prefix is too wide |
Date: |
Wed, 15 Apr 2020 07:30:10 -0400 (EDT) |
branch: master
commit bedb3cb66541fd4dd35cf15261c6d99f132e7d2c
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>
Avoid infloop in redisplay when wrap-prefix is too wide
* src/xdisp.c (move_it_to): Avoid infloop due to wrap-prefix that
is wide enough to leave no space to display even the first
character of the continuation line. (Bug#40632)
---
src/xdisp.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/xdisp.c b/src/xdisp.c
index 193cc37..cce434e 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -9662,9 +9662,13 @@ move_it_to (struct it *it, ptrdiff_t to_charpos, int
to_x, int to_y, int to_vpos
int line_height, line_start_x = 0, reached = 0;
int max_current_x = 0;
void *backup_data = NULL;
+ ptrdiff_t orig_charpos = -1;
+ enum it_method orig_method = NUM_IT_METHODS;
for (;;)
{
+ orig_charpos = IT_CHARPOS (*it);
+ orig_method = it->method;
if (op & MOVE_TO_VPOS)
{
/* If no TO_CHARPOS and no TO_X specified, stop at the
@@ -9898,7 +9902,17 @@ move_it_to (struct it *it, ptrdiff_t to_charpos, int
to_x, int to_y, int to_vpos
}
}
else
- it->continuation_lines_width += it->current_x;
+ {
+ /* Make sure we do advance, otherwise we might infloop.
+ This could happen when the first display element is
+ wider than the window, or if we have a wrap-prefix
+ that doesn't leave enough space after it to display
+ even a single character. */
+ if (IT_CHARPOS (*it) == orig_charpos
+ && it->method == orig_method)
+ set_iterator_to_next (it, false);
+ it->continuation_lines_width += it->current_x;
+ }
break;
default:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master bedb3cb: Avoid infloop in redisplay when wrap-prefix is too wide,
Eli Zaretskii <=