From e1b959a36f7b2b98b05db6ae7d4fe65ec7efdb6b Mon Sep 17 00:00:00 2001 From: Hunter Bown Date: Tue, 12 May 2026 01:29:15 -0500 Subject: [PATCH] fix(session_picker): stronger highlight on the selected row in dark terminals MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `/sessions` picker's selection background was subtle enough to disappear in low-contrast dark themes — keyboard navigation moved the focus indicator but the visual change between focused and unfocused rows was hard to notice, especially when running the TUI in a terminal with a near-black background. The selected row now renders with a bolded label on a stronger background so the focused row reads cleanly across the dark palettes the TUI ships with. The non-selected rows are unchanged so the change doesn't add visual noise on light terminals. Test pin: `build_list_lines_selected_row_uses_strong_highlight` ensures the rendered row at the selected index applies the expected modifier and background combination. Harvested from PR #1493 by @reidliu41 Co-Authored-By: Claude Opus 4.7 (1M context) --- CHANGELOG.md | 7 +++++++ crates/tui/src/tui/session_picker.rs | 29 +++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf4373be..597d988d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,13 @@ real world uses." ### Fixed +- **`/sessions` picker highlights the selected row more strongly + in dark terminals** (harvested from PR #1493 by **@reidliu41**). + Previously the selection background was subtle enough to lose + in low-contrast dark themes; keyboard navigation up/down didn't + obviously change which row was active. The selected row now + uses a bolded label on a stronger background so the focused row + reads cleanly across the dark palettes the TUI ships with. - **TUI input no longer freezes while long-running shell jobs flood stdout** (#1299, harvested from PR #1494 by **@CrepuscularIRIS / autoghclaw**). The job-panel refresh path diff --git a/crates/tui/src/tui/session_picker.rs b/crates/tui/src/tui/session_picker.rs index 40deeebe..49831839 100644 --- a/crates/tui/src/tui/session_picker.rs +++ b/crates/tui/src/tui/session_picker.rs @@ -491,7 +491,8 @@ fn build_list_lines( let style = if idx == selected { Style::default() .fg(palette::SELECTION_TEXT) - .bg(palette::SELECTION_BG) + .bg(palette::DEEPSEEK_BLUE) + .add_modifier(Modifier::BOLD) } else { Style::default().fg(palette::TEXT_PRIMARY) }; @@ -771,6 +772,32 @@ mod tests { } } + #[test] + fn build_list_lines_selected_row_uses_strong_highlight() { + let sessions = vec![ + test_session(1, "first session"), + test_session(2, "second session"), + ]; + let lines = build_list_lines(&sessions, 1, 80, 0, 5, false, "", "recent", false, None); + + let selected_line = lines + .iter() + .find(|line| { + line.spans + .iter() + .any(|span| span.content.contains("second session")) + }) + .expect("selected session should render"); + let span = selected_line + .spans + .first() + .expect("selected row should have a span"); + + assert_eq!(span.style.fg, Some(palette::SELECTION_TEXT)); + assert_eq!(span.style.bg, Some(palette::DEEPSEEK_BLUE)); + assert!(span.style.add_modifier.contains(Modifier::BOLD)); + } + #[test] fn ensure_selected_visible_updates_scroll_window() { let sessions = (0..10)