diff options
| author | Richard M. Stallman | 1998-05-11 16:36:02 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-05-11 16:36:02 +0000 |
| commit | 09cacf9c793d9094b1891e325682ffc6252a978d (patch) | |
| tree | d82e04cb2d97344e30d2bfde55571aa3b0058378 /src | |
| parent | 88eace34a7eb8a5e72c7d5d08787369e653607c9 (diff) | |
| download | emacs-09cacf9c793d9094b1891e325682ffc6252a978d.tar.gz emacs-09cacf9c793d9094b1891e325682ffc6252a978d.zip | |
(redisplay_window): Handle scroll_step along with
scroll_conservatively. Fix 1-off error checking the limit for them.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 8b2eabb5e2f..9564cd841f3 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -2115,7 +2115,7 @@ redisplay_window (window, just_this_one, preserve_echo_area) | |||
| 2115 | goto done; | 2115 | goto done; |
| 2116 | } | 2116 | } |
| 2117 | /* Don't bother trying redisplay with same start; | 2117 | /* Don't bother trying redisplay with same start; |
| 2118 | we already know it will lose */ | 2118 | we already know it will lose. */ |
| 2119 | } | 2119 | } |
| 2120 | /* If current starting point was originally the beginning of a line | 2120 | /* If current starting point was originally the beginning of a line |
| 2121 | but no longer is, find a new starting point. */ | 2121 | but no longer is, find a new starting point. */ |
| @@ -2204,11 +2204,15 @@ redisplay_window (window, just_this_one, preserve_echo_area) | |||
| 2204 | 2204 | ||
| 2205 | /* Try to scroll by specified few lines */ | 2205 | /* Try to scroll by specified few lines */ |
| 2206 | 2206 | ||
| 2207 | if (scroll_conservatively && !current_buffer->clip_changed | 2207 | if ((scroll_conservatively || scroll_step) |
| 2208 | && !current_buffer->clip_changed | ||
| 2208 | && startp >= BEGV && startp <= ZV) | 2209 | && startp >= BEGV && startp <= ZV) |
| 2209 | { | 2210 | { |
| 2210 | int this_scroll_margin = scroll_margin; | 2211 | int this_scroll_margin = scroll_margin; |
| 2211 | int scroll_margin_pos, scroll_margin_bytepos; | 2212 | int scroll_margin_pos, scroll_margin_bytepos; |
| 2213 | int scroll_max = scroll_step; | ||
| 2214 | if (scroll_conservatively) | ||
| 2215 | scroll_max = scroll_conservatively; | ||
| 2212 | 2216 | ||
| 2213 | /* Don't use a scroll margin that is negative or too large. */ | 2217 | /* Don't use a scroll margin that is negative or too large. */ |
| 2214 | if (this_scroll_margin < 0) | 2218 | if (this_scroll_margin < 0) |
| @@ -2236,10 +2240,12 @@ redisplay_window (window, just_this_one, preserve_echo_area) | |||
| 2236 | pos_tab_offset (w, scroll_margin_pos, | 2240 | pos_tab_offset (w, scroll_margin_pos, |
| 2237 | scroll_margin_bytepos), | 2241 | scroll_margin_bytepos), |
| 2238 | w); | 2242 | w); |
| 2239 | if (pos.vpos > scroll_conservatively) | 2243 | if (pos.vpos >= scroll_max) |
| 2240 | goto scroll_fail_1; | 2244 | goto scroll_fail_1; |
| 2241 | 2245 | ||
| 2242 | pos = *vmotion (startp, pos.vpos + 1, w); | 2246 | pos = *vmotion (startp, |
| 2247 | scroll_conservatively ? pos.vpos + 1 : scroll_step, | ||
| 2248 | w); | ||
| 2243 | 2249 | ||
| 2244 | if (! NILP (Vwindow_scroll_functions)) | 2250 | if (! NILP (Vwindow_scroll_functions)) |
| 2245 | { | 2251 | { |
| @@ -2275,10 +2281,12 @@ redisplay_window (window, just_this_one, preserve_echo_area) | |||
| 2275 | XFASTINT (w->width), XFASTINT (w->hscroll), | 2281 | XFASTINT (w->width), XFASTINT (w->hscroll), |
| 2276 | pos_tab_offset (w, PT, PT_BYTE), | 2282 | pos_tab_offset (w, PT, PT_BYTE), |
| 2277 | w); | 2283 | w); |
| 2278 | if (pos.vpos > scroll_conservatively) | 2284 | if (pos.vpos > scroll_max) |
| 2279 | goto scroll_fail_1; | 2285 | goto scroll_fail_1; |
| 2280 | 2286 | ||
| 2281 | pos = *vmotion (startp, -pos.vpos, w); | 2287 | pos = *vmotion (startp, |
| 2288 | scroll_conservatively ? -pos.vpos : - scroll_step, | ||
| 2289 | w); | ||
| 2282 | 2290 | ||
| 2283 | if (! NILP (Vwindow_scroll_functions)) | 2291 | if (! NILP (Vwindow_scroll_functions)) |
| 2284 | { | 2292 | { |
| @@ -2302,17 +2310,21 @@ redisplay_window (window, just_this_one, preserve_echo_area) | |||
| 2302 | scroll_fail_1: ; | 2310 | scroll_fail_1: ; |
| 2303 | } | 2311 | } |
| 2304 | 2312 | ||
| 2305 | if (scroll_step && !current_buffer->clip_changed | 2313 | #if 0 |
| 2314 | if (scroll_step && ! scroll_margin && !current_buffer->clip_changed | ||
| 2306 | && startp >= BEGV && startp <= ZV) | 2315 | && startp >= BEGV && startp <= ZV) |
| 2307 | { | 2316 | { |
| 2308 | if (PT > startp) | 2317 | if (margin_call == 0) |
| 2318 | margin_call = (PT > startp ? 1 : -1); | ||
| 2319 | if (margin_call > 0) | ||
| 2309 | { | 2320 | { |
| 2310 | pos = *vmotion (Z - XFASTINT (w->window_end_pos), scroll_step, w); | 2321 | pos = *vmotion (Z - XFASTINT (w->window_end_pos), scroll_step, w); |
| 2311 | if (pos.vpos >= height) | 2322 | if (pos.vpos >= height) |
| 2312 | goto scroll_fail; | 2323 | goto scroll_fail; |
| 2313 | } | 2324 | } |
| 2314 | 2325 | ||
| 2315 | pos = *vmotion (startp, (PT < startp ? - scroll_step : scroll_step), w); | 2326 | pos = *vmotion (startp, (margin_call < 0 ? - scroll_step : scroll_step), |
| 2327 | w); | ||
| 2316 | 2328 | ||
| 2317 | if (PT >= pos.bufpos) | 2329 | if (PT >= pos.bufpos) |
| 2318 | { | 2330 | { |
| @@ -2337,6 +2349,7 @@ redisplay_window (window, just_this_one, preserve_echo_area) | |||
| 2337 | } | 2349 | } |
| 2338 | scroll_fail: ; | 2350 | scroll_fail: ; |
| 2339 | } | 2351 | } |
| 2352 | #endif | ||
| 2340 | 2353 | ||
| 2341 | /* Finally, just choose place to start which centers point */ | 2354 | /* Finally, just choose place to start which centers point */ |
| 2342 | 2355 | ||