comparison src/xdisp.c @ 19571:28ab022089b2

(redisplay_window): When trying to scroll conservatively correctly take the scroll margin into account.
author Richard M. Stallman <rms@gnu.org>
date Wed, 27 Aug 1997 17:13:29 +0000
parents 318a3a6a8ff5
children 18d979b08faf
comparison
equal deleted inserted replaced
19570:a2a72d1e0970 19571:28ab022089b2
1992 1992
1993 if (scroll_conservatively && !current_buffer->clip_changed 1993 if (scroll_conservatively && !current_buffer->clip_changed
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 {
2019 Fset_marker (w->start, make_number (pos.bufpos), Qnil); 2026 Fset_marker (w->start, make_number (pos.bufpos), Qnil);
2020 run_hook_with_args_2 (Qwindow_scroll_functions, window, 2027 run_hook_with_args_2 (Qwindow_scroll_functions, window,
2031 goto done; 2038 goto done;
2032 } 2039 }
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 {
2050 Fset_marker (w->start, make_number (pos.bufpos), Qnil); 2064 Fset_marker (w->start, make_number (pos.bufpos), Qnil);
2051 run_hook_with_args_2 (Qwindow_scroll_functions, window, 2065 run_hook_with_args_2 (Qwindow_scroll_functions, window,