From aa8399be9507ebc789063117c71d02efb5fb7251 Mon Sep 17 00:00:00 2001 From: aiongg <67543387+aiongg@users.noreply.github.com> Date: Fri, 23 Oct 2026 14:14:15 -0400 Subject: [PATCH] Grid: #### is sized by the width of #, so it fits its cell in every font (#2378) A number too wide for its column is drawn as ####, with as many # as fit. The count used the width of 0, and in fonts where # is wider than 0 the hashes ran past the cell edge. accounting_fill::too_wide_fill_number_shows_hashes_not_a_clipped_value caught it on FreeBSD and on Linux machines without the CI font set. --- crates/ui-egui/src/grid.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/grid.rs b/crates/ui-egui/src/grid.rs index 40ef2c8e9..590294904 100644 --- a/crates/ui-egui/src/grid.rs +++ b/crates/ui-egui/src/grid.rs @@ -1300,7 +1300,9 @@ pub(crate) fn paint_quadrant( // Numbers and dates never overflow: they show #### when too narrow. let hashed = !shrunk && (numeric || matches!(v, Value::Number(_))) && w > avail_w - 2.0 * pad && st.align.h != HAlign::Fill; if hashed { - let n = ((avail_w - 2.0 * pad) / char_w).floor().max(1.0) as usize; + // Measured on `#` itself: it is wider than `0` in some fonts, and #### must fit its cell. + let hash_w = p.layout_no_wrap("#".to_string(), font.clone(), color).size().x.max(1.0); + let n = ((avail_w - 2.0 * pad) / hash_w).floor().max(1.0) as usize; galley = p.layout_no_wrap("#".repeat(n), font.clone(), color); w = galley.size().x; }