summaryrefslogtreecommitdiff
path: root/src/xdisp.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2020-08-02 18:27:33 +0300
committerEli Zaretskii <eliz@gnu.org>2020-08-02 18:27:33 +0300
commita07ec21bf24b8d1dc41808f997dd0fb78cad3870 (patch)
tree6b40d82e3e2335537e57d92408aad7b215058b51 /src/xdisp.c
parent2e9d1f4d44036e7c0605cfeac091368e013e3ed9 (diff)
downloademacs-a07ec21bf24b8d1dc41808f997dd0fb78cad3870.tar.gz
Re-enable scroll-margin when cursor-motion optimization is disabled
* src/xdisp.c (try_window): Fix logic of disabling margins when cursor is close to BOB or EOB. Account for header-line, if any, when computing the scroll margin in pixels. (Bug#42653)
Diffstat (limited to 'src/xdisp.c')
-rw-r--r--src/xdisp.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index fc17014c029..a8cd4dc853c 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -19223,18 +19223,20 @@ try_window (Lisp_Object window, struct text_pos pos, int flags)
&& !MINI_WINDOW_P (w))
{
int this_scroll_margin = window_scroll_margin (w, MARGIN_IN_PIXELS);
+ if (window_wants_header_line (w))
+ this_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
- && CHARPOS (pos) > BEGV
- && it_charpos < ZV)
+ && 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))
+ || (it_charpos < ZV /* if EOB is visible, disable bottom margin */
+ && w->cursor.y > (it.last_visible_y - partial_line_height (&it)
+ - this_scroll_margin - 1)))
{
w->cursor.vpos = -1;
clear_glyph_matrix (w->desired_matrix);