emacs-diffs
[Top][All Lists]
Advanced

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

master 699e40c: Avoid unneeded recentering when header-line is used


From: Eli Zaretskii
Subject: master 699e40c: Avoid unneeded recentering when header-line is used
Date: Sat, 12 Sep 2020 04:07:47 -0400 (EDT)

branch: master
commit 699e40caf634cea11350c59fc64ce5693d378cb4
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Avoid unneeded recentering when header-line is used
    
    * src/xdisp.c (try_window): Account for header-line height only in
    the scroll-margin at the window's top, but not at its bottom.
    (Bug#42653)
---
 src/xdisp.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/xdisp.c b/src/xdisp.c
index 406b2d7..69e5a9e 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -19308,20 +19308,21 @@ try_window (Lisp_Object window, struct text_pos pos, 
int flags)
   if ((flags & TRY_WINDOW_CHECK_MARGINS)
       && !MINI_WINDOW_P (w))
     {
-      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;
       if (window_wants_header_line (w))
-       this_scroll_margin += CURRENT_HEADER_LINE_HEIGHT (w);
+       top_scroll_margin += CURRENT_HEADER_LINE_HEIGHT (w);
       start_display (&it, w, pos);
 
       if ((w->cursor.y >= 0    /* not vscrolled */
-          && w->cursor.y < this_scroll_margin
+          && w->cursor.y < top_scroll_margin
           && CHARPOS (pos) > BEGV)
          /* rms: considering make_cursor_line_fully_visible_p here
             seems to give wrong results.  We don't want to recenter
             when the last line is partly visible, we want to allow
             that case to be handled in the usual way.  */
          || w->cursor.y > (it.last_visible_y - partial_line_height (&it)
-                           - this_scroll_margin - 1))
+                           - bot_scroll_margin - 1))
        {
          w->cursor.vpos = -1;
          clear_glyph_matrix (w->desired_matrix);



reply via email to

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