aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2023-05-01 15:27:21 +0300
committerEli Zaretskii2023-05-01 15:27:21 +0300
commit46392c1623bc3f9764b8c7df293a89fcd47ab0ad (patch)
tree01fc2dc89b7949862d9d5c3e2e0ba2244c2b4a3a /src
parent0e52beeacead956cdaa7921e911afc2fd29aea61 (diff)
downloademacs-46392c1623bc3f9764b8c7df293a89fcd47ab0ad.tar.gz
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.c14
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)
20600 int bot_scroll_margin = top_scroll_margin; 20600 int bot_scroll_margin = top_scroll_margin;
20601 if (window_wants_header_line (w)) 20601 if (window_wants_header_line (w))
20602 top_scroll_margin += CURRENT_HEADER_LINE_HEIGHT (w); 20602 top_scroll_margin += CURRENT_HEADER_LINE_HEIGHT (w);
20603 if (window_wants_tab_line (w))
20604 top_scroll_margin += CURRENT_TAB_LINE_HEIGHT (w);
20603 start_display (&it, w, pos); 20605 start_display (&it, w, pos);
20604 20606
20605 if ((w->cursor.y >= 0 20607 if ((w->cursor.y >= 0
@@ -21944,17 +21946,23 @@ try_window_id (struct window *w)
21944 21946
21945 /* Don't let the cursor end in the scroll margins. */ 21947 /* Don't let the cursor end in the scroll margins. */
21946 { 21948 {
21947 int this_scroll_margin = window_scroll_margin (w, MARGIN_IN_PIXELS); 21949 int top_scroll_margin = window_scroll_margin (w, MARGIN_IN_PIXELS);
21950 int bot_scroll_margin = top_scroll_margin;
21948 int cursor_height = MATRIX_ROW (w->desired_matrix, w->cursor.vpos)->height; 21951 int cursor_height = MATRIX_ROW (w->desired_matrix, w->cursor.vpos)->height;
21949 21952
21950 if ((w->cursor.y < this_scroll_margin 21953 if (window_wants_header_line (w))
21954 top_scroll_margin += CURRENT_HEADER_LINE_HEIGHT (w);
21955 if (window_wants_tab_line (w))
21956 top_scroll_margin += CURRENT_TAB_LINE_HEIGHT (w);
21957
21958 if ((w->cursor.y < top_scroll_margin
21951 && CHARPOS (start) > BEGV) 21959 && CHARPOS (start) > BEGV)
21952 /* Old redisplay didn't take scroll margin into account at the bottom, 21960 /* Old redisplay didn't take scroll margin into account at the bottom,
21953 but then global-hl-line-mode doesn't scroll. KFS 2004-06-14 */ 21961 but then global-hl-line-mode doesn't scroll. KFS 2004-06-14 */
21954 || (w->cursor.y 21962 || (w->cursor.y
21955 + (cursor_row_fully_visible_p (w, false, true, true) 21963 + (cursor_row_fully_visible_p (w, false, true, true)
21956 ? 1 21964 ? 1
21957 : cursor_height + this_scroll_margin)) > it.last_visible_y) 21965 : cursor_height + bot_scroll_margin)) > it.last_visible_y)
21958 { 21966 {
21959 w->cursor.vpos = -1; 21967 w->cursor.vpos = -1;
21960 clear_glyph_matrix (w->desired_matrix); 21968 clear_glyph_matrix (w->desired_matrix);