emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r111079: Fix bug #13055 with cursor p


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111079: Fix bug #13055 with cursor positioning inside scroll-margin.
Date: Mon, 03 Dec 2012 22:48:12 +0200
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111079
fixes bug: http://debbugs.gnu.org/13055
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Mon 2012-12-03 22:48:12 +0200
message:
  Fix bug #13055 with cursor positioning inside scroll-margin.
  
   src/xdisp.c (redisplay_window): If the cursor is visible, but inside
   the scroll margin, move point outside the margin.
modified:
  src/ChangeLog
  src/xdisp.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-12-03 19:16:17 +0000
+++ b/src/ChangeLog     2012-12-03 20:48:12 +0000
@@ -1,3 +1,8 @@
+2012-12-03  Eli Zaretskii  <address@hidden>
+
+       * xdisp.c (redisplay_window): If the cursor is visible, but inside
+       the scroll margin, move point outside the margin.  (Bug#13055)
+
 2012-12-03  Jan Djärv  <address@hidden>
 
        * gtkutil.c (my_log_handler): New function.

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2012-11-30 09:23:15 +0000
+++ b/src/xdisp.c       2012-12-03 20:48:12 +0000
@@ -15717,6 +15717,35 @@
             Move it back to a fully-visible line.  */
          new_vpos = window_box_height (w);
        }
+      else if (w->cursor.vpos >=0)
+       {
+         /* Some people insist on not letting point enter the scroll
+            margin, even though this part handles windows that didn't
+            scroll at all.  */
+         struct frame *f = XFRAME (w->frame);
+         int margin = min (scroll_margin, WINDOW_TOTAL_LINES (w) / 4);
+         int pixel_margin = margin * FRAME_LINE_HEIGHT (f);
+         bool header_line = WINDOW_WANTS_HEADER_LINE_P (w);
+
+         /* Note: We add an extra FRAME_LINE_HEIGHT, because the loop
+            below, which finds the row to move point to, advances by
+            the Y coordinate of the _next_ row, see the definition of
+            MATRIX_ROW_BOTTOM_Y.  */
+         if (w->cursor.vpos < margin + header_line)
+           new_vpos
+             = pixel_margin + (header_line
+                               ? CURRENT_HEADER_LINE_HEIGHT (w)
+                               : 0) + FRAME_LINE_HEIGHT (f);
+         else
+           {
+             int window_height = window_box_height (w);
+
+             if (header_line)
+               window_height += CURRENT_HEADER_LINE_HEIGHT (w);
+             if (w->cursor.y >= window_height - pixel_margin)
+               new_vpos = window_height - pixel_margin;
+           }
+       }
 
       /* If we need to move point for either of the above reasons,
         now actually do it.  */


reply via email to

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