Allow disabling the BPA part of bidi reordering

* src/xdisp.c (syms_of_xdisp): New variable 'bidi-inhibit-bpa'.
* src/bidi.c (bidi_paired_bracket_type): If 'bidi-inhibit-bpa'
is non-nil, return BIDI_BRACKET_NONE for all characters.

* lisp/frame.el: Add 'bidi-inhibit-bpa' to the list of
variables whose changes require redisplay.  (Bug#38407)
This commit is contained in:
Eli Zaretskii 2019-11-28 17:00:33 +02:00
parent b05aa8d742
commit 5629af9cbe
3 changed files with 11 additions and 2 deletions

View file

@ -2736,7 +2736,8 @@ See also `toggle-frame-maximized'."
display-fill-column-indicator-column
display-fill-column-indicator-character
bidi-paragraph-direction
bidi-display-reordering))
bidi-display-reordering
bidi-inhibit-bpa))
(provide 'frame)

View file

@ -404,7 +404,7 @@ bidi_mirror_char (int c)
static bidi_bracket_type_t
bidi_paired_bracket_type (int c)
{
if (c == BIDI_EOB)
if (c == BIDI_EOB || bidi_inhibit_bpa)
return BIDI_BRACKET_NONE;
if (c < 0 || c > MAX_CHAR)
emacs_abort ();

View file

@ -34839,6 +34839,14 @@ Intended for use during debugging and for testing bidi display;
see biditest.el in the test suite. */);
inhibit_bidi_mirroring = false;
DEFVAR_BOOL ("bidi-inhibit-bpa", bidi_inhibit_bpa,
doc: /* Non-nil means inhibit the Bidirectional Parentheses Algorithm.
Disabling the BPA makes redisplay faster, but might produce incorrect
display reordering of bidirectional text with embedded parentheses and
other bracket characters whose 'paired-bracket' Unicode property is
non-nil, see `get-char-code-property'. */);
bidi_inhibit_bpa = false;
#ifdef GLYPH_DEBUG
DEFVAR_BOOL ("inhibit-try-window-id", inhibit_try_window_id,
doc: /* Inhibit try_window_id display optimization. */);