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