comparison src/xdisp.c @ 16560:8b1dd6f2222d

(scroll_margin): New variable. (init_xdisp): Set up Lisp variable. (redisplay_window): Implement scroll_margin; don't use old start pos if point is inside the margin.
author Richard M. Stallman <rms@gnu.org>
date Mon, 11 Nov 1996 00:35:31 +0000
parents f930574421d9
children f1f1c509a8f2
comparison
equal deleted inserted replaced
16559:d62b7f309f2b 16560:8b1dd6f2222d
140 static int scroll_step; 140 static int scroll_step;
141 141
142 /* Non-0 means scroll just far enough to bring point back on the screen, 142 /* Non-0 means scroll just far enough to bring point back on the screen,
143 when appropriate. */ 143 when appropriate. */
144 static int scroll_conservatively; 144 static int scroll_conservatively;
145
146 /* Recenter the window whenever point gets within this many lines
147 of the top or bottom of the window. */
148 int scroll_margin;
145 149
146 /* Nonzero if try_window_id has made blank lines at window bottom 150 /* Nonzero if try_window_id has made blank lines at window bottom
147 since the last redisplay that paused */ 151 since the last redisplay that paused */
148 static int blank_end_of_window; 152 static int blank_end_of_window;
149 153
1697 /* If end pos is out of date, scroll bar and percentage will be wrong */ 1701 /* If end pos is out of date, scroll bar and percentage will be wrong */
1698 && INTEGERP (w->window_end_vpos) 1702 && INTEGERP (w->window_end_vpos)
1699 && XFASTINT (w->window_end_vpos) < XFASTINT (w->height) 1703 && XFASTINT (w->window_end_vpos) < XFASTINT (w->height)
1700 && !EQ (window, minibuf_window)) 1704 && !EQ (window, minibuf_window))
1701 { 1705 {
1706 int this_scroll_margin = scroll_margin;
1707
1702 pos = *compute_motion (startp, 0, (hscroll ? 1 - hscroll : 0), 0, 1708 pos = *compute_motion (startp, 0, (hscroll ? 1 - hscroll : 0), 0,
1703 PT, height, 0, width, hscroll, 1709 PT, height, 0, width, hscroll,
1704 pos_tab_offset (w, startp), w); 1710 pos_tab_offset (w, startp), w);
1705 1711
1706 if (pos.vpos < height) 1712 /* Don't use a scroll margin that is negative or too large. */
1713 if (this_scroll_margin < 0)
1714 this_scroll_margin = 0;
1715
1716 if (XINT (w->height) < 4 * scroll_margin)
1717 this_scroll_margin = XINT (w->height) / 4;
1718
1719 /* If point fits on the screen, and not within the scroll margin,
1720 we are ok. */
1721 if (pos.vpos < height - this_scroll_margin
1722 && (pos.vpos >= this_scroll_margin || startp == BEGV))
1707 { 1723 {
1708 /* Ok, point is still on frame */ 1724 /* Ok, point is still on frame */
1709 if (w == XWINDOW (FRAME_SELECTED_WINDOW (f))) 1725 if (w == XWINDOW (FRAME_SELECTED_WINDOW (f)))
1710 { 1726 {
1711 /* These variables are supposed to be origin 1 */ 1727 /* These variables are supposed to be origin 1 */
4472 4488
4473 DEFVAR_INT ("scroll-conservatively", &scroll_conservatively, 4489 DEFVAR_INT ("scroll-conservatively", &scroll_conservatively,
4474 "*Scroll up to this many lines, to bring point back on screen."); 4490 "*Scroll up to this many lines, to bring point back on screen.");
4475 scroll_conservatively = 0; 4491 scroll_conservatively = 0;
4476 4492
4493 DEFVAR_INT ("scroll-margin", &scroll_margin,
4494 "*Number of lines of margin at the top and bottom of a window.\n\
4495 Recenter the window whenever point gets within this many lines\n\
4496 of the top or bottom of the window.");
4497 scroll_margin = 0;
4498
4477 DEFVAR_INT ("debug-end-pos", &debug_end_pos, "Don't ask"); 4499 DEFVAR_INT ("debug-end-pos", &debug_end_pos, "Don't ask");
4478 4500
4479 DEFVAR_BOOL ("truncate-partial-width-windows", 4501 DEFVAR_BOOL ("truncate-partial-width-windows",
4480 &truncate_partial_width_windows, 4502 &truncate_partial_width_windows,
4481 "*Non-nil means truncate lines in all windows less than full frame wide."); 4503 "*Non-nil means truncate lines in all windows less than full frame wide.");