aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2014-10-04 15:09:46 +0300
committerEli Zaretskii2014-10-04 15:09:46 +0300
commit16f54832c0ddd0cc553d4231d95778ed91ed5218 (patch)
tree2ee0c26e52ce00ac9adb31bd1e7c45e1f097dafe
parent6382f0a1d64caa4a688b6a264a4693ffe93c63ca (diff)
downloademacs-16f54832c0ddd0cc553d4231d95778ed91ed5218.tar.gz
emacs-16f54832c0ddd0cc553d4231d95778ed91ed5218.zip
Fixed a crash in 'C-x =' and in RLE followed by PDF; fixed 'C-x =' display.
-rw-r--r--lisp/descr-text.el15
-rw-r--r--lisp/simple.el20
-rw-r--r--src/bidi.c15
3 files changed, 32 insertions, 18 deletions
diff --git a/lisp/descr-text.el b/lisp/descr-text.el
index 02ed55b5bdf..7d5964cb368 100644
--- a/lisp/descr-text.el
+++ b/lisp/descr-text.el
@@ -434,13 +434,20 @@ relevant to POS."
434 code (encode-char char charset))) 434 code (encode-char char charset)))
435 (setq code char)) 435 (setq code char))
436 (cond 436 (cond
437 ;; Append a PDF character to directional embeddings and 437 ;; Append a PDF character to left-to-right directional
438 ;; overrides, to prevent potential messup of the following 438 ;; embeddings and overrides, to prevent potential messup of the
439 ;; text. 439 ;; following text.
440 ((memq char '(?\x202a ?\x202b ?\x202d ?\x202e)) 440 ((memq char '(?\x202a ?\x202d))
441 (setq char-description 441 (setq char-description
442 (concat char-description 442 (concat char-description
443 (propertize (string ?\x202c) 'invisible t)))) 443 (propertize (string ?\x202c) 'invisible t))))
444 ;; Append a PDF character followed by LRM to right-to-left
445 ;; directional embeddings and overrides, to prevent potential
446 ;; messup of the following numerical text.
447 ((memq char '(?\x202b ?\x202e))
448 (setq char-description
449 (concat char-description
450 (propertize (string ?\x202c ?\x200e) 'invisible t))))
444 ;; Append a LRM character to any strong character to avoid 451 ;; Append a LRM character to any strong character to avoid
445 ;; messing up the numerical codepoint. 452 ;; messing up the numerical codepoint.
446 ((memq (get-char-code-property char 'bidi-class) '(R AL)) 453 ((memq (get-char-code-property char 'bidi-class) '(R AL))
diff --git a/lisp/simple.el b/lisp/simple.el
index cdff8d7fc3a..69c64b6de7b 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1216,15 +1216,19 @@ in *Help* buffer. See also the command `describe-char'."
1216 (interactive "P") 1216 (interactive "P")
1217 (let* ((char (following-char)) 1217 (let* ((char (following-char))
1218 (bidi-fixer 1218 (bidi-fixer
1219 (cond ((memq char '(?\x202a ?\x202b ?\x202d ?\x202e)) 1219 ;; If the character is one of LRE, LRO, RLE, RLO, it will
1220 ;; If the character is one of LRE, LRO, RLE, RLO, it 1220 ;; start a directional embedding, which could completely
1221 ;; will start a directional embedding, which could 1221 ;; disrupt the rest of the line (e.g., RLO will display the
1222 ;; completely disrupt the rest of the line (e.g., RLO 1222 ;; rest of the line right-to-left). So we put an invisible
1223 ;; will display the rest of the line right-to-left). 1223 ;; PDF character after these characters, to end the
1224 ;; So we put an invisible PDF character after these 1224 ;; embedding, which eliminates any effects on the rest of
1225 ;; characters, to end the embedding, which eliminates 1225 ;; the line. For RLE and RLO we also append an invisible
1226 ;; any effects on the rest of the line. 1226 ;; LRM, to avoid reordering the following numerical
1227 ;; characters.
1228 (cond ((memq char '(?\x202a ?\x202d))
1227 (propertize (string ?\x202c) 'invisible t)) 1229 (propertize (string ?\x202c) 'invisible t))
1230 ((memq char '(?\x202b ?\x202e))
1231 (propertize (string ?\x202c ?\x200e) 'invisible t))
1228 ;; Strong right-to-left characters cause reordering of 1232 ;; Strong right-to-left characters cause reordering of
1229 ;; the following numerical characters which show the 1233 ;; the following numerical characters which show the
1230 ;; codepoint, so append LRM to countermand that. 1234 ;; codepoint, so append LRM to countermand that.
diff --git a/src/bidi.c b/src/bidi.c
index aad867887b1..eee2a9c623b 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -1763,10 +1763,10 @@ bidi_resolve_explicit (struct bidi_it *bidi_it)
1763 } 1763 }
1764 else 1764 else
1765 { 1765 {
1766 /* LRI, RLI, and FSI increment, and PDF decrements, the 1766 /* LRI, RLI, and FSI increment, and PDF decrements, the
1767 embedding level of the _following_ characters, so we must 1767 embedding level of the _following_ characters, so we must
1768 first look at the type of the previous character to support 1768 first look at the type of the previous character to support
1769 that. */ 1769 that. */
1770 switch (prev_type) 1770 switch (prev_type)
1771 { 1771 {
1772 case RLI: /* X5a */ 1772 case RLI: /* X5a */
@@ -2518,7 +2518,7 @@ bidi_level_of_next_char (struct bidi_it *bidi_it)
2518 { 2518 {
2519 int bob = ((bidi_it->string.s || STRINGP (bidi_it->string.lstring)) 2519 int bob = ((bidi_it->string.s || STRINGP (bidi_it->string.lstring))
2520 ? 0 : 1); 2520 ? 0 : 1);
2521 bidi_type_t prev_type = bidi_it->prev.type; 2521 bidi_type_t prev_type = bidi_it->type;
2522 bidi_type_t type_for_neutral = bidi_it->next_for_neutral.type; 2522 bidi_type_t type_for_neutral = bidi_it->next_for_neutral.type;
2523 ptrdiff_t pos_for_neutral = bidi_it->next_for_neutral.charpos; 2523 ptrdiff_t pos_for_neutral = bidi_it->next_for_neutral.charpos;
2524 2524
@@ -2553,7 +2553,10 @@ bidi_level_of_next_char (struct bidi_it *bidi_it)
2553 && bidi_explicit_dir_char (bidi_it->ch) 2553 && bidi_explicit_dir_char (bidi_it->ch)
2554 && type_for_neutral != UNKNOWN_BT 2554 && type_for_neutral != UNKNOWN_BT
2555 && bidi_it->charpos < pos_for_neutral) 2555 && bidi_it->charpos < pos_for_neutral)
2556 type = prev_type; 2556 {
2557 type = prev_type;
2558 eassert (type != UNKNOWN_BT);
2559 }
2557 } 2560 }
2558 else 2561 else
2559 type = UNKNOWN_BT; 2562 type = UNKNOWN_BT;