]> git.eshelyaron.com Git - emacs.git/commitdiff
Prevent redisplay slowdown with non-zero vscroll
authorEli Zaretskii <eliz@gnu.org>
Tue, 17 Jun 2025 13:00:04 +0000 (16:00 +0300)
committerEshel Yaron <me@eshelyaron.com>
Wed, 18 Jun 2025 08:14:43 +0000 (10:14 +0200)
* src/xdisp.c (try_scrolling): Don't loop when the
partially-visible cursor line is at the top of the window.  This
looping are pointless, and just makes redisplay slow for no reason.
(Bug#78766)

(cherry picked from commit 06b74b04cb86be6847bbee11e0060bf51c4a9ab5)

src/xdisp.c

index 30818191e42f29d3529505b4c793f36102606cc4..98232f639d5190208d1a26ff32e30dd8ff3b67e7 100644 (file)
@@ -19449,9 +19449,11 @@ try_scrolling (Lisp_Object window, bool just_this_one_p,
       if (! cursor_row_fully_visible_p (w, extra_scroll_margin_lines <= 1,
                                        false, false)
          /* It's possible that the cursor is on the first line of the
-            buffer, which is partially obscured due to a vscroll
-            (Bug#7537).  In that case, avoid looping forever. */
-         && extra_scroll_margin_lines < w->desired_matrix->nrows - 1)
+            buffer/window, which is partially obscured due to a vscroll
+            (Bug#7537, Bug#78766).  If so, just return, since the code
+            above is not prepared to deal with that case.  */
+         && !(MATRIX_ROW_PARTIALLY_VISIBLE_AT_TOP_P
+                (w, MATRIX_ROW (w->desired_matrix, w->cursor.vpos))))
        {
          clear_glyph_matrix (w->desired_matrix);
          ++extra_scroll_margin_lines;