diff options
| author | Eli Zaretskii | 2023-02-04 13:34:42 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2023-02-04 13:34:42 +0200 |
| commit | 1a123feb1815d6a2ee4ba6abb747fb62fd8b9e0f (patch) | |
| tree | d6a8531ffc9a16fd30cd3424715a97d22dfc8b05 /src | |
| parent | 8870b54db995e4e8fc6ecfcdd85c4b0e6545dd29 (diff) | |
| download | emacs-1a123feb1815d6a2ee4ba6abb747fb62fd8b9e0f.tar.gz emacs-1a123feb1815d6a2ee4ba6abb747fb62fd8b9e0f.zip | |
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)
Diffstat (limited to 'src')
| -rw-r--r-- | src/bidi.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/bidi.c b/src/bidi.c index e01251263be..93875d243e4 100644 --- a/src/bidi.c +++ b/src/bidi.c | |||
| @@ -3300,12 +3300,15 @@ bidi_level_of_next_char (struct bidi_it *bidi_it) | |||
| 3300 | it belongs to a sequence of WS characters preceding a newline | 3300 | it belongs to a sequence of WS characters preceding a newline |
| 3301 | or a TAB or a paragraph separator. */ | 3301 | or a TAB or a paragraph separator. */ |
| 3302 | if ((bidi_it->orig_type == NEUTRAL_WS | 3302 | if ((bidi_it->orig_type == NEUTRAL_WS |
| 3303 | || bidi_it->orig_type == WEAK_BN | 3303 | || (bidi_it->orig_type == WEAK_BN |
| 3304 | /* If this BN character is already at base level, we don't | ||
| 3305 | need to consider resetting it, since I1 and I2 below | ||
| 3306 | will not change the level, so avoid the potentially | ||
| 3307 | costly loop below. */ | ||
| 3308 | && level != bidi_it->level_stack[0].level) | ||
| 3304 | || bidi_isolate_fmt_char (bidi_it->orig_type)) | 3309 | || bidi_isolate_fmt_char (bidi_it->orig_type)) |
| 3305 | && bidi_it->next_for_ws.charpos < bidi_it->charpos | 3310 | /* This means the informaition about WS resolution is not valid. */ |
| 3306 | /* If this character is already at base level, we don't need to | 3311 | && bidi_it->next_for_ws.charpos < bidi_it->charpos) |
| 3307 | reset it, so avoid the potentially costly loop below. */ | ||
| 3308 | && level != bidi_it->level_stack[0].level) | ||
| 3309 | { | 3312 | { |
| 3310 | int ch; | 3313 | int ch; |
| 3311 | ptrdiff_t clen = bidi_it->ch_len; | 3314 | ptrdiff_t clen = bidi_it->ch_len; |
| @@ -3340,7 +3343,7 @@ bidi_level_of_next_char (struct bidi_it *bidi_it) | |||
| 3340 | || bidi_it->orig_type == NEUTRAL_S | 3343 | || bidi_it->orig_type == NEUTRAL_S |
| 3341 | || bidi_it->ch == '\n' || bidi_it->ch == BIDI_EOB | 3344 | || bidi_it->ch == '\n' || bidi_it->ch == BIDI_EOB |
| 3342 | || ((bidi_it->orig_type == NEUTRAL_WS | 3345 | || ((bidi_it->orig_type == NEUTRAL_WS |
| 3343 | || bidi_it->orig_type == WEAK_BN | 3346 | || bidi_it->orig_type == WEAK_BN /* L1/Retaining */ |
| 3344 | || bidi_isolate_fmt_char (bidi_it->orig_type) | 3347 | || bidi_isolate_fmt_char (bidi_it->orig_type) |
| 3345 | || bidi_explicit_dir_char (bidi_it->ch)) | 3348 | || bidi_explicit_dir_char (bidi_it->ch)) |
| 3346 | && (bidi_it->next_for_ws.type == NEUTRAL_B | 3349 | && (bidi_it->next_for_ws.type == NEUTRAL_B |