From: Pip Cet <pipcet@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 41506@debbugs.gnu.org
Subject: bug#41506: 28.0.50; RTL problem
Date: Sat, 06 Jun 2020 07:58:24 +0000 [thread overview]
Message-ID: <87k10kzkv3.fsf@gmail.com> (raw)
In-Reply-To: <83ftbdcmm3.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 02 Jun 2020 22:07:48 +0300")
[-- Attachment #1: Type: text/plain, Size: 1083 bytes --]
Eli Zaretskii <eliz@gnu.org> writes:
>> Date: Tue, 02 Jun 2020 19:34:31 +0300
>> From: Eli Zaretskii <eliz@gnu.org>
>> Cc: 41506@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...
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Handle-buffers-containing-two-newlines-followed-by-a.patch --]
[-- Type: text/x-diff, Size: 1254 bytes --]
From b5302d2e89710166cc8540c8fc08a7eaabc341f4 Mon Sep 17 00:00:00 2001
From: Pip Cet <pipcet@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
[-- Attachment #3: Type: text/plain, Size: 122 bytes --]
If you have any further comments, I'd be glad to amend the comments in
bidi.c to reflect what we actually do understand.
next prev parent reply other threads:[~2020-06-06 7:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-24 13:05 bug#41506: 28.0.50; RTL problem Pip Cet
2020-05-24 14:46 ` Eli Zaretskii
2020-06-02 10:17 ` Pip Cet
2020-06-02 16:34 ` Eli Zaretskii
2020-06-02 19:07 ` Eli Zaretskii
2020-06-06 7:58 ` Pip Cet [this message]
2020-06-06 8:35 ` Eli Zaretskii
2020-06-06 13:05 ` Pip Cet
2020-06-06 13:45 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87k10kzkv3.fsf@gmail.com \
--to=pipcet@gmail.com \
--cc=41506@debbugs.gnu.org \
--cc=eliz@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.