]> git.eshelyaron.com Git - emacs.git/commitdiff
Avoid inflooping in redisplay caused by hscrolled R2L lines.
authorEli Zaretskii <eliz@gnu.org>
Sun, 17 Aug 2014 14:48:50 +0000 (17:48 +0300)
committerEli Zaretskii <eliz@gnu.org>
Sun, 17 Aug 2014 14:48:50 +0000 (17:48 +0300)
 src/xdisp.c (display_line): Don't assume that the call to
 reseat_at_next_visible_line_start ends up at a character
 immediately following the newline on the previous line.  Avoids
 setting the ends_at_zv_p flag on screen lines that are not at or
 beyond ZV, which causes infloop in redisplay.  For the details, see
 http://lists.gnu.org/archive/html/emacs-devel/2014-08/msg00368.html.

src/ChangeLog
src/xdisp.c

index 68f6babb991b3a58bb14b456acd04fde16411e34..8c89f693bca4bbd3838d52e4f739b1f27b95dd65 100644 (file)
@@ -1,5 +1,12 @@
 2014-08-17  Eli Zaretskii  <eliz@gnu.org>
 
+       * xdisp.c (display_line): Don't assume that the call to
+       reseat_at_next_visible_line_start ends up at a character
+       immediately following the newline on the previous line.  Avoids
+       setting the ends_at_zv_p flag on screen lines that are not at or
+       beyond ZV, which causes infloop in redisplay.  For the details, see
+       http://lists.gnu.org/archive/html/emacs-devel/2014-08/msg00368.html.
+
        * dispnew.c (buffer_posn_from_coords): Fix mirroring of X
        coordinate for hscrolled R2L screen lines.  (Bug#18277)
 
index 776e4d000eeaa1818cf1552c3365b2335bc4d8b8..e60a9d341c64a204b207a32e894d68ee15381848 100644 (file)
@@ -20583,10 +20583,15 @@ display_line (struct it *it)
          row->truncated_on_right_p = 1;
          it->continuation_lines_width = 0;
          reseat_at_next_visible_line_start (it, 0);
-         if (IT_BYTEPOS (*it) <= BEG_BYTE)
-           row->ends_at_zv_p = true;
+         /* We insist below that IT's position be at ZV because in
+            bidi-reordered lines the character at visible line start
+            might not be the character that follows the newline in
+            the logical order.  */
+         if (IT_BYTEPOS (*it) > BEG_BYTE)
+           row->ends_at_zv_p =
+             IT_BYTEPOS (*it) >= ZV_BYTE && FETCH_BYTE (ZV_BYTE - 1) != '\n';
          else
-           row->ends_at_zv_p = FETCH_BYTE (IT_BYTEPOS (*it) - 1) != '\n';
+           row->ends_at_zv_p = false;
          break;
        }
     }