Commit bdf4ec93 authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(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.
parent 6ef874e9
...@@ -4783,7 +4783,9 @@ window_scroll_pixel_based (window, n, whole, noerror) ...@@ -4783,7 +4783,9 @@ window_scroll_pixel_based (window, n, whole, noerror)
/* We moved the window start towards ZV, so PT may be now /* We moved the window start towards ZV, so PT may be now
in the scroll margin at the top. */ in the scroll margin at the top. */
move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS); move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS);
if (IT_CHARPOS (it) == PT && it.current_y >= this_scroll_margin) if (IT_CHARPOS (it) == PT && it.current_y >= this_scroll_margin
&& (NILP (Vscroll_preserve_screen_position)
|| EQ (Vscroll_preserve_screen_position, Qt)))
/* We found PT at a legitimate height. Leave it alone. */ /* We found PT at a legitimate height. Leave it alone. */
; ;
else if (preserve_y >= 0) else if (preserve_y >= 0)
...@@ -4836,7 +4838,9 @@ window_scroll_pixel_based (window, n, whole, noerror) ...@@ -4836,7 +4838,9 @@ window_scroll_pixel_based (window, n, whole, noerror)
partial_p = it.current_y > it.last_visible_y; partial_p = it.current_y > it.last_visible_y;
} }
if (charpos == PT && !partial_p) if (charpos == PT && !partial_p
&& (NILP (Vscroll_preserve_screen_position)
|| EQ (Vscroll_preserve_screen_position, Qt)))
/* We found PT before we found the display margin, so PT is ok. */ /* We found PT before we found the display margin, so PT is ok. */
; ;
else if (preserve_y >= 0) else if (preserve_y >= 0)
...@@ -4951,7 +4955,8 @@ window_scroll_line_based (window, n, whole, noerror) ...@@ -4951,7 +4955,8 @@ window_scroll_line_based (window, n, whole, noerror)
the window-scroll-functions. */ the window-scroll-functions. */
w->force_start = Qt; w->force_start = Qt;
if (whole && !NILP (Vscroll_preserve_screen_position)) if (!NILP (Vscroll_preserve_screen_position)
&& (whole || !EQ (Vscroll_preserve_screen_position, Qt)))
{ {
SET_PT_BOTH (pos, pos_byte); SET_PT_BOTH (pos, pos_byte);
Fvertical_motion (make_number (original_vpos), window); 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,9 +6919,13 @@ If there is only one window, it is split regardless of this value. */);
DEFVAR_LISP ("scroll-preserve-screen-position", DEFVAR_LISP ("scroll-preserve-screen-position",
&Vscroll_preserve_screen_position, &Vscroll_preserve_screen_position,
doc: /* *Non-nil means scroll commands move point to keep its screen line unchanged. doc: /* *Controls if scroll commands move point to keep its screen line unchanged.
This is only when it is impossible to keep point fixed and still A value of nil means point does not keep its screen position except
scroll as specified. */); at the scroll margin or window boundary respectively.
A value of t means point keeps its screen position if the scroll
command moved it vertically out of the window, e.g. when scrolling
by full screens.
Any other value means point always keeps its screen position. */);
Vscroll_preserve_screen_position = Qnil; Vscroll_preserve_screen_position = Qnil;
DEFVAR_LISP ("window-configuration-change-hook", DEFVAR_LISP ("window-configuration-change-hook",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment