improv: show ellipsis if nothing else fits

If buffer is small enough that char+ellipsis doesn't fit, then show
ellipsis alone. If buffer is smaller than ellipsis, show nothing.
This commit is contained in:
Hojjat 2026-02-20 15:25:02 -07:00 committed by Jeremy Soller
parent d304a49536
commit a8873a0536
3 changed files with 31 additions and 0 deletions

View file

@ -183,3 +183,16 @@ fn test_ellipsize_bidi_isolates_middle_bug() {
.canvas(220, 50)
.validate_text_rendering();
}
#[test]
fn test_ellipsize_ltr_middle_small_buffer() {
let attrs = Attrs::new().family(Family::Name("Inter"));
DrawTestCfg::new("ellipsize_ltr_middle_small_buffer")
.font_size(20., 26.)
.font_attrs(attrs)
.text("A/B Tester x8 Mono")
.wrap(Wrap::None)
.ellipsize(Ellipsize::Middle(EllipsizeHeightLimit::Lines(1)))
.canvas(30, 100)
.validate_text_rendering();
}