From: Eli Zaretskii Date: Sun, 31 May 2020 14:34:09 +0000 (+0300) Subject: Protect bidi cache from inadvertent resets X-Git-Tag: emacs-28.0.90~7244 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=dc4db3ef09dd5851c48421757a5b5e0f439a143e;p=emacs.git 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. --- diff --git a/src/xdisp.c b/src/xdisp.c index db0ec683159..ea28395cf55 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);