aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2024-10-03 13:32:10 +0300
committerEli Zaretskii2024-10-03 13:32:10 +0300
commitd5b02b7ad6fc67a10176a2ce56e14592252d3ed7 (patch)
treed343de25ccffae875e386cdfd7c457047405f994 /src
parent3d609375f99cd0d4b7a441802d4616bad385e31d (diff)
downloademacs-d5b02b7ad6fc67a10176a2ce56e14592252d3ed7.tar.gz
emacs-d5b02b7ad6fc67a10176a2ce56e14592252d3ed7.zip
Avoid assertion violations due to wrong 'min-width' property
* src/xdisp.c (display_min_width): Ignore 'min-width' display specs which produce stretch glyphs wider than the window when lines are truncated. (Bug#73600)
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 7883c579815..c74e81a3933 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -5689,7 +5689,13 @@ display_min_width (struct it *it, ptrdiff_t charpos,
5689 XCAR (it->min_width_property), 5689 XCAR (it->min_width_property),
5690 font, true, NULL); 5690 font, true, NULL);
5691 width -= it->current_x - it->min_width_start; 5691 width -= it->current_x - it->min_width_start;
5692 w = list1 (make_int (width)); 5692 /* It makes no sense to try to obey min-width which yields
5693 a stretch that ends beyond the visible portion of the
5694 window if we are truncating screen lines. If we are
5695 requested to do that, some Lisp program went awry. */
5696 if (!(it->line_wrap == TRUNCATE
5697 && it->current_x + width > it->last_visible_x))
5698 w = list1 (make_int (width));
5693 } 5699 }
5694 else 5700 else
5695#endif 5701#endif
@@ -5699,19 +5705,24 @@ display_min_width (struct it *it, ptrdiff_t charpos,
5699 NULL, true, NULL); 5705 NULL, true, NULL);
5700 width -= (it->current_x - it->min_width_start) / 5706 width -= (it->current_x - it->min_width_start) /
5701 FRAME_COLUMN_WIDTH (it->f); 5707 FRAME_COLUMN_WIDTH (it->f);
5702 w = make_int (width); 5708 if (!(it->line_wrap == TRUNCATE
5709 && it->current_x + width > it->last_visible_x))
5710 w = make_int (width);
5703 } 5711 }
5704 5712
5705 /* Insert the stretch glyph. */ 5713 /* Insert the stretch glyph. */
5706 it->object = list3 (Qspace, QCwidth, w); 5714 if (!NILP (w))
5707 produce_stretch_glyph (it);
5708 if (it->area == TEXT_AREA)
5709 { 5715 {
5710 it->current_x += it->pixel_width; 5716 it->object = list3 (Qspace, QCwidth, w);
5717 produce_stretch_glyph (it);
5718 if (it->area == TEXT_AREA)
5719 {
5720 it->current_x += it->pixel_width;
5711 5721
5712 if (it->continuation_lines_width 5722 if (it->continuation_lines_width
5713 && it->string_from_prefix_prop_p) 5723 && it->string_from_prefix_prop_p)
5714 it->wrap_prefix_width = it->current_x; 5724 it->wrap_prefix_width = it->current_x;
5725 }
5715 } 5726 }
5716 it->min_width_property = Qnil; 5727 it->min_width_property = Qnil;
5717 } 5728 }