emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r111752: Fix cursor positioning near


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111752: Fix cursor positioning near scroll margin at top of window.
Date: Tue, 12 Feb 2013 18:43:09 +0200
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111752
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Tue 2013-02-12 18:43:09 +0200
message:
  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.
modified:
  src/ChangeLog
  src/xdisp.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-02-12 16:36:55 +0000
+++ b/src/ChangeLog     2013-02-12 16:43:09 +0000
@@ -6,6 +6,9 @@
        it->region_beg_charpos, not to -1.  This fixes redisplay
        optimization when cursor is moved up after M->.  (Bug#13623)
        (Bug#13626)
+       (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.
 
        * window.h (struct window): region_showing can no longer be
        negative.

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2013-02-12 16:36:55 +0000
+++ b/src/xdisp.c       2013-02-12 16:43:09 +0000
@@ -14604,14 +14604,24 @@
   else
     {
       struct text_pos scroll_margin_pos = startp;
+      int y_offset = 0;
 
       /* See if point is inside the scroll margin at the top of the
          window.  */
       if (this_scroll_margin)
        {
+         int y_start;
+
          start_display (&it, w, startp);
+         y_start = it.current_y;
          move_it_vertically (&it, this_scroll_margin);
          scroll_margin_pos = it.current.pos;
+         /* If we didn't move enough before hitting ZV, request
+            additional amount of scroll, to move point out of the
+            scroll margin.  */
+         if (IT_CHARPOS (it) == ZV
+             && it.current_y - y_start < this_scroll_margin)
+           y_offset = this_scroll_margin - (it.current_y - y_start);
        }
 
       if (PT < CHARPOS (scroll_margin_pos))
@@ -14638,6 +14648,9 @@
              || IT_CHARPOS (it) < CHARPOS (scroll_margin_pos))
            return SCROLLING_FAILED;
 
+         /* Additional scroll for when ZV was too close to point.  */
+         dy += y_offset;
+
          /* Compute new window start.  */
          start_display (&it, w, startp);
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]