From: Gerd Möllmann Date: Tue, 4 Feb 2025 05:09:52 +0000 (+0100) Subject: Fix min-width display spec handling (bug#76014) X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=420da376d923fc0a47be7e46255492b4df0d35f1;p=emacs.git Fix min-width display spec handling (bug#76014) * src/xdisp.c (display_min_width): Take into account that the output may already be longer than the specified min-width. (cherry picked from commit f9a1f449d9cbe57f7312a5327d08e28e71c16882) --- diff --git a/src/xdisp.c b/src/xdisp.c index 6f82b2527d2..2de6dfc620b 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -5646,7 +5646,7 @@ get_display_property (ptrdiff_t charpos, Lisp_Object prop, Lisp_Object object) /* Handle 'display' property '(min-width (WIDTH))' at CHARPOS in OBJECT. OBJECT can be a buffer (or nil, which means the current buffer) or a - string. MIN_WIDTH is the value of min-width spec that we expect to + string. WIDTH_SPEC is the value of min-width spec that we expect to process. */ static void display_min_width (struct it *it, ptrdiff_t charpos, @@ -5692,8 +5692,9 @@ display_min_width (struct it *it, ptrdiff_t charpos, a stretch that ends beyond the visible portion of the window if we are truncating screen lines. If we are requested to do that, some Lisp program went awry. */ - if (!(it->line_wrap == TRUNCATE - && it->current_x + width > it->last_visible_x)) + if (width > 0 + && !(it->line_wrap == TRUNCATE + && it->current_x + width > it->last_visible_x)) w = list1 (make_int (width)); } else @@ -5704,8 +5705,9 @@ display_min_width (struct it *it, ptrdiff_t charpos, NULL, true, NULL); width -= (it->current_x - it->min_width_start) / FRAME_COLUMN_WIDTH (it->f); - if (!(it->line_wrap == TRUNCATE - && it->current_x + width > it->last_visible_x)) + if (width > 0 + && !(it->line_wrap == TRUNCATE + && it->current_x + width > it->last_visible_x)) w = make_int (width); }