diff options
| author | Eli Zaretskii | 2020-05-31 17:34:09 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2020-05-31 17:34:09 +0300 |
| commit | dc4db3ef09dd5851c48421757a5b5e0f439a143e (patch) | |
| tree | b78ee47bf2365b364669d121319c0771bf2824a0 /src | |
| parent | abe7c22da96694ced1bc80ec7eb9eb8a662a568b (diff) | |
| download | emacs-dc4db3ef09dd5851c48421757a5b5e0f439a143e.tar.gz emacs-dc4db3ef09dd5851c48421757a5b5e0f439a143e.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 4 |
1 files changed, 4 insertions, 0 deletions
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. */) | |||
| 1415 | set_buffer_internal_1 (XBUFFER (w->contents)); | 1415 | set_buffer_internal_1 (XBUFFER (w->contents)); |
| 1416 | } | 1416 | } |
| 1417 | SET_TEXT_POS (pt, PT, PT_BYTE); | 1417 | SET_TEXT_POS (pt, PT, PT_BYTE); |
| 1418 | void *itdata = bidi_shelve_cache (); | ||
| 1418 | start_display (&it, w, pt); | 1419 | start_display (&it, w, pt); |
| 1419 | /* Start from the beginning of the screen line, to make sure we | 1420 | /* Start from the beginning of the screen line, to make sure we |
| 1420 | traverse all of its display elements, and thus capture the | 1421 | 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. */) | |||
| 1426 | if (old_buffer) | 1427 | if (old_buffer) |
| 1427 | set_buffer_internal_1 (old_buffer); | 1428 | set_buffer_internal_1 (old_buffer); |
| 1428 | 1429 | ||
| 1430 | bidi_unshelve_cache (itdata, false); | ||
| 1429 | return result; | 1431 | return result; |
| 1430 | } | 1432 | } |
| 1431 | 1433 | ||
| @@ -24442,6 +24444,7 @@ Value is the new character position of point. */) | |||
| 24442 | bool at_eol_p; | 24444 | bool at_eol_p; |
| 24443 | bool overshoot_expected = false; | 24445 | bool overshoot_expected = false; |
| 24444 | bool target_is_eol_p = false; | 24446 | bool target_is_eol_p = false; |
| 24447 | void *itdata = bidi_shelve_cache (); | ||
| 24445 | 24448 | ||
| 24446 | /* Setup the arena. */ | 24449 | /* Setup the arena. */ |
| 24447 | SET_TEXT_POS (pt, PT, PT_BYTE); | 24450 | SET_TEXT_POS (pt, PT, PT_BYTE); |
| @@ -24670,6 +24673,7 @@ Value is the new character position of point. */) | |||
| 24670 | 24673 | ||
| 24671 | /* Move point to that position. */ | 24674 | /* Move point to that position. */ |
| 24672 | SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); | 24675 | SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); |
| 24676 | bidi_unshelve_cache (itdata, false); | ||
| 24673 | } | 24677 | } |
| 24674 | 24678 | ||
| 24675 | return make_fixnum (PT); | 24679 | return make_fixnum (PT); |