diff options
| author | Richard M. Stallman | 2005-06-29 23:29:01 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2005-06-29 23:29:01 +0000 |
| commit | bdf4ec93fdb64406d1ec76811bef2420e785db26 (patch) | |
| tree | 4f8c2f745146860ee20c7f4ac3e00b5e7b02a7a4 /src/window.c | |
| parent | 6ef874e972b32e07d6a05fcbbc470db5889dfbc9 (diff) | |
| download | emacs-bdf4ec93fdb64406d1ec76811bef2420e785db26.tar.gz emacs-bdf4ec93fdb64406d1ec76811bef2420e785db26.zip | |
(window_scroll_pixel_based, window_scroll_line_based):
Handle `scroll-preserve-screen-position' non-nil, non-t specially.
(syms_of_window): <scroll-preserve-screen-position>: Doc fix.
Diffstat (limited to 'src/window.c')
| -rw-r--r-- | src/window.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/window.c b/src/window.c index aec6c16eb9c..5aa036ec810 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -4783,7 +4783,9 @@ window_scroll_pixel_based (window, n, whole, noerror) | |||
| 4783 | /* We moved the window start towards ZV, so PT may be now | 4783 | /* We moved the window start towards ZV, so PT may be now |
| 4784 | in the scroll margin at the top. */ | 4784 | in the scroll margin at the top. */ |
| 4785 | move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS); | 4785 | move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS); |
| 4786 | if (IT_CHARPOS (it) == PT && it.current_y >= this_scroll_margin) | 4786 | if (IT_CHARPOS (it) == PT && it.current_y >= this_scroll_margin |
| 4787 | && (NILP (Vscroll_preserve_screen_position) | ||
| 4788 | || EQ (Vscroll_preserve_screen_position, Qt))) | ||
| 4787 | /* We found PT at a legitimate height. Leave it alone. */ | 4789 | /* We found PT at a legitimate height. Leave it alone. */ |
| 4788 | ; | 4790 | ; |
| 4789 | else if (preserve_y >= 0) | 4791 | else if (preserve_y >= 0) |
| @@ -4836,7 +4838,9 @@ window_scroll_pixel_based (window, n, whole, noerror) | |||
| 4836 | partial_p = it.current_y > it.last_visible_y; | 4838 | partial_p = it.current_y > it.last_visible_y; |
| 4837 | } | 4839 | } |
| 4838 | 4840 | ||
| 4839 | if (charpos == PT && !partial_p) | 4841 | if (charpos == PT && !partial_p |
| 4842 | && (NILP (Vscroll_preserve_screen_position) | ||
| 4843 | || EQ (Vscroll_preserve_screen_position, Qt))) | ||
| 4840 | /* We found PT before we found the display margin, so PT is ok. */ | 4844 | /* We found PT before we found the display margin, so PT is ok. */ |
| 4841 | ; | 4845 | ; |
| 4842 | else if (preserve_y >= 0) | 4846 | else if (preserve_y >= 0) |
| @@ -4951,7 +4955,8 @@ window_scroll_line_based (window, n, whole, noerror) | |||
| 4951 | the window-scroll-functions. */ | 4955 | the window-scroll-functions. */ |
| 4952 | w->force_start = Qt; | 4956 | w->force_start = Qt; |
| 4953 | 4957 | ||
| 4954 | if (whole && !NILP (Vscroll_preserve_screen_position)) | 4958 | if (!NILP (Vscroll_preserve_screen_position) |
| 4959 | && (whole || !EQ (Vscroll_preserve_screen_position, Qt))) | ||
| 4955 | { | 4960 | { |
| 4956 | SET_PT_BOTH (pos, pos_byte); | 4961 | SET_PT_BOTH (pos, pos_byte); |
| 4957 | Fvertical_motion (make_number (original_vpos), window); | 4962 | Fvertical_motion (make_number (original_vpos), window); |
| @@ -6914,9 +6919,13 @@ If there is only one window, it is split regardless of this value. */); | |||
| 6914 | 6919 | ||
| 6915 | DEFVAR_LISP ("scroll-preserve-screen-position", | 6920 | DEFVAR_LISP ("scroll-preserve-screen-position", |
| 6916 | &Vscroll_preserve_screen_position, | 6921 | &Vscroll_preserve_screen_position, |
| 6917 | doc: /* *Non-nil means scroll commands move point to keep its screen line unchanged. | 6922 | doc: /* *Controls if scroll commands move point to keep its screen line unchanged. |
| 6918 | This is only when it is impossible to keep point fixed and still | 6923 | A value of nil means point does not keep its screen position except |
| 6919 | scroll as specified. */); | 6924 | at the scroll margin or window boundary respectively. |
| 6925 | A value of t means point keeps its screen position if the scroll | ||
| 6926 | command moved it vertically out of the window, e.g. when scrolling | ||
| 6927 | by full screens. | ||
| 6928 | Any other value means point always keeps its screen position. */); | ||
| 6920 | Vscroll_preserve_screen_position = Qnil; | 6929 | Vscroll_preserve_screen_position = Qnil; |
| 6921 | 6930 | ||
| 6922 | DEFVAR_LISP ("window-configuration-change-hook", | 6931 | DEFVAR_LISP ("window-configuration-change-hook", |