aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
authorGerd Moellmann2001-04-10 16:13:02 +0000
committerGerd Moellmann2001-04-10 16:13:02 +0000
commitd4e7cf01c913318040ab464ae7c4885a8580251a (patch)
treec79504f169985293b5573a4d4d4dc0ca316ee394 /src/window.c
parent3a03001381fe4728b710de0b8f60026d648826d9 (diff)
downloademacs-d4e7cf01c913318040ab464ae7c4885a8580251a.tar.gz
emacs-d4e7cf01c913318040ab464ae7c4885a8580251a.zip
(window_scroll): Change the meaning of N to mean
N screen-fulls or N lines. (window_scroll_pixel_based, window_scroll_line_based) (scroll_command, Fscroll_other_window): Change accordingly.
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c37
1 files changed, 16 insertions, 21 deletions
diff --git a/src/window.c b/src/window.c
index 33c99f5cfd2..5abff76c434 100644
--- a/src/window.c
+++ b/src/window.c
@@ -3915,7 +3915,7 @@ window_internal_width (w)
3915 ***********************************************************************/ 3915 ***********************************************************************/
3916 3916
3917/* Scroll contents of window WINDOW up. If WHOLE is non-zero, scroll 3917/* Scroll contents of window WINDOW up. If WHOLE is non-zero, scroll
3918 one screen-full, which is defined as the height of the window minus 3918 N screen-fulls, which is defined as the height of the window minus
3919 next_screen_context_lines. If WHOLE is zero, scroll up N lines 3919 next_screen_context_lines. If WHOLE is zero, scroll up N lines
3920 instead. Negative values of N mean scroll down. NOERROR non-zero 3920 instead. Negative values of N mean scroll down. NOERROR non-zero
3921 means don't signal an error if we try to move over BEGV or ZV, 3921 means don't signal an error if we try to move over BEGV or ZV,
@@ -4004,8 +4004,7 @@ window_scroll_pixel_based (window, n, whole, noerror)
4004 { 4004 {
4005 int screen_full = (window_box_height (w) 4005 int screen_full = (window_box_height (w)
4006 - next_screen_context_lines * CANON_Y_UNIT (it.f)); 4006 - next_screen_context_lines * CANON_Y_UNIT (it.f));
4007 int direction = n < 0 ? -1 : 1; 4007 int dy = n * screen_full;
4008 int dy = direction * screen_full;
4009 4008
4010 /* Note that move_it_vertically always moves the iterator to the 4009 /* Note that move_it_vertically always moves the iterator to the
4011 start of a line. So, if the last line doesn't have a newline, 4010 start of a line. So, if the last line doesn't have a newline,
@@ -4149,6 +4148,11 @@ window_scroll_line_based (window, n, whole, noerror)
4149 struct position posit; 4148 struct position posit;
4150 int original_vpos; 4149 int original_vpos;
4151 4150
4151 /* If scrolling screen-fulls, compute the number of lines to
4152 scroll from the window's height. */
4153 if (whole)
4154 n *= max (1, ht - next_screen_context_lines);
4155
4152 startpos = marker_position (w->start); 4156 startpos = marker_position (w->start);
4153 4157
4154 posit = *compute_motion (startpos, 0, 0, 0, 4158 posit = *compute_motion (startpos, 0, 0, 0,
@@ -4280,8 +4284,7 @@ scroll_command (n, direction)
4280 Lisp_Object n; 4284 Lisp_Object n;
4281 int direction; 4285 int direction;
4282{ 4286{
4283 register int defalt; 4287 int count = BINDING_STACK_SIZE ();
4284 int count = specpdl_ptr - specpdl;
4285 4288
4286 xassert (abs (direction) == 1); 4289 xassert (abs (direction) == 1);
4287 4290
@@ -4296,14 +4299,10 @@ scroll_command (n, direction)
4296 ++windows_or_buffers_changed; 4299 ++windows_or_buffers_changed;
4297 } 4300 }
4298 4301
4299 defalt = (window_internal_height (XWINDOW (selected_window))
4300 - next_screen_context_lines);
4301 defalt = direction * (defalt < 1 ? 1 : defalt);
4302
4303 if (NILP (n)) 4302 if (NILP (n))
4304 window_scroll (selected_window, defalt, 1, 0); 4303 window_scroll (selected_window, direction, 1, 0);
4305 else if (EQ (n, Qminus)) 4304 else if (EQ (n, Qminus))
4306 window_scroll (selected_window, - defalt, 1, 0); 4305 window_scroll (selected_window, -direction, 1, 0);
4307 else 4306 else
4308 { 4307 {
4309 n = Fprefix_numeric_value (n); 4308 n = Fprefix_numeric_value (n);
@@ -4395,18 +4394,14 @@ specifies the window to scroll.\n\
4395If `other-window-scroll-buffer' is non-nil, scroll the window\n\ 4394If `other-window-scroll-buffer' is non-nil, scroll the window\n\
4396showing that buffer, popping the buffer up if necessary.") 4395showing that buffer, popping the buffer up if necessary.")
4397 (arg) 4396 (arg)
4398 register Lisp_Object arg; 4397 Lisp_Object arg;
4399{ 4398{
4400 register Lisp_Object window; 4399 Lisp_Object window;
4401 register int defalt; 4400 struct window *w;
4402 register struct window *w; 4401 int count = BINDING_STACK_SIZE ();
4403 register int count = specpdl_ptr - specpdl;
4404 4402
4405 window = Fother_window_for_scrolling (); 4403 window = Fother_window_for_scrolling ();
4406
4407 w = XWINDOW (window); 4404 w = XWINDOW (window);
4408 defalt = window_internal_height (w) - next_screen_context_lines;
4409 if (defalt < 1) defalt = 1;
4410 4405
4411 /* Don't screw up if window_scroll gets an error. */ 4406 /* Don't screw up if window_scroll gets an error. */
4412 record_unwind_protect (save_excursion_restore, save_excursion_save ()); 4407 record_unwind_protect (save_excursion_restore, save_excursion_save ());
@@ -4416,9 +4411,9 @@ showing that buffer, popping the buffer up if necessary.")
4416 SET_PT (marker_position (w->pointm)); 4411 SET_PT (marker_position (w->pointm));
4417 4412
4418 if (NILP (arg)) 4413 if (NILP (arg))
4419 window_scroll (window, defalt, 1, 1); 4414 window_scroll (window, 1, 1, 1);
4420 else if (EQ (arg, Qminus)) 4415 else if (EQ (arg, Qminus))
4421 window_scroll (window, -defalt, 1, 1); 4416 window_scroll (window, -1, 1, 1);
4422 else 4417 else
4423 { 4418 {
4424 if (CONSP (arg)) 4419 if (CONSP (arg))