aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/descr-text.el14
-rw-r--r--lisp/simple.el32
3 files changed, 42 insertions, 12 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ff9a8ad19df..8cb089d523e 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
12011-12-05 Eli Zaretskii <eliz@gnu.org>
2
3 * descr-text.el (describe-char): Fix display of strong
4 right-to-left characters and directional embeddings and overrides.
5
6 * simple.el (what-cursor-position): Fix display of codepoints of
7 strong right-to-left characters.
8
12011-12-05 Chong Yidong <cyd@gnu.org> 92011-12-05 Chong Yidong <cyd@gnu.org>
2 10
3 * faces.el (read-color): Doc fix. 11 * faces.el (read-color): Doc fix.
diff --git a/lisp/descr-text.el b/lisp/descr-text.el
index f285fe42332..47f96e8d68f 100644
--- a/lisp/descr-text.el
+++ b/lisp/descr-text.el
@@ -422,6 +422,20 @@ as well as widgets, buttons, overlays, and text properties."
422 (setq charset (char-charset char) 422 (setq charset (char-charset char)
423 code (encode-char char charset))) 423 code (encode-char char charset)))
424 (setq code char)) 424 (setq code char))
425 (cond
426 ;; Append a PDF character to directional embeddings and
427 ;; overrides, to prevent potential messup of the following
428 ;; text.
429 ((memq char '(?\x202a ?\x202b ?\x202d ?\x202e))
430 (setq char-description
431 (concat char-description
432 (propertize (string ?\x202c) 'invisible t))))
433 ;; Append a LRM character to any strong character to avoid
434 ;; messing up the numerical codepoint.
435 ((memq (get-char-code-property char 'bidi-class) '(R AL))
436 (setq char-description
437 (concat char-description
438 (propertize (string ?\x200e) 'invisible t)))))
425 (when composition 439 (when composition
426 ;; When the composition is trivial (i.e. composed only with the 440 ;; When the composition is trivial (i.e. composed only with the
427 ;; current character itself without any alternate characters), 441 ;; current character itself without any alternate characters),
diff --git a/lisp/simple.el b/lisp/simple.el
index b718546248b..e9d88a210cf 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1052,16 +1052,23 @@ In addition, with prefix argument, show details about that character
1052in *Help* buffer. See also the command `describe-char'." 1052in *Help* buffer. See also the command `describe-char'."
1053 (interactive "P") 1053 (interactive "P")
1054 (let* ((char (following-char)) 1054 (let* ((char (following-char))
1055 ;; If the character is one of LRE, LRO, RLE, RLO, it will 1055 (bidi-fixer
1056 ;; start a directional embedding, which could completely 1056 (cond ((memq char '(?\x202a ?\x202b ?\x202d ?\x202e))
1057 ;; disrupt the rest of the line (e.g., RLO will display the 1057 ;; If the character is one of LRE, LRO, RLE, RLO, it
1058 ;; rest of the line right-to-left). So we put an invisible 1058 ;; will start a directional embedding, which could
1059 ;; PDF character after these characters, to end the 1059 ;; completely disrupt the rest of the line (e.g., RLO
1060 ;; embedding, which eliminates any effects on the rest of the 1060 ;; will display the rest of the line right-to-left).
1061 ;; line. 1061 ;; So we put an invisible PDF character after these
1062 (pdf (if (memq char '(?\x202a ?\x202b ?\x202d ?\x202e)) 1062 ;; characters, to end the embedding, which eliminates
1063 (propertize (string ?\x202c) 'invisible t) 1063 ;; any effects on the rest of the line.
1064 "")) 1064 (propertize (string ?\x202c) 'invisible t))
1065 ;; Strong right-to-left characters cause reordering of
1066 ;; the following numerical characters which show the
1067 ;; codepoint, so append LRM to countermand that.
1068 ((memq (get-char-code-property char 'bidi-class) '(R AL))
1069 (propertize (string ?\x200e) 'invisible t))
1070 (t
1071 "")))
1065 (beg (point-min)) 1072 (beg (point-min))
1066 (end (point-max)) 1073 (end (point-max))
1067 (pos (point)) 1074 (pos (point))
@@ -1125,14 +1132,15 @@ in *Help* buffer. See also the command `describe-char'."
1125 (if (< char 256) 1132 (if (< char 256)
1126 (single-key-description char) 1133 (single-key-description char)
1127 (buffer-substring-no-properties (point) (1+ (point)))) 1134 (buffer-substring-no-properties (point) (1+ (point))))
1128 pdf encoding-msg pos total percent beg end col hscroll) 1135 bidi-fixer
1136 encoding-msg pos total percent beg end col hscroll)
1129 (message "Char: %s%s %s point=%d of %d (%d%%) column=%d%s" 1137 (message "Char: %s%s %s point=%d of %d (%d%%) column=%d%s"
1130 (if enable-multibyte-characters 1138 (if enable-multibyte-characters
1131 (if (< char 128) 1139 (if (< char 128)
1132 (single-key-description char) 1140 (single-key-description char)
1133 (buffer-substring-no-properties (point) (1+ (point)))) 1141 (buffer-substring-no-properties (point) (1+ (point))))
1134 (single-key-description char)) 1142 (single-key-description char))
1135 pdf encoding-msg pos total percent col hscroll)))))) 1143 bidi-fixer encoding-msg pos total percent col hscroll))))))
1136 1144
1137;; Initialize read-expression-map. It is defined at C level. 1145;; Initialize read-expression-map. It is defined at C level.
1138(let ((m (make-sparse-keymap))) 1146(let ((m (make-sparse-keymap)))