Skip to content

Terminal interface to find, download, and stream movies, TV shows, and live TV using local media players.

fix(tui): unify search item selection background across slot

Samir Hossains3f0a467c5b9c
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b02d7b6..e431541 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -30,6 +30,9 @@
- Removed redundant `Poster Graphics` toggle from Settings Hub (`/settings` $\to$ Appearance) and `config.json`, delegating terminal graphics strictly to automatic native GPU protocol detection (Kitty, Sixel, iTerm2).
### Fixed
+- **Unified Search Result Selection Background**:
+ - Unified search result card selection highlight across the entire item slot (`item_area`), eliminating fragmented background rendering between cursor indicators, posters, and text columns.
+ - Removed redundant poster sub-area buffer clearing before image rendering, preventing selection background clipping and black gutter artifacts on the right edge of posters.
- **High-Precision Playback Tracking & Race Elimination**:
- Eliminated wall-clock race condition where process elapsed time overwrote exact seek/pause positions from `mpv` and `iina-cli` Lua trackers.
- Hardened `moviebox_tracker.lua` with latched completion: reaching $\ge 90\%$ playback or EOF permanently latches completion, preventing shutdown events from reverting completed status.
diff --git a/src/tui/screens/home.rs b/src/tui/screens/home.rs
index 7778df9..5c59bba 100644
--- a/src/tui/screens/home.rs
+++ b/src/tui/screens/home.rs
@@ -1732,11 +1732,7 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)
let selected_bg = theme.surface0.fg.unwrap_or(theme.base);
frame.render_widget(
Block::default().style(Style::default().bg(selected_bg)),
- text_area,
- );
- frame.render_widget(
- Block::default().style(Style::default().bg(selected_bg)),
- highlight_area,
+ item_area,
);
}
@@ -1794,7 +1790,6 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)
}
if let Some((_, proto)) = state.search_poster_protocols.peek(&res.id) {
if !state.has_active_modal() {
- crate::tui::clear_area(frame, p_area, theme);
frame.render_widget(ratatui_image::Image::new(proto), p_area);
}
}
@@ -3616,4 +3611,44 @@ mod tests {
assert_eq!(text.x, 25);
assert_eq!(text.width, 65);
}
+
+ #[test]
+ fn test_search_result_selection_continuous_background() {
+ let backend = TestBackend::new(100, 30);
+ let mut terminal = Terminal::new(backend).unwrap();
+ let mut state = AppState {
+ input_mode: InputMode::Normal,
+ search_query: "Matrix".into(),
+ search_results: vec![crate::models::SearchResult {
+ id: "test_1".into(),
+ title: "The Matrix".into(),
+ stype: 1,
+ release_year: "1999".into(),
+ cover_url: None,
+ season: 0,
+ episode: 0,
+ provider: crate::providers::models::ProviderKind::MovieBox,
+ }],
+ ..Default::default()
+ };
+ state.search_list_state.select(Some(0));
+ let theme = Theme::mocha();
+ let selected_bg = theme.surface0.fg.unwrap_or(theme.base);
+
+ terminal
+ .draw(|frame| {
+ let area = Rect::new(0, 0, 100, 30);
+ draw(frame, area, &mut state, &theme);
+ })
+ .unwrap();
+
+ let buffer = terminal.backend().buffer();
+ for x in 0..100 {
+ assert_eq!(
+ buffer[(x, 2)].style().bg,
+ Some(selected_bg),
+ "mismatch at x={x}"
+ );
+ }
+ }
}