summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2021-11-06 12:33:26 +0200
committerEli Zaretskii <eliz@gnu.org>2021-11-06 12:33:26 +0200
commit26089c8c446de4851143a42b2005844d152e8e99 (patch)
tree3afc9ca7fb59dbe8a7da8fcb130948d19edc82ac /src
parent5b963e481546157cd7ebf02441a2002374169d86 (diff)
downloademacs-26089c8c446de4851143a42b2005844d152e8e99.tar.gz
emacs-26089c8c446de4851143a42b2005844d152e8e99.tar.bz2
emacs-26089c8c446de4851143a42b2005844d152e8e99.zip
Improve detection of suspicious reordering in source code
* src/bidi.c (bidi_find_first_overridden): Detect suspiciously reordered EN types as well. * test/src/xdisp-tests.el (xdisp-tests--find-directional-overrides-case-1): Rename from 'xdisp-tests--find-directional-overrides'. (xdisp-tests--find-directional-overrides-case-2): New test.
Diffstat (limited to 'src')
-rw-r--r--src/bidi.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/bidi.c b/src/bidi.c
index 3cdcd7da1b5..511b4602fec 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -3589,10 +3589,11 @@ bidi_find_first_overridden (struct bidi_it *bidi_it)
|| (type == STRONG_L
&& (bidi_it->orig_type == STRONG_R
|| bidi_it->orig_type == STRONG_AL))
- /* Detect strong L or R types that were pushed into higher
- embedding levels (and will thus reorder) by explicit
- embeddings and isolates. */
- || (bidi_it->orig_type == STRONG_L
+ /* Detect strong L or R types or WEAK_EN types that were
+ pushed into higher embedding levels (and will thus
+ reorder) by explicit embeddings and isolates. */
+ || ((bidi_it->orig_type == STRONG_L
+ || bidi_it->orig_type == WEAK_EN)
&& bidi_it->level_stack[bidi_it->stack_idx].level > max_l2r)
|| ((bidi_it->orig_type == STRONG_R
|| bidi_it->orig_type == STRONG_AL)