]> git.eshelyaron.com Git - emacs.git/commitdiff
Implement inhibit-bidi-mirroring; improve biditest.el.
authorEli Zaretskii <eliz@gnu.org>
Tue, 14 Oct 2014 13:17:16 +0000 (16:17 +0300)
committerEli Zaretskii <eliz@gnu.org>
Tue, 14 Oct 2014 13:17:16 +0000 (16:17 +0300)
src/xdisp.c
test/biditest.el

index 70a1a2b870321cd6dce775f4deede0e22aefc3ee..a1e78f1129a7f5e0f2b6e0bb31f5cc7ebd74376e 100644 (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.  */);
index 07bdcb7c55acee89a71d7a94f7cd7537ceeb8db6..4dd3a8c63cf40f08d0fdbdbc6cfcf7a2b59a9ce0 100644 (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
 ;;; 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)
       (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)