aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c40
1 files changed, 24 insertions, 16 deletions
diff --git a/src/window.c b/src/window.c
index 6b244ca5353..d9ac2eb62bd 100644
--- a/src/window.c
+++ b/src/window.c
@@ -4627,17 +4627,25 @@ window_scroll_pixel_based (window, n, whole, noerror)
4627 w->force_start = Qt; 4627 w->force_start = Qt;
4628 } 4628 }
4629 4629
4630 /* The rest of this function uses current_y in a nonstandard way,
4631 not including the height of the header line if any. */
4630 it.current_y = it.vpos = 0; 4632 it.current_y = it.vpos = 0;
4631 4633
4632 /* Preserve the screen position if we must. */ 4634 /* Preserve the screen position if we should. */
4633 if (preserve_y >= 0) 4635 if (preserve_y >= 0)
4634 { 4636 {
4637 /* If we have a header line, take account of it. */
4638 if (WINDOW_WANTS_HEADER_LINE_P (w))
4639 preserve_y -= CURRENT_HEADER_LINE_HEIGHT (w);
4640
4635 move_it_to (&it, -1, -1, preserve_y, -1, MOVE_TO_Y); 4641 move_it_to (&it, -1, -1, preserve_y, -1, MOVE_TO_Y);
4636 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); 4642 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it));
4637 } 4643 }
4638 else 4644 else
4639 { 4645 {
4640 /* Move PT out of scroll margins. */ 4646 /* Move PT out of scroll margins.
4647 This code wants current_y to be zero at the window start position
4648 even if there is a header line. */
4641 this_scroll_margin = max (0, scroll_margin); 4649 this_scroll_margin = max (0, scroll_margin);
4642 this_scroll_margin = min (this_scroll_margin, XFASTINT (w->total_lines) / 4); 4650 this_scroll_margin = min (this_scroll_margin, XFASTINT (w->total_lines) / 4);
4643 this_scroll_margin *= FRAME_LINE_HEIGHT (it.f); 4651 this_scroll_margin *= FRAME_LINE_HEIGHT (it.f);
@@ -4992,17 +5000,17 @@ specifies the window to scroll. This takes precedence over
4992 return Qnil; 5000 return Qnil;
4993} 5001}
4994 5002
4995DEFUN ("scroll-left", Fscroll_left, Sscroll_left, 0, 1, "P", 5003DEFUN ("scroll-left", Fscroll_left, Sscroll_left, 0, 2, "P\np",
4996 doc: /* Scroll selected window display ARG columns left. 5004 doc: /* Scroll selected window display ARG columns left.
4997Default for ARG is window width minus 2. 5005Default for ARG is window width minus 2.
4998Value is the total amount of leftward horizontal scrolling in 5006Value is the total amount of leftward horizontal scrolling in
4999effect after the change. 5007effect after the change.
5000If `automatic-hscrolling' is non-nil, the argument ARG modifies 5008If SET_MINIMUM is non-nil, the new scroll amount becomes the
5001a lower bound for automatic scrolling, i.e. automatic scrolling 5009lower bound for automatic scrolling, i.e. automatic scrolling
5002will not scroll a window to a column less than the value returned 5010will not scroll a window to a column less than the value returned
5003by this function. */) 5011by this function. This happens in an interactive call. */)
5004 (arg) 5012 (arg, set_minimum)
5005 register Lisp_Object arg; 5013 register Lisp_Object arg, set_minimum;
5006{ 5014{
5007 Lisp_Object result; 5015 Lisp_Object result;
5008 int hscroll; 5016 int hscroll;
@@ -5016,23 +5024,23 @@ by this function. */)
5016 hscroll = XINT (w->hscroll) + XINT (arg); 5024 hscroll = XINT (w->hscroll) + XINT (arg);
5017 result = Fset_window_hscroll (selected_window, make_number (hscroll)); 5025 result = Fset_window_hscroll (selected_window, make_number (hscroll));
5018 5026
5019 if (interactive_p (0)) 5027 if (!NILP (set_minimum))
5020 w->min_hscroll = w->hscroll; 5028 w->min_hscroll = w->hscroll;
5021 5029
5022 return result; 5030 return result;
5023} 5031}
5024 5032
5025DEFUN ("scroll-right", Fscroll_right, Sscroll_right, 0, 1, "P", 5033DEFUN ("scroll-right", Fscroll_right, Sscroll_right, 0, 2, "P\np",
5026 doc: /* Scroll selected window display ARG columns right. 5034 doc: /* Scroll selected window display ARG columns right.
5027Default for ARG is window width minus 2. 5035Default for ARG is window width minus 2.
5028Value is the total amount of leftward horizontal scrolling in 5036Value is the total amount of leftward horizontal scrolling in
5029effect after the change. 5037effect after the change.
5030If `automatic-hscrolling' is non-nil, the argument ARG modifies 5038If SET_MINIMUM is non-nil, the new scroll amount becomes the
5031a lower bound for automatic scrolling, i.e. automatic scrolling 5039lower bound for automatic scrolling, i.e. automatic scrolling
5032will not scroll a window to a column less than the value returned 5040will not scroll a window to a column less than the value returned
5033by this function. */) 5041by this function. This happens in an interactive call. */)
5034 (arg) 5042 (arg, set_minimum)
5035 register Lisp_Object arg; 5043 register Lisp_Object arg, set_minimum;
5036{ 5044{
5037 Lisp_Object result; 5045 Lisp_Object result;
5038 int hscroll; 5046 int hscroll;
@@ -5046,7 +5054,7 @@ by this function. */)
5046 hscroll = XINT (w->hscroll) - XINT (arg); 5054 hscroll = XINT (w->hscroll) - XINT (arg);
5047 result = Fset_window_hscroll (selected_window, make_number (hscroll)); 5055 result = Fset_window_hscroll (selected_window, make_number (hscroll));
5048 5056
5049 if (interactive_p (0)) 5057 if (!NILP (set_minimum))
5050 w->min_hscroll = w->hscroll; 5058 w->min_hscroll = w->hscroll;
5051 5059
5052 return result; 5060 return result;