diff options
| author | Richard M. Stallman | 1996-11-11 00:35:31 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-11-11 00:35:31 +0000 |
| commit | 9afd2168d4b157e9249c082ab9e07fca4594e92f (patch) | |
| tree | 91c668f4d27bba8322bd884fd5358099c0a8a0f0 | |
| parent | 0c7da84e740374854ce27528cd0de712ddb1f589 (diff) | |
| download | emacs-9afd2168d4b157e9249c082ab9e07fca4594e92f.tar.gz emacs-9afd2168d4b157e9249c082ab9e07fca4594e92f.zip | |
(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.
| -rw-r--r-- | src/xdisp.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 7151877a6f8..b74fe724300 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -143,6 +143,10 @@ static int scroll_step; | |||
| 143 | when appropriate. */ | 143 | when appropriate. */ |
| 144 | static int scroll_conservatively; | 144 | static int scroll_conservatively; |
| 145 | 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; | ||
| 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; |
| @@ -1699,11 +1703,23 @@ redisplay_window (window, just_this_one, preserve_echo_area) | |||
| 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))) |
| @@ -4474,6 +4490,12 @@ If this is zero, point is always centered after it moves off frame."); | |||
| 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", |