aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 9a20830e1d3..33e6e9c70fd 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -155,6 +155,10 @@ static int scroll_conservatively;
155 of the top or bottom of the window. */ 155 of the top or bottom of the window. */
156int scroll_margin; 156int scroll_margin;
157 157
158/* Number of characters of overlap to show,
159 when scrolling a one-line window such as a minibuffer. */
160static int minibuffer_scroll_overlap;
161
158/* Nonzero if try_window_id has made blank lines at window bottom 162/* Nonzero if try_window_id has made blank lines at window bottom
159 since the last redisplay that paused */ 163 since the last redisplay that paused */
160static int blank_end_of_window; 164static int blank_end_of_window;
@@ -2145,6 +2149,20 @@ recenter:
2145 w->base_line_number = Qnil; 2149 w->base_line_number = Qnil;
2146 2150
2147 pos = *vmotion (PT, - (height / 2), w); 2151 pos = *vmotion (PT, - (height / 2), w);
2152
2153 /* The minibuffer is often just one line. Ordinary scrolling
2154 gives little overlap and looks bad. So show 20 chars before point. */
2155 if (height == 1
2156 && (pos.bufpos >= PT - minibuffer_scroll_overlap
2157 /* If we scrolled less than 1/2 line forward, we will
2158 get too much overlap, so change to the usual amount. */
2159 || pos.bufpos < startp + width / 2)
2160 && PT > BEGV + minibuffer_scroll_overlap
2161 /* If we scrolled to an actual line boundary,
2162 that's different; don't ignore line boundaries. */
2163 && FETCH_CHAR (pos.bufpos - 1) != '\n')
2164 pos.bufpos = PT - minibuffer_scroll_overlap;
2165
2148 /* Set startp here explicitly in case that helps avoid an infinite loop 2166 /* Set startp here explicitly in case that helps avoid an infinite loop
2149 in case the window-scroll-functions functions get errors. */ 2167 in case the window-scroll-functions functions get errors. */
2150 Fset_marker (w->start, make_number (pos.bufpos), Qnil); 2168 Fset_marker (w->start, make_number (pos.bufpos), Qnil);
@@ -5144,11 +5162,16 @@ all the functions in the list are called, with the frame as argument.");
5144 Vwindow_size_change_functions = Qnil; 5162 Vwindow_size_change_functions = Qnil;
5145 5163
5146 DEFVAR_LISP ("window-scroll-functions", &Vwindow_scroll_functions, 5164 DEFVAR_LISP ("window-scroll-functions", &Vwindow_scroll_functions,
5147 "List of Functions to call before redisplaying a window with scrolling.\n\ 5165 "List of functions to call before redisplaying a window with scrolling.\n\
5148Each function is called with two arguments, the window\n\ 5166Each function is called with two arguments, the window\n\
5149and its new display-start position. Note that the value of `window-end'\n\ 5167and its new display-start position. Note that the value of `window-end'\n\
5150is not valid when these functions are called."); 5168is not valid when these functions are called.");
5151 Vwindow_scroll_functions = Qnil; 5169 Vwindow_scroll_functions = Qnil;
5170
5171 DEFVAR_INT ("minibuffer-scroll-overlap", &minibuffer_scroll_overlap,
5172 "*Number of characters of overlap when scrolling a one-line window.\n\
5173This commonly affects the minibuffer window, hence the name of the variable.");
5174 minibuffer_scroll_overlap = 20;
5152} 5175}
5153 5176
5154/* initialize the window system */ 5177/* initialize the window system */