From 5f26879bcd4190750c79cbff92454e400166ca98 Mon Sep 17 00:00:00 2001 From: JJ Liebig Date: Sun, 13 Sep 2026 20:17:42 +0400 Subject: fix(ui): keep muted sidebar and tab labels readable (#4062) refs #2692 --- src/client/shell/tests/mod.rs | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'src/client/shell/tests/mod.rs') diff --git a/src/client/shell/tests/mod.rs b/src/client/shell/tests/mod.rs index 497ce2c6..a308c1f9 100644 --- a/src/client/shell/tests/mod.rs +++ b/src/client/shell/tests/mod.rs @@ -133,6 +133,41 @@ fn surface() -> PaneSurfaceFrame { } } +fn frame_rows(frame: &FrameData) -> Vec { + frame + .cells + .chunks(frame.width as usize) + .map(|row| row.iter().map(|cell| cell.symbol.as_str()).collect()) + .collect() +} + +/// Absolute cell position of `needle` inside `area`, for style assertions. +fn cell_symbol_position(frame: &FrameData, area: Rect, needle: &str) -> (u16, u16) { + let rows = frame_rows(frame); + for y in area.y..area.bottom().min(frame.height) { + let row = &rows[y as usize]; + let slice = row + .chars() + .skip(area.x as usize) + .take(area.width as usize) + .collect::(); + if let Some(byte) = slice.find(needle) { + let column = slice[..byte].chars().count() as u16 + area.x; + return (column, y); + } + } + let visible = (area.y..area.bottom().min(frame.height)) + .map(|y| { + rows[y as usize] + .chars() + .skip(area.x as usize) + .take(area.width as usize) + .collect::() + }) + .collect::>(); + panic!("symbol {needle:?} not found in {area:?}: {visible:?}"); +} + fn pane_scroll_result( offset_from_bottom: u64, max_offset_from_bottom: u64, -- cgit v1.2.3