emacs-31 f13e409cf4f: Fix min-width in mode-line constructs

Eli Zaretskii <[email protected]> Sat, 4 Jul 2026 08:10:57 -0400 (EDT)
Newsgroups gmane.emacs.diffs
Message-ID <[email protected]>
branch: emacs-31
commit f13e409cf4ff7c1833553b1743d9d224c81ffb98
Author: Eli Zaretskii <[email protected]>
Commit: Eli Zaretskii <[email protected]>

    Fix min-width in mode-line constructs
    
    * src/xdisp.c (handle_display_prop): To handle min-width's end on
    the mode line, call display_min_width also when starting a new
    string.  This is needed because mode line supports :propertize
    application to a list of strings, and we only need to apply the
    effect of min-width at the end of the last element.  (Bug#81354)
---
 src/xdisp.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/xdisp.c b/src/xdisp.c
index 8513139d77e..5377d5e8ada 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -5960,7 +5960,11 @@ handle_display_prop (struct it *it)
 	  pos = IT_STRING_CHARPOS (*it);
 	  start = 0;
 	}
-      if (pos > start)
+      if (pos > start
+	  /* If we are iterating over a string and display-stack level
+	     is zero, this is a mode line or similar.  The case of
+	     it->sp > 0 is handled in set_iterator_to_next.  */
+	  || (STRINGP (object) && it->sp == 0))
 	display_min_width (it, pos, objwin, Qnil);
     }