diff options
| author | Eli Zaretskii | 2024-07-25 21:26:08 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2024-07-25 21:26:08 +0300 |
| commit | c22b4198b2e5a9d63109c5ceeb386fbb1904f5dc (patch) | |
| tree | 50f75abe9ffbdd0a1ecb5ca169ff8b3a447cb5e9 /src | |
| parent | e56e4b345a25194bc7adb83523e8d886b718c9fa (diff) | |
| download | emacs-c22b4198b2e5a9d63109c5ceeb386fbb1904f5dc.tar.gz emacs-c22b4198b2e5a9d63109c5ceeb386fbb1904f5dc.zip | |
Fix display of 'display' strings in RTL paragraphs at window-start
* src/xdisp.c (handle_single_display_spec)
(get_overlay_strings_1, push_prefix_prop): Initialize bidi
paragraph direction if not yet done. (Bug#72287)
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 45317cc9f5d..a8f9f59b654 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -6355,6 +6355,12 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object, | |||
| 6355 | return retval; | 6355 | return retval; |
| 6356 | } | 6356 | } |
| 6357 | 6357 | ||
| 6358 | /* We want the string to inherit the paragraph direction of the | ||
| 6359 | parent object, so we need to calculate that if not yet done. */ | ||
| 6360 | ptrdiff_t eob = (BUFFERP (object) ? ZV : it->end_charpos); | ||
| 6361 | if (it->bidi_it.first_elt && it->bidi_it.charpos < eob) | ||
| 6362 | bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it, true); | ||
| 6363 | |||
| 6358 | /* Save current settings of IT so that we can restore them | 6364 | /* Save current settings of IT so that we can restore them |
| 6359 | when we are finished with the glyph property value. */ | 6365 | when we are finished with the glyph property value. */ |
| 6360 | push_it (it, position); | 6366 | push_it (it, position); |
| @@ -6387,9 +6393,10 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object, | |||
| 6387 | if (BUFFERP (object)) | 6393 | if (BUFFERP (object)) |
| 6388 | *position = start_pos; | 6394 | *position = start_pos; |
| 6389 | 6395 | ||
| 6390 | /* Force paragraph direction to be that of the parent | 6396 | /* Force paragraph direction to be that of the parent object. |
| 6391 | object. If the parent object's paragraph direction is | 6397 | If the parent object's paragraph direction is not yet |
| 6392 | not yet determined, default to L2R. */ | 6398 | determined (which shouldn not happen, since we called |
| 6399 | bidi_paragraph_init above), default to L2R. */ | ||
| 6393 | if (it->bidi_p && it->bidi_it.paragraph_dir == R2L) | 6400 | if (it->bidi_p && it->bidi_it.paragraph_dir == R2L) |
| 6394 | it->paragraph_embedding = it->bidi_it.paragraph_dir; | 6401 | it->paragraph_embedding = it->bidi_it.paragraph_dir; |
| 6395 | else | 6402 | else |
| @@ -7044,6 +7051,11 @@ get_overlay_strings_1 (struct it *it, ptrdiff_t charpos, bool compute_stop_p) | |||
| 7044 | strings have been processed. */ | 7051 | strings have been processed. */ |
| 7045 | eassert (!compute_stop_p || it->sp == 0); | 7052 | eassert (!compute_stop_p || it->sp == 0); |
| 7046 | 7053 | ||
| 7054 | /* We want the string to inherit the paragraph direction of the | ||
| 7055 | parent object, so we need to calculate that if not yet done. */ | ||
| 7056 | if (it->bidi_it.first_elt && it->bidi_it.charpos < ZV) | ||
| 7057 | bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it, true); | ||
| 7058 | |||
| 7047 | /* When called from handle_stop, there might be an empty display | 7059 | /* When called from handle_stop, there might be an empty display |
| 7048 | string loaded. In that case, don't bother saving it. But | 7060 | string loaded. In that case, don't bother saving it. But |
| 7049 | don't use this optimization with the bidi iterator, since we | 7061 | don't use this optimization with the bidi iterator, since we |
| @@ -7197,7 +7209,7 @@ iterate_out_of_display_property (struct it *it) | |||
| 7197 | eassert (eob >= CHARPOS (it->position) && CHARPOS (it->position) >= bob); | 7209 | eassert (eob >= CHARPOS (it->position) && CHARPOS (it->position) >= bob); |
| 7198 | 7210 | ||
| 7199 | /* Maybe initialize paragraph direction. If we are at the beginning | 7211 | /* Maybe initialize paragraph direction. If we are at the beginning |
| 7200 | of a new paragraph, next_element_from_buffer may not have a | 7212 | of a new paragraph, next_element_from_buffer may not have had a |
| 7201 | chance to do that. */ | 7213 | chance to do that. */ |
| 7202 | if (it->bidi_it.first_elt && it->bidi_it.charpos < eob) | 7214 | if (it->bidi_it.first_elt && it->bidi_it.charpos < eob) |
| 7203 | bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it, true); | 7215 | bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it, true); |
| @@ -24415,6 +24427,12 @@ push_prefix_prop (struct it *it, Lisp_Object prop) | |||
| 24415 | || it->method == GET_FROM_STRING | 24427 | || it->method == GET_FROM_STRING |
| 24416 | || it->method == GET_FROM_IMAGE); | 24428 | || it->method == GET_FROM_IMAGE); |
| 24417 | 24429 | ||
| 24430 | /* We want the string to inherit the paragraph direction of the parent | ||
| 24431 | object, so we need to calculate that if not yet done. */ | ||
| 24432 | ptrdiff_t eob = (STRINGP (it->string) ? SCHARS (it->string) : ZV); | ||
| 24433 | if (it->bidi_it.first_elt && it->bidi_it.charpos < eob) | ||
| 24434 | bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it, true); | ||
| 24435 | |||
| 24418 | /* We need to save the current buffer/string position, so it will be | 24436 | /* We need to save the current buffer/string position, so it will be |
| 24419 | restored by pop_it, because iterate_out_of_display_property | 24437 | restored by pop_it, because iterate_out_of_display_property |
| 24420 | depends on that being set correctly, but some situations leave | 24438 | depends on that being set correctly, but some situations leave |