aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1997-08-27 17:13:29 +0000
committerRichard M. Stallman1997-08-27 17:13:29 +0000
commit44173109afdc1252dda450184f7621c09b4c92fc (patch)
tree9303aa779387947665faf4f534057edde8268113 /src
parent3198a3d5909da33ca4e6356055e964a3f2c863b5 (diff)
downloademacs-44173109afdc1252dda450184f7621c09b4c92fc.tar.gz
emacs-44173109afdc1252dda450184f7621c09b4c92fc.zip
(redisplay_window): When trying to scroll conservatively
correctly take the scroll margin into account.
Diffstat (limited to 'src')
-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)
1994 && startp >= BEGV && startp <= ZV) 1994 && startp >= BEGV && startp <= ZV)
1995 { 1995 {
1996 int this_scroll_margin = scroll_margin; 1996 int this_scroll_margin = scroll_margin;
1997 int scroll_margin_pos;
1997 1998
1998 /* Don't use a scroll margin that is negative or too large. */ 1999 /* Don't use a scroll margin that is negative or too large. */
1999 if (this_scroll_margin < 0) 2000 if (this_scroll_margin < 0)
2000 this_scroll_margin = 0; 2001 this_scroll_margin = 0;
2001 2002
2002 if (XINT (w->height) < 4 * scroll_margin) 2003 if (XINT (w->height) < 4 * this_scroll_margin)
2003 this_scroll_margin = XINT (w->height) / 4; 2004 this_scroll_margin = XINT (w->height) / 4;
2004 2005
2005 if (PT >= Z - XFASTINT (w->window_end_pos)) 2006 scroll_margin_pos = Z - XFASTINT (w->window_end_pos);
2007 if (this_scroll_margin)
2008 {
2009 pos = *vmotion (scroll_margin_pos, -this_scroll_margin, w);
2010 scroll_margin_pos = pos.bufpos;
2011 }
2012 if (PT >= scroll_margin_pos)
2006 { 2013 {
2007 struct position pos; 2014 struct position pos;
2008 pos = *compute_motion (Z - XFASTINT (w->window_end_pos), 0, 0, 0, 2015 pos = *compute_motion (scroll_margin_pos, 0, 0, 0,
2009 PT, XFASTINT (w->height), 0, 2016 PT, XFASTINT (w->height), 0,
2010 XFASTINT (w->width), XFASTINT (w->hscroll), 2017 XFASTINT (w->width), XFASTINT (w->hscroll),
2011 pos_tab_offset (w, startp), w); 2018 pos_tab_offset (w, startp), w);
2012 if (pos.vpos > scroll_conservatively) 2019 if (pos.vpos > scroll_conservatively)
2013 goto scroll_fail_1; 2020 goto scroll_fail_1;
2014 2021
2015 pos = *vmotion (startp, pos.vpos + 1 + this_scroll_margin, w); 2022 pos = *vmotion (startp, pos.vpos + 1, w);
2016 2023
2017 if (! NILP (Vwindow_scroll_functions)) 2024 if (! NILP (Vwindow_scroll_functions))
2018 { 2025 {
@@ -2033,17 +2040,24 @@ redisplay_window (window, just_this_one, preserve_echo_area)
2033 else 2040 else
2034 cancel_my_columns (w); 2041 cancel_my_columns (w);
2035 } 2042 }
2036 if (PT < startp) 2043
2044 scroll_margin_pos = startp;
2045 if (this_scroll_margin)
2046 {
2047 pos = *vmotion (scroll_margin_pos, this_scroll_margin, w);
2048 scroll_margin_pos = pos.bufpos;
2049 }
2050 if (PT < scroll_margin_pos)
2037 { 2051 {
2038 struct position pos; 2052 struct position pos;
2039 pos = *compute_motion (PT, 0, 0, 0, 2053 pos = *compute_motion (PT, 0, 0, 0,
2040 startp, XFASTINT (w->height), 0, 2054 scroll_margin_pos, XFASTINT (w->height), 0,
2041 XFASTINT (w->width), XFASTINT (w->hscroll), 2055 XFASTINT (w->width), XFASTINT (w->hscroll),
2042 pos_tab_offset (w, startp), w); 2056 pos_tab_offset (w, startp), w);
2043 if (pos.vpos > scroll_conservatively) 2057 if (pos.vpos > scroll_conservatively)
2044 goto scroll_fail_1; 2058 goto scroll_fail_1;
2045 2059
2046 pos = *vmotion (startp, - pos.vpos - this_scroll_margin, w); 2060 pos = *vmotion (startp, -pos.vpos, w);
2047 2061
2048 if (! NILP (Vwindow_scroll_functions)) 2062 if (! NILP (Vwindow_scroll_functions))
2049 { 2063 {