aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPip Cet2025-02-24 20:46:49 +0000
committerPip Cet2025-02-25 16:36:17 +0000
commit1f891898d490380ea59f21fa8ea4e7f7364a1a79 (patch)
treed43b3ff1e7d8b4ac32af38f43de239576d277d2d
parent6f3067324aa83c0e6a44193c81a443d2c98e43d8 (diff)
downloademacs-1f891898d490380ea59f21fa8ea4e7f7364a1a79.tar.gz
emacs-1f891898d490380ea59f21fa8ea4e7f7364a1a79.zip
Handle multibyte mode line spec chars (bug#76517)
* src/xdisp.c (display_mode_element): Make 'c' an 'int'. Use 'string_char_and_length' to fetch the character from a multibyte string, not 'SREF'.
-rw-r--r--src/xdisp.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index b6d9094e684..adc0f4d7e0a 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -27755,7 +27755,7 @@ display_mode_element (struct it *it, int depth, int field_width, int precision,
27755 case Lisp_String: 27755 case Lisp_String:
27756 { 27756 {
27757 /* A string: output it and check for %-constructs within it. */ 27757 /* A string: output it and check for %-constructs within it. */
27758 unsigned char c; 27758 int c;
27759 ptrdiff_t offset = 0; 27759 ptrdiff_t offset = 0;
27760 27760
27761 if (SCHARS (elt) > 0 27761 if (SCHARS (elt) > 0
@@ -27926,6 +27926,15 @@ display_mode_element (struct it *it, int depth, int field_width, int precision,
27926 while ((c = SREF (elt, offset++)) >= '0' && c <= '9') 27926 while ((c = SREF (elt, offset++)) >= '0' && c <= '9')
27927 field = field * 10 + c - '0'; 27927 field = field * 10 + c - '0';
27928 27928
27929 /* "%" could be followed by a multibyte character. */
27930 if (STRING_MULTIBYTE (elt))
27931 {
27932 int length;
27933 offset--;
27934 c = string_char_and_length (SDATA (elt) + offset, &length);
27935 offset += length;
27936 }
27937
27929 /* Don't pad beyond the total padding allowed. */ 27938 /* Don't pad beyond the total padding allowed. */
27930 if (field_width - n > 0 && field > field_width - n) 27939 if (field_width - n > 0 && field > field_width - n)
27931 field = field_width - n; 27940 field = field_width - n;