Commit 71cc0b74 authored by Eli Zaretskii's avatar Eli Zaretskii
Browse files

Fix "C-x =" wrt display of strong RTL characters and directional controls.

 lisp/descr-text.el (describe-char): Fix display of strong
 right-to-left characters and directional embeddings and overrides.
 lisp/simple.el (what-cursor-position): Fix display of codepoints of
 strong right-to-left characters by appending LRM.
parent a7cdbfce
2011-12-05 Eli Zaretskii <eliz@gnu.org>
* descr-text.el (describe-char): Fix display of strong
right-to-left characters and directional embeddings and overrides.
* simple.el (what-cursor-position): Fix display of codepoints of
strong right-to-left characters.
2011-12-05 Chong Yidong <cyd@gnu.org>
* faces.el (read-color): Doc fix.
......
......@@ -422,6 +422,20 @@ as well as widgets, buttons, overlays, and text properties."
(setq charset (char-charset char)
code (encode-char char charset)))
(setq code char))
(cond
;; Append a PDF character to directional embeddings and
;; overrides, to prevent potential messup of the following
;; text.
((memq char '(?\x202a ?\x202b ?\x202d ?\x202e))
(setq char-description
(concat char-description
(propertize (string ?\x202c) 'invisible t))))
;; Append a LRM character to any strong character to avoid
;; messing up the numerical codepoint.
((memq (get-char-code-property char 'bidi-class) '(R AL))
(setq char-description
(concat char-description
(propertize (string ?\x200e) 'invisible t)))))
(when composition
;; When the composition is trivial (i.e. composed only with the
;; current character itself without any alternate characters),
......
......@@ -1052,16 +1052,23 @@ In addition, with prefix argument, show details about that character
in *Help* buffer. See also the command `describe-char'."
(interactive "P")
(let* ((char (following-char))
;; If the character is one of LRE, LRO, RLE, RLO, it will
;; start a directional embedding, which could completely
;; disrupt the rest of the line (e.g., RLO will display the
;; rest of the line right-to-left). So we put an invisible
;; PDF character after these characters, to end the
;; embedding, which eliminates any effects on the rest of the
;; line.
(pdf (if (memq char '(?\x202a ?\x202b ?\x202d ?\x202e))
(propertize (string ?\x202c) 'invisible t)
""))
(bidi-fixer
(cond ((memq char '(?\x202a ?\x202b ?\x202d ?\x202e))
;; If the character is one of LRE, LRO, RLE, RLO, it
;; will start a directional embedding, which could
;; completely disrupt the rest of the line (e.g., RLO
;; will display the rest of the line right-to-left).
;; So we put an invisible PDF character after these
;; characters, to end the embedding, which eliminates
;; any effects on the rest of the line.
(propertize (string ?\x202c) 'invisible t))
;; Strong right-to-left characters cause reordering of
;; the following numerical characters which show the
;; codepoint, so append LRM to countermand that.
((memq (get-char-code-property char 'bidi-class) '(R AL))
(propertize (string ?\x200e) 'invisible t))
(t
"")))
(beg (point-min))
(end (point-max))
(pos (point))
......@@ -1125,14 +1132,15 @@ in *Help* buffer. See also the command `describe-char'."
(if (< char 256)
(single-key-description char)
(buffer-substring-no-properties (point) (1+ (point))))
pdf encoding-msg pos total percent beg end col hscroll)
bidi-fixer
encoding-msg pos total percent beg end col hscroll)
(message "Char: %s%s %s point=%d of %d (%d%%) column=%d%s"
(if enable-multibyte-characters
(if (< char 128)
(single-key-description char)
(buffer-substring-no-properties (point) (1+ (point))))
(single-key-description char))
pdf encoding-msg pos total percent col hscroll))))))
bidi-fixer encoding-msg pos total percent col hscroll))))))
;; Initialize read-expression-map. It is defined at C level.
(let ((m (make-sparse-keymap)))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment