emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r107535: Prevent bidi reordering of r


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r107535: Prevent bidi reordering of rows and keys in the quail layout display.
Date: Thu, 08 Mar 2012 20:21:07 +0200
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 107535
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Thu 2012-03-08 20:21:07 +0200
message:
  Prevent bidi reordering of rows and keys in the quail layout display.
  
   lisp/international/quail.el (quail-insert-kbd-layout): Insert
   invisible LRM characters before each character in a keyboard
   layout cell, to prevent their reordering by bidi display engine.
   For details, see the discussion in
   http://lists.gnu.org/archive/html/emacs-devel/2012-03/msg00085.html.
modified:
  lisp/ChangeLog
  lisp/international/quail.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-03-08 11:32:57 +0000
+++ b/lisp/ChangeLog    2012-03-08 18:21:07 +0000
@@ -1,3 +1,11 @@
+2012-03-08  Eli Zaretskii  <address@hidden>
+
+       * international/quail.el (quail-insert-kbd-layout): Insert
+       invisible LRM characters before each character in a keyboard
+       layout cell, to prevent their reordering by bidi display engine.
+       For details, see the discussion in
+       http://lists.gnu.org/archive/html/emacs-devel/2012-03/msg00085.html.
+
 2012-03-08  Alan Mackenzie  <address@hidden>
 
        * progmodes/cc-cmds.el (c-mark-function): Make it leave a mark at

=== modified file 'lisp/international/quail.el'
--- a/lisp/international/quail.el       2012-03-07 18:48:07 +0000
+++ b/lisp/international/quail.el       2012-03-08 18:21:07 +0000
@@ -833,7 +833,15 @@
        (insert bar)
        (if (= (if (stringp lower) (string-width lower) (char-width lower)) 1)
            (insert " "))
-       (insert lower upper)
+       ;; Insert invisible LRM characters to force each keyboard row
+       ;; be rendered left to right, and also to prevent reordering of
+       ;; individual characters within each cell.  See
+       ;; http://lists.gnu.org/archive/html/emacs-devel/2012-03/msg00085.html
+       ;; for the reasons.
+       (insert (propertize (string ?\x200e) 'invisible t))
+       (insert lower)
+       (insert (propertize (string ?\x200e) 'invisible t))
+       (insert upper)
        (if (= (if (stringp upper) (string-width upper) (char-width upper)) 1)
            (insert " "))
        (setq i (+ i 2))
@@ -849,20 +857,21 @@
        ;;(delete-region pos (point)))
        (let ((from1 100) (to1 0) from2 to2)
          (while (not (eobp))
-           (if (looking-at "[| ]*$")
+           (if (looking-at "[| \u200e]*$")
                ;; The entire row is blank.
                (delete-region (point) (match-end 0))
              ;; Delete blank key columns at the head.
-             (if (looking-at " *\\(|    \\)+")
+             (if (looking-at " *\\(| \u200e \u200e  \\)+")
                  (subst-char-in-region (point) (match-end 0) ?| ? ))
              ;; Delete blank key columns at the tail.
-             (if (re-search-forward "\\(    |\\)+$" (line-end-position) t)
+             (if (re-search-forward "\\( \u200e \u200e  |\\)+$"
+                                    (line-end-position) t)
                  (delete-region (match-beginning 0) (point)))
              (beginning-of-line))
            ;; Calculate the start and end columns of a horizontal line.
            (if (eolp)
                (setq from2 from1 to2 to1)
-             (skip-chars-forward " ")
+             (skip-chars-forward " \u200e")
              (setq from2 (current-column))
              (end-of-line)
              (setq to2 (current-column))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]