From: Eli Zaretskii Date: Tue, 17 Jun 2025 13:00:04 +0000 (+0300) Subject: Prevent redisplay slowdown with non-zero vscroll X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=1b34334f61746fc791362337cab4bd82ed249bb0;p=emacs.git Prevent redisplay slowdown with non-zero vscroll * 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) --- diff --git a/src/xdisp.c b/src/xdisp.c index 30818191e42..98232f639d5 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -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;