mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-21 06:55:39 +00:00
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)
This commit is contained in:
parent
e56e4b345a
commit
c22b4198b2
26
src/xdisp.c
26
src/xdisp.c
@ -6355,6 +6355,12 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* We want the string to inherit the paragraph direction of the
|
||||
parent object, so we need to calculate that if not yet done. */
|
||||
ptrdiff_t eob = (BUFFERP (object) ? ZV : it->end_charpos);
|
||||
if (it->bidi_it.first_elt && it->bidi_it.charpos < eob)
|
||||
bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it, true);
|
||||
|
||||
/* Save current settings of IT so that we can restore them
|
||||
when we are finished with the glyph property value. */
|
||||
push_it (it, position);
|
||||
@ -6387,9 +6393,10 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
|
||||
if (BUFFERP (object))
|
||||
*position = start_pos;
|
||||
|
||||
/* Force paragraph direction to be that of the parent
|
||||
object. If the parent object's paragraph direction is
|
||||
not yet determined, default to L2R. */
|
||||
/* Force paragraph direction to be that of the parent object.
|
||||
If the parent object's paragraph direction is not yet
|
||||
determined (which shouldn not happen, since we called
|
||||
bidi_paragraph_init above), default to L2R. */
|
||||
if (it->bidi_p && it->bidi_it.paragraph_dir == R2L)
|
||||
it->paragraph_embedding = it->bidi_it.paragraph_dir;
|
||||
else
|
||||
@ -7044,6 +7051,11 @@ get_overlay_strings_1 (struct it *it, ptrdiff_t charpos, bool compute_stop_p)
|
||||
strings have been processed. */
|
||||
eassert (!compute_stop_p || it->sp == 0);
|
||||
|
||||
/* We want the string to inherit the paragraph direction of the
|
||||
parent object, so we need to calculate that if not yet done. */
|
||||
if (it->bidi_it.first_elt && it->bidi_it.charpos < ZV)
|
||||
bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it, true);
|
||||
|
||||
/* When called from handle_stop, there might be an empty display
|
||||
string loaded. In that case, don't bother saving it. But
|
||||
don't use this optimization with the bidi iterator, since we
|
||||
@ -7197,7 +7209,7 @@ iterate_out_of_display_property (struct it *it)
|
||||
eassert (eob >= CHARPOS (it->position) && CHARPOS (it->position) >= bob);
|
||||
|
||||
/* Maybe initialize paragraph direction. If we are at the beginning
|
||||
of a new paragraph, next_element_from_buffer may not have a
|
||||
of a new paragraph, next_element_from_buffer may not have had a
|
||||
chance to do that. */
|
||||
if (it->bidi_it.first_elt && it->bidi_it.charpos < eob)
|
||||
bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it, true);
|
||||
@ -24415,6 +24427,12 @@ push_prefix_prop (struct it *it, Lisp_Object prop)
|
||||
|| it->method == GET_FROM_STRING
|
||||
|| it->method == GET_FROM_IMAGE);
|
||||
|
||||
/* We want the string to inherit the paragraph direction of the parent
|
||||
object, so we need to calculate that if not yet done. */
|
||||
ptrdiff_t eob = (STRINGP (it->string) ? SCHARS (it->string) : ZV);
|
||||
if (it->bidi_it.first_elt && it->bidi_it.charpos < eob)
|
||||
bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it, true);
|
||||
|
||||
/* We need to save the current buffer/string position, so it will be
|
||||
restored by pop_it, because iterate_out_of_display_property
|
||||
depends on that being set correctly, but some situations leave
|
||||
|
Loading…
Reference in New Issue
Block a user