emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r107585: international/quail.el (quai


From: Kenichi Handa
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r107585: international/quail.el (quail-insert-kbd-layout): Surround each row by LRO and PDF instead of inserting many LRMs. Pad the left and right of each non-spacing marks. Insert invisible space between lower and upper characters to prevent composition.
Date: Mon, 12 Mar 2012 16:43:16 +0900
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 107585 [merge]
committer: Kenichi Handa <address@hidden>
branch nick: trunk
timestamp: Mon 2012-03-12 16:43:16 +0900
message:
  international/quail.el (quail-insert-kbd-layout): Surround each row by LRO 
and PDF instead of inserting many LRMs.  Pad the left and right of each 
non-spacing marks.  Insert invisible space between lower and upper characters 
to prevent composition.
modified:
  lisp/ChangeLog
  lisp/international/quail.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-03-12 04:10:59 +0000
+++ b/lisp/ChangeLog    2012-03-12 07:42:02 +0000
@@ -1,3 +1,10 @@
+2012-03-12  Kenichi Handa  <address@hidden>
+
+       * international/quail.el (quail-insert-kbd-layout): Surround each
+       row by LRO and PDF instead of inserting many LRMs.  Pad the left
+       and right of each non-spacing marks.  Insert invisible space
+       between lower and upper characters to prevent composition.
+
 2012-03-12  Stefan Monnier  <address@hidden>
 
        * minibuffer.el (minibuffer-complete): Don't get confused when the

=== modified file 'lisp/international/quail.el'
--- a/lisp/international/quail.el       2012-03-08 18:21:07 +0000
+++ b/lisp/international/quail.el       2012-03-12 07:42:02 +0000
@@ -825,28 +825,35 @@
       (setq i 0)
       (while (< i quail-keyboard-layout-len)
        (when (= (% i 30) 0)
+         ;; Insert LRO to avoid bidi-reordering of keyboard cells.
+         (insert (propertize (string ?\x202d) 'invisible t))
          (setq row (/ i 30))
          (if (> row 1)
              (insert-char 32 (+ row (/ (- row 2) 2)))))
        (setq lower (aref layout i)
              upper (aref layout (1+ i)))
        (insert bar)
-       (if (= (if (stringp lower) (string-width lower) (char-width lower)) 1)
+       (if (< (if (stringp lower) (string-width lower) (char-width lower)) 2)
            (insert " "))
-       ;; 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)
+       (if (and (characterp lower)
+                (eq (get-char-code-property lower 'general-category) 'Mn))
+           ;; Pad the left and right of non-spacing characters.
+           (setq lower (compose-string (string lower) 0 1
+                                       (format "\t%c\t" lower))))
+       (if (and (characterp upper)
+                (eq (get-char-code-property upper 'general-category) 'Mn))
+           ;; Pad the left and right of non-spacing characters.
+           (setq upper (compose-string (string upper) 0 1
+                                       (format "\t%c\t" upper))))
+       (insert lower (propertize " " 'invisible t) upper)
+       (if (< (if (stringp upper) (string-width upper) (char-width upper)) 2)
            (insert " "))
        (setq i (+ i 2))
        (if (= (% i 30) 0)
-           (insert bar "\n")))
+           (insert bar
+                   ;; Insert PDF to deny the previously inserted LRO.
+                   (propertize (string ?\x202c) 'invisible t)
+                   "\n")))
       ;; Insert horizontal lines while deleting blank key columns at the
       ;; beginning and end of each line.
       (save-restriction
@@ -857,21 +864,21 @@
        ;;(delete-region pos (point)))
        (let ((from1 100) (to1 0) from2 to2)
          (while (not (eobp))
-           (if (looking-at "[| \u200e]*$")
+           (if (looking-at "[| \u202c\u202d]*$")
                ;; The entire row is blank.
                (delete-region (point) (match-end 0))
              ;; Delete blank key columns at the head.
-             (if (looking-at " *\\(| \u200e \u200e  \\)+")
+             (if (looking-at "\u202d? *\\(|     \\)+")
                  (subst-char-in-region (point) (match-end 0) ?| ? ))
              ;; Delete blank key columns at the tail.
-             (if (re-search-forward "\\( \u200e \u200e  |\\)+$"
+             (if (re-search-forward "\\(     |\\)+\u202c?$"
                                     (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 " \u200e")
+             (skip-chars-forward " \u202d")
              (setq from2 (current-column))
              (end-of-line)
              (setq to2 (current-column))


reply via email to

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