diff options
author | Eli Zaretskii <eliz@gnu.org> | 2023-05-01 15:27:21 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2023-05-01 15:27:21 +0300 |
commit | 46392c1623bc3f9764b8c7df293a89fcd47ab0ad (patch) | |
tree | 01fc2dc89b7949862d9d5c3e2e0ba2244c2b4a3a /src | |
parent | 0e52beeacead956cdaa7921e911afc2fd29aea61 (diff) | |
download | emacs-46392c1623bc3f9764b8c7df293a89fcd47ab0ad.tar.gz emacs-46392c1623bc3f9764b8c7df293a89fcd47ab0ad.tar.bz2 emacs-46392c1623bc3f9764b8c7df293a89fcd47ab0ad.zip |
Fix vertical-motion when tab-line is displayed in a window
* src/xdisp.c (try_window, try_window_id): Account for tab-line,
if present, when converting scroll-margin at the top of the window
to vertical pixel coordinate. (Bug#63201)
Diffstat (limited to 'src')
-rw-r--r-- | src/xdisp.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 8e265fb5a49..43847544396 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -20600,6 +20600,8 @@ try_window (Lisp_Object window, struct text_pos pos, int flags) int bot_scroll_margin = top_scroll_margin; if (window_wants_header_line (w)) top_scroll_margin += CURRENT_HEADER_LINE_HEIGHT (w); + if (window_wants_tab_line (w)) + top_scroll_margin += CURRENT_TAB_LINE_HEIGHT (w); start_display (&it, w, pos); if ((w->cursor.y >= 0 @@ -21944,17 +21946,23 @@ try_window_id (struct window *w) /* Don't let the cursor end in the scroll margins. */ { - int this_scroll_margin = window_scroll_margin (w, MARGIN_IN_PIXELS); + int top_scroll_margin = window_scroll_margin (w, MARGIN_IN_PIXELS); + int bot_scroll_margin = top_scroll_margin; int cursor_height = MATRIX_ROW (w->desired_matrix, w->cursor.vpos)->height; - if ((w->cursor.y < this_scroll_margin + if (window_wants_header_line (w)) + top_scroll_margin += CURRENT_HEADER_LINE_HEIGHT (w); + if (window_wants_tab_line (w)) + top_scroll_margin += CURRENT_TAB_LINE_HEIGHT (w); + + if ((w->cursor.y < top_scroll_margin && CHARPOS (start) > BEGV) /* Old redisplay didn't take scroll margin into account at the bottom, but then global-hl-line-mode doesn't scroll. KFS 2004-06-14 */ || (w->cursor.y + (cursor_row_fully_visible_p (w, false, true, true) ? 1 - : cursor_height + this_scroll_margin)) > it.last_visible_y) + : cursor_height + bot_scroll_margin)) > it.last_visible_y) { w->cursor.vpos = -1; clear_glyph_matrix (w->desired_matrix); |