aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
authorKaroly Lorentey2005-07-10 19:23:59 +0000
committerKaroly Lorentey2005-07-10 19:23:59 +0000
commitcc7d6d6f6d422efeba9934486bdf7b418391660f (patch)
tree695ceaedc1ae0410347235eac9119f8bca382e2b /src/window.c
parente519a50bf7b0d7074f07ce492abb3cd544f79f59 (diff)
parent43b557d50704df1dc45cc201a5596c05b62a6178 (diff)
downloademacs-cc7d6d6f6d422efeba9934486bdf7b418391660f.tar.gz
emacs-cc7d6d6f6d422efeba9934486bdf7b418391660f.zip
Merged from miles@gnu.org--gnu-2005 (patch 470-473)
Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-470 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-471 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-472 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-473 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-376
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c62
1 files changed, 53 insertions, 9 deletions
diff --git a/src/window.c b/src/window.c
index 68b2d4f89c7..d9af9ba72ac 100644
--- a/src/window.c
+++ b/src/window.c
@@ -5335,6 +5335,8 @@ and redisplay normally--don't erase and redraw the frame. */)
5335 struct buffer *obuf = current_buffer; 5335 struct buffer *obuf = current_buffer;
5336 int center_p = 0; 5336 int center_p = 0;
5337 int charpos, bytepos; 5337 int charpos, bytepos;
5338 int iarg;
5339 int this_scroll_margin;
5338 5340
5339 /* If redisplay is suppressed due to an error, try again. */ 5341 /* If redisplay is suppressed due to an error, try again. */
5340 obuf->display_error_modiff = 0; 5342 obuf->display_error_modiff = 0;
@@ -5361,6 +5363,12 @@ and redisplay normally--don't erase and redraw the frame. */)
5361 5363
5362 set_buffer_internal (buf); 5364 set_buffer_internal (buf);
5363 5365
5366 /* Do this after making BUF current
5367 in case scroll_margin is buffer-local. */
5368 this_scroll_margin = max (0, scroll_margin);
5369 this_scroll_margin = min (this_scroll_margin,
5370 XFASTINT (w->total_lines) / 4);
5371
5364 /* Handle centering on a graphical frame specially. Such frames can 5372 /* Handle centering on a graphical frame specially. Such frames can
5365 have variable-height lines and centering point on the basis of 5373 have variable-height lines and centering point on the basis of
5366 line counts would lead to strange effects. */ 5374 line counts would lead to strange effects. */
@@ -5377,14 +5385,17 @@ and redisplay normally--don't erase and redraw the frame. */)
5377 charpos = IT_CHARPOS (it); 5385 charpos = IT_CHARPOS (it);
5378 bytepos = IT_BYTEPOS (it); 5386 bytepos = IT_BYTEPOS (it);
5379 } 5387 }
5380 else if (XINT (arg) < 0) 5388 else if (iarg < 0)
5381 { 5389 {
5382 struct it it; 5390 struct it it;
5383 struct text_pos pt; 5391 struct text_pos pt;
5384 int nlines = - XINT (arg); 5392 int nlines = -iarg;
5385 int extra_line_spacing; 5393 int extra_line_spacing;
5386 int h = window_box_height (w); 5394 int h = window_box_height (w);
5387 5395
5396 iarg = XINT (arg);
5397 iarg = - max (-iarg, this_scroll_margin);
5398
5388 SET_TEXT_POS (pt, PT, PT_BYTE); 5399 SET_TEXT_POS (pt, PT, PT_BYTE);
5389 start_display (&it, w, pt); 5400 start_display (&it, w, pt);
5390 5401
@@ -5443,7 +5454,11 @@ and redisplay normally--don't erase and redraw the frame. */)
5443 else 5454 else
5444 { 5455 {
5445 struct position pos; 5456 struct position pos;
5446 pos = *vmotion (PT, - XINT (arg), w); 5457
5458 iarg = XINT (arg);
5459 iarg = max (iarg, this_scroll_margin);
5460
5461 pos = *vmotion (PT, -iarg, w);
5447 charpos = pos.bufpos; 5462 charpos = pos.bufpos;
5448 bytepos = pos.bytepos; 5463 bytepos = pos.bytepos;
5449 } 5464 }
@@ -5454,11 +5469,17 @@ and redisplay normally--don't erase and redraw the frame. */)
5454 int ht = window_internal_height (w); 5469 int ht = window_internal_height (w);
5455 5470
5456 if (center_p) 5471 if (center_p)
5457 arg = make_number (ht / 2); 5472 iarg = make_number (ht / 2);
5458 else if (XINT (arg) < 0) 5473 else if (XINT (arg) < 0)
5459 arg = make_number (XINT (arg) + ht); 5474 iarg = XINT (arg) + ht;
5475 else
5476 iarg = XINT (arg);
5477
5478 /* Don't let it get into the margin at either top or bottom. */
5479 iarg = max (iarg, this_scroll_margin);
5480 iarg = min (iarg, ht - this_scroll_margin - 1);
5460 5481
5461 pos = *vmotion (PT, - XINT (arg), w); 5482 pos = *vmotion (PT, - iarg, w);
5462 charpos = pos.bufpos; 5483 charpos = pos.bufpos;
5463 bytepos = pos.bytepos; 5484 bytepos = pos.bytepos;
5464 } 5485 }
@@ -5507,6 +5528,9 @@ zero means top of window, negative means relative to bottom of window. */)
5507 struct window *w = XWINDOW (selected_window); 5528 struct window *w = XWINDOW (selected_window);
5508 int lines, start; 5529 int lines, start;
5509 Lisp_Object window; 5530 Lisp_Object window;
5531#if 0
5532 int this_scroll_margin;
5533#endif
5510 5534
5511 window = selected_window; 5535 window = selected_window;
5512 start = marker_position (w->start); 5536 start = marker_position (w->start);
@@ -5522,13 +5546,33 @@ zero means top of window, negative means relative to bottom of window. */)
5522 Fgoto_char (w->start); 5546 Fgoto_char (w->start);
5523 5547
5524 lines = displayed_window_lines (w); 5548 lines = displayed_window_lines (w);
5549
5550#if 0
5551 this_scroll_margin = max (0, scroll_margin);
5552 this_scroll_margin = min (this_scroll_margin, lines / 4);
5553#endif
5554
5525 if (NILP (arg)) 5555 if (NILP (arg))
5526 XSETFASTINT (arg, lines / 2); 5556 XSETFASTINT (arg, lines / 2);
5527 else 5557 else
5528 { 5558 {
5529 arg = Fprefix_numeric_value (arg); 5559 int iarg = XINT (Fprefix_numeric_value (arg));
5530 if (XINT (arg) < 0) 5560
5531 XSETINT (arg, XINT (arg) + lines); 5561 if (iarg < 0)
5562 iarg = iarg + lines;
5563
5564#if 0 /* This code would prevent move-to-window-line from moving point
5565 to a place inside the scroll margins (which would cause the
5566 next redisplay to scroll). I wrote this code, but then concluded
5567 it is probably better not to install it. However, it is here
5568 inside #if 0 so as not to lose it. -- rms. */
5569
5570 /* Don't let it get into the margin at either top or bottom. */
5571 iarg = max (iarg, this_scroll_margin);
5572 iarg = min (iarg, lines - this_scroll_margin - 1);
5573#endif
5574
5575 arg = make_number (iarg);
5532 } 5576 }
5533 5577
5534 /* Skip past a partially visible first line. */ 5578 /* Skip past a partially visible first line. */