diff options
| author | Richard M. Stallman | 2004-11-02 09:06:06 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2004-11-02 09:06:06 +0000 |
| commit | dc297565e7204be213349cbf4bff6d17d2d24d76 (patch) | |
| tree | 2f714f8dd8e3a74a208f37984b50d0883e390175 /src/window.c | |
| parent | c63df42bfac4b43ba7af2590d18edbfc8e073690 (diff) | |
| download | emacs-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.c | 38 |
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 | ||
| 4993 | DEFUN ("scroll-left", Fscroll_left, Sscroll_left, 0, 1, "P", | 5001 | DEFUN ("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. |
| 4995 | Default for ARG is window width minus 2. | 5003 | Default for ARG is window width minus 2. |
| 4996 | Value is the total amount of leftward horizontal scrolling in | 5004 | Value is the total amount of leftward horizontal scrolling in |
| 4997 | effect after the change. | 5005 | effect after the change. |
| 4998 | If `automatic-hscrolling' is non-nil, the argument ARG modifies | 5006 | If SET_MINIMUM is non-nil, the new scroll amount becomes the |
| 4999 | a lower bound for automatic scrolling, i.e. automatic scrolling | 5007 | lower bound for automatic scrolling, i.e. automatic scrolling |
| 5000 | will not scroll a window to a column less than the value returned | 5008 | will not scroll a window to a column less than the value returned |
| 5001 | by this function. */) | 5009 | by 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 | ||
| 5023 | DEFUN ("scroll-right", Fscroll_right, Sscroll_right, 0, 1, "P", | 5031 | DEFUN ("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. |
| 5025 | Default for ARG is window width minus 2. | 5033 | Default for ARG is window width minus 2. |
| 5026 | Value is the total amount of leftward horizontal scrolling in | 5034 | Value is the total amount of leftward horizontal scrolling in |
| 5027 | effect after the change. | 5035 | effect after the change. |
| 5028 | If `automatic-hscrolling' is non-nil, the argument ARG modifies | 5036 | If SET_MINIMUM is non-nil, the new scroll amount becomes the |
| 5029 | a lower bound for automatic scrolling, i.e. automatic scrolling | 5037 | lower bound for automatic scrolling, i.e. automatic scrolling |
| 5030 | will not scroll a window to a column less than the value returned | 5038 | will not scroll a window to a column less than the value returned |
| 5031 | by this function. */) | 5039 | by 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; |