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.
This commit is contained in:
Eli Zaretskii 2011-11-25 13:32:14 +02:00
parent e4920bc99d
commit 8c535114e2
2 changed files with 26 additions and 1 deletions

View file

@ -1,3 +1,10 @@
2011-11-25 Eli Zaretskii <eliz@gnu.org>
* 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 <juri@jurta.org>
* image.c (imagemagick_load_image): Move `MagickSetResolution' down

View file

@ -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. */