aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
authorNoam Postavsky2016-09-11 11:09:57 -0400
committerNoam Postavsky2017-02-02 21:20:29 -0500
commite27a91cddc1a66c25e09d3929c5625637ec34a49 (patch)
tree00096f2a38822f4c63ba228e769fb02c1c966b54 /src/window.c
parentc92fc7a2156a5939439b7236452d4dfcfc13cc89 (diff)
downloademacs-e27a91cddc1a66c25e09d3929c5625637ec34a49.tar.gz
emacs-e27a91cddc1a66c25e09d3929c5625637ec34a49.zip
Make limit on scroll-margin variable
* src/xdisp.c (maximum-scroll-margin): New variable. * lisp/cus-start.el: Make it customizable. * etc/NEWS: Mention it. * doc/emacs/display.texi (Auto Scrolling): * doc/lispref/windows.texi (Textual Scrolling): Document it. * src/window.c (window_scroll_pixel_based): Use it instead of hardcoding division by 4 (Bug #5718).
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/window.c b/src/window.c
index 235c3c1ade8..ba03780f3df 100644
--- a/src/window.c
+++ b/src/window.c
@@ -4801,11 +4801,20 @@ window_scroll_margin (struct window *window, enum margin_unit unit)
4801 { 4801 {
4802 int frame_line_height = default_line_pixel_height (window); 4802 int frame_line_height = default_line_pixel_height (window);
4803 int window_lines = window_box_height (window) / frame_line_height; 4803 int window_lines = window_box_height (window) / frame_line_height;
4804 int margin = min (scroll_margin, window_lines / 4); 4804
4805 if (unit == MARGIN_IN_PIXELS) 4805 double ratio = 0.25;
4806 return margin * frame_line_height; 4806 if (FLOATP (Vmaximum_scroll_margin))
4807 else 4807 {
4808 return margin; 4808 ratio = XFLOAT_DATA (Vmaximum_scroll_margin);
4809 ratio = max (0.0, ratio);
4810 ratio = min (ratio, 0.5);
4811 }
4812 int max_margin = min ((window_lines - 1)/2,
4813 (int) (window_lines * ratio));
4814 int margin = clip_to_bounds (0, scroll_margin, max_margin);
4815 return (unit == MARGIN_IN_PIXELS)
4816 ? margin * frame_line_height
4817 : margin;
4809 } 4818 }
4810 else 4819 else
4811 return 0; 4820 return 0;