Eli Zaretskii writes: >> Date: Tue, 02 Jun 2020 19:34:31 +0300 >> From: Eli Zaretskii >> 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...