emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/emacs-24 r107994: Fix bug #11464 with pos-v


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-24 r107994: Fix bug #11464 with pos-visible-in-window-p and R2L text in L2R paragraph.
Date: Sun, 13 May 2012 21:22:35 +0300
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 107994
fixes bug(s): http://debbugs.gnu.org/11464
committer: Eli Zaretskii <address@hidden>
branch nick: emacs-24
timestamp: Sun 2012-05-13 21:22:35 +0300
message:
  Fix bug #11464 with pos-visible-in-window-p and R2L text in L2R paragraph.
  
   src/xdisp.c (pos_visible_p): Don't report a position visible when move_it_to
   stopped at the last line of window, which happens to be scanned
   backwards by the bidi iteration.
modified:
  src/ChangeLog
  src/xdisp.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-05-13 15:35:13 +0000
+++ b/src/ChangeLog     2012-05-13 18:22:35 +0000
@@ -14,6 +14,9 @@
        proceed to consider_string_end without incrementing string
        position.  Don't increment display vector index past the end of
        the display vector.  (Bug#11417)
+       (pos_visible_p): Don't report a position visible when move_it_to
+       stopped at the last line of window, which happens to be scanned
+       backwards by the bidi iteration.  (Bug#11464)
 
 2012-05-11  Eli Zaretskii  <address@hidden>
 

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2012-05-13 15:35:13 +0000
+++ b/src/xdisp.c       2012-05-13 18:22:35 +0000
@@ -1304,8 +1304,8 @@
         glyph.  */
       int top_x = it.current_x;
       int top_y = it.current_y;
+      /* Calling line_bottom_y may change it.method, it.position, etc.  */
       enum it_method it_method = it.method;
-      /* Calling line_bottom_y may change it.method, it.position, etc.  */
       int bottom_y = (last_height = 0, line_bottom_y (&it));
       int window_top_y = WINDOW_HEADER_LINE_HEIGHT (w);
 
@@ -1313,6 +1313,31 @@
        visible_p = bottom_y > window_top_y;
       else if (top_y < it.last_visible_y)
        visible_p = 1;
+      if (bottom_y >= it.last_visible_y
+         && it.bidi_p && it.bidi_it.scan_dir == -1
+         && IT_CHARPOS (it) < charpos)
+       {
+         /* When the last line of the window is scanned backwards
+            under bidi iteration, we could be duped into thinking
+            that we have passed CHARPOS, when in fact move_it_to
+            simply stopped short of CHARPOS because it reached
+            last_visible_y.  To see if that's what happened, we call
+            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 * FRAME_LINE_HEIGHT (XFRAME (WINDOW_FRAME (w)));
+
+         move_it_to (&it, charpos, -1, bottom_y + ten_more_lines, -1,
+                     MOVE_TO_POS | MOVE_TO_Y);
+         if (it.current_y > top_y)
+           visible_p = 0;
+
+         it = save_it;
+       }
       if (visible_p)
        {
          if (it_method == GET_FROM_DISPLAY_VECTOR)


reply via email to

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