From b5302d2e89710166cc8540c8fc08a7eaabc341f4 Mon Sep 17 00:00:00 2001 From: Pip Cet Date: Sat, 6 Jun 2020 07:52:13 +0000 Subject: [PATCH] Handle buffers containing two newlines followed by an RTL char * src/bidi.c (bidi_paragraph_init): Correct handling of initial newlines. (Bug#41506) --- src/bidi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bidi.c b/src/bidi.c index 1017bd2d52..8d2d3c1f07 100644 --- a/src/bidi.c +++ b/src/bidi.c @@ -1707,14 +1707,14 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, bool no_default_p) return; /* If we are on a newline, get past it to where the next - paragraph might start. But don't do that at BEGV since then - we are potentially in a new paragraph that doesn't yet - exist. */ + paragraph might start. But don't do that for the first + element since this function will be called twice in that + case. */ pos = bidi_it->charpos; s = (STRINGP (bidi_it->string.lstring) ? SDATA (bidi_it->string.lstring) : bidi_it->string.s); - if (bytepos > begbyte + if (!bidi_it->first_elt && bidi_char_at_pos (bytepos, s, bidi_it->string.unibyte) == '\n') { bytepos++; -- 2.27.0.rc0