aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2020-02-08 15:41:36 +0200
committerEli Zaretskii2020-02-08 15:41:36 +0200
commitfe903c5ab7354b97f80ecf1b01ca3ff1027be446 (patch)
treee3bb6b5cc872e5e0bb075985ba8306f47ba58382
parent953e7abf5befc560d1c88b6dfbbeb5f52d60e8b6 (diff)
downloademacs-fe903c5ab7354b97f80ecf1b01ca3ff1027be446.tar.gz
emacs-fe903c5ab7354b97f80ecf1b01ca3ff1027be446.zip
Allow composition of pure-ASCII strings in the mode line
* src/composite.c (Fcomposition_get_gstring): Allow unibyte strings if they are pure ASCII, by copying text into a multibyte string.
-rw-r--r--src/composite.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/composite.c b/src/composite.c
index 53e6930b5f2..05365cfb65e 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -1746,7 +1746,18 @@ should be ignored. */)
1746 CHECK_STRING (string); 1746 CHECK_STRING (string);
1747 validate_subarray (string, from, to, SCHARS (string), &frompos, &topos); 1747 validate_subarray (string, from, to, SCHARS (string), &frompos, &topos);
1748 if (! STRING_MULTIBYTE (string)) 1748 if (! STRING_MULTIBYTE (string))
1749 error ("Attempt to shape unibyte text"); 1749 {
1750 ptrdiff_t i;
1751
1752 for (i = SBYTES (string) - 1; i >= 0; i--)
1753 if (!ASCII_CHAR_P (SREF (string, i)))
1754 error ("Attempt to shape unibyte text");
1755 /* STRING is a pure-ASCII string, so we can convert it (or,
1756 rather, its copy) to multibyte and use that thereafter. */
1757 Lisp_Object string_copy = Fconcat (1, &string);
1758 STRING_SET_MULTIBYTE (string_copy);
1759 string = string_copy;
1760 }
1750 frombyte = string_char_to_byte (string, frompos); 1761 frombyte = string_char_to_byte (string, frompos);
1751 } 1762 }
1752 1763