summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2022-07-23 16:13:32 +0300
committerEli Zaretskii <eliz@gnu.org>2022-07-23 16:13:32 +0300
commit350e97d78e7803650c6dd2bf46fcfece8e2b4b32 (patch)
treed3e64c795b73713f411599e4d4fc9c6489890785 /src
parent304e2a3a05feee6578aadfa0228dde734fe850cf (diff)
downloademacs-350e97d78e7803650c6dd2bf46fcfece8e2b4b32.tar.gz
Speed up redisplay of long truncated lines
* src/xdisp.c (forward_to_next_line_start): Fix logic of interpreting the result of Fnext_single_property_change. (reseat_at_next_visible_line_start): When ON_NEWLINE_P is zero, pass NULL to 'forward_to_next_line_start', to avoid costly bidi iteration when none is needed. This speeds up redisplay of very long lines under 'truncate-lines'.
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 215a6d561ea..690f10b8403 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -7153,10 +7153,10 @@ forward_to_next_line_start (struct it *it, bool *skipped_p,
|| ((pos = Fnext_single_property_change (make_fixnum (start),
Qdisplay, Qnil,
make_fixnum (limit)),
- NILP (pos))
+ (NILP (pos) || XFIXNAT (pos) == limit))
&& next_overlay_change (start) == ZV))
{
- if (!it->bidi_p)
+ if (!it->bidi_p || !bidi_it_prev)
{
IT_CHARPOS (*it) = limit;
IT_BYTEPOS (*it) = bytepos;
@@ -7319,7 +7319,8 @@ reseat_at_next_visible_line_start (struct it *it, bool on_newline_p)
bool skipped_p = false;
struct bidi_it bidi_it_prev;
bool newline_found_p
- = forward_to_next_line_start (it, &skipped_p, &bidi_it_prev);
+ = forward_to_next_line_start (it, &skipped_p,
+ on_newline_p ? &bidi_it_prev : NULL);
/* Skip over lines that are invisible because they are indented
more than the value of IT->selective. */
@@ -7331,7 +7332,8 @@ reseat_at_next_visible_line_start (struct it *it, bool on_newline_p)
eassert (IT_BYTEPOS (*it) == BEGV
|| FETCH_BYTE (IT_BYTEPOS (*it) - 1) == '\n');
newline_found_p =
- forward_to_next_line_start (it, &skipped_p, &bidi_it_prev);
+ forward_to_next_line_start (it, &skipped_p,
+ on_newline_p ? &bidi_it_prev : NULL);
}
/* Position on the newline if that's what's requested. */