]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix images on the mode line under 'mode-line-compact'
authorEli Zaretskii <eliz@gnu.org>
Thu, 6 Mar 2025 14:27:00 +0000 (16:27 +0200)
committerEshel Yaron <me@eshelyaron.com>
Sun, 9 Mar 2025 10:19:42 +0000 (11:19 +0100)
* 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)

src/xdisp.c

index 5ca713f099ce5ea16b0d15412a8891b1630299ea..2ecfeec215f91d223cb2b506413ab65eb42454b4 100644 (file)
@@ -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;
            }