]> git.eshelyaron.com Git - emacs.git/commitdiff
Fixed a crash in 'C-x =' and in RLE followed by PDF; fixed 'C-x =' display.
authorEli Zaretskii <eliz@gnu.org>
Sat, 4 Oct 2014 12:09:46 +0000 (15:09 +0300)
committerEli Zaretskii <eliz@gnu.org>
Sat, 4 Oct 2014 12:09:46 +0000 (15:09 +0300)
lisp/descr-text.el
lisp/simple.el
src/bidi.c

index 02ed55b5bdf70247dc37899a4e0bb93fbc45ec3d..7d5964cb368946be4e33a040956bc844f58fe93a 100644 (file)
@@ -434,13 +434,20 @@ relevant to POS."
                     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))
+       ;; Append a PDF character to left-to-right directional
+       ;; embeddings and overrides, to prevent potential messup of the
+       ;; following text.
+       ((memq char '(?\x202a ?\x202d))
        (setq char-description
              (concat char-description
                      (propertize (string ?\x202c) 'invisible t))))
+       ;; Append a PDF character followed by LRM to right-to-left
+       ;; directional embeddings and overrides, to prevent potential
+       ;; messup of the following numerical text.
+       ((memq char '(?\x202b ?\x202e))
+       (setq char-description
+             (concat char-description
+                     (propertize (string ?\x202c ?\x200e) '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))
index cdff8d7fc3a99dc50ef7b64989a0c67b83b019bc..69c64b6de7b11e86760e3e7488a636d42c1802a0 100644 (file)
@@ -1216,15 +1216,19 @@ in *Help* buffer.  See also the command `describe-char'."
   (interactive "P")
   (let* ((char (following-char))
         (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.
+         ;; 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.  For RLE and RLO we also append an invisible
+         ;; LRM, to avoid reordering the following numerical
+         ;; characters.
+         (cond ((memq char '(?\x202a ?\x202d))
                 (propertize (string ?\x202c) 'invisible t))
+               ((memq char '(?\x202b ?\x202e))
+                (propertize (string ?\x202c ?\x200e) 'invisible t))
                ;; Strong right-to-left characters cause reordering of
                ;; the following numerical characters which show the
                ;; codepoint, so append LRM to countermand that.
index aad867887b1e751211b8027b8d66f4ab823ce37c..eee2a9c623bb71aa8f465bc0a684f1996588f9c9 100644 (file)
@@ -1763,10 +1763,10 @@ bidi_resolve_explicit (struct bidi_it *bidi_it)
     }
   else
     {
-       /* LRI, RLI, and FSI increment, and PDF decrements, the
-          embedding level of the _following_ characters, so we must
-          first look at the type of the previous character to support
-          that.  */
+      /* LRI, RLI, and FSI increment, and PDF decrements, the
+        embedding level of the _following_ characters, so we must
+        first look at the type of the previous character to support
+        that.  */
       switch (prev_type)
        {
        case RLI:       /* X5a */
@@ -2518,7 +2518,7 @@ bidi_level_of_next_char (struct bidi_it *bidi_it)
     {
       int bob = ((bidi_it->string.s || STRINGP (bidi_it->string.lstring))
                 ? 0 : 1);
-      bidi_type_t prev_type = bidi_it->prev.type;
+      bidi_type_t prev_type = bidi_it->type;
       bidi_type_t type_for_neutral = bidi_it->next_for_neutral.type;
       ptrdiff_t pos_for_neutral = bidi_it->next_for_neutral.charpos;
 
@@ -2553,7 +2553,10 @@ bidi_level_of_next_char (struct bidi_it *bidi_it)
          && bidi_explicit_dir_char (bidi_it->ch)
          && type_for_neutral != UNKNOWN_BT
          && bidi_it->charpos < pos_for_neutral)
-       type = prev_type;
+       {
+         type = prev_type;
+         eassert (type != UNKNOWN_BT);
+       }
     }
   else
     type = UNKNOWN_BT;