GNU bug report logs -
#41506
two newlines followed by RTL text aligns left instead of right
Previous Next
Full log
Message #24 received at 41506 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:
>> Date: Tue, 02 Jun 2020 19:34:31 +0300
>> From: Eli Zaretskii <eliz <at> gnu.org>
>> Cc: 41506 <at> debbugs.gnu.org
>>
>> So I guess whatever issues I had back then were meanwhile solved "by
>> other means", and you should install this patch. If there is indeed
>> some subtlety here, it will present itself sooner or later (like, in
>> another 11 years).
>
> Btw, please note that some residual problem remains: after the patch,
> if a buffer begins with 2 newlines and an RTL letter, the first screen
> line is rendered right-to-left, which is wrong. You can see that it's
> wrong if you insert more newlines at BOB: then only the single empty
> line immediately before the RTL letter is rendered right-to-left.
>
> Of course, this is better than the original problem.
I decided to investigate further, and finally came up with this patch,
which appears to work. I'm not a hundred percent sure it's the right
thing to do, because when we're called with bidi_it->first_elt = true,
it's possible we shouldn't touch bidi_it->new_paragraph at all...
[0001-Handle-buffers-containing-two-newlines-followed-by-a.patch (text/x-diff, inline)]
From b5302d2e89710166cc8540c8fc08a7eaabc341f4 Mon Sep 17 00:00:00 2001
From: Pip Cet <pipcet <at> gmail.com>
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
[Message part 3 (text/plain, inline)]
If you have any further comments, I'd be glad to amend the comments in
bidi.c to reflect what we actually do understand.
This bug report was last modified 5 years and 10 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.