Terminal interface to find, download, and stream movies, TV shows, and live TV using local media players.
feat: Advanced UI/UX and Terminal Ergonomics Overhaul
Samir Hossainsb35a587a5239
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex e43be72..c50cbcc 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -2,6 +2,20 @@## [Unreleased]+### Changed+- **Responsive Mode Tabs**: Mode tabs on compact viewports dynamically abbreviate to `<76` (`[Ctrl+S] Stream`) and ultra-compact `<58` (`[S] Stream`), protecting them against collisions with the right-aligned utility bar.+- **TV Mode Logo Responsiveness**: Terminal width `<80` triggers the narrower 33-column compact logo to render in TV mode, establishing clean margins on medium setups.+- **Hitbox Splitting**: Synchronized horizontal clicks for mode tabs and the `[?] Help`/`[q] Quit` widgets by enforcing an exact `saturating_sub(19)` boundary layout.+- **Bounded Hitbox**: Addressed dropdown autocompletion leakage. Mouse click events are now strictly clipped inside the computed dynamic bounds of the search suggestion dropdown list.+- **Normal Mode Direct Clear Shortcut**: Pressing `c` or `C` in `InputMode::Normal` clears the active search query instantly and clears search view states when not in an active download.+- **Single-Column Grid Sequencing**: Standardized `<Left>` and `<Right>` movement behaviors in single-column grids so that `jump = 1` enforces granular sequential traversal.+- **Vertical Picker Scaling**: Budget capacity for Picker rows has shifted to `(height - 6).clamp(4, 14)`, effectively granting 14 visible rows on a standard 24-row height layout.+- **Help Layout Rendering Safety**: Wide but vertically short environments safely fall back to scrollable single-column views instead of broken two-column layout.+- **Update Component Layout**: Brought the auto-updater window entirely into parity via `ModalFrame`, granting background area clearing overlays and standard unified outlines.+- **Confirmation Footer Buttons**: Dropped redundant confirmation footers to inject dynamic, formatted `[ Download ] [ Cancel ]` dialog responses seamlessly inside confirmation views.+- **Synopsis Clean Formatting**: Wrapped synopses auto-strip trailing punctuations (`.`, `,`, `!`, `?`, `:`, `;`) before truncating with an ellipsis (`…`).+- **NO_COLOR Adjustments**: Added standard `Modifier::REVERSED` rendering on active item rows across Pickers and Results where `ColorSupport::NoColor` is enforced.+### Added- **Centralized UI widgets subsystem (`src/tui/widgets`)**: Standardized single-line text inputfields (`render_single_line_input`), viewport-accurate Ratatui scrollbars (`render_scrollbar`),diff --git a/src/tui/app/keyboard.rs b/src/tui/app/keyboard.rsindex 912d219..7640e6b 100644--- a/src/tui/app/keyboard.rs+++ b/src/tui/app/keyboard.rs@@ -977,6 +977,13 @@ impl App {self.action_sender.send(Action::Refresh).ok();}}+ KeyCode::Char('c') | KeyCode::Char('C')+ if self.state.download_progress.is_none() =>+ {+ self.state.clear_search_state();+ self.state.input_mode = InputMode::Normal;+ self.state.set_status_default("Search cleared.");+ }KeyCode::Char('o') | KeyCode::Char('O')if self.state.input_mode == InputMode::Normal&& self.state.is_tv_mode =>diff --git a/src/tui/app/mouse.rs b/src/tui/app/mouse.rsindex 278bd6a..adf57d9 100644--- a/src/tui/app/mouse.rs+++ b/src/tui/app/mouse.rs@@ -376,10 +376,11 @@ impl App {if row == rows.rects[rows.mode_row].y {if compact {- if col < area.width / 2 {- self.handle_home_mode_click(col, area.width, true);+ let util_split = area.width.saturating_sub(19);+ if col < util_split {+ self.handle_home_mode_click(col, util_split, true);} else {- self.handle_home_util_click(col, area.width, true);+ self.handle_home_util_click(col.saturating_sub(util_split), 19, true);}} else {self.handle_home_mode_click(col, area.width, false);@@ -430,7 +431,13 @@ impl App {);let start_y = search_bar_area.bottom();- if row >= start_y && (row - start_y) < visible_count as u16 {+ let container_w = search_bar_area.width.max(48);+ let container_x = search_bar_area.x;+ if col >= container_x+ && col < container_x + container_w+ && row >= start_y+ && (row - start_y) < visible_count as u16+ {let clicked_idx = suggestion_offset + (row - start_y) as usize;if let Some(query) = self.state.search_suggestions.get(clicked_idx).cloned() {self.action_senderdiff --git a/src/tui/app/navigation.rs b/src/tui/app/navigation.rsindex eb5e981..d2862bb 100644--- a/src/tui/app/navigation.rs+++ b/src/tui/app/navigation.rs@@ -688,11 +688,7 @@ impl App {Action::MoveLeft => {if self.state.active_screen == Screen::Home {let current = self.state.search_list_state.selected().unwrap_or(0);- let jump = if self.result_grid_columns() > 1 {- 1- } else {- self.state.effective_visible_items().max(1)- };+ let jump = 1;if current > jump {self.state.search_list_state.select(Some(current - jump));} else {@@ -714,11 +710,7 @@ impl App {Action::MoveRight => {if self.state.active_screen == Screen::Home {let current = self.state.search_list_state.selected().unwrap_or(0);- let jump = if self.result_grid_columns() > 1 {- 1- } else {- self.state.effective_visible_items().max(1)- };+ let jump = 1;let total = self.state.search_results.len();if current + jump < total {self.state.search_list_state.select(Some(current + jump));diff --git a/src/tui/app/run.rs b/src/tui/app/run.rsindex c7c55c7..2c9c66f 100644--- a/src/tui/app/run.rs+++ b/src/tui/app/run.rs@@ -691,7 +691,7 @@ impl App {if let Some((version, notes)) = &self.state.update_available {use ratatui::layout::Alignment;use ratatui::text::{Line, Span};- use ratatui::widgets::{Block, Borders, Paragraph};+ use ratatui::widgets::Paragraph;let layout = crate::tui::overlay::update_modal_layout(area, notes);let popup_area = layout.popup_area;@@ -704,7 +704,12 @@ impl App {.filter(|l| !l.is_empty()).collect();- crate::tui::overlay::clear_modal_area(frame, area, popup_area, &self.theme);+ let inner_area = crate::tui::widgets::ModalFrame::new(+ "Update Available",+ &self.theme,+ self.state.basic_terminal,+ )+ .render(frame, popup_area, area);let mut text = vec![Line::from(vec![Span::styled(@@ -807,16 +812,8 @@ impl App {.alignment(Alignment::Center),);- let block = Block::default()- .title(" Update Available ")- .title_alignment(Alignment::Center)- .title_style(self.theme.title)- .borders(Borders::ALL)- .border_type(crate::tui::overlay::border_type(self.state.basic_terminal))- .border_style(self.theme.border_focus);-- let popup = Paragraph::new(text).block(block);- frame.render_widget(popup, popup_area);+ let popup = Paragraph::new(text);+ frame.render_widget(popup, inner_area);}}}diff --git a/src/tui/overlay.rs b/src/tui/overlay.rsindex eeb8cfa..fccfe27 100644--- a/src/tui/overlay.rs+++ b/src/tui/overlay.rs@@ -11,7 +11,7 @@ use crate::tui::theme::Theme;const MAX_PICKER_ROWS_CAP: usize = 14;pub(crate) fn max_picker_rows(area: Rect) -> usize {- (area.height.saturating_sub(6) as usize / 2).clamp(4, MAX_PICKER_ROWS_CAP)+ (area.height.saturating_sub(6) as usize).clamp(4, MAX_PICKER_ROWS_CAP)}pub use crate::models::{Notification, NotificationKind};@@ -188,8 +188,7 @@ pub fn confirmation(.render(frame, popup, area);let sections = Layout::vertical([Constraint::Length(summary.len() as u16),- Constraint::Length(1),- Constraint::Length(1),+ Constraint::Length(2),]).split(inner);frame.render_widget(@@ -198,7 +197,7 @@ pub fn confirmation();let selected_style = selection_style(theme, basic_terminal);- let actions = Line::from(vec![+ let actions = vec![Span::styled(" Download ",if confirm_selected {@@ -216,32 +215,8 @@ pub fn confirmation(selected_style},),- ]);- frame.render_widget(- Paragraph::new(actions).alignment(Alignment::Center),- sections[1],- );- let footer = if sections[2].width < 44 {- Line::from(vec![- key_hint("←→", "Choose", theme),- Span::raw(" "),- key_hint("Enter", "OK", theme),- Span::raw(" "),- key_hint("Esc", "Back", theme),- ])- } else {- Line::from(vec![- key_hint("←→", "Choose", theme),- Span::raw(" "),- key_hint("Enter", "Confirm", theme),- Span::raw(" "),- key_hint("Esc", "Back", theme),- ])- };- frame.render_widget(- Paragraph::new(footer).alignment(Alignment::Center),- sections[2],- );+ ];+ crate::tui::widgets::render_modal_footer(frame, sections[1], actions, theme);}pub fn notifications(@@ -405,7 +380,10 @@ pub(crate) fn key_hint(key: &str, action: &str, theme: &Theme) -> Span<'static>}pub(crate) fn selection_style(theme: &Theme, basic_terminal: bool) -> Style {- let style = theme.text.add_modifier(Modifier::BOLD);+ let mut style = theme.text.add_modifier(Modifier::BOLD);+ if crate::tui::theme::ColorSupport::current() == crate::tui::theme::ColorSupport::NoColor {+ style = style.add_modifier(Modifier::REVERSED);+ }if basic_terminal {style.add_modifier(Modifier::UNDERLINED)} else {diff --git a/src/tui/screens/details.rs b/src/tui/screens/details.rsindex d804655..afa2c3f 100644--- a/src/tui/screens/details.rs+++ b/src/tui/screens/details.rs@@ -554,6 +554,9 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)if max_width >= ellipsis_w {let trimmed =crate::tui::text::truncate_width(last, max_width.saturating_sub(ellipsis_w));+ let trimmed = trimmed+ .trim_end_matches(['.', ',', '!', '?', ':', ';'])+ .trim_end();*last = format!("{trimmed}{ellipsis}");}}diff --git a/src/tui/screens/help.rs b/src/tui/screens/help.rsindex 8e74a14..9d7cb81 100644--- a/src/tui/screens/help.rs+++ b/src/tui/screens/help.rs@@ -261,7 +261,10 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &AppState, theme: &Theme) {let content_width = help_text.iter().map(Line::width).max().unwrap_or(42) as u16;let capacity = area.height.saturating_sub(6).max(4) as usize;- let two_columns = area.width >= 90;+ let mut two_columns = area.width >= 90;+ if two_columns && capacity < help_text.len().div_ceil(2) {+ two_columns = false;+ }let required_lines = if two_columns {help_text.len().div_ceil(2)diff --git a/src/tui/screens/home.rs b/src/tui/screens/home.rsindex 7dbce99..df5821d 100644--- a/src/tui/screens/home.rs+++ b/src/tui/screens/home.rs@@ -119,7 +119,7 @@ pub(crate) fn landing_split(basic_terminal: bool,) -> (HomeLayoutTier, LandingRows) {let tier = HomeLayoutTier::for_width(area.width);- let compact_logo = tier.is_compact();+ let compact_logo = tier.is_compact() || (tv_mode && area.width < 80);let effective_basic = basic_terminal || compact_logo;let logo_height = if effective_basic { 2 } else { 6 };let logo_width = if effective_basic {@@ -743,10 +743,32 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)render_favorites_landing(frame, vertical_chunks[rows.favorites], state, theme);}- let ctrl_s = crate::tui::text::ctrl_key("S");- let ctrl_t = crate::tui::text::ctrl_key("T");- let ctrl_a = crate::tui::text::ctrl_key("A");- let ctrl_p = crate::tui::text::ctrl_key("P");+ let compact_tabs = area.width < 76;+ let ultra_compact_tabs = area.width < 58;++ let ctrl_s = if ultra_compact_tabs {+ "S".to_string()+ } else {+ crate::tui::text::ctrl_key("S")+ };+ let ctrl_t = if ultra_compact_tabs {+ "T".to_string()+ } else {+ crate::tui::text::ctrl_key("T")+ };+ let ctrl_a = if ultra_compact_tabs {+ "A".to_string()+ } else {+ crate::tui::text::ctrl_key("A")+ };+ let ctrl_p = if ultra_compact_tabs {+ "P".to_string()+ } else {+ crate::tui::text::ctrl_key("P")+ };++ let stream_label = if compact_tabs { "Stream" } else { "Streaming" };+ let addon_label = if compact_tabs { "Addon" } else { "Addons" };let current_mode = state.mode();let mut mode_tabs: Vec<Vec<Span>> = Vec::new();@@ -765,7 +787,7 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)spans.push(Span::styled("[", theme.text_dim));spans.push(Span::styled(&ctrl_s, theme.shortcut));spans.push(Span::styled("] ", theme.text_dim));- spans.push(Span::styled("Streaming", theme.text_dim));+ spans.push(Span::styled(stream_label, theme.text_dim));}mode_tabs.push(spans);}@@ -793,7 +815,7 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)if current_mode == crate::tui::state::AppMode::Addon {spans.push(Span::styled("[ ", theme.text_dim));spans.push(Span::styled(- "Addons",+ if compact_tabs { "Addon" } else { "Addons" },theme.highlight.add_modifier(Modifier::BOLD),));spans.push(Span::styled(" ]", theme.text_dim));@@ -801,7 +823,7 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)spans.push(Span::styled("[", theme.text_dim));spans.push(Span::styled(&ctrl_a, theme.shortcut));spans.push(Span::styled("] ", theme.text_dim));- spans.push(Span::styled("Addons", theme.text_dim));+ spans.push(Span::styled(addon_label, theme.text_dim));}mode_tabs.push(spans);}@@ -809,7 +831,12 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)let mut mode_spans = vec![];for (i, tab) in mode_tabs.into_iter().enumerate() {if i > 0 {- mode_spans.push(Span::raw(if tier.is_compact() { " " } else { " " }));+ let separator = if compact_tabs {+ " • "+ } else {+ if tier.is_compact() { " " } else { " " }+ };+ mode_spans.push(Span::raw(separator));}mode_spans.extend(tab);}