Implement inhibit-bidi-mirroring; improve biditest.el.

This commit is contained in:
Eli Zaretskii 2014-10-14 16:17:16 +03:00
parent c1621a49bd
commit 3fe73df071
2 changed files with 30 additions and 4 deletions

View file

@ -6876,7 +6876,8 @@ get_next_display_element (struct it *it)
is R..." */
/* FIXME: Do we need an exception for characters from display
tables? */
if (it->bidi_p && it->bidi_it.type == STRONG_R)
if (it->bidi_p && it->bidi_it.type == STRONG_R
&& !inhibit_bidi_mirroring)
it->c = bidi_mirror_char (it->c);
/* Map via display table or translate control characters.
IT->c, IT->len etc. have been set to the next character by
@ -30803,6 +30804,12 @@ To add a prefix to continuation lines, use `wrap-prefix'. */);
doc: /* Non-nil means don't free realized faces. Internal use only. */);
inhibit_free_realized_faces = 0;
DEFVAR_BOOL ("inhibit-bidi-mirroring", inhibit_bidi_mirroring,
doc: /* Non-nil means don't mirror characters even when bidi context requires that.
Intended for use during debugging and for testing bidi display;
see biditest.el in the test suite. */);
inhibit_bidi_mirroring = 0;
#ifdef GLYPH_DEBUG
DEFVAR_BOOL ("inhibit-try-window-id", inhibit_try_window_id,
doc: /* Inhibit try_window_id display optimization. */);

View file

@ -1,6 +1,6 @@
;;; biditest.el --- test bidi reordering in GNU Emacs display engine.
;; Copyright (C) 2013 Free Software Foundation, Inc.
;; Copyright (C) 2013-2014 Free Software Foundation, Inc.
;; Author: Eli Zaretskii
;; Maintainer: FSF
@ -30,7 +30,13 @@
;;; Code:
(defun biditest-generate-testfile (input-file output-file)
""
"Generate a bidi test file OUTPUT-FILE from data in INPUT-FILE.
INPUT-FILE should be in the format of the BidiCharacterTest.txt file
available from the Unicode site, as part of the UCD database, see
http://www.unicode.org/Public/UCD/latest/ucd/BidiCharacterTest.txt.
The resulting file should be viewed with `inhibit-bidi-mirroring' set to t."
(let ((output-buf (get-buffer-create "*biditest-output*"))
(lnum 1)
tbuf)
@ -96,7 +102,20 @@
(message "Generating output in %s ... done" output-file))))
(defun biditest-create-test ()
""
"Create a test file for testing the Emacs bidirectional display.
The resulting file should be viewed with `inhibit-bidi-mirroring' set to t."
(biditest-generate-testfile (pop command-line-args-left)
(or (pop command-line-args-left)
"biditest.txt")))
;; A handy function for displaying the resolved bidi levels.
(defun bidi-levels ()
"Display the resolved bidirectional levels of characters on current line.
The results can be compared with the levels stated in the
BidiCharacterTest.txt file."
(interactive)
(message "%s" (bidi-resolved-levels)))
(define-key global-map [f8] 'bidi-levels)