emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] scratch/line-numbers fb62728: Avoid slow redisplay under '


From: Eli Zaretskii
Subject: [Emacs-diffs] scratch/line-numbers fb62728: Avoid slow redisplay under 'visual' mode of line numbers
Date: Sat, 1 Jul 2017 03:24:22 -0400 (EDT)

branch: scratch/line-numbers
commit fb62728b7afa7024d4ca01e6f89b0267231cf607
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Avoid slow redisplay under 'visual' mode of line numbers
    
    * src/xdisp.c (display_count_lines_visually): Avoid very slow
    redisplay when this function is invoked very far from point.
    Reported by Alex <address@hidden>.
---
 src/xdisp.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/xdisp.c b/src/xdisp.c
index aeccac2..7bbe9d9 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -20783,7 +20783,14 @@ display_count_lines_visually (struct it *it)
       /* Need to disable visual mode temporarily, since otherwise the
         call to move_it_to will cause infinite recursion.  */
       specbind (Qdisplay_line_numbers, Qrelative);
-      move_it_to (&tem_it, to, -1, -1, -1, MOVE_TO_POS);
+      /* Some redisplay optimizations could invoke us very far from
+        PT, which will make the caller painfully slow.  There should
+        be no need to go too far beyond the window's bottom, as any
+        such optimization will fail to show point anyway.  */
+      move_it_to (&tem_it, to, -1,
+                 tem_it.last_visible_y
+                 + (SCROLL_LIMIT + 10) * FRAME_LINE_HEIGHT (tem_it.f),
+                 -1, MOVE_TO_POS | MOVE_TO_Y);
       unbind_to (count, Qnil);
       return IT_CHARPOS (*it) <= PT ? -tem_it.vpos : tem_it.vpos;
     }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]