summaryrefslogtreecommitdiff
path: root/src/xdisp.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1997-08-27 17:13:29 +0000
committerRichard M. Stallman <rms@gnu.org>1997-08-27 17:13:29 +0000
commit5de2b9b358e277947b5e09e6ac90f18a68b8da5e (patch)
tree65d1953c6bb1dda08b2bc5d4049bcc57cbdf81e7 /src/xdisp.c
parent61e8c0e314eb34e87abf9b9274a6cf2e69267ca0 (diff)
downloademacs-5de2b9b358e277947b5e09e6ac90f18a68b8da5e.tar.gz
(redisplay_window): When trying to scroll conservatively
correctly take the scroll margin into account.
Diffstat (limited to 'src/xdisp.c')
-rw-r--r--src/xdisp.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 48115508823..607fe85d27e 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -1994,25 +1994,32 @@ redisplay_window (window, just_this_one, preserve_echo_area)
&& startp >= BEGV && startp <= ZV)
{
int this_scroll_margin = scroll_margin;
+ int scroll_margin_pos;
/* Don't use a scroll margin that is negative or too large. */
if (this_scroll_margin < 0)
this_scroll_margin = 0;
- if (XINT (w->height) < 4 * scroll_margin)
+ if (XINT (w->height) < 4 * this_scroll_margin)
this_scroll_margin = XINT (w->height) / 4;
- if (PT >= Z - XFASTINT (w->window_end_pos))
+ scroll_margin_pos = Z - XFASTINT (w->window_end_pos);
+ if (this_scroll_margin)
+ {
+ pos = *vmotion (scroll_margin_pos, -this_scroll_margin, w);
+ scroll_margin_pos = pos.bufpos;
+ }
+ if (PT >= scroll_margin_pos)
{
struct position pos;
- pos = *compute_motion (Z - XFASTINT (w->window_end_pos), 0, 0, 0,
+ pos = *compute_motion (scroll_margin_pos, 0, 0, 0,
PT, XFASTINT (w->height), 0,
XFASTINT (w->width), XFASTINT (w->hscroll),
pos_tab_offset (w, startp), w);
if (pos.vpos > scroll_conservatively)
goto scroll_fail_1;
- pos = *vmotion (startp, pos.vpos + 1 + this_scroll_margin, w);
+ pos = *vmotion (startp, pos.vpos + 1, w);
if (! NILP (Vwindow_scroll_functions))
{
@@ -2033,17 +2040,24 @@ redisplay_window (window, just_this_one, preserve_echo_area)
else
cancel_my_columns (w);
}
- if (PT < startp)
+
+ scroll_margin_pos = startp;
+ if (this_scroll_margin)
+ {
+ pos = *vmotion (scroll_margin_pos, this_scroll_margin, w);
+ scroll_margin_pos = pos.bufpos;
+ }
+ if (PT < scroll_margin_pos)
{
struct position pos;
pos = *compute_motion (PT, 0, 0, 0,
- startp, XFASTINT (w->height), 0,
+ scroll_margin_pos, XFASTINT (w->height), 0,
XFASTINT (w->width), XFASTINT (w->hscroll),
pos_tab_offset (w, startp), w);
if (pos.vpos > scroll_conservatively)
goto scroll_fail_1;
- pos = *vmotion (startp, - pos.vpos - this_scroll_margin, w);
+ pos = *vmotion (startp, -pos.vpos, w);
if (! NILP (Vwindow_scroll_functions))
{