diff options
| author | Richard M. Stallman | 1996-11-06 23:26:02 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-11-06 23:26:02 +0000 |
| commit | 0789adb29988c4278dddb50211c936d128868202 (patch) | |
| tree | e24fa5e3adb342969f9d3ef37f5e664690a03f2b /src | |
| parent | 7459d65b898ce84e89b7f24db2afa8f58e0e8d8e (diff) | |
| download | emacs-0789adb29988c4278dddb50211c936d128868202.tar.gz emacs-0789adb29988c4278dddb50211c936d128868202.zip | |
(scroll_conservatively): New variable.
(redisplay_window): Obey it.
(syms_of_xdisp): Set up Lisp var.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index dc1148ecbaf..5787a2e6668 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -139,6 +139,10 @@ static int highlight_nonselected_windows; | |||
| 139 | Try scrolling this many lines up or down if that will bring it back. */ | 139 | Try scrolling this many lines up or down if that will bring it back. */ |
| 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, | ||
| 143 | when appropriate. */ | ||
| 144 | static int scroll_conservatively; | ||
| 145 | |||
| 142 | /* Nonzero if try_window_id has made blank lines at window bottom | 146 | /* Nonzero if try_window_id has made blank lines at window bottom |
| 143 | since the last redisplay that paused */ | 147 | since the last redisplay that paused */ |
| 144 | static int blank_end_of_window; | 148 | static int blank_end_of_window; |
| @@ -1778,6 +1782,74 @@ redisplay_window (window, just_this_one, preserve_echo_area) | |||
| 1778 | 1782 | ||
| 1779 | /* Try to scroll by specified few lines */ | 1783 | /* Try to scroll by specified few lines */ |
| 1780 | 1784 | ||
| 1785 | if (scroll_conservatively && !current_buffer->clip_changed | ||
| 1786 | && startp >= BEGV && startp <= ZV) | ||
| 1787 | { | ||
| 1788 | if (PT >= Z - XFASTINT (w->window_end_pos)) | ||
| 1789 | { | ||
| 1790 | struct position pos; | ||
| 1791 | pos = *compute_motion (Z - XFASTINT (w->window_end_pos), 0, 0, 0, | ||
| 1792 | PT, XFASTINT (w->height), 0, | ||
| 1793 | XFASTINT (w->width), XFASTINT (w->hscroll), | ||
| 1794 | pos_tab_offset (w, startp), w); | ||
| 1795 | if (pos.vpos > scroll_conservatively) | ||
| 1796 | goto scroll_fail_1; | ||
| 1797 | |||
| 1798 | pos = *vmotion (startp, pos.vpos + 1, w); | ||
| 1799 | |||
| 1800 | if (! NILP (Vwindow_scroll_functions)) | ||
| 1801 | { | ||
| 1802 | Fset_marker (w->start, make_number (pos.bufpos), Qnil); | ||
| 1803 | run_hook_with_args_2 (Qwindow_scroll_functions, window, | ||
| 1804 | make_number (pos.bufpos)); | ||
| 1805 | pos.bufpos = marker_position (w->start); | ||
| 1806 | } | ||
| 1807 | try_window (window, pos.bufpos); | ||
| 1808 | if (cursor_vpos >= 0) | ||
| 1809 | { | ||
| 1810 | if (!just_this_one || current_buffer->clip_changed | ||
| 1811 | || beg_unchanged < startp) | ||
| 1812 | /* Forget any recorded base line for line number display. */ | ||
| 1813 | w->base_line_number = Qnil; | ||
| 1814 | goto done; | ||
| 1815 | } | ||
| 1816 | else | ||
| 1817 | cancel_my_columns (w); | ||
| 1818 | } | ||
| 1819 | if (PT < startp) | ||
| 1820 | { | ||
| 1821 | struct position pos; | ||
| 1822 | pos = *compute_motion (PT, 0, 0, 0, | ||
| 1823 | startp, XFASTINT (w->height), 0, | ||
| 1824 | XFASTINT (w->width), XFASTINT (w->hscroll), | ||
| 1825 | pos_tab_offset (w, startp), w); | ||
| 1826 | if (pos.vpos >= scroll_conservatively) | ||
| 1827 | goto scroll_fail_1; | ||
| 1828 | |||
| 1829 | pos = *vmotion (startp, - pos.vpos, w); | ||
| 1830 | |||
| 1831 | if (! NILP (Vwindow_scroll_functions)) | ||
| 1832 | { | ||
| 1833 | Fset_marker (w->start, make_number (pos.bufpos), Qnil); | ||
| 1834 | run_hook_with_args_2 (Qwindow_scroll_functions, window, | ||
| 1835 | make_number (pos.bufpos)); | ||
| 1836 | pos.bufpos = marker_position (w->start); | ||
| 1837 | } | ||
| 1838 | try_window (window, pos.bufpos); | ||
| 1839 | if (cursor_vpos >= 0) | ||
| 1840 | { | ||
| 1841 | if (!just_this_one || current_buffer->clip_changed | ||
| 1842 | || beg_unchanged < startp) | ||
| 1843 | /* Forget any recorded base line for line number display. */ | ||
| 1844 | w->base_line_number = Qnil; | ||
| 1845 | goto done; | ||
| 1846 | } | ||
| 1847 | else | ||
| 1848 | cancel_my_columns (w); | ||
| 1849 | } | ||
| 1850 | scroll_fail_1: ; | ||
| 1851 | } | ||
| 1852 | |||
| 1781 | if (scroll_step && !current_buffer->clip_changed | 1853 | if (scroll_step && !current_buffer->clip_changed |
| 1782 | && startp >= BEGV && startp <= ZV) | 1854 | && startp >= BEGV && startp <= ZV) |
| 1783 | { | 1855 | { |
| @@ -4377,6 +4449,10 @@ See also `overlay-arrow-string'."); | |||
| 4377 | If that fails to bring point back on frame, point is centered instead.\n\ | 4449 | If that fails to bring point back on frame, point is centered instead.\n\ |
| 4378 | If this is zero, point is always centered after it moves off frame."); | 4450 | If this is zero, point is always centered after it moves off frame."); |
| 4379 | 4451 | ||
| 4452 | DEFVAR_INT ("scroll-conservatively", &scroll_conservatively, | ||
| 4453 | "*Scroll up to this many lines, to bring point back on screen."); | ||
| 4454 | scroll_conservatively = 0; | ||
| 4455 | |||
| 4380 | DEFVAR_INT ("debug-end-pos", &debug_end_pos, "Don't ask"); | 4456 | DEFVAR_INT ("debug-end-pos", &debug_end_pos, "Don't ask"); |
| 4381 | 4457 | ||
| 4382 | DEFVAR_BOOL ("truncate-partial-width-windows", | 4458 | DEFVAR_BOOL ("truncate-partial-width-windows", |