aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2013-02-12 18:43:09 +0200
committerEli Zaretskii2013-02-12 18:43:09 +0200
commitc4131562319d3529841136d236ac39fb1e3d2b7c (patch)
tree5ad493efa9ff4e2c5d53dc39632c759f710717c3 /src
parent33b49d71e45e3be1db4577277763f1cb3138d225 (diff)
downloademacs-c4131562319d3529841136d236ac39fb1e3d2b7c.tar.gz
emacs-c4131562319d3529841136d236ac39fb1e3d2b7c.zip
Fix cursor positioning near scroll margin at top of window.
src/xdisp.c (try_scrolling): Scroll text up more if point is too close to ZV and inside the scroll margin. This makes sure point is moved outside the scroll margin in these cases.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog3
-rw-r--r--src/xdisp.c13
2 files changed, 16 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index fb4cc723646..05737bb1194 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -6,6 +6,9 @@
6 it->region_beg_charpos, not to -1. This fixes redisplay 6 it->region_beg_charpos, not to -1. This fixes redisplay
7 optimization when cursor is moved up after M->. (Bug#13623) 7 optimization when cursor is moved up after M->. (Bug#13623)
8 (Bug#13626) 8 (Bug#13626)
9 (try_scrolling): Scroll text up more if point is too close to ZV
10 and inside the scroll margin. This makes sure point is moved
11 outside the scroll margin in these cases.
9 12
10 * window.h (struct window): region_showing can no longer be 13 * window.h (struct window): region_showing can no longer be
11 negative. 14 negative.
diff --git a/src/xdisp.c b/src/xdisp.c
index ca3f968afa7..d2d4b3bbb79 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -14604,14 +14604,24 @@ try_scrolling (Lisp_Object window, int just_this_one_p,
14604 else 14604 else
14605 { 14605 {
14606 struct text_pos scroll_margin_pos = startp; 14606 struct text_pos scroll_margin_pos = startp;
14607 int y_offset = 0;
14607 14608
14608 /* See if point is inside the scroll margin at the top of the 14609 /* See if point is inside the scroll margin at the top of the
14609 window. */ 14610 window. */
14610 if (this_scroll_margin) 14611 if (this_scroll_margin)
14611 { 14612 {
14613 int y_start;
14614
14612 start_display (&it, w, startp); 14615 start_display (&it, w, startp);
14616 y_start = it.current_y;
14613 move_it_vertically (&it, this_scroll_margin); 14617 move_it_vertically (&it, this_scroll_margin);
14614 scroll_margin_pos = it.current.pos; 14618 scroll_margin_pos = it.current.pos;
14619 /* If we didn't move enough before hitting ZV, request
14620 additional amount of scroll, to move point out of the
14621 scroll margin. */
14622 if (IT_CHARPOS (it) == ZV
14623 && it.current_y - y_start < this_scroll_margin)
14624 y_offset = this_scroll_margin - (it.current_y - y_start);
14615 } 14625 }
14616 14626
14617 if (PT < CHARPOS (scroll_margin_pos)) 14627 if (PT < CHARPOS (scroll_margin_pos))
@@ -14638,6 +14648,9 @@ try_scrolling (Lisp_Object window, int just_this_one_p,
14638 || IT_CHARPOS (it) < CHARPOS (scroll_margin_pos)) 14648 || IT_CHARPOS (it) < CHARPOS (scroll_margin_pos))
14639 return SCROLLING_FAILED; 14649 return SCROLLING_FAILED;
14640 14650
14651 /* Additional scroll for when ZV was too close to point. */
14652 dy += y_offset;
14653
14641 /* Compute new window start. */ 14654 /* Compute new window start. */
14642 start_display (&it, w, startp); 14655 start_display (&it, w, startp);
14643 14656