summaryrefslogtreecommitdiff
path: root/src/window.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1997-02-08 15:50:17 +0000
committerRichard M. Stallman <rms@gnu.org>1997-02-08 15:50:17 +0000
commited505f93d1d7d42f4abfc958862af4c0b6232b00 (patch)
tree40788e3c04076e00862b27f0525eaac568919969 /src/window.c
parentf896e82300afaa3743fd670d17e8a1ac94868fe7 (diff)
downloademacs-ed505f93d1d7d42f4abfc958862af4c0b6232b00.tar.gz
(scroll_preserve_screen_position): New variable.
(keys_of_window): Set up Lisp var. (window_scroll): If scroll_preserve_screen_position is 0, behave the old way (advancing point the minimum distance).
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/src/window.c b/src/window.c
index dd5d472ed7e..071c3dc903c 100644
--- a/src/window.c
+++ b/src/window.c
@@ -111,8 +111,14 @@ static int sequence_number;
/* Nonzero after init_window_once has finished. */
static int window_initialized;
+/* Nonzero means scroll commands try to put point
+ at the same screen height as previously. */
+static int scroll_preserve_screen_position;
+
#define min(a, b) ((a) < (b) ? (a) : (b))
+extern int scroll_margin;
+
extern Lisp_Object Qwindow_scroll_functions, Vwindow_scroll_functions;
DEFUN ("windowp", Fwindowp, Swindowp, 1, 1, 0,
@@ -2638,8 +2644,7 @@ window_internal_width (w)
/* Scroll contents of window WINDOW up N lines.
- If WHOLE is nonzero, it means we wanted to scroll
- by entire screenfuls. */
+ If WHOLE is nonzero, it means scroll N screenfuls instead. */
static void
window_scroll (window, n, whole, noerror)
@@ -2693,8 +2698,6 @@ window_scroll (window, n, whole, noerror)
if (pos < ZV)
{
- extern int scroll_margin;
-
int this_scroll_margin = scroll_margin;
/* Don't use a scroll margin that is negative or too large. */
@@ -2713,7 +2716,7 @@ window_scroll (window, n, whole, noerror)
the window-scroll-functions. */
w->force_start = Qt;
- if (whole)
+ if (whole && scroll_preserve_screen_position)
{
SET_PT (pos);
Fvertical_motion (make_number (original_vpos), window);
@@ -2735,11 +2738,13 @@ window_scroll (window, n, whole, noerror)
if (top_margin <= opoint)
SET_PT (opoint);
- else
+ else if (scroll_preserve_screen_position)
{
SET_PT (pos);
Fvertical_motion (make_number (original_vpos), window);
}
+ else
+ SET_PT (pos);
}
else if (n < 0)
{
@@ -2758,8 +2763,13 @@ window_scroll (window, n, whole, noerror)
SET_PT (opoint);
else
{
- SET_PT (pos);
- Fvertical_motion (make_number (original_vpos), window);
+ if (scroll_preserve_screen_position)
+ {
+ SET_PT (pos);
+ Fvertical_motion (make_number (original_vpos), window);
+ }
+ else
+ Fvertical_motion (make_number (-1), window);
}
}
}
@@ -3644,6 +3654,11 @@ If there is only one window, it is split regardless of this value.");
"*Delete any window less than this wide.");
window_min_width = 10;
+ DEFVAR_BOOL ("scroll-preserve-screen-position",
+ &scroll_preserve_screen_position,
+ "*Nonzero means scroll commands move point to keep its screen line unchanged.");
+ scroll_preserve_screen_position = 0;
+
defsubr (&Sselected_window);
defsubr (&Sminibuffer_window);
defsubr (&Swindow_minibuffer_p);