aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2022-07-23 16:13:32 +0300
committerEli Zaretskii2022-07-23 16:13:32 +0300
commit350e97d78e7803650c6dd2bf46fcfece8e2b4b32 (patch)
treed3e64c795b73713f411599e4d4fc9c6489890785 /src
parent304e2a3a05feee6578aadfa0228dde734fe850cf (diff)
downloademacs-350e97d78e7803650c6dd2bf46fcfece8e2b4b32.tar.gz
emacs-350e97d78e7803650c6dd2bf46fcfece8e2b4b32.zip
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,
7153 || ((pos = Fnext_single_property_change (make_fixnum (start), 7153 || ((pos = Fnext_single_property_change (make_fixnum (start),
7154 Qdisplay, Qnil, 7154 Qdisplay, Qnil,
7155 make_fixnum (limit)), 7155 make_fixnum (limit)),
7156 NILP (pos)) 7156 (NILP (pos) || XFIXNAT (pos) == limit))
7157 && next_overlay_change (start) == ZV)) 7157 && next_overlay_change (start) == ZV))
7158 { 7158 {
7159 if (!it->bidi_p) 7159 if (!it->bidi_p || !bidi_it_prev)
7160 { 7160 {
7161 IT_CHARPOS (*it) = limit; 7161 IT_CHARPOS (*it) = limit;
7162 IT_BYTEPOS (*it) = bytepos; 7162 IT_BYTEPOS (*it) = bytepos;
@@ -7319,7 +7319,8 @@ reseat_at_next_visible_line_start (struct it *it, bool on_newline_p)
7319 bool skipped_p = false; 7319 bool skipped_p = false;
7320 struct bidi_it bidi_it_prev; 7320 struct bidi_it bidi_it_prev;
7321 bool newline_found_p 7321 bool newline_found_p
7322 = forward_to_next_line_start (it, &skipped_p, &bidi_it_prev); 7322 = forward_to_next_line_start (it, &skipped_p,
7323 on_newline_p ? &bidi_it_prev : NULL);
7323 7324
7324 /* Skip over lines that are invisible because they are indented 7325 /* Skip over lines that are invisible because they are indented
7325 more than the value of IT->selective. */ 7326 more than the value of IT->selective. */
@@ -7331,7 +7332,8 @@ reseat_at_next_visible_line_start (struct it *it, bool on_newline_p)
7331 eassert (IT_BYTEPOS (*it) == BEGV 7332 eassert (IT_BYTEPOS (*it) == BEGV
7332 || FETCH_BYTE (IT_BYTEPOS (*it) - 1) == '\n'); 7333 || FETCH_BYTE (IT_BYTEPOS (*it) - 1) == '\n');
7333 newline_found_p = 7334 newline_found_p =
7334 forward_to_next_line_start (it, &skipped_p, &bidi_it_prev); 7335 forward_to_next_line_start (it, &skipped_p,
7336 on_newline_p ? &bidi_it_prev : NULL);
7335 } 7337 }
7336 7338
7337 /* Position on the newline if that's what's requested. */ 7339 /* Position on the newline if that's what's requested. */