aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/xdisp.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index b74fe724300..d947a5dd40a 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -1822,6 +1822,15 @@ redisplay_window (window, just_this_one, preserve_echo_area)
1822 if (scroll_conservatively && !current_buffer->clip_changed 1822 if (scroll_conservatively && !current_buffer->clip_changed
1823 && startp >= BEGV && startp <= ZV) 1823 && startp >= BEGV && startp <= ZV)
1824 { 1824 {
1825 int this_scroll_margin = scroll_margin;
1826
1827 /* Don't use a scroll margin that is negative or too large. */
1828 if (this_scroll_margin < 0)
1829 this_scroll_margin = 0;
1830
1831 if (XINT (w->height) < 4 * scroll_margin)
1832 this_scroll_margin = XINT (w->height) / 4;
1833
1825 if (PT >= Z - XFASTINT (w->window_end_pos)) 1834 if (PT >= Z - XFASTINT (w->window_end_pos))
1826 { 1835 {
1827 struct position pos; 1836 struct position pos;
@@ -1832,7 +1841,7 @@ redisplay_window (window, just_this_one, preserve_echo_area)
1832 if (pos.vpos > scroll_conservatively) 1841 if (pos.vpos > scroll_conservatively)
1833 goto scroll_fail_1; 1842 goto scroll_fail_1;
1834 1843
1835 pos = *vmotion (startp, pos.vpos + 1, w); 1844 pos = *vmotion (startp, pos.vpos + 1 + this_scroll_margin, w);
1836 1845
1837 if (! NILP (Vwindow_scroll_functions)) 1846 if (! NILP (Vwindow_scroll_functions))
1838 { 1847 {
@@ -1863,7 +1872,7 @@ redisplay_window (window, just_this_one, preserve_echo_area)
1863 if (pos.vpos >= scroll_conservatively) 1872 if (pos.vpos >= scroll_conservatively)
1864 goto scroll_fail_1; 1873 goto scroll_fail_1;
1865 1874
1866 pos = *vmotion (startp, - pos.vpos, w); 1875 pos = *vmotion (startp, - pos.vpos - this_scroll_margin, w);
1867 1876
1868 if (! NILP (Vwindow_scroll_functions)) 1877 if (! NILP (Vwindow_scroll_functions))
1869 { 1878 {