emacs-diffs
[Top][All Lists]
Advanced

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

master dc4db3e: Protect bidi cache from inadvertent resets


From: Eli Zaretskii
Subject: master dc4db3e: Protect bidi cache from inadvertent resets
Date: Sun, 31 May 2020 10:35:50 -0400 (EDT)

branch: master
commit dc4db3ef09dd5851c48421757a5b5e0f439a143e
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Protect bidi cache from inadvertent resets
    
    * src/xdisp.c (Fline_pixel_height, Fmove_point_visually): Save and
    restore the bidi cache, to avoid inadvertently resetting it by
    starting a new iteration through buffer text.  This could cause
    trouble if these functions are called during a redisplay cycle,
    especially while we were processing RTL text.
---
 src/xdisp.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/xdisp.c b/src/xdisp.c
index db0ec68..ea28395 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -1415,6 +1415,7 @@ Value is the height in pixels of the line at point.  */)
       set_buffer_internal_1 (XBUFFER (w->contents));
     }
   SET_TEXT_POS (pt, PT, PT_BYTE);
+  void *itdata = bidi_shelve_cache ();
   start_display (&it, w, pt);
   /* Start from the beginning of the screen line, to make sure we
      traverse all of its display elements, and thus capture the
@@ -1426,6 +1427,7 @@ Value is the height in pixels of the line at point.  */)
   if (old_buffer)
     set_buffer_internal_1 (old_buffer);
 
+  bidi_unshelve_cache (itdata, false);
   return result;
 }
 
@@ -24442,6 +24444,7 @@ Value is the new character position of point.  */)
       bool at_eol_p;
       bool overshoot_expected = false;
       bool target_is_eol_p = false;
+      void *itdata = bidi_shelve_cache ();
 
       /* Setup the arena.  */
       SET_TEXT_POS (pt, PT, PT_BYTE);
@@ -24670,6 +24673,7 @@ Value is the new character position of point.  */)
 
       /* Move point to that position.  */
       SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it));
+      bidi_unshelve_cache (itdata, false);
     }
 
   return make_fixnum (PT);



reply via email to

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