Commit fe903c5a authored by Eli Zaretskii's avatar Eli Zaretskii

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.
parent 953e7abf
Pipeline #4766 passed with stage
in 53 minutes and 45 seconds
......@@ -1746,7 +1746,18 @@ should be ignored. */)
CHECK_STRING (string);
validate_subarray (string, from, to, SCHARS (string), &frompos, &topos);
if (! STRING_MULTIBYTE (string))
error ("Attempt to shape unibyte text");
ptrdiff_t i;
for (i = SBYTES (string) - 1; i >= 0; i--)
if (!ASCII_CHAR_P (SREF (string, i)))
error ("Attempt to shape unibyte text");
/* STRING is a pure-ASCII string, so we can convert it (or,
rather, its copy) to multibyte and use that thereafter. */
Lisp_Object string_copy = Fconcat (1, &string);
string = string_copy;
frombyte = string_char_to_byte (string, frompos);
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