diff options
| author | Eli Zaretskii | 2016-01-18 21:53:34 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2016-01-18 21:53:34 +0200 |
| commit | 874a10b13fb2438322ac1c9b437720ada713631b (patch) | |
| tree | dbced0bcf7ec2c3a84ba9ad738b3962063b0e029 /src | |
| parent | 2f838b76897329867a49271608beff1116625d59 (diff) | |
| download | emacs-874a10b13fb2438322ac1c9b437720ada713631b.tar.gz emacs-874a10b13fb2438322ac1c9b437720ada713631b.zip | |
Fix scrolling under scroll-preserve-screen-position on TTY
* src/window.c (window_scroll_line_based): When setting point to
preserve screen coordinates, don't let cursor enter either of the
two scroll margins. (Bug#22395)
Diffstat (limited to 'src')
| -rw-r--r-- | src/window.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/window.c b/src/window.c index 1a75342471f..2eacc3a2647 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -5212,6 +5212,7 @@ window_scroll_line_based (Lisp_Object window, int n, bool whole, bool noerror) | |||
| 5212 | w->force_start = true; | 5212 | w->force_start = true; |
| 5213 | 5213 | ||
| 5214 | if (!NILP (Vscroll_preserve_screen_position) | 5214 | if (!NILP (Vscroll_preserve_screen_position) |
| 5215 | && this_scroll_margin == 0 | ||
| 5215 | && (whole || !EQ (Vscroll_preserve_screen_position, Qt))) | 5216 | && (whole || !EQ (Vscroll_preserve_screen_position, Qt))) |
| 5216 | { | 5217 | { |
| 5217 | SET_PT_BOTH (pos, pos_byte); | 5218 | SET_PT_BOTH (pos, pos_byte); |
| @@ -5237,8 +5238,16 @@ window_scroll_line_based (Lisp_Object window, int n, bool whole, bool noerror) | |||
| 5237 | marker_byte_position (opoint_marker)); | 5238 | marker_byte_position (opoint_marker)); |
| 5238 | else if (!NILP (Vscroll_preserve_screen_position)) | 5239 | else if (!NILP (Vscroll_preserve_screen_position)) |
| 5239 | { | 5240 | { |
| 5241 | int nlines = window_scroll_preserve_vpos; | ||
| 5242 | |||
| 5240 | SET_PT_BOTH (pos, pos_byte); | 5243 | SET_PT_BOTH (pos, pos_byte); |
| 5241 | Fvertical_motion (original_pos, window, Qnil); | 5244 | if (window_scroll_preserve_vpos < this_scroll_margin) |
| 5245 | nlines = this_scroll_margin; | ||
| 5246 | else if (window_scroll_preserve_vpos | ||
| 5247 | >= w->total_lines - this_scroll_margin) | ||
| 5248 | nlines = w->total_lines - this_scroll_margin - 1; | ||
| 5249 | Fvertical_motion (Fcons (make_number (window_scroll_preserve_hpos), | ||
| 5250 | make_number (nlines)), window, Qnil); | ||
| 5242 | } | 5251 | } |
| 5243 | else | 5252 | else |
| 5244 | SET_PT (top_margin); | 5253 | SET_PT (top_margin); |
| @@ -5264,8 +5273,16 @@ window_scroll_line_based (Lisp_Object window, int n, bool whole, bool noerror) | |||
| 5264 | { | 5273 | { |
| 5265 | if (!NILP (Vscroll_preserve_screen_position)) | 5274 | if (!NILP (Vscroll_preserve_screen_position)) |
| 5266 | { | 5275 | { |
| 5276 | int nlines = window_scroll_preserve_vpos; | ||
| 5277 | |||
| 5267 | SET_PT_BOTH (pos, pos_byte); | 5278 | SET_PT_BOTH (pos, pos_byte); |
| 5268 | Fvertical_motion (original_pos, window, Qnil); | 5279 | if (window_scroll_preserve_vpos < this_scroll_margin) |
| 5280 | nlines = this_scroll_margin; | ||
| 5281 | else if (window_scroll_preserve_vpos | ||
| 5282 | >= ht - this_scroll_margin) | ||
| 5283 | nlines = ht - this_scroll_margin - 1; | ||
| 5284 | Fvertical_motion (Fcons (make_number (window_scroll_preserve_hpos), | ||
| 5285 | make_number (nlines)), window, Qnil); | ||
| 5269 | } | 5286 | } |
| 5270 | else | 5287 | else |
| 5271 | Fvertical_motion (make_number (-1), window, Qnil); | 5288 | Fvertical_motion (make_number (-1), window, Qnil); |