fix(session_picker): stronger highlight on the selected row in dark terminals

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) <noreply@anthropic.com>
This commit is contained in:
Hunter Bown
2026-05-12 01:29:15 -05:00
parent 2950cadc36
commit e1b959a36f
2 changed files with 35 additions and 1 deletions
+7
View File
@@ -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
+28 -1
View File
@@ -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)