emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-29 46392c1623b: Fix vertical-motion when tab-line is displayed in


From: Eli Zaretskii
Subject: emacs-29 46392c1623b: Fix vertical-motion when tab-line is displayed in a window
Date: Mon, 1 May 2023 08:27:50 -0400 (EDT)

branch: emacs-29
commit 46392c1623bc3f9764b8c7df293a89fcd47ab0ad
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    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)
---
 src/xdisp.c | 14 +++++++++++---
 1 file 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);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]