emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r106623: Fix "C-x =" wrt display of s


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r106623: Fix "C-x =" wrt display of strong RTL characters and directional controls.
Date: Mon, 05 Dec 2011 19:46:27 +0200
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 106623
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Mon 2011-12-05 19:46:27 +0200
message:
  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.
modified:
  lisp/ChangeLog
  lisp/descr-text.el
  lisp/simple.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-12-05 15:23:56 +0000
+++ b/lisp/ChangeLog    2011-12-05 17:46:27 +0000
@@ -1,3 +1,11 @@
+2011-12-05  Eli Zaretskii  <address@hidden>
+
+       * 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  <address@hidden>
 
        * faces.el (read-color): Doc fix.

=== modified file 'lisp/descr-text.el'
--- a/lisp/descr-text.el        2011-12-04 08:02:42 +0000
+++ b/lisp/descr-text.el        2011-12-05 17:46:27 +0000
@@ -422,6 +422,20 @@
               (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),

=== modified file 'lisp/simple.el'
--- a/lisp/simple.el    2011-12-04 08:02:42 +0000
+++ b/lisp/simple.el    2011-12-05 17:46:27 +0000
@@ -1052,16 +1052,23 @@
 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 @@
                     (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)))


reply via email to

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