From 2652e11930125b5b5e28f3f01e73b07eacb5ef75 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 1 Feb 2026 17:26:56 +0200 Subject: [PATCH] Minor improvements in vertical cusror motion * src/xdisp.c (move_it_vertically_backward): Zero out cached value of line height, to avoid using stale and incorrect values. (try_window_reusing_current_matrix): Fix conditions for changes in tab-line height. Reported by Michael Heerdegen in https://lists.gnu.org/archive/html/help-gnu-emacs/2026-01/msg00163.html This improves the scrolling a little bit, but doesn't solve the problem entirely. --- src/xdisp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/xdisp.c b/src/xdisp.c index fa826c366dd..22e178fcdc9 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -11300,6 +11300,7 @@ move_it_vertically_backward (struct it *it, int dy) int line_height; RESTORE_IT (&it3, &it3, it3data); + last_height = 0; y1 = line_bottom_y (&it3); line_height = y1 - y0; RESTORE_IT (it, it, it2data); @@ -21673,8 +21674,9 @@ try_window_reusing_current_matrix (struct window *w) return false; /* If top-line visibility has changed, give up. */ - if (window_wants_tab_line (w) - != MATRIX_TAB_LINE_ROW (w->current_matrix)->mode_line_p) + if (!w->current_matrix->header_line_p + && (window_wants_tab_line (w) + != MATRIX_TAB_LINE_ROW (w->current_matrix)->mode_line_p)) return false; /* If top-line visibility has changed, give up. */