From 8c535114e2eceabcf14127715dccf7842f5b55a8 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 25 Nov 2011 13:32:14 +0200 Subject: [PATCH] Fix bug #10105 with Isearch triggered scrolling under scroll-conservatively. src/xdisp.c (redisplay_window): If cursor row is not fully visible after recentering, and scroll-conservatively is set to a large number, scroll window by a few more lines to make the cursor fully visible and out of scroll-margin. --- src/ChangeLog | 7 +++++++ src/xdisp.c | 20 +++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index 59115a910e3..1614b02786b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2011-11-25 Eli Zaretskii + + * xdisp.c (redisplay_window): If cursor row is not fully visible + after recentering, and scroll-conservatively is set to a large + number, scroll window by a few more lines to make the cursor fully + visible and out of scroll-margin. (Bug#10105) + 2011-11-24 Juri Linkov * image.c (imagemagick_load_image): Move `MagickSetResolution' down diff --git a/src/xdisp.c b/src/xdisp.c index 403272e7d0c..953a102b095 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -15043,6 +15043,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) int centering_position = -1; int last_line_misfit = 0; EMACS_INT beg_unchanged, end_unchanged; + int scrolling_up; SET_TEXT_POS (lpoint, PT, PT_BYTE); opoint = lpoint; @@ -15557,7 +15558,6 @@ redisplay_window (Lisp_Object window, int just_this_one_p) ? min (scroll_margin, WINDOW_TOTAL_LINES (w) / 4) : 0; EMACS_INT margin_pos = CHARPOS (startp); - int scrolling_up; Lisp_Object aggressive; /* If there is a scroll margin at the top of the window, find @@ -15720,6 +15720,24 @@ redisplay_window (Lisp_Object window, int just_this_one_p) goto recenter; } + /* Users who set scroll-conservatively to a large number want + point just above/below the scroll margin. If we ended up + with point's row partially visible, move the window start to + make that row fully visible and out of the margin. */ + if (scroll_conservatively > SCROLL_LIMIT) + { + int margin = + scroll_margin > 0 + ? min (scroll_margin, WINDOW_TOTAL_LINES (w) / 4) + : 0; + + move_it_by_lines (&it, scrolling_up ? margin + 1 : margin -1); + clear_glyph_matrix (w->desired_matrix); + if (1 == try_window (window, it.current.pos, + TRY_WINDOW_CHECK_MARGINS)) + goto done; + } + /* If centering point failed to make the whole line visible, put point at the top instead. That has to make the whole line visible, if it can be done. */ -- 2.11.4.GIT