emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-24 r117488: Fix the row number mistakenly reported b


From: Eli Zaretskii
Subject: [Emacs-diffs] emacs-24 r117488: Fix the row number mistakenly reported by pos_visible_p in rare cases.
Date: Tue, 09 Sep 2014 15:05:09 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117488
revision-id: address@hidden
parent: address@hidden
committer: Eli Zaretskii <address@hidden>
branch nick: emacs-24
timestamp: Tue 2014-09-09 18:04:35 +0300
message:
  Fix the row number mistakenly reported by pos_visible_p in rare cases.
  
   src/xdisp.c (pos_visible_p): Properly save and restore the iterator
   state around the call to line_bottom, since it can move the
   iterator to another screen line.  This fixes off-by-one errors in
   the reported row in some rare cases.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/xdisp.c                    xdisp.c-20091113204419-o5vbwnq5f7feedwu-240
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-09-07 17:16:36 +0000
+++ b/src/ChangeLog     2014-09-09 15:04:35 +0000
@@ -1,3 +1,10 @@
+2014-09-09  Eli Zaretskii  <address@hidden>
+
+       * xdisp.c (pos_visible_p): Properly save and restore the iterator
+       state around the call to line_bottom, since it can move the
+       iterator to another screen line.  This fixes off-by-one errors in
+       the reported row in some rare cases.
+
 2014-09-07  Eli Zaretskii  <address@hidden>
 
        * dispnew.c (prepare_desired_row): When MODE_LINE_P is zero,

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2014-08-31 15:53:27 +0000
+++ b/src/xdisp.c       2014-09-09 15:04:35 +0000
@@ -1452,11 +1452,15 @@
         glyph.  */
       int top_x = it.current_x;
       int top_y = it.current_y;
+      int window_top_y = WINDOW_HEADER_LINE_HEIGHT (w);
+      int bottom_y;
+      struct it save_it;
+      void *save_it_data = NULL;
+
       /* Calling line_bottom_y may change it.method, it.position, etc.  */
-      enum it_method it_method = it.method;
-      int bottom_y = (last_height = 0, line_bottom_y (&it));
-      int window_top_y = WINDOW_HEADER_LINE_HEIGHT (w);
-
+      SAVE_IT (save_it, it, save_it_data);
+      last_height = 0;
+      bottom_y = line_bottom_y (&it);
       if (top_y < window_top_y)
        visible_p = bottom_y > window_top_y;
       else if (top_y < it.last_visible_y)
@@ -1473,7 +1477,6 @@
             move_it_to again with a slightly larger vertical limit,
             and see if it actually moved vertically; if it did, we
             didn't really reach CHARPOS, which is beyond window end.  */
-         struct it save_it = it;
          /* Why 10? because we don't know how many canonical lines
             will the height of the next line(s) be.  So we guess.  */
          int ten_more_lines = 10 * default_line_pixel_height (w);
@@ -1483,11 +1486,11 @@
          if (it.current_y > top_y)
            visible_p = 0;
 
-         it = save_it;
        }
+      RESTORE_IT (&it, &save_it, save_it_data);
       if (visible_p)
        {
-         if (it_method == GET_FROM_DISPLAY_VECTOR)
+         if (it.method == GET_FROM_DISPLAY_VECTOR)
            {
              /* We stopped on the last glyph of a display vector.
                 Try and recompute.  Hack alert!  */


reply via email to

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