From: Eli Zaretskii Date: Tue, 14 Oct 2014 13:17:16 +0000 (+0300) Subject: Implement inhibit-bidi-mirroring; improve biditest.el. X-Git-Tag: emacs-25.0.90~2635^2~679^2~50^2~6 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3fe73df071b1d354c7e35f30a105c3133c9c38a4;p=emacs.git Implement inhibit-bidi-mirroring; improve biditest.el. --- diff --git a/src/xdisp.c b/src/xdisp.c index 70a1a2b8703..a1e78f1129a 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -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. */); diff --git a/test/biditest.el b/test/biditest.el index 07bdcb7c55a..4dd3a8c63cf 100644 --- a/test/biditest.el +++ b/test/biditest.el @@ -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)