emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-29 1a123feb18: Fix bidi reordering of sequence of whitespace chara


From: Eli Zaretskii
Subject: emacs-29 1a123feb18: Fix bidi reordering of sequence of whitespace characters before a TAB
Date: Sat, 4 Feb 2023 06:36:23 -0500 (EST)

branch: emacs-29
commit 1a123feb1815d6a2ee4ba6abb747fb62fd8b9e0f
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Fix bidi reordering of sequence of whitespace characters before a TAB
    
    * src/bidi.c (bidi_level_of_next_char): Test the current level
    only for characters whose original type is BN.  (Bug#61269)
---
 src/bidi.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/bidi.c b/src/bidi.c
index e01251263b..93875d243e 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -3300,12 +3300,15 @@ bidi_level_of_next_char (struct bidi_it *bidi_it)
      it belongs to a sequence of WS characters preceding a newline
      or a TAB or a paragraph separator.  */
   if ((bidi_it->orig_type == NEUTRAL_WS
-       || bidi_it->orig_type == WEAK_BN
+       || (bidi_it->orig_type == WEAK_BN
+          /* If this BN character is already at base level, we don't
+             need to consider resetting it, since I1 and I2 below
+             will not change the level, so avoid the potentially
+             costly loop below.  */
+          && level != bidi_it->level_stack[0].level)
        || bidi_isolate_fmt_char (bidi_it->orig_type))
-      && bidi_it->next_for_ws.charpos < bidi_it->charpos
-      /* If this character is already at base level, we don't need to
-        reset it, so avoid the potentially costly loop below.  */
-      && level != bidi_it->level_stack[0].level)
+      /* This means the informaition about WS resolution is not valid.  */
+      && bidi_it->next_for_ws.charpos < bidi_it->charpos)
     {
       int ch;
       ptrdiff_t clen = bidi_it->ch_len;
@@ -3340,7 +3343,7 @@ bidi_level_of_next_char (struct bidi_it *bidi_it)
       || bidi_it->orig_type == NEUTRAL_S
       || bidi_it->ch == '\n' || bidi_it->ch == BIDI_EOB
       || ((bidi_it->orig_type == NEUTRAL_WS
-          || bidi_it->orig_type == WEAK_BN
+          || bidi_it->orig_type == WEAK_BN /* L1/Retaining */
           || bidi_isolate_fmt_char (bidi_it->orig_type)
           || bidi_explicit_dir_char (bidi_it->ch))
          && (bidi_it->next_for_ws.type == NEUTRAL_B



reply via email to

[Prev in Thread] Current Thread [Next in Thread]