From: Eli Zaretskii Date: Thu, 6 Mar 2025 14:27:00 +0000 (+0200) Subject: Fix images on the mode line under 'mode-line-compact' X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d50bb2b97e87c503353a27f2f20e2d80a6096e27;p=emacs.git Fix images on the mode line under 'mode-line-compact' * src/xdisp.c (display_mode_line): When 'mode-line-compact' is in effect, don't remove spaces that have a 'display' property on them. (Bug#76761) (cherry picked from commit cd051ef78e465bd70f9d89ba251288204cbb0383) --- diff --git a/src/xdisp.c b/src/xdisp.c index 5ca713f099c..2ecfeec215f 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -27612,15 +27612,31 @@ display_mode_line (struct window *w, enum face_id face_id, Lisp_Object format) int c = fetch_string_char_advance (mode_string, &i, &i_byte); if (c == ' ' && prev == ' ') { - display_string (NULL, - Fsubstring (mode_string, make_fixnum (start), - make_fixnum (i - 1)), - Qnil, 0, 0, &it, 0, 0, 0, - STRING_MULTIBYTE (mode_string)); - /* Skip past the rest of the space characters. */ - while (c == ' ' && i < SCHARS (mode_string)) - c = fetch_string_char_advance (mode_string, &i, &i_byte); - start = i - 1; + Lisp_Object prev_pos = make_fixnum (i - 1); + + /* SPC characters with 'display' properties are not + really "empty", since they have non-trivial visual + effects on the mode line. */ + if (NILP (Fget_text_property (prev_pos, Qdisplay, + mode_string))) + { + display_string (NULL, + Fsubstring (mode_string, + make_fixnum (start), + prev_pos), + Qnil, 0, 0, &it, 0, 0, 0, + STRING_MULTIBYTE (mode_string)); + /* Skip past the rest of the space characters. */ + while (c == ' ' && i < SCHARS (mode_string) + && NILP (Fget_text_property (make_fixnum (i), + Qdisplay, + mode_string))) + { + c = fetch_string_char_advance (mode_string, + &i, &i_byte); + } + start = i - 1; + } } prev = c; }