diff options
| author | Eli Zaretskii | 2012-03-08 20:21:07 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2012-03-08 20:21:07 +0200 |
| commit | 6ff6e72f7993e06f831428e0ad8ccc0c5bf2524a (patch) | |
| tree | 16acb97af1eba84948f738e7740931b8acaa2c53 /lisp | |
| parent | 9cec78342c003b09a961c1b501eba55e14ef32cc (diff) | |
| download | emacs-6ff6e72f7993e06f831428e0ad8ccc0c5bf2524a.tar.gz emacs-6ff6e72f7993e06f831428e0ad8ccc0c5bf2524a.zip | |
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.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/international/quail.el | 19 |
2 files changed, 22 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7673b1fc429..0e931572f01 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2012-03-08 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * international/quail.el (quail-insert-kbd-layout): Insert | ||
| 4 | invisible LRM characters before each character in a keyboard | ||
| 5 | layout cell, to prevent their reordering by bidi display engine. | ||
| 6 | For details, see the discussion in | ||
| 7 | http://lists.gnu.org/archive/html/emacs-devel/2012-03/msg00085.html. | ||
| 8 | |||
| 1 | 2012-03-08 Alan Mackenzie <acm@muc.de> | 9 | 2012-03-08 Alan Mackenzie <acm@muc.de> |
| 2 | 10 | ||
| 3 | * progmodes/cc-cmds.el (c-mark-function): Make it leave a mark at | 11 | * progmodes/cc-cmds.el (c-mark-function): Make it leave a mark at |
diff --git a/lisp/international/quail.el b/lisp/international/quail.el index 48aa013c674..4e068741e43 100644 --- a/lisp/international/quail.el +++ b/lisp/international/quail.el | |||
| @@ -833,7 +833,15 @@ The format of KBD-LAYOUT is the same as `quail-keyboard-layout'." | |||
| 833 | (insert bar) | 833 | (insert bar) |
| 834 | (if (= (if (stringp lower) (string-width lower) (char-width lower)) 1) | 834 | (if (= (if (stringp lower) (string-width lower) (char-width lower)) 1) |
| 835 | (insert " ")) | 835 | (insert " ")) |
| 836 | (insert lower upper) | 836 | ;; Insert invisible LRM characters to force each keyboard row |
| 837 | ;; be rendered left to right, and also to prevent reordering of | ||
| 838 | ;; individual characters within each cell. See | ||
| 839 | ;; http://lists.gnu.org/archive/html/emacs-devel/2012-03/msg00085.html | ||
| 840 | ;; for the reasons. | ||
| 841 | (insert (propertize (string ?\x200e) 'invisible t)) | ||
| 842 | (insert lower) | ||
| 843 | (insert (propertize (string ?\x200e) 'invisible t)) | ||
| 844 | (insert upper) | ||
| 837 | (if (= (if (stringp upper) (string-width upper) (char-width upper)) 1) | 845 | (if (= (if (stringp upper) (string-width upper) (char-width upper)) 1) |
| 838 | (insert " ")) | 846 | (insert " ")) |
| 839 | (setq i (+ i 2)) | 847 | (setq i (+ i 2)) |
| @@ -849,20 +857,21 @@ The format of KBD-LAYOUT is the same as `quail-keyboard-layout'." | |||
| 849 | ;;(delete-region pos (point))) | 857 | ;;(delete-region pos (point))) |
| 850 | (let ((from1 100) (to1 0) from2 to2) | 858 | (let ((from1 100) (to1 0) from2 to2) |
| 851 | (while (not (eobp)) | 859 | (while (not (eobp)) |
| 852 | (if (looking-at "[| ]*$") | 860 | (if (looking-at "[| \u200e]*$") |
| 853 | ;; The entire row is blank. | 861 | ;; The entire row is blank. |
| 854 | (delete-region (point) (match-end 0)) | 862 | (delete-region (point) (match-end 0)) |
| 855 | ;; Delete blank key columns at the head. | 863 | ;; Delete blank key columns at the head. |
| 856 | (if (looking-at " *\\(| \\)+") | 864 | (if (looking-at " *\\(| \u200e \u200e \\)+") |
| 857 | (subst-char-in-region (point) (match-end 0) ?| ? )) | 865 | (subst-char-in-region (point) (match-end 0) ?| ? )) |
| 858 | ;; Delete blank key columns at the tail. | 866 | ;; Delete blank key columns at the tail. |
| 859 | (if (re-search-forward "\\( |\\)+$" (line-end-position) t) | 867 | (if (re-search-forward "\\( \u200e \u200e |\\)+$" |
| 868 | (line-end-position) t) | ||
| 860 | (delete-region (match-beginning 0) (point))) | 869 | (delete-region (match-beginning 0) (point))) |
| 861 | (beginning-of-line)) | 870 | (beginning-of-line)) |
| 862 | ;; Calculate the start and end columns of a horizontal line. | 871 | ;; Calculate the start and end columns of a horizontal line. |
| 863 | (if (eolp) | 872 | (if (eolp) |
| 864 | (setq from2 from1 to2 to1) | 873 | (setq from2 from1 to2 to1) |
| 865 | (skip-chars-forward " ") | 874 | (skip-chars-forward " \u200e") |
| 866 | (setq from2 (current-column)) | 875 | (setq from2 (current-column)) |
| 867 | (end-of-line) | 876 | (end-of-line) |
| 868 | (setq to2 (current-column)) | 877 | (setq to2 (current-column)) |