Terminal interface to find, download, and stream movies, TV shows, and live TV using local media players.
refactor(tui): streamline settings and modal selection popups
Samir Hossainsd9841bf5ac64
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex e5792a7..4674314 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1,5 +1,60 @@# Changelog+## [Unreleased]++### Changed+- **Modal and Overlay Declutter — Keyhint Footer Removal**:+ - Removed redundant boilerplate footer keyhint bars (`render_modal_footer` / `render_footer`) and top divider borders across all modal dialogs and overlay pickers (Settings, Streaming Sources, Themes, Players, Subtitles, TV Config, Addon Manager, Provider popup).+ - Removed duplicate and truncated popup title headers on option-selection pickers (Media Player, Themes, Sources) so they cleanly present options without repeating row labels.+ - Compacted Settings modal vertical geometry to snap directly to the search bar row position and eliminated dead spacer gaps between category tabs and content rows.+ - Added background dimming overlays behind all modal pickers to prevent background text bleed-through.+ - Streamlined Settings rows into single-line entries with aligned label and value spans, removing redundant explanatory subtexts.+ - Expanded Settings → Content Modes from a coarse global toggle to individual provider controls covering MovieBox, 4KHDHub, CircleFTP (BDIX), and DhakaFlix (BDIX) alongside Streaming and Live TV mode toggles.+ - Added an active provider guard ensuring at least one streaming provider remains enabled at all times and automatically falling back to the next available source if the currently active provider is disabled.+ - Preserved backward compatibility with legacy `bdix_enabled` configs by automatically migrating enabled BDIX state to both CircleFTP and DhakaFlix flags on startup.+- **Automatic BDIX Network Availability Probing**:+ - Added non-blocking HTTP network probes (`probe_url`) on first application startup with a 3-second timeout against CircleFTP and DhakaFlix endpoints, automatically enabling accessible optical mirrors on local networks while disabling unreachable ones.+ - Added a dedicated "Re-check BDIX Network" action in Settings → Maintenance allowing users to manually re-probe and refresh BDIX provider availability at any time.+- **Unified Streaming and Stremio Addons Engine**:+ - Merged separate Addon Mode into standard Streaming Mode; Stremio Addons (`ProviderKind::Addons`) is now a first-class streaming provider selectable directly via `Ctrl+P`.+ - Simplified application state model by removing `AppMode::Addon` and `AppState.is_addon_mode`, making navigation two-mode (`Streaming` and `Live TV`).+ - Routed Addon Manager dialog access through `/config` when the active provider is `Addons`.++- **Provider Selection Popup UX and Layout Unification**:+ - Replaced manual paragraph iteration in `render_provider_popup` with `ratatui::widgets::List` and canonical `selection_style`, eliminating competing dual-indicator visuals (left bar and background highlight) into a single cohesive selection cue.+ - Added persistent `✓` active provider prefix glyph in `theme.success`, ensuring the currently active source remains visually distinguishable while navigating through options.+ - Added compact key hints footer (`[↑↓] [↵] [Esc]`) anchored to the bottom of the popup with automatic geometry expansion in `provider_popup_bounds`.+ - Styled popup block title with `theme.title` matching modal frame standards and restored unselected item labels to `theme.text`.+- **TUI Declutter and OS/Terminal Native-Feel Adaptation**:+ - Standardized `key_hint` with split styling (`[`/`]` in `theme.overlay0`, key in `theme.shortcut`, label in `theme.subtext1`), improving shortcut readability across all modals and popups.+ - Stripped instructional "Press X" prose from stream failure messages, details error cards, and the update modal.+ - Streamlined home screen bottom bar on compact terminals by dropping redundant mode word labels and keeping clean shortcut glyphs.+ - Trimmed dynamic rotating search placeholder hints to three focused prompts per mode.+ - Added Truecolor detection support for `Konsole` and `xfce4-terminal` via `TERM_PROGRAM`.+ - Added `BACKGROUND` environment variable fallback for light/dark terminal detection.+ - Updated Help modal title from "Help · Streaming Mode" to clean "Help · Streaming".+- **Universal Solid Highlight Bar Selection Overhaul**:+ - Replaced floating cursor and indicator glyphs (`▌`, `>`, `▸`) across all application screens with full-width solid inverted highlight bars (`Modifier::REVERSED` with `theme.highlight` and dark bold text), unifying selection styling across the entire TUI to match the provider selection standard.+ - Upgraded search results cards by eliminating the floating vertical `▌` indicator paragraph and styling the selected card's title with a tight inverted highlight pill (`" " + title + " "` in `Modifier::REVERSED`), stopping exactly where the title text ends rather than stretching across empty card space, preserving rich metadata badge colors on transparent background underneath, and recovering 2 horizontal columns in `item_slot_rects`.+ - Refactored Continue Watching and Favorites landing deck lists to use empty highlight symbols (`""`) with clean 2-space padding, ensuring the active row renders as an uninterrupted solid highlight bar.+ - Converted search autocomplete suggestions to use empty highlight symbols (`""`) with 1-space leading padding, rendering active suggestions as solid highlight bars.+ - Updated all four Media Details panes (Audio, Seasons, Episodes, Streams) to use canonical `overlay::selection_style` with `Modifier::REVERSED` and empty highlight symbols (`""`), eliminating the `▌` glyph and horizontal layout shifts when alternating focus between panes.+ - Unified Provider popup, TV playlist manager, Addons manager, and overlay modal pickers (themes, players, subtitles, browse presets) by removing leading `▌` symbols and rendering clean solid highlight bars.+- **Terminal Color Support and Capability Detection Precision**:+ - Fixed a critical precedence bug in `classify_terminal` where `term == "xterm"` degraded truecolor-capable terminals to 16-color Basic even when `COLORTERM=truecolor` was set.+ - Made `term_program` matching case-insensitive across all checks (`iterm.app`, `hyper`, `tabby`, `wezterm`, `warpterminal`, `warp`, `vscode`, `ghostty`, `konsole`, `xfce4-terminal`, `apple_terminal`).+ - Added truecolor recognition for VTE-based terminals via `VTE_VERSION` (GNOME Terminal, Tilix), Warp via `warp` / `WARP_IS_LOCAL_SHELL_SESSION`, and Alacritty / WezTerm socket and executable environment variables.+ - Corrected Windows fallback in `classify_terminal` to `ColorSupport::Color256` instead of `Truecolor`, preventing legacy Windows ConHost sessions from receiving garbled truecolor escapes while preserving automatic `Truecolor` for Windows Terminal via `WT_SESSION`.+ - Connected `uses_basic_ui` directly to `ColorSupport::Basic`, ensuring all basic and 16-color terminals automatically receive plain borders and simplified ASCII controls.+### Removed+- **Legacy Addon Mode Routing and Keybindings**:+ - Removed `Ctrl+A` shortcut and the bottom bar Addon Mode button.+ - Removed obsolete `Action::ToggleAddonMode`.+++### Fixed+- **Notification Toast Title Text Coloring**:+ - Styled notification toast title spans with `badge_style` rather than the default foreground text style, ensuring that Error (red), Warning (yellow), Success (green), and Info (blue) toasts render consistent title colors matching their borders and badges.## [0.1.18] - 2026-09-06### Addeddiff --git a/README.md b/README.mdindex e0a4b71..3e4ba2d 100644--- a/README.md+++ b/README.md@@ -13,7 +13,7 @@ MovieBox-TUI replaces ad-heavy streaming websites and clunky browser players wit- **Automatic Subtitles**: Automatically searches, downloads, and syncs subtitles in your preferred language directly into your player.- **Season Batch Downloads**: Download individual episodes or entire seasons with one keypress (`d`), with HTTP range resume support and clean folder structure (`Movies/` and `Series/`).- **Interactive Settings Hub**: Configure your default media player, download folder, content modes, and themes inside an in-app visual modal via `/settings` (`Ctrl+S`).-- **Modes**: Switch instantly between standard Streaming, Live TV (`Ctrl+T`), and Addon Mode (`Ctrl+A`).+- **Modes**: Switch between Streaming and Live TV (`Ctrl+T`), with community Stremio addons available directly as a streaming provider.- **Ergonomics & Themes**: Full keyboard navigation (vim-style `j`/`k`, `/`, `Tab`) and mouse support (click, scroll, drag) with 6 built-in themes (Catppuccin, TokyoNight, Nord, Dracula, Gruvbox, Rosé Pine) and terminal theme autodetection.## Prerequisitesdiff --git a/docs/README.md b/docs/README.mdindex 042c692..975d04e 100644--- a/docs/README.md+++ b/docs/README.md@@ -13,7 +13,7 @@ MovieBox-TUI replaces ad-heavy streaming websites and clunky browser players wit- **Automatic Subtitles**: Automatically searches, downloads, and syncs subtitles in your preferred language directly into your player.- **Season Batch Downloads**: Download individual episodes or entire seasons with one keypress (`d`), with HTTP range resume support and clean folder structure (`Movies/` and `Series/`).- **Interactive Settings Hub**: Configure your default media player, download folder, content modes, and themes inside an in-app visual modal via `/settings` (`Ctrl+S`).-- **Modes**: Switch instantly between standard Streaming, Live TV (`Ctrl+T`), and Addon Mode (`Ctrl+A`).+- **Modes**: Switch between Streaming and Live TV (`Ctrl+T`), with community Stremio addons available directly as a streaming provider.- **Ergonomics & Themes**: Full keyboard navigation (vim-style `j`/`k`, `/`, `Tab`) and mouse support (click, scroll, drag) with 6 built-in themes (Catppuccin, TokyoNight, Nord, Dracula, Gruvbox, Rosé Pine) and terminal theme autodetection.## Prerequisitesdiff --git a/docs/addons-mode.md b/docs/addons-mode.mdindex 663c8fc..fa14022 100644--- a/docs/addons-mode.md+++ b/docs/addons-mode.md@@ -1,6 +1,6 @@-# Addon Mode (HTTP Addons)+# Stremio Addons Provider (HTTP Addons)-Addon Mode enables support for community HTTP addon manifests. You can install any standard addon manifest URL to fetch metadata catalogs and aggregate direct HTTP/HTTPS media streams.+Stremio Addons are integrated directly into standard Streaming Mode as a first-class content provider alongside MovieBox, 4KHDHub, and BDIX mirrors. You can install any standard addon manifest URL to fetch metadata catalogs and aggregate direct HTTP/HTTPS media streams.## Features@@ -15,14 +15,12 @@ Addon Mode enables support for community HTTP addon manifests. You can install a- **Watch History & Progress Parity**: Full `/history` support in Addon Mode with real-time `mpv` position tracking, scrub lines, and auto-resume.- **High-Performance Caching**: Curated `/browse` catalogs are cached for `1 hour`, manifests for `24 hours`, and stream aggregations for `2 hours`.-## Entering Addon Mode+## Accessing Addon Streams-- `Ctrl+A`: Toggle / Enter **Addon Mode**.-- `Ctrl+S`: Return to standard **Streaming Mode**.-- `Ctrl+T`: Toggle **TV Mode**.+- `Ctrl+P`: Cycle providers in Streaming Mode to select **Addons**.+- `/config`: Open the **Addon Manager** directly when the active provider is `Addons`.+- `Ctrl+S`: Return smoothly to **MovieBox** provider.- `/browse`: Browse curated addon catalogs (`Top Movies`, `Top Series`, `Top Rated Movies`, `Top Rated Series`).-- `/settings` → Content Modes: Enable or disable Addon Mode navigation.-## Addon Manager- Interactive modal listing installed addons with capability badges (`[Core]`, `[Meta]`, `[Streams]`, `[Catalog]`).diff --git a/docs/config.md b/docs/config.mdindex 359d676..2c3cc82 100644--- a/docs/config.md+++ b/docs/config.md@@ -15,7 +15,7 @@ macOS `~/Library/Application Support/moviebox-tui`, Linux `~/.config/moviebox-tu| `bdix_enabled` | bool | Show BDIX providers (Bangladesh-only). || `streaming_enabled` | bool | Enable Streaming Mode navigation in bottom dock (`/settings` → Content Modes). || `tv_enabled` | bool | Enable TV Mode navigation in bottom dock (`/settings` → Content Modes). |-| `addons_enabled` | bool | Enable Addon Mode navigation in bottom dock (`/settings` → Content Modes). |+| `addons_enabled` | bool | Enable Stremio Addons provider availability (`/settings` → Content Modes). || `default_player` | string or null | Preferred player: `mpv`, `iina`, `vlc`, `android`; absent/null until you choose one from the in-app picker. || `download_dir` | string or null | Custom directory for video and subtitle downloads (null uses OS default). |@@ -24,7 +24,7 @@ macOS `~/Library/Application Support/moviebox-tui`, Linux `~/.config/moviebox-tuAll settings in `config.json` can be configured interactively inside the application by typing `/settings` into the search bar.- **General**: Toggle automatic update checks, choose default media player (`mpv`, `VLC`, `IINA`, `Android`), and edit download folder path.-- **Content Modes**: Enable or disable Streaming Mode, BDIX FTP sources, Live TV (IPTV), and HTTP Addons with safety guards (preventing 0 active modes).+- **Content Modes**: Enable or disable Streaming Mode, BDIX FTP sources, and Live TV (IPTV) with safety guards (preventing 0 active modes).- **Appearance**: Cycle color themes live with real-time palette swatches and launch the visual theme swatch picker.- **Maintenance**: Purge disk cache, query GitHub for release updates, and view repository information.## Other persisted filesdiff --git a/docs/controls.md b/docs/controls.mdindex d72fc7a..f74cbe3 100644--- a/docs/controls.md+++ b/docs/controls.md@@ -22,7 +22,6 @@ MovieBox-TUI is designed for fast keyboard navigation with complete mouse suppor| **`x` / `X`** | Cancel active download and preserve partial `.part` data || **`Ctrl+S`** | Switch to standard **Streaming Mode** || **`Ctrl+T`** | Toggle / switch to **TV Mode** |-| **`Ctrl+A`** | Toggle / switch to **Addon Mode** || **`?`** | Open interactive in-app help menu || **`Ctrl+C` / `q`** | Quit application and restore terminal |@@ -59,7 +58,7 @@ All popup dialogs (Theme picker, Browse categories, Provider menu, Settings Medi## Mode-Specific Controls### Streaming Mode-- **`Ctrl+P`**: Cycle content providers (`MovieBox` → `4KHDHub` → `BDIX`). On the Details screen, re-searches and fetches alternate streams for the current movie in-place.+- **`Ctrl+P`**: Cycle content providers (`MovieBox` → `4KHDHub` → `BDIX` → `Addons`). On the Details screen, re-searches and fetches alternate streams for the current movie in-place.- **`←` / `→` / `h` / `l` / `Tab` / `Shift+Tab`**: Switch Details screen selector panes (Audio Languages, Seasons, Episodes, Streams).- **`Enter`**: Play selected stream or open selected title.- **`d`**: Download current episode or full season batch.@@ -75,15 +74,12 @@ All popup dialogs (Theme picker, Browse categories, Provider menu, Settings Medi- **`Enter`**: Play selected TV channel immediately with default player.- **`r`**: Reload all active M3U playlist sources.- **`/list`**: Show all loaded channels.-### Addon Mode (HTTP Addons)-- **`/settings`**: Open Settings Hub to manage addons and configuration.+### Stremio Addons Provider+- **`/config`**: Open the Addon Manager directly when the active provider is `Addons`.- **`Enter`**: Select title or play resolved stream.- **`d`**: Download HTTP stream release.- **`r`**: Refresh addon catalog search results.- **`f`**: Favorite / unfavorite the selected title (Home & Details screens).-- **`/history`**: Open watch history (`Space` or `P` to instantly resume recorded episode/movie).-- **`/favorites`**: Open your starred titles.-- **`/clear`**: Clear active search query and return to landing.## Mouse Controls| Action | Result |diff --git a/docs/cross-platform.md b/docs/cross-platform.mdindex c1e7c63..d08f663 100644--- a/docs/cross-platform.md+++ b/docs/cross-platform.md@@ -37,8 +37,8 @@ prevent escape sequence probe leakage (`Gi=31...`):`MOVIEBOX_CELL_SIZE=WxH` overrides metrics.- **Colors & Themes**: With no explicit theme, `NO_COLOR` wins, then truecolor RGB(auto-detected across Ghostty, Kitty, WezTerm, iTerm2, Alacritty, Foot, Windows Terminal,- Hyper, Tabby, Warp, and VSCode; enabled by default on Windows 10/11 console host and Windows Terminal),- quantized 256-color palettes for strict terminals, and a tuned high-contrast 16-color ANSI+ Hyper, Tabby, Warp, VSCode, Konsole, xfce4-terminal, GNOME Terminal, and Tilix; enabled by+ default on Windows Terminal via `WT_SESSION`), quantized 256-color palettes for strict terminals,fallback palette (`Theme::fallback`) using crisp cyan accents; an OSC 11 background querypicks light/dark variants. Light mode themes (including Catppuccin Latte) are tuned forWCAG AA compliance, ensuring high-contrast readability across light terminal backgrounds.@@ -85,5 +85,5 @@ MovieBox-TUI embeds an in-app binary upgrade engine (`src/updater/`) with cross-- Poster rendering across Sixel (Windows Terminal, foot), Kitty, iTerm2, and basicnon-graphics terminals.- TV mode with a sample M3U playlist (URL and local file).-- Addon Mode with sample HTTP addon manifests (Cinemeta, torrent/stream addons).+- Stremio Addons provider with sample HTTP addon manifests (Cinemeta, torrent/stream addons).- Termux: on-device check that Play opens the Android chooser and the stream plays.diff --git a/docs/downloads.md b/docs/downloads.mdindex fa7b922..f60d93e 100644--- a/docs/downloads.md+++ b/docs/downloads.md@@ -56,7 +56,7 @@ Selected subtitle sidecars are saved next to the video using ISO 639-1 language- **High-Contrast Responsive Bar**: Renders a proportional progress track (`[━━━━━────]` on modern terminals and `[=====>----]` on basic terminals) with prominent media title display (`⬇ Downloading: <Title>`), percentage badge, and separated transfer metrics (`<Size> | <Speed> | ETA <Time>`).- **Monotonic DASH Normalization**: Multi-stream MPEG-DASH downloads via `yt-dlp` automatically normalize segmented tracks (video 0–90%, audio 90–98%, and track merger 99–100%) so that progress strictly increases and never resets backwards to 0% mid-download.- **Throttled Updates**: Progress events are throttled to 250ms intervals, eliminating terminal flicker and event-channel flooding from high-frequency chunk streams.-- **Background Download Continuity**: Downloads continue running uninterrupted in the background when switching content providers (`Ctrl+P`) or toggling modes (`Ctrl+T`, `Ctrl+A`), keeping all active transfer workers and queues alive.+- **Background Download Continuity**: Downloads continue running uninterrupted in the background when switching content providers (`Ctrl+P`) or toggling TV mode (`Ctrl+T`), keeping all active transfer workers and queues alive.- **Isolated Cancellation Hitbox**: Cancellation is bound strictly to the `x` / `X` keyboard shortcut and the `[x] Cancel` button in the top-right corner of the download bar. Clicking anywhere else on the bar safely consumes the mouse event without interrupting active downloads.## Outcomesdiff --git a/docs/providers.md b/docs/providers.mdindex d09a52a..5fc081a 100644--- a/docs/providers.md+++ b/docs/providers.md@@ -14,9 +14,11 @@ shared typed models in `providers/models.rs` and the moviebox JSON schema used b| **BdixDhakaFlix** | `providers/bdix/dhakaflix` | BDIX indexer. || **Addons** | `providers/addons` | Community HTTP addons (Cinemeta, streams). |-BDIX sources are only reachable from supported Bangladeshi ISPs and are hidden by-default (`bdix_enabled` in config; `/settings` → Content Modes → BDIX Sources).-+BDIX sources are local optical mirrors reachable from supported Bangladeshi ISPs.+On first startup, MovieBox-Tui automatically probes BDIX mirror endpoints on your local network+and enables available ones. Individual providers (MovieBox, 4KHDHub, CircleFTP, DhakaFlix) can+also be manually toggled in `/settings` (or `s`) → Content Modes. A manual re-probe can be+triggered via `/settings` → Maintenance → Re-check BDIX Network.Active streaming providers can be cycled via `Ctrl+P` or visually selected by clicking the provider badge (`[MovieBox · ^P]`) on the landing search bar to open the anchored provider popup menu.## Shared Provider Contractdiff --git a/docs/tv-mode.md b/docs/tv-mode.mdindex 2e77489..52c69c5 100644--- a/docs/tv-mode.md+++ b/docs/tv-mode.md@@ -41,4 +41,4 @@ namespace.- `/list` — display all loaded TV channels.- `[r]` key — reload all active M3U playlist sources.- Global commands (`/settings`, `/clear`, `/help`, `/exit`) are active across all modes.-- Streaming/Addon-only commands (e.g. `/browse`, `/history`, `/favorites`) display friendly guidance notifications prompting you to switch modes (`Ctrl+S` or `Ctrl+A`).+- Streaming-only commands (e.g. `/browse`, `/history`, `/favorites`) display guidance notifications prompting you to switch to streaming mode (`Ctrl+S`).diff --git a/src/config.rs b/src/config.rsindex a913e39..1411c4f 100644--- a/src/config.rs+++ b/src/config.rs@@ -12,7 +12,11 @@ pub struct Config {pub active_mode: String,pub active_provider: ProviderKind,pub active_theme: String,- pub bdix_enabled: bool,+ pub moviebox_enabled: bool,+ pub fourkhdhub_enabled: bool,+ pub bdix_circleftp_enabled: bool,+ pub bdix_dhakaflix_enabled: bool,+ pub bdix_probed: bool,pub streaming_enabled: bool,pub tv_enabled: bool,pub addons_enabled: bool,@@ -27,7 +31,11 @@ impl Default for Config {active_mode: "streaming".to_string(),active_provider: ProviderKind::MovieBox,active_theme: String::new(),- bdix_enabled: false,+ moviebox_enabled: true,+ fourkhdhub_enabled: true,+ bdix_circleftp_enabled: false,+ bdix_dhakaflix_enabled: false,+ bdix_probed: false,streaming_enabled: true,tv_enabled: true,addons_enabled: false,@@ -150,7 +158,19 @@ pub fn load() -> Config {};if path.exists() {if let Ok(content) = std::fs::read_to_string(&path) {- if let Ok(config) = serde_json::from_str::<Config>(&content) {+ let mut val: serde_json::Value = serde_json::from_str(&content).unwrap_or_default();+ let old_bdix = val+ .get("bdix_enabled")+ .and_then(|v| v.as_bool())+ .unwrap_or(false);+ if let Some(obj) = val.as_object_mut() {+ obj.remove("bdix_enabled");+ }+ if let Ok(mut config) = serde_json::from_value::<Config>(val) {+ if old_bdix {+ config.bdix_circleftp_enabled = true;+ config.bdix_dhakaflix_enabled = true;+ }return config;}}diff --git a/src/net.rs b/src/net.rsindex c4fc2da..3a2a80a 100644--- a/src/net.rs+++ b/src/net.rs@@ -74,6 +74,20 @@ pub fn http_client_builder() -> reqwest::ClientBuilder {.pool_max_idle_per_host(8)}+pub async fn probe_url(url: &str, timeout: std::time::Duration) -> bool {+ let Ok(client) = reqwest::Client::builder()+ .timeout(timeout)+ .connect_timeout(timeout)+ .build()+ else {+ return false;+ };+ if client.head(url).send().await.is_ok() {+ return true;+ }+ client.get(url).send().await.is_ok()+}+pub fn is_http_url(source: &str) -> bool {let trimmed = source.trim();trimmed.starts_with("http://") || trimmed.starts_with("https://")diff --git a/src/tui/action.rs b/src/tui/action.rsindex 01a85d4..4ba9a62 100644--- a/src/tui/action.rs+++ b/src/tui/action.rs@@ -11,7 +11,6 @@ pub enum Action {Resize(u16, u16),ToggleHelp,ToggleTvMode,- ToggleAddonMode,SwitchToStreamingMode,SwitchProvider(crate::providers::models::ProviderKind),ShowTvConfig,@@ -159,4 +158,10 @@ pub enum Action {ShowFavorites,OpenFavorite(usize),OpenContinueWatching(usize),+ ToggleProvider(crate::providers::models::ProviderKind),+ CheckBdixNetwork,+ BdixProbeResult {+ circleftp: bool,+ dhakaflix: bool,+ },}diff --git a/src/tui/app/addons.rs b/src/tui/app/addons.rsindex 532cedb..05c6936 100644--- a/src/tui/app/addons.rs+++ b/src/tui/app/addons.rs@@ -6,39 +6,6 @@ use crate::tui::overlay::NotificationKind;impl App {pub(super) async fn handle_addons(&mut self, action: Action) -> Option<()> {match action {- Action::ToggleAddonMode => {- self.reset_mode_state();- let will_be_addon = !self.state.is_addon_mode;- if will_be_addon {- self.state.set_mode(crate::tui::state::AppMode::Addon);- } else if self.state.streaming_enabled {- self.state.set_mode(crate::tui::state::AppMode::Streaming);- } else if self.state.tv_enabled {- self.state.set_mode(crate::tui::state::AppMode::Tv);- }- if self.state.is_addon_mode {- self.state.active_provider = crate::providers::models::ProviderKind::Addons;- self.load_installed_addons_from_config();- if self.state.installed_addons.is_empty() {- self.action_sender.send(Action::ShowAddonManager).ok();- } else {- self.announce_mode();- }- } else if self.state.is_tv_mode {- self.state.active_provider = crate::providers::models::ProviderKind::MovieBox;- self.announce_mode();- self.load_tv_playlists_from_config();- self.reload_tv_playlists();- if self.state.tv_playlists.is_empty() {- self.action_sender.send(Action::ShowTvConfig).ok();- }- } else {- self.state.active_provider = crate::providers::models::ProviderKind::MovieBox;- self.announce_mode();- }- self.persist_config();- }-Action::SwitchToStreamingMode => {self.reset_mode_state();self.state.set_mode(crate::tui::state::AppMode::Streaming);@@ -64,7 +31,10 @@ impl App {if url.is_empty() {return None;}-+ if !self.state.addons_enabled {+ self.state.addons_enabled = true;+ self.persist_config();+ }self.state.set_status_long("Verifying addon manifest...");let client = self.service.addon_client.clone();let sender = self.action_sender.clone();diff --git a/src/tui/app/keyboard.rs b/src/tui/app/keyboard.rsindex 07bdd3b..2e6a74a 100644--- a/src/tui/app/keyboard.rs+++ b/src/tui/app/keyboard.rs@@ -45,22 +45,15 @@ impl App {}return None;}- if let KeyCode::Char('a') = key.code {- if self.state.addons_enabled {- self.action_sender.send(Action::ToggleAddonMode).ok();- self.state.set_status_short("Switched to Addon Mode.");- } else {- self.state- .set_status_short("Addon Mode is disabled. Use /settings to enable.");- }- return None;- }if let KeyCode::Char('s') = key.code {if !self.state.streaming_enabled {self.state.set_status_short("Streaming Mode is disabled. Use /settings to enable.",);- } else if !self.state.is_tv_mode && !self.state.is_addon_mode {+ } else if !self.state.is_tv_mode+ && self.state.active_provider+ != crate::providers::models::ProviderKind::Addons+ {self.state.set_status_short("Already in Streaming Mode.");} else {self.action_sender.send(Action::SwitchToStreamingMode).ok();@@ -69,7 +62,7 @@ impl App {return None;}if let KeyCode::Char('p') = key.code {- if !self.state.is_tv_mode && !self.state.is_addon_mode {+ if !self.state.is_tv_mode {self.cycle_provider();}return None;@@ -180,7 +173,8 @@ impl App {}if self.state.show_browse_popup {- let is_addon = self.state.mode() == crate::tui::state::AppMode::Addon;+ let is_addon =+ self.state.active_provider == crate::providers::models::ProviderKind::Addons;let total_count = if is_addon {crate::providers::addons::models::curated_catalog_presets(&self.state.installed_addons,@@ -273,6 +267,40 @@ impl App {return None;}+ if self.state.show_sources_popup {+ match key.code {+ KeyCode::Esc => {+ self.state.show_sources_popup = false;+ }+ KeyCode::Up | KeyCode::Char('k') => {+ crate::tui::state::cycle_list_selection(+ &mut self.state.sources_list_state,+ crate::providers::models::ProviderKind::ENABLED.len(),+ false,+ );+ }+ KeyCode::Down | KeyCode::Char('j') => {+ crate::tui::state::cycle_list_selection(+ &mut self.state.sources_list_state,+ crate::providers::models::ProviderKind::ENABLED.len(),+ true,+ );+ }+ KeyCode::Enter | KeyCode::Char(' ') => {+ let idx = self.state.sources_list_state.selected().unwrap_or(0);+ if let Some(&provider) =+ crate::providers::models::ProviderKind::ENABLED.get(idx)+ {+ self.action_sender+ .send(Action::ToggleProvider(provider))+ .ok();+ }+ }+ _ => {}+ }+ return None;+ }+if self.state.show_theme_popup {match key.code {KeyCode::Esc => {diff --git a/src/tui/app/mod.rs b/src/tui/app/mod.rsindex aee8bba..39c9063 100644--- a/src/tui/app/mod.rs+++ b/src/tui/app/mod.rs@@ -89,16 +89,25 @@ impl App {let config = crate::tui::config::load();state.auto_update = config.auto_update;state.last_update_check = config.last_update_check;- state.bdix_enabled = config.bdix_enabled;+ state.moviebox_enabled = config.moviebox_enabled;+ state.fourkhdhub_enabled = config.fourkhdhub_enabled;+ state.bdix_circleftp_enabled = config.bdix_circleftp_enabled;+ state.bdix_dhakaflix_enabled = config.bdix_dhakaflix_enabled;+ state.bdix_probed = config.bdix_probed;state.streaming_enabled = config.streaming_enabled;state.tv_enabled = config.tv_enabled;state.addons_enabled = config.addons_enabled;- if !state.streaming_enabled && !state.tv_enabled && !state.addons_enabled {+ if !state.streaming_enabled && !state.tv_enabled {state.streaming_enabled = true;}- let provider_was_sanitized = !state.bdix_enabled && config.active_provider.is_bdix();+ let provider_was_sanitized = !state.provider_enabled(config.active_provider)+ && config.active_provider != crate::providers::models::ProviderKind::Addons;state.active_provider = if provider_was_sanitized {- crate::providers::models::ProviderKind::MovieBox+ state+ .available_providers()+ .into_iter()+ .next()+ .unwrap_or(crate::providers::models::ProviderKind::MovieBox)} else {config.active_provider};@@ -107,23 +116,21 @@ impl App {"tv" if state.tv_enabled => {state.set_mode(crate::tui::state::AppMode::Tv);}- "addon" if state.addons_enabled => {- state.set_mode(crate::tui::state::AppMode::Addon);- state.active_provider = crate::providers::models::ProviderKind::Addons;- }_ => {if state.streaming_enabled {state.set_mode(crate::tui::state::AppMode::Streaming);} else if state.tv_enabled {state.set_mode(crate::tui::state::AppMode::Tv);- } else if state.addons_enabled {- state.set_mode(crate::tui::state::AppMode::Addon);- state.active_provider = crate::providers::models::ProviderKind::Addons;} else {state.set_mode(crate::tui::state::AppMode::Streaming);}}}+ if !state.addons_enabled+ && state.active_provider == crate::providers::models::ProviderKind::Addons+ {+ state.active_provider = crate::providers::models::ProviderKind::MovieBox;+ }state.active_theme_kind = config.active_theme;state.default_player = config.default_player;state.download_dir = config.download_dir.map(std::path::PathBuf::from);@@ -168,9 +175,8 @@ impl App {if app.state.is_tv_mode {app.load_tv_playlists_from_config();app.reload_tv_playlists();- } else if app.state.is_addon_mode {- app.load_installed_addons_from_config();}+ app.load_installed_addons_from_config();if provider_was_sanitized {app.persist_config();}@@ -200,7 +206,6 @@ impl App {fn persist_config(&self) {let active_mode = match self.state.mode() {crate::tui::state::AppMode::Tv => "tv",- crate::tui::state::AppMode::Addon => "addon",crate::tui::state::AppMode::Streaming => "streaming",};let config = crate::tui::config::Config {@@ -209,7 +214,11 @@ impl App {active_mode: active_mode.to_string(),active_provider: self.state.active_provider,active_theme: self.state.active_theme_kind.clone(),- bdix_enabled: self.state.bdix_enabled,+ moviebox_enabled: self.state.moviebox_enabled,+ fourkhdhub_enabled: self.state.fourkhdhub_enabled,+ bdix_circleftp_enabled: self.state.bdix_circleftp_enabled,+ bdix_dhakaflix_enabled: self.state.bdix_dhakaflix_enabled,+ bdix_probed: self.state.bdix_probed,streaming_enabled: self.state.streaming_enabled,tv_enabled: self.state.tv_enabled,addons_enabled: self.state.addons_enabled,diff --git a/src/tui/app/mouse.rs b/src/tui/app/mouse.rsindex 53a5022..3d2412b 100644--- a/src/tui/app/mouse.rs+++ b/src/tui/app/mouse.rs@@ -71,7 +71,7 @@ impl App {.collect::<Vec<_>>();let confirm_label = "Select";match click_in_picker(- crate::tui::overlay::picker_layout(area, &items, confirm_label, 24),+ crate::tui::overlay::picker_layout(area, &items, confirm_label, 20),col,row,&self.state.player_picker_state,@@ -90,21 +90,56 @@ impl App {}return true;}+ if self.state.show_sources_popup {+ let items = crate::providers::models::ProviderKind::ENABLED+ .iter()+ .map(|p| format!(" [✓] {} ", p.label()))+ .collect::<Vec<_>>();+ match click_in_picker(+ crate::tui::overlay::picker_layout(area, &items, "Toggle", 20),+ col,+ row,+ &self.state.sources_list_state,+ items.len(),+ area,+ ) {+ Some(Some(clicked_idx)) => {+ self.state.sources_list_state.select(Some(clicked_idx));+ if let Some(&provider) =+ crate::providers::models::ProviderKind::ENABLED.get(clicked_idx)+ {+ self.action_sender+ .send(Action::ToggleProvider(provider))+ .ok();+ }+ }+ Some(None) => {}+ None => {+ self.state.show_sources_popup = false;+ }+ }+ return true;+ }if self.state.show_theme_popup {let theme_names = crate::tui::theme::AVAILABLE_THEMES;+ let longest_name = theme_names+ .iter()+ .map(|name| crate::tui::text::width(name))+ .max()+ .unwrap_or(10);let items: Vec<String> = theme_names.iter().map(|name| {if self.state.basic_terminal {- format!("{name:<12} * * *")+ format!(" {name:<pad$} * * * ", pad = longest_name)} else {- format!("{name:<12} ■ ■ ■")+ format!(" {name:<pad$} ■ ■ ■ ", pad = longest_name)}}).collect();match click_in_picker(- crate::tui::overlay::picker_layout(area, &items, "Apply", 32),+ crate::tui::overlay::picker_layout(area, &items, "Apply", 24),col,row,&self.state.theme_list_state,@@ -167,7 +202,8 @@ impl App {}if self.state.show_browse_popup {- let is_addon = self.state.mode() == crate::tui::state::AppMode::Addon;+ let is_addon =+ self.state.active_provider == crate::providers::models::ProviderKind::Addons;let raw_labels: Vec<String> = if is_addon {crate::providers::addons::models::curated_catalog_presets(&self.state.installed_addons,@@ -497,7 +533,7 @@ impl App {if col >= inner_area.left()&& col < inner_area.right()&& row >= inner_area.top()- && row < inner_area.bottom()+ && row < inner_area.bottom().saturating_sub(1){let clicked_idx = (row - inner_area.top()) as usize;if let Some(&provider) = available.get(clicked_idx) {@@ -593,8 +629,6 @@ impl App {self.state.input_mode = InputMode::Normal;} else if self.state.mode() == crate::tui::state::AppMode::Tv {self.action_sender.send(Action::ToggleTvMode).ok();- } else if self.state.mode() == crate::tui::state::AppMode::Addon {- self.action_sender.send(Action::ToggleAddonMode).ok();}return None;}@@ -691,7 +725,9 @@ impl App {&& row >= discover_card_area.top()&& row < discover_card_area.bottom(){- if self.state.is_addon_mode {+ if self.state.active_provider+ == crate::providers::models::ProviderKind::Addons+ {self.action_sender.send(Action::ShowBrowseMenu).ok();} else {let rel_row = row - discover_card_area.top();@@ -813,13 +849,15 @@ impl App {next_label,ctrl_p,self.state.is_tv_mode,- self.state.is_addon_mode,+ self.state.active_provider == crate::providers::models::ProviderKind::Addons,);let pos = ratatui::layout::Position::new(col, row);if btn1.contains(pos) {if self.state.is_tv_mode {self.action_sender.send(Action::TvReloadPlaylists).ok();- } else if self.state.is_addon_mode {+ } else if self.state.active_provider+ == crate::providers::models::ProviderKind::Addons+ {self.action_sender.send(Action::ShowAddonManager).ok();} else {self.cycle_provider();@@ -879,16 +917,10 @@ impl App {} else {crate::tui::text::CTRL_T_STR};- let ctrl_a = if ultra_compact || compact {- "A"- } else {- crate::tui::text::CTRL_A_STR- };enum BottomBtn {Stream,Tv,- Addon,}let current_mode = self.state.mode();@@ -902,10 +934,6 @@ impl App {let len = (3 + ctrl_t.len() + 2) as u16;buttons.push((BottomBtn::Tv, len));}- if self.state.addons_enabled && current_mode != crate::tui::state::AppMode::Addon {- let len = (3 + ctrl_a.len() + 5) as u16;- buttons.push((BottomBtn::Addon, len));- }let mode_count = buttons.len();let sep_len = if compact { 3 } else { 5 };@@ -944,11 +972,6 @@ impl App {self.action_sender.send(Action::ToggleTvMode).ok();}}- BottomBtn::Addon => {- if self.state.mode() != crate::tui::state::AppMode::Addon {- self.action_sender.send(Action::ToggleAddonMode).ok();- }- }}return;}@@ -1390,7 +1413,7 @@ mod tests {next_label,ctrl_p,app.state.is_tv_mode,- app.state.is_addon_mode,+ app.state.active_provider == crate::providers::models::ProviderKind::Addons,);app.handle_home_mouse(btn2.x + 1, btn2.y, area);diff --git a/src/tui/app/requests.rs b/src/tui/app/requests.rsindex 5bbf6a2..fde8e63 100644--- a/src/tui/app/requests.rs+++ b/src/tui/app/requests.rs@@ -132,8 +132,7 @@ impl App {let lower_query = query.trim().to_lowercase();if lower_query == "/history"- && (self.state.mode() == crate::tui::state::AppMode::Streaming- || self.state.mode() == crate::tui::state::AppMode::Addon)+ && self.state.mode() == crate::tui::state::AppMode::Streaming{self.state.input_mode = InputMode::Normal;self.state.is_loading = false;diff --git a/src/tui/app/run.rs b/src/tui/app/run.rsindex a1f6418..15df485 100644--- a/src/tui/app/run.rs+++ b/src/tui/app/run.rs@@ -35,6 +35,10 @@ impl App {});}+ if !self.state.bdix_probed {+ self.action_sender.send(Action::CheckBdixNetwork).ok();+ }+let now = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap_or_default()@@ -288,9 +292,15 @@ impl App {pub fn contextual_title(&self) -> String {match self.state.active_screen {Screen::Home => match self.state.mode() {- crate::tui::state::AppMode::Streaming => "MovieBox-Tui — Streaming".to_string(),+ crate::tui::state::AppMode::Streaming => {+ if self.state.active_provider == crate::providers::models::ProviderKind::Addons+ {+ "MovieBox-Tui — Addons".to_string()+ } else {+ "MovieBox-Tui — Streaming".to_string()+ }+ }crate::tui::state::AppMode::Tv => "MovieBox-Tui — Live TV".to_string(),- crate::tui::state::AppMode::Addon => "MovieBox-Tui — Addons".to_string(),},Screen::Details => {if let Some(details) = &self.state.selected_details {@@ -390,7 +400,10 @@ impl App {| Action::SelectSettingsCategory(..)| Action::SettingsAdjustValue(..)| Action::SettingsActivateRow- | Action::SettingsResetDownloadDir => {+ | Action::SettingsResetDownloadDir+ | Action::ToggleProvider(..)+ | Action::CheckBdixNetwork+ | Action::BdixProbeResult { .. } => {self.handle_system(action).await;}@@ -404,8 +417,7 @@ impl App {self.handle_tv(action).await;}- Action::ToggleAddonMode- | Action::SwitchToStreamingMode+ Action::SwitchToStreamingMode| Action::ShowAddonManager| Action::AddonAddManifest(..)| Action::AddonToggleEnabled(..)@@ -534,6 +546,7 @@ impl App {self.draw_download_gauge(frame, download_area);self.draw_settings_modal(frame, area);+ self.draw_sources_picker(frame, area);self.draw_theme_picker(frame, area);self.draw_player_picker(frame, area);self.draw_subtitle_picker(frame, area);@@ -896,13 +909,18 @@ impl App {use ratatui::text::{Line, Span};let theme_names = crate::tui::theme::AVAILABLE_THEMES;+ let longest_name = theme_names+ .iter()+ .map(|name| crate::tui::text::width(name))+ .max()+ .unwrap_or(10);let raw_items: Vec<String> = theme_names.iter().map(|name| {if self.state.basic_terminal {- format!("{name:<12} * * *")+ format!(" {name:<pad$} * * * ", pad = longest_name)} else {- format!("{name:<12} ■ ■ ■")+ format!(" {name:<pad$} ■ ■ ■ ", pad = longest_name)}}).collect();@@ -910,11 +928,16 @@ impl App {let lines: Vec<Line<'static>> = theme_names.iter().map(|name| {- let mut spans = vec![Span::styled(format!("{name:<12} "), self.theme.text)];+ let mut spans = vec![+ Span::raw(" "),+ Span::styled(format!("{name:<pad$}", pad = longest_name), self.theme.text),+ Span::raw(" "),+ ];spans.extend(crate::tui::theme::Theme::palette_swatch_spans(name,self.state.basic_terminal,));+ spans.push(Span::raw(" "));Line::from(spans)}).collect();@@ -926,9 +949,10 @@ impl App {&raw_items,&mut self.state.theme_list_state,crate::tui::overlay::PickerSpec {- title: "Select Theme",+ title: "",confirm_label: "Apply",- minimum_width: 32,+ minimum_width: 16,+ show_counter: false,},&self.theme,self.state.basic_terminal,@@ -940,23 +964,85 @@ impl App {crate::tui::widgets::settings::draw(frame, area, &mut self.state, &self.theme);}}+ fn draw_sources_picker(&mut self, frame: &mut Frame, area: Rect) {+ if self.state.show_sources_popup {+ let providers = crate::providers::models::ProviderKind::ENABLED;+ let raw_items: Vec<String> = providers+ .iter()+ .map(|p| format!(" [✓] {} ", p.label()))+ .collect();+ let lines: Vec<ratatui::text::Line<'static>> = providers+ .iter()+ .map(|p| {+ let is_enabled = self.state.provider_enabled(*p);+ let (check, check_style) = if is_enabled {+ if self.state.basic_terminal {+ (+ "[X] ",+ self.theme+ .success+ .add_modifier(ratatui::style::Modifier::BOLD),+ )+ } else {+ (+ "[✓] ",+ self.theme+ .success+ .add_modifier(ratatui::style::Modifier::BOLD),+ )+ }+ } else {+ ("[ ] ", self.theme.text_dim)+ };+ let label_style = if is_enabled {+ self.theme.text+ } else {+ self.theme.text_dim+ };+ ratatui::text::Line::from(vec![+ ratatui::text::Span::raw(" "),+ ratatui::text::Span::styled(check, check_style),+ ratatui::text::Span::styled(p.label(), label_style),+ ratatui::text::Span::raw(" "),+ ])+ })+ .collect();++ crate::tui::overlay::picker_with_lines(+ frame,+ area,+ &lines,+ &raw_items,+ &mut self.state.sources_list_state,+ crate::tui::overlay::PickerSpec {+ title: "",+ confirm_label: "Toggle",+ minimum_width: 20,+ show_counter: false,+ },+ &self.theme,+ self.state.basic_terminal,+ );+ }+ }fn draw_player_picker(&mut self, frame: &mut Frame, area: Rect) {if self.state.player_picker_popup {- let items = self+ let raw_items = self.state.available_players.iter()- .map(|k| k.label().to_string())+ .map(|k| format!(" {} ", k.label())).collect::<Vec<_>>();crate::tui::overlay::picker(frame,area,- &items,+ &raw_items,&mut self.state.player_picker_state,crate::tui::overlay::PickerSpec {- title: "Default Media Player",+ title: "",confirm_label: "Select",- minimum_width: 24,+ minimum_width: 10,+ show_counter: false,},&self.theme,self.state.basic_terminal,@@ -982,9 +1068,14 @@ impl App {&items,&mut self.state.subtitle_list_state,crate::tui::overlay::PickerSpec {- title: "Subtitles",+ title: if self.state.is_download_subtitle_popup {+ "Download Subtitles"+ } else {+ "Subtitles"+ },confirm_label,minimum_width: 32,+ show_counter: true,},&self.theme,self.state.basic_terminal,@@ -1010,7 +1101,7 @@ impl App {let layout = crate::tui::overlay::update_modal_layout(area, notes);let popup_area = layout.popup_area;let display_count = layout.display_count;- let has_more = layout.has_more;+ let _ = layout.has_more;let note_lines: Vec<&str> = notes.lines()@@ -1224,12 +1315,6 @@ impl App {text.push(Line::from(spans));}- let more_msg = if has_more {- " Press [o] to read full changelog on GitHub"- } else {- " Press [o] to view release on GitHub"- };- text.push(Line::from(Span::styled(more_msg, self.theme.text_dim)));text.push(Line::from(Span::styled(divider_str, self.theme.surface1)));let is_compact_modal = inner_area.width < 58;diff --git a/src/tui/app/search.rs b/src/tui/app/search.rsindex efb2868..f5d7787 100644--- a/src/tui/app/search.rs+++ b/src/tui/app/search.rs@@ -96,7 +96,6 @@ impl App {let current_mode = self.state.mode();let ctrl_s = crate::tui::text::CTRL_S_STR;let ctrl_t = crate::tui::text::CTRL_T_STR;- let ctrl_a = crate::tui::text::CTRL_A_STR;let will_handle = !matches!(&parsed,@@ -124,7 +123,9 @@ impl App {if self.state.is_tv_mode {self.action_sender.send(Action::ShowTvConfig).ok();return Some(true);- } else if self.state.is_addon_mode {+ } else if self.state.active_provider+ == crate::providers::models::ProviderKind::Addons+ {self.action_sender.send(Action::ShowAddonManager).ok();return Some(true);}@@ -146,7 +147,7 @@ impl App {self.state.notify(NotificationKind::Info,"TV Mode",- format!("Command /browse is available in Streaming Mode ({ctrl_s}) or Addon Mode ({ctrl_a})."),+ format!("Command /browse is available in Streaming Mode ({ctrl_s})."),);} else {self.action_sender.send(Action::ShowBrowseMenu).ok();@@ -158,7 +159,7 @@ impl App {self.state.notify(NotificationKind::Info,"TV Mode",- format!("Command /history is available in Streaming Mode ({ctrl_s}) or Addon Mode ({ctrl_a})."),+ format!("Command /history is available in Streaming Mode ({ctrl_s})."),);Some(true)} else {@@ -170,7 +171,7 @@ impl App {self.state.notify(NotificationKind::Info,"TV Mode",- format!("Command /favorites is available in Streaming Mode ({ctrl_s}) or Addon Mode ({ctrl_a})."),+ format!("Command /favorites is available in Streaming Mode ({ctrl_s})."),);Some(true)} else {diff --git a/src/tui/app/system.rs b/src/tui/app/system.rsindex 56417dc..635d560 100644--- a/src/tui/app/system.rs+++ b/src/tui/app/system.rs@@ -285,11 +285,13 @@ impl App {self.state.settings_selected_row = 0;self.state.settings_download_dir_input = None;self.state.settings_player_picker = false;+ self.state.show_sources_popup = false;self.state.input_mode = crate::tui::state::InputMode::Normal;} else {self.state.show_settings_popup = false;self.state.settings_download_dir_input = None;self.state.settings_player_picker = false;+ self.state.show_sources_popup = false;self.persist_config();}}@@ -306,6 +308,7 @@ impl App {self.state.settings_selected_row = 0;self.state.settings_download_dir_input = None;self.state.settings_player_picker = false;+ self.state.show_sources_popup = false;self.state.input_mode = crate::tui::state::InputMode::Normal;}@@ -313,6 +316,7 @@ impl App {self.state.show_settings_popup = false;self.state.settings_download_dir_input = None;self.state.settings_player_picker = false;+ self.state.show_sources_popup = false;self.persist_config();}@@ -359,21 +363,18 @@ impl App {} else {self.state.streaming_enabled = enable_req;self.persist_config();- if !self.state.streaming_enabled- && !self.state.is_tv_mode- && !self.state.is_addon_mode- {+ if !self.state.streaming_enabled && !self.state.is_tv_mode {if self.state.tv_enabled {self.state.set_mode(crate::tui::state::AppMode::Tv);- } else if self.state.addons_enabled {- self.state.set_mode(crate::tui::state::AppMode::Addon);}}}}1 => {- self.state.bdix_enabled = !self.state.bdix_enabled;- self.persist_config();+ self.state.show_sources_popup = true;+ if self.state.sources_list_state.selected().is_none() {+ self.state.sources_list_state.select(Some(0));+ }}2 => {let enable_req = !self.state.tv_enabled;@@ -389,28 +390,6 @@ impl App {if !self.state.tv_enabled && self.state.is_tv_mode {if self.state.streaming_enabled {self.state.set_mode(crate::tui::state::AppMode::Streaming);- } else if self.state.addons_enabled {- self.state.set_mode(crate::tui::state::AppMode::Addon);- }- }- }- }- 3 => {- let enable_req = !self.state.addons_enabled;- if !enable_req && !self.state.can_disable_addons_mode() {- self.state.notify(- NotificationKind::Warning,- "Addon Mode",- "Cannot disable: at least one mode must remain active.",- );- } else {- self.state.addons_enabled = enable_req;- self.persist_config();- if !self.state.addons_enabled && self.state.is_addon_mode {- if self.state.streaming_enabled {- self.state.set_mode(crate::tui::state::AppMode::Streaming);- } else if self.state.tv_enabled {- self.state.set_mode(crate::tui::state::AppMode::Tv);}}}@@ -513,21 +492,18 @@ impl App {} else {self.state.streaming_enabled = enable_req;self.persist_config();- if !self.state.streaming_enabled- && !self.state.is_tv_mode- && !self.state.is_addon_mode- {+ if !self.state.streaming_enabled && !self.state.is_tv_mode {if self.state.tv_enabled {self.state.set_mode(crate::tui::state::AppMode::Tv);- } else if self.state.addons_enabled {- self.state.set_mode(crate::tui::state::AppMode::Addon);}}}}1 => {- self.state.bdix_enabled = !self.state.bdix_enabled;- self.persist_config();+ self.state.show_sources_popup = true;+ if self.state.sources_list_state.selected().is_none() {+ self.state.sources_list_state.select(Some(0));+ }}2 => {let enable_req = !self.state.tv_enabled;@@ -543,28 +519,6 @@ impl App {if !self.state.tv_enabled && self.state.is_tv_mode {if self.state.streaming_enabled {self.state.set_mode(crate::tui::state::AppMode::Streaming);- } else if self.state.addons_enabled {- self.state.set_mode(crate::tui::state::AppMode::Addon);- }- }- }- }- 3 => {- let enable_req = !self.state.addons_enabled;- if !enable_req && !self.state.can_disable_addons_mode() {- self.state.notify(- NotificationKind::Warning,- "Addon Mode",- "Cannot disable: at least one mode must remain active.",- );- } else {- self.state.addons_enabled = enable_req;- self.persist_config();- if !self.state.addons_enabled && self.state.is_addon_mode {- if self.state.streaming_enabled {- self.state.set_mode(crate::tui::state::AppMode::Streaming);- } else if self.state.tv_enabled {- self.state.set_mode(crate::tui::state::AppMode::Tv);}}}@@ -625,6 +579,15 @@ impl App {}}}+ 3 => {+ self.state.bdix_probed = false;+ self.action_sender.send(Action::CheckBdixNetwork).ok();+ self.state.notify(+ NotificationKind::Info,+ "BDIX Check",+ "Probing BDIX mirrors on local network...",+ );+ }_ => {}}}@@ -654,11 +617,10 @@ impl App {let current_mode = self.state.mode();if current_mode == crate::tui::state::AppMode::Tv {let ctrl_s = crate::tui::text::CTRL_S_STR;- let ctrl_a = crate::tui::text::CTRL_A_STR;self.state.notify(NotificationKind::Info,"TV Mode",- format!("Command /browse is available in Streaming Mode ({ctrl_s}) or Addon Mode ({ctrl_a})."),+ format!("Command /browse is available in Streaming Mode ({ctrl_s})."),);} else if current_mode == crate::tui::state::AppMode::Streaming&& self.state.active_provider@@ -899,8 +861,92 @@ impl App {}}}++ Action::ToggleProvider(provider) => {+ self.toggle_provider(provider);+ }++ Action::CheckBdixNetwork => {+ let sender = self.action_sender.clone();+ tokio::spawn(async move {+ let timeout = std::time::Duration::from_secs(3);+ let circleftp =+ crate::net::probe_url("http://new.circleftp.net:5000/api", timeout).await;+ let dhakaflix = crate::net::probe_url("http://172.16.50.7/", timeout).await;+ sender+ .send(Action::BdixProbeResult {+ circleftp,+ dhakaflix,+ })+ .ok();+ });+ }++ Action::BdixProbeResult {+ circleftp,+ dhakaflix,+ } => {+ self.state.bdix_circleftp_enabled = circleftp;+ self.state.bdix_dhakaflix_enabled = dhakaflix;+ self.state.bdix_probed = true;+ if !self.state.provider_enabled(self.state.active_provider) {+ let next = self+ .state+ .available_providers()+ .into_iter()+ .next()+ .unwrap_or(crate::providers::models::ProviderKind::MovieBox);+ self.switch_provider(next);+ }+ self.persist_config();+ if circleftp || dhakaflix {+ let mut found = Vec::new();+ if circleftp {+ found.push("CircleFTP");+ }+ if dhakaflix {+ found.push("DhakaFlix");+ }+ self.state.notify(+ NotificationKind::Info,+ "BDIX Network Detected",+ format!("Automatically enabled: {}", found.join(", ")),+ );+ }+ }_ => return None,}None}++ fn toggle_provider(&mut self, provider: crate::providers::models::ProviderKind) {+ let currently_enabled = self.state.provider_enabled(provider);+ if currently_enabled {+ let would_remain: Vec<crate::providers::models::ProviderKind> =+ crate::providers::models::ProviderKind::ENABLED+ .into_iter()+ .filter(|p| *p != provider && self.state.provider_enabled(*p))+ .collect();+ if would_remain.is_empty() {+ self.state.notify(+ NotificationKind::Warning,+ provider.label(),+ "Cannot disable: at least one streaming provider must remain active.",+ );+ return;+ }+ }+ self.state+ .set_provider_enabled(provider, !currently_enabled);+ if currently_enabled && self.state.active_provider == provider {+ let next = self+ .state+ .available_providers()+ .into_iter()+ .next()+ .unwrap_or(crate::providers::models::ProviderKind::MovieBox);+ self.switch_provider(next);+ }+ self.persist_config();+ }}diff --git a/src/tui/app/tv.rs b/src/tui/app/tv.rsindex 6f4d40d..26d116f 100644--- a/src/tui/app/tv.rs+++ b/src/tui/app/tv.rs@@ -55,9 +55,6 @@ impl App {crate::tui::state::AppMode::Tv => {self.state.set_status_long("Loading TV playlists...");}- crate::tui::state::AppMode::Addon => {- self.state.set_status_default("Addon mode active.");- }}}@@ -68,10 +65,8 @@ impl App {let will_be_tv = !self.state.is_tv_mode;if will_be_tv {self.state.set_mode(crate::tui::state::AppMode::Tv);- } else if self.state.streaming_enabled {+ } else {self.state.set_mode(crate::tui::state::AppMode::Streaming);- } else if self.state.addons_enabled {- self.state.set_mode(crate::tui::state::AppMode::Addon);}if self.state.is_tv_mode {self.state.tv_config_popup = false;@@ -82,16 +77,6 @@ impl App {if self.state.tv_playlists.is_empty() {self.action_sender.send(Action::ShowTvConfig).ok();}- } else if self.state.is_addon_mode {- self.state.tv_config_popup = false;- self.state.search_results.clear();- self.state.active_provider = crate::providers::models::ProviderKind::Addons;- self.load_installed_addons_from_config();- if self.state.installed_addons.is_empty() {- self.action_sender.send(Action::ShowAddonManager).ok();- } else {- self.announce_mode();- }} else {self.state.tv_config_popup = false;self.state.search_query.clear();diff --git a/src/tui/commands.rs b/src/tui/commands.rsindex 291153b..c40daec 100644--- a/src/tui/commands.rs+++ b/src/tui/commands.rs@@ -62,14 +62,7 @@ impl SlashCommand {pub fn is_available(self, state: &AppState) -> bool {match self {Self::Settings => true,- Self::Browse => {- (state.streaming_enabled && !state.is_tv_mode && !state.is_addon_mode)- || (state.addons_enabled && state.is_addon_mode)- }- Self::History => {- (state.streaming_enabled && !state.is_tv_mode && !state.is_addon_mode)- || (state.addons_enabled && state.is_addon_mode)- }+ Self::Browse | Self::History => state.streaming_enabled && !state.is_tv_mode,Self::Favorites => state.favorites_available(),Self::List => state.tv_enabled && state.is_tv_mode,Self::Clear | Self::Help | Self::Exit => true,diff --git a/src/tui/overlay.rs b/src/tui/overlay.rsindex 85daafb..92fae7f 100644--- a/src/tui/overlay.rs+++ b/src/tui/overlay.rs@@ -20,28 +20,26 @@ pub struct PickerSpec<'a> {pub title: &'a str,pub confirm_label: &'a str,pub minimum_width: u16,+ pub show_counter: bool,}pub fn picker_layout(area: Rect,items: &[String],- confirm_label: &str,+ _confirm_label: &str,minimum_width: u16,) -> Rect {let visible_rows = items.len().clamp(1, max_picker_rows(area));- let footer_str = format!("[↑↓] Move [Enter] {confirm_label} [Esc] Back");- let footer_width = crate::tui::text::width(&footer_str);let content_width = items.iter().map(|item| crate::tui::text::width(item)).max().unwrap_or(0)- .max(footer_width)- .saturating_add(4);+ .saturating_add(2);centered(area,content_width as u16,- (visible_rows as u16 + 4).max(5),+ (visible_rows as u16 + 2).max(3),minimum_width,64,)@@ -60,9 +58,9 @@ pub fn tv_config_layout(.max(content_width.saturating_add(6) as u16).min(area.width.saturating_sub(4));let popup_height = if input_active {- 7u16+ 5u16} else {- total_rows.min(10).saturating_add(6) as u16+ total_rows.min(10).saturating_add(4) as u16};centered(area, popup_width, popup_height, 36, 74)}@@ -70,22 +68,30 @@ pub fn tv_config_layout(pub fn addon_manager_layout(area: Rect, addons_count: usize, input_active: bool) -> Rect {let popup_width = 76u16.min(area.width.saturating_sub(4)).max(56);let popup_height = if input_active {- 7u16+ 5u16} else {(addons_count as u16)- .saturating_add(6)+ .saturating_add(4).min(area.height.saturating_sub(4))- .max(7)+ .max(5)};centered(area, popup_width, popup_height, 36, 80)}pub fn settings_modal_layout(area: Rect, category: crate::tui::state::SettingsCategory) -> Rect {- let min_width = 46u16.min(area.width.saturating_sub(2));- let popup_width = 76u16.min(area.width.saturating_sub(2)).max(min_width);- let content_height = (category.row_count() as u16 * 2).max(4);- let desired_height = 2 + 1 + content_height + 2 + 2;- let popup_height = desired_height.min(area.height.saturating_sub(2)).max(11);- centered(area, popup_width, popup_height, min_width, 76)+ let min_width = 44u16.min(area.width.saturating_sub(2));+ let popup_width = 68u16.min(area.width.saturating_sub(2)).max(min_width);+ let content_height = (category.row_count() as u16).max(1);+ let popup_height = (content_height + 4).min(area.height.saturating_sub(2));+ let available_width = area.width.saturating_sub(2).max(1);+ let width = popup_width.min(available_width);+ let x = area.x + area.width.saturating_sub(width) / 2;+ let search_y = if area.height >= 24 {+ area.y + 2 + 6 + 1 + 2+ } else {+ area.y + 1 + 2 + 1 + 1+ };+ let y = search_y.min(area.bottom().saturating_sub(popup_height));+ Rect::new(x, y, width, popup_height)}pub fn download_confirm_layout(@@ -116,7 +122,10 @@ pub fn picker(theme: &Theme,basic_terminal: bool,) {- let lines: Vec<Line<'static>> = items.iter().map(|item| Line::from(item.clone())).collect();+ let lines: Vec<Line<'static>> = items+ .iter()+ .map(|item| Line::from(vec![Span::raw(item.clone())]))+ .collect();picker_with_lines(frame,area,@@ -146,29 +155,34 @@ pub fn picker_with_lines<'a>(.min(lines.len().saturating_sub(1));let visible_rows = lines.len().clamp(1, max_picker_rows(area));let popup = picker_layout(area, raw_items, spec.confirm_label, spec.minimum_width);- let title = format!(- "{} · {}/{}",- spec.title,- selected.saturating_add(1),- lines.len().max(1)- );+ let title = if spec.title.is_empty() {+ String::new()+ } else if spec.show_counter && lines.len() > 1 {+ format!(+ "{} · {}/{}",+ spec.title,+ selected.saturating_add(1),+ lines.len().max(1)+ )+ } else {+ spec.title.to_string()+ };let inner = crate::tui::widgets::ModalFrame::new(&title, theme, basic_terminal).render(frame, popup, area);- let sections = Layout::vertical([Constraint::Min(1), Constraint::Length(2)]).split(inner);let list_items = lines.iter().map(|line| ListItem::new(line.clone()).style(theme.text)).collect::<Vec<_>>();let list = List::new(list_items).highlight_style(selection_style(theme, basic_terminal))- .highlight_symbol(if basic_terminal { "> " } else { "▌ " });- frame.render_stateful_widget(list, sections[0], state);+ .highlight_symbol("");+ frame.render_stateful_widget(list, inner, state);if lines.len() > visible_rows {crate::tui::widgets::render_scrollbar(frame,- sections[0],+ inner,lines.len(),visible_rows,selected,@@ -176,20 +190,6 @@ pub fn picker_with_lines<'a>(basic_terminal,);}-- let confirm_label = if sections[1].width < 40 && spec.confirm_label == "Download" {- "Save"- } else {- spec.confirm_label- };- let footer = vec![- key_hint("↑↓", "Move", theme),- Span::raw(" "),- key_hint("Enter", confirm_label, theme),- Span::raw(" "),- key_hint("Esc", "Back", theme),- ];- crate::tui::widgets::render_modal_footer(frame, sections[1], footer, theme);}pub fn browse_category_badge<'a>(label: &str, theme: &'a Theme) -> (Span<'a>, &'static str) {@@ -345,7 +345,7 @@ pub fn notifications(let mut lines = Vec::new();lines.push(Line::from(vec![Span::styled(crate::tui::text::truncate_width(¬ification.title, inner_width),- theme.text.add_modifier(Modifier::BOLD),+ badge_style.add_modifier(Modifier::BOLD),)]));for line in &msg_lines {@@ -438,33 +438,35 @@ pub fn border_type(basic_terminal: bool) -> BorderType {}}-pub(crate) fn key_hint(key: &str, action: &str, theme: &Theme) -> Span<'static> {+pub(crate) fn key_hint(key: &'static str, action: &str, theme: &Theme) -> Vec<Span<'static>> {if action.is_empty() {- Span::styled(format!("[{key}]"), theme.text_dim)+ vec![+ Span::styled("[", theme.overlay0),+ Span::styled(key, theme.shortcut),+ Span::styled("]", theme.overlay0),+ ]} else {- Span::styled(format!("[{key}] {action}"), theme.text_dim)+ vec![+ Span::styled("[", theme.overlay0),+ Span::styled(key, theme.shortcut),+ Span::styled("] ", theme.overlay0),+ Span::styled(action.to_string(), theme.subtext1),+ ]}}pub(crate) fn selection_style(theme: &Theme, basic_terminal: bool) -> Style {- let style = if theme.is_light {- theme.text- } else {- theme.highlight- }- .add_modifier(Modifier::BOLD);- if crate::tui::theme::ColorSupport::current() == crate::tui::theme::ColorSupport::NoColor {- return style.add_modifier(Modifier::REVERSED);- }if basic_terminal {- style.add_modifier(Modifier::UNDERLINED)+ Style::default()+ .fg(theme.highlight.fg.unwrap_or(theme.base))+ .add_modifier(Modifier::BOLD | Modifier::UNDERLINED)} else {- let bg_color = if theme.is_light {- theme.surface1.fg.unwrap_or(ratatui::style::Color::DarkGray)- } else {- theme.surface1.fg.unwrap_or(theme.base)- };- style.bg(bg_color)+ let bg = theme.surface1.fg.unwrap_or(theme.base);+ let fg = theme+ .highlight+ .fg+ .unwrap_or(theme.text.fg.unwrap_or(theme.base));+ Style::default().fg(fg).bg(bg).add_modifier(Modifier::BOLD)}}@@ -809,6 +811,7 @@ mod tests {title: "Browse",confirm_label: "Open",minimum_width: 36,+ show_counter: true,},&theme,false,@@ -830,10 +833,27 @@ mod tests {let area = Rect::new(0, 0, 80, 24);let items_single = vec!["Single Item".to_string()];let layout_single = picker_layout(area, &items_single, "Open", 20);- assert_eq!(layout_single.height, 5);+ assert_eq!(layout_single.height, 3);let items_two = vec!["Item 1".to_string(), "Item 2".to_string()];let layout_two = picker_layout(area, &items_two, "Use", 20);- assert_eq!(layout_two.height, 6);+ assert_eq!(layout_two.height, 4);+ }++ #[test]+ fn test_notification_style_colors_match_kind() {+ let theme = Theme::mocha();++ let (_, info_style) = notification_style(NotificationKind::Info, &theme, false);+ assert_eq!(info_style.fg, theme.sapphire.fg);++ let (_, success_style) = notification_style(NotificationKind::Success, &theme, false);+ assert_eq!(success_style.fg, theme.success.fg);++ let (_, warning_style) = notification_style(NotificationKind::Warning, &theme, false);+ assert_eq!(warning_style.fg, theme.rating.fg);++ let (_, error_style) = notification_style(NotificationKind::Error, &theme, false);+ assert_eq!(error_style.fg, theme.error.fg);}}diff --git a/src/tui/screens/details.rs b/src/tui/screens/details.rsindex ac0e90a..9982881 100644--- a/src/tui/screens/details.rs+++ b/src/tui/screens/details.rs@@ -230,16 +230,15 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)let err_msg =crate::tui::text::truncate_width(err, (box_width.saturating_sub(4)) as usize);- let text = vec![+ let mut text = vec![Line::from(""),Line::from(Span::styled(err_msg, theme.text)),Line::from(""),- Line::from(vec![- crate::tui::overlay::key_hint("r", "Retry fetch", theme),- Span::raw(" "),- crate::tui::overlay::key_hint("Esc", "Back", theme),- ]),];+ let mut hint_spans = crate::tui::overlay::key_hint("r", "Retry", theme);+ hint_spans.push(Span::raw(" "));+ hint_spans.extend(crate::tui::overlay::key_hint("Esc", "Back", theme));+ text.push(Line::from(hint_spans));let error_p = Paragraph::new(text).block(error_block)@@ -1282,12 +1281,12 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)let msg = if waiting_for_language {"Choose an audio track to load streams.".to_string()} else if let Some(error) = &state.stream_error {- if state.is_addon_mode {+ if state.active_provider == crate::providers::ProviderKind::Addons {error.clone()} else if error.contains("No stream sources") || error.contains("not listed") {- format!("{error}.\nPress Ctrl+P to try another provider, or r to refresh.")+ format!("{error}.")} else {- format!("{error} — press r to retry or Ctrl+P to switch provider.")+ error.clone()}} else if is_loading_streams {let spinner = stream_loading_spinner(state.tick_count, state.basic_terminal);@@ -1297,9 +1296,7 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)format!("{spinner} Loading streams...")}} else if state.has_streams_settled && state.selected_resources.is_empty() {- format!(- "No stream sources found on {provider_label} (Ctrl+P to switch provider, r to retry)"- )+ format!("No stream sources found on {provider_label}.")} else {let spinner = stream_loading_spinner(state.tick_count, state.basic_terminal);if state.basic_terminal {@@ -1641,25 +1638,19 @@ fn metadata_style(theme: &Theme) -> Style {theme.subtext1}-fn with_selection_surface(style: Style, basic_terminal: bool, theme: &Theme) -> Style {+fn with_selection_surface(style: Style, basic_terminal: bool, _theme: &Theme) -> Style {if basic_terminal {style} else {- style.bg(theme_color(theme.surface1, theme.base))+ style.add_modifier(Modifier::BOLD)}}fn selection_style(focused: bool, basic_terminal: bool, theme: &Theme) -> Style {if focused {- let style =- with_selection_surface(theme.text, basic_terminal, theme).add_modifier(Modifier::BOLD);- if basic_terminal {- style.add_modifier(Modifier::UNDERLINED)- } else {- style- }+ crate::tui::overlay::selection_style(theme, basic_terminal)} else {- theme.text.add_modifier(Modifier::BOLD)+ theme.subtext1.add_modifier(Modifier::BOLD)}}@@ -1667,14 +1658,8 @@ fn focus_title_marker(basic_terminal: bool) -> &'static str {if basic_terminal { "> " } else { "● " }}-fn selection_symbol(focused: bool, basic_terminal: bool) -> &'static str {- if focused {- if basic_terminal { "> " } else { "▌ " }- } else if basic_terminal {- "* "- } else {- "· "- }+fn selection_symbol(_focused: bool, _basic_terminal: bool) -> &'static str {+ ""}#[allow(clippy::too_many_arguments)]@@ -1882,7 +1867,7 @@ fn details_footer(} else {"Favorite"};- let show_provider = !state.is_addon_mode+ let show_provider = state.active_provider != crate::providers::ProviderKind::Addons&& !state.selected_details.as_ref()@@ -2202,7 +2187,7 @@ mod tests {.map(|cell| cell.symbol()).collect::<String>();assert!(content.contains("Error Loading Details"));- assert!(content.contains("Retry fetch"));+ assert!(content.contains("Retry"));assert!(content.contains("Back"));}@@ -2267,13 +2252,13 @@ mod tests {let compact_text: String = compact_spans.iter().map(|s| s.content.as_ref()).collect();assert!(compact_text.contains("[d] Save"));- state.is_addon_mode = true;+ state.active_provider = crate::providers::ProviderKind::Addons;let (addon_primary, addon_secondary) = details_footer(&state, &theme, 120, false);let mut addon_spans = addon_primary;addon_spans.extend(addon_secondary);let addon_text: String = addon_spans.iter().map(|s| s.content.as_ref()).collect();assert!(!addon_text.contains("Provider"));- state.is_addon_mode = false;+ state.active_provider = crate::providers::ProviderKind::MovieBox;state.details_pane = crate::tui::state::DetailsPane::Seasons;let (primary, secondary) = details_footer(&state, &theme, 120, false);diff --git a/src/tui/screens/help.rs b/src/tui/screens/help.rsindex 8a7d4b3..54371a4 100644--- a/src/tui/screens/help.rs+++ b/src/tui/screens/help.rs@@ -57,7 +57,7 @@ pub fn build_help_columns(left.push(help_row("[Enter]", "Play Selected Channel", theme));left.push(help_row("[r]", "Reload M3U Playlists", theme));left.push(help_row("/list", "Show All TV Channels", theme));- } else if state.is_addon_mode {+ } else if state.active_provider == crate::providers::models::ProviderKind::Addons {left.push(help_section_header("Addon Actions", theme));left.push(help_row("[Enter]", "Select Title / Play Stream", theme));left.push(help_row("[d]", "Download Video Stream", theme));@@ -86,17 +86,13 @@ pub fn build_help_columns(let key = format!("[{}]", crate::tui::text::CTRL_T_STR);right.push(help_row(&key, "Switch to Live TV Mode", theme));}- if state.addons_enabled {- let key = format!("[{}]", crate::tui::text::CTRL_A_STR);- right.push(help_row(&key, "Switch to Addon Mode", theme));- }right.push(Line::from(""));right.push(help_section_header("Commands & Shortcuts", theme));right.push(help_row("/settings", "Preferences, Themes & Modes", theme));if state.is_tv_mode {right.push(help_row("/list", "Show All TV Channels", theme));- } else if state.is_addon_mode {+ } else if state.active_provider == crate::providers::models::ProviderKind::Addons {right.push(help_row("/browse", "Browse Addon Catalogs", theme));} else {right.push(help_row("/browse", "Browse Curated Categories", theme));@@ -118,11 +114,9 @@ pub fn build_help_columns(pub fn draw(frame: &mut Frame, area: Rect, state: &AppState, theme: &Theme) {let mode_title = if state.is_tv_mode {- "TV Mode"- } else if state.is_addon_mode {- "Addon Mode"+ "Live TV"} else {- "Streaming Mode"+ "Streaming"};let (left_col, right_col) = build_help_columns(state, theme);@@ -276,7 +270,7 @@ mod tests {.map(|cell| cell.symbol()).collect::<String>();- assert!(content.contains("Help · Streaming Mode"));+ assert!(content.contains("Help · Streaming"));assert!(content.contains("Navigation"));assert!(content.contains("Streaming Actions"));assert!(content.contains("Commands & Shortcuts"));diff --git a/src/tui/screens/home.rs b/src/tui/screens/home.rsindex 7641039..e295482 100644--- a/src/tui/screens/home.rs+++ b/src/tui/screens/home.rs@@ -8,7 +8,7 @@ use ratatui::{layout::{Alignment, Constraint, Direction, Layout, Margin, Rect},style::{Color, Modifier, Style},text::{Line, Span},- widgets::{Block, Borders, Paragraph},+ widgets::{Block, Borders, List, ListItem, ListState, Paragraph},};#[derive(Debug, Clone, Copy, PartialEq, Eq)]@@ -259,7 +259,7 @@ fn render_search_state(Span::styled("c", theme.shortcut),Span::styled(") ]", theme.subtext1),]- } else if state.is_addon_mode {+ } else if state.active_provider == crate::providers::models::ProviderKind::Addons {let (btn1_label, btn2_label) = if is_compact_btn {("[ Addons (", "[ Clear (")} else {@@ -554,21 +554,28 @@ pub(crate) fn render_landing_deck(frame: &mut Frame, area: Rect, state: &AppStatreturn;}- let mut curr_y = inner_area.y;- let selected = if is_focused {- state.favorites_landing_state.selected()+ let mut list_state = if is_focused {+ state.favorites_landing_state} else {- None+ let mut s = ListState::default();+ s.select(None);+ s};- match tab {- crate::tui::state::HomeDeckTab::ContinueWatching => {- for (i, item) in cw_items.iter().enumerate() {- if curr_y >= inner_area.bottom() {- break;- }- let is_selected = selected == Some(i);+ let hl_sym = "";+ let hl_style = crate::tui::overlay::selection_style(theme, state.basic_terminal);+ let list_height = item_count as u16;+ let list_area = Rect {+ x: inner_area.x,+ y: inner_area.y,+ width: inner_area.width,+ height: list_height.min(inner_area.height),+ };+ let list_items: Vec<ListItem> = match tab {+ crate::tui::state::HomeDeckTab::ContinueWatching => cw_items+ .iter()+ .map(|item| {let episode_tag = if item.season > 0 {format!("S{:02}E{:02}", item.season, item.episode)} else {@@ -595,30 +602,12 @@ pub(crate) fn render_landing_deck(frame: &mut Frame, area: Rect, state: &AppStatprogress_str};- let pointer = if is_selected {- if state.basic_terminal { "> " } else { "▌ " }- } else {- " "- };-- let title_style = if is_selected {- theme.title.add_modifier(Modifier::BOLD)- } else {- theme.text- };-- let row_style = if is_selected {- Style::default().bg(theme.surface0.fg.unwrap_or(theme.base))- } else {- Style::default()- };-let left_margin = " ";- let right_margin = " ";+ let right_margin = " ";let tag_len = crate::tui::text::width(&right_tag);- let pointer_len = 3;- let margins_len = 3;- let fixed_overhead = margins_len + pointer_len + tag_len;+ let hl_sym_len = 0;+ let margins_len = 4;+ let fixed_overhead = margins_len + tag_len;let max_title_width =(inner_area.width as usize).saturating_sub(fixed_overhead + 1);@@ -626,33 +615,21 @@ pub(crate) fn render_landing_deck(frame: &mut Frame, area: Rect, state: &AppStatcrate::tui::text::truncate_width(&item.title, max_title_width);let title_width = crate::tui::text::width(&truncated_title);let pad_len = (inner_area.width as usize)- .saturating_sub(margins_len + pointer_len + title_width + tag_len);+ .saturating_sub(margins_len + hl_sym_len + title_width + tag_len);let line = Line::from(vec![Span::raw(left_margin),- Span::styled(pointer, theme.accent),- Span::styled(truncated_title, title_style),+ Span::styled(truncated_title, theme.text),Span::raw(" ".repeat(pad_len)),Span::styled(right_tag, theme.text_dim),Span::raw(right_margin),]);-- let row_area = Rect {- x: inner_area.x,- y: curr_y,- width: inner_area.width,- height: 1,- };- frame.render_widget(Paragraph::new(line).style(row_style), row_area);- curr_y += 1;- }- }- crate::tui::state::HomeDeckTab::Favorites => {- for (i, item) in fav_items.iter().enumerate() {- if curr_y >= inner_area.bottom() {- break;- }- let is_selected = selected == Some(i);+ ListItem::new(line)+ })+ .collect(),+ crate::tui::state::HomeDeckTab::Favorites => fav_items+ .iter()+ .map(|item| {let type_tag = if item.stype == 2 { "Series" } else { "Movie" };let right_tag = if item.release_year.is_empty() {type_tag.to_string()@@ -660,30 +637,12 @@ pub(crate) fn render_landing_deck(frame: &mut Frame, area: Rect, state: &AppStatformat!("{} {type_tag}", item.release_year)};- let pointer = if is_selected {- if state.basic_terminal { "> " } else { "▌ " }- } else {- " "- };-- let title_style = if is_selected {- theme.title.add_modifier(Modifier::BOLD)- } else {- theme.text- };-- let row_style = if is_selected {- Style::default().bg(theme.surface0.fg.unwrap_or(theme.base))- } else {- Style::default()- };-let left_margin = " ";- let right_margin = " ";+ let right_margin = " ";let tag_len = crate::tui::text::width(&right_tag);- let pointer_len = 3;- let margins_len = 3;- let fixed_overhead = margins_len + pointer_len + tag_len;+ let hl_sym_len = 0;+ let margins_len = 4;+ let fixed_overhead = margins_len + tag_len;let max_title_width =(inner_area.width as usize).saturating_sub(fixed_overhead + 1);@@ -691,29 +650,25 @@ pub(crate) fn render_landing_deck(frame: &mut Frame, area: Rect, state: &AppStatcrate::tui::text::truncate_width(&item.title, max_title_width);let title_width = crate::tui::text::width(&truncated_title);let pad_len = (inner_area.width as usize)- .saturating_sub(margins_len + pointer_len + title_width + tag_len);+ .saturating_sub(margins_len + hl_sym_len + title_width + tag_len);let line = Line::from(vec![Span::raw(left_margin),- Span::styled(pointer, theme.accent),- Span::styled(truncated_title, title_style),+ Span::styled(truncated_title, theme.text),Span::raw(" ".repeat(pad_len)),Span::styled(right_tag, theme.text_dim),Span::raw(right_margin),]);+ ListItem::new(line)+ })+ .collect(),+ };- let row_area = Rect {- x: inner_area.x,- y: curr_y,- width: inner_area.width,- height: 1,- };- frame.render_widget(Paragraph::new(line).style(row_style), row_area);- curr_y += 1;- }- }- }-+ let list = List::new(list_items)+ .highlight_symbol(hl_sym)+ .highlight_style(hl_style);+ frame.render_stateful_widget(list, list_area, &mut list_state);+ let curr_y = list_area.bottom();if overflow > 0 && curr_y < inner_area.bottom() {let sep = if state.basic_terminal { "-" } else { "·" };let cmd = match tab {@@ -752,7 +707,7 @@ pub(crate) fn render_discover_landing(return;}- let presets = if state.is_addon_mode {+ let presets = if state.active_provider == crate::providers::models::ProviderKind::Addons {[("Top Movies", "Cinemeta Curated Catalog"),("Top Series", "Popular & Episodic TV"),@@ -857,36 +812,11 @@ pub(crate) fn render_discover_landing(pub(crate) fn dynamic_search_placeholder(state: &AppState) -> &'static str {if state.is_tv_mode {- const TV_HINTS: &[&str] = &[- "Search live TV channels & streams…",- "Type /list to display all channels…",- "Type /config to add M3U playlist URLs…",- "Type /settings for TV & player options…",- ];- let idx = ((state.tick_count / 40) as usize) % TV_HINTS.len();- TV_HINTS[idx]- } else if state.is_addon_mode {- const ADDON_HINTS: &[&str] = &[- "Search movies and series via addons…",- "Type /config to install Stremio addons…",- "Type /browse to explore addon catalogs…",- "Type /favorites for starred addon media…",- "Type /settings for preferences & options…",- ];- let idx = ((state.tick_count / 40) as usize) % ADDON_HINTS.len();- ADDON_HINTS[idx]+ "Search live TV channels…"+ } else if state.active_provider == crate::providers::models::ProviderKind::Addons {+ "Search via addons…"} else {- const STREAMING_HINTS: &[&str] = &[- "Search movies, series & anime…",- "Try 'Interstellar', 'Dune', 'Breaking Bad'…",- "Type /settings for preferences & themes…",- "Type /browse for trending & top rated…",- "Type /history to resume your watch list…",- "Type /favorites for starred media…",- "Type /help for interactive keybindings…",- ];- let idx = ((state.tick_count / 40) as usize) % STREAMING_HINTS.len();- STREAMING_HINTS[idx]+ "Search movies, series & anime…"}}@@ -987,12 +917,8 @@ fn render_search_bar(let sep = if state.basic_terminal { "-" } else { "·" };format!("[Live TV {sep} {ctrl_t}]")}- } else if state.is_addon_mode {- if is_ultra_compact {- "[Addons]".to_string()- } else {- "[Addon Mode]".to_string()- }+ } else if state.active_provider == crate::providers::models::ProviderKind::Addons {+ "[Addons]".to_string()} else {let label = state.active_provider.label();if is_ultra_compact {@@ -1026,12 +952,8 @@ fn render_search_bar(Style::default().bg(bg).fg(fg)};(text, style)- } else if state.is_addon_mode {- let text = if is_ultra_compact {- "[Addons]".to_string()- } else {- "[Addon Mode]".to_string()- };+ } else if state.active_provider == crate::providers::models::ProviderKind::Addons {+ let text = "[Addons]".to_string();let style = if state.basic_terminal {theme.teal} else {@@ -1290,11 +1212,6 @@ fn home_bottom_bar_spans(} else {crate::tui::text::CTRL_T_STR};- let ctrl_a = if ultra_compact_tabs || compact_tabs {- "A"- } else {- crate::tui::text::CTRL_A_STR- };let current_mode = state.mode();let mut bar_spans: Vec<Span<'static>> = Vec::new();@@ -1325,8 +1242,10 @@ fn home_bottom_bar_spans(if state.streaming_enabled && current_mode != crate::tui::state::AppMode::Streaming {bar_spans.push(Span::styled("[", bracket_style));bar_spans.push(Span::styled(ctrl_s, shortcut_style));- bar_spans.push(Span::styled("] ", bracket_style));- bar_spans.push(Span::styled("Stream", text_style));+ bar_spans.push(Span::styled("]", bracket_style));+ if !compact_tabs {+ bar_spans.push(Span::styled(" Stream", text_style));+ }}if state.tv_enabled && current_mode != crate::tui::state::AppMode::Tv {@@ -1335,18 +1254,10 @@ fn home_bottom_bar_spans(}bar_spans.push(Span::styled("[", bracket_style));bar_spans.push(Span::styled(ctrl_t, shortcut_style));- bar_spans.push(Span::styled("] ", bracket_style));- bar_spans.push(Span::styled("TV", text_style));- }-- if state.addons_enabled && current_mode != crate::tui::state::AppMode::Addon {- if !bar_spans.is_empty() {- bar_spans.push(Span::raw(sep));+ bar_spans.push(Span::styled("]", bracket_style));+ if !compact_tabs {+ bar_spans.push(Span::styled(" TV", text_style));}- bar_spans.push(Span::styled("[", bracket_style));- bar_spans.push(Span::styled(ctrl_a, shortcut_style));- bar_spans.push(Span::styled("] ", bracket_style));- bar_spans.push(Span::styled("Addon", text_style));}if !bar_spans.is_empty() {@@ -1356,18 +1267,19 @@ fn home_bottom_bar_spans(bar_spans.push(Span::styled("[", bracket_style));bar_spans.push(Span::styled("?", shortcut_style));- bar_spans.push(Span::styled("] ", bracket_style));- if !ultra_compact_tabs {- bar_spans.push(Span::styled("Help", text_style));+ bar_spans.push(Span::styled("]", bracket_style));+ if !compact_tabs {+ bar_spans.push(Span::styled(" Help", text_style));bar_spans.push(Span::raw(" "));+ } else if !ultra_compact_tabs {+ bar_spans.push(Span::raw(" "));}bar_spans.push(Span::styled("[", bracket_style));bar_spans.push(Span::styled("q", shortcut_style));- bar_spans.push(Span::styled("] ", bracket_style));- if !ultra_compact_tabs {- bar_spans.push(Span::styled("Quit", text_style));+ bar_spans.push(Span::styled("]", bracket_style));+ if !compact_tabs {+ bar_spans.push(Span::styled(" Quit", text_style));}-bar_spans}@@ -1467,19 +1379,24 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)height: vertical_chunks[rows.search].height,};- if !state.tv_config_popup && !update_active {+ if !state.tv_config_popup && !update_active && !state.show_settings_popup {render_search_bar(frame, search_card_area, state, theme, view, true);}search_bar_area = search_card_area;let suggestions_open =state.input_mode == InputMode::Editing && !state.search_suggestions.is_empty();- if state.landing_deck_visible() && !state.tv_config_popup && !update_active {+ if state.landing_deck_visible()+ && !state.tv_config_popup+ && !update_active+ && !state.show_settings_popup+ {render_landing_deck(frame, vertical_chunks[rows.favorites], state, theme);} else if !state.is_tv_mode&& !state.tv_config_popup&& !suggestions_open&& !update_active+ && !state.show_settings_popup&& area.height >= 26{render_discover_landing(frame, vertical_chunks[rows.favorites], state, theme);@@ -1581,41 +1498,9 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)height: metrics.poster_rows_eff,};- let (highlight_area, poster_area, text_area) =- item_slot_rects(item_area, poster_width);+ let (poster_area, text_area) = item_slot_rects(item_area, poster_width);let is_selected = Some(i) == selected_idx;- if is_selected && !is_editing && !modal_active {- let selected_bg = theme.surface0.fg.unwrap_or(theme.base);- frame.render_widget(- Block::default().style(Style::default().bg(selected_bg)),- item_area,- );- }-- if is_selected {- let (indicator_sym, indicator_style) = if is_editing || modal_active {- (- if state.basic_terminal { "- " } else { "· " },- theme.text_dim,- )- } else {- (if state.basic_terminal { "> " } else { "▌ " }, theme.accent)- };- let indicator = Paragraph::new(ratatui::text::Line::from(vec![- ratatui::text::Span::styled(indicator_sym, indicator_style),- ]));-- let indicator_y =- highlight_area.y + (highlight_area.height.saturating_sub(1) / 2);- let indicator_area = Rect {- x: highlight_area.x,- y: indicator_y,- width: highlight_area.width,- height: 1.min(highlight_area.height),- };- frame.render_widget(indicator, indicator_area);- }let img_height = poster_area.height.min(state.poster_rows);let img_y_offset = item_area.height.saturating_sub(img_height) / 2;@@ -1624,7 +1509,6 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)height: img_height,..poster_area};-if state.image_supported && poster_area.width > 0 {if let Some(img) = state.search_posters.peek(&res.id) {let target_dims = (poster_area.width, state.poster_rows);@@ -1704,14 +1588,11 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme).split(text_area)};+ let is_active_selection = is_selected && !is_editing && !modal_active;let title_style = if modal_active {theme.muted- } else if is_selected {- if is_editing {- theme.text- } else {- theme.title.add_modifier(Modifier::BOLD)- }+ } else if is_active_selection {+ crate::tui::overlay::selection_style(theme, state.basic_terminal)} else {theme.text};@@ -1769,12 +1650,19 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme).max(4);let display_title = crate::tui::text::truncate_width(&res.title, max_title_width);- let mut row1_spans = vec![ratatui::text::Span::raw(" ")];+ let mut row1_spans = Vec::new();+ if is_active_selection {+ row1_spans.push(ratatui::text::Span::styled(" ", title_style));+ } else {+ row1_spans.push(ratatui::text::Span::raw(" "));+ }if is_favorited {row1_spans.push(ratatui::text::Span::styled(if state.basic_terminal { "* " } else { "★ " },if modal_active {theme.muted+ } else if is_active_selection {+ title_style} else {theme.rating},@@ -1784,11 +1672,15 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)display_title.as_ref(),title_style,));+ if is_active_selection {+ row1_spans.push(ratatui::text::Span::styled(" ", title_style));+ }if let Some(b_spans) = badge_spans {let title_actual_w = 1+ if is_favorited { 2 } else { 0 }- + crate::tui::text::width(&display_title);+ + crate::tui::text::width(&display_title)+ + if is_active_selection { 1 } else { 0 };let gap =(text_area.width as usize).saturating_sub(title_actual_w + badge_width);if gap > 0 {@@ -1882,7 +1774,6 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)}}}-row2_spans.push(crate::tui::widgets::badge::provider_badge_span(res.provider,theme,@@ -2005,7 +1896,7 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)}}- if !state.tv_config_popup {+ if !state.tv_config_popup && !state.show_settings_popup {render_search_suggestions(frame, area, search_bar_area, state, theme, view);}render_provider_popup(frame, area, search_bar_area, state, theme);@@ -2032,12 +1923,6 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)let inner_area = crate::tui::widgets::ModalFrame::new(&title, theme, state.basic_terminal).render(frame, popup_area, area);- let sections = ratatui::layout::Layout::vertical([- ratatui::layout::Constraint::Min(1),- ratatui::layout::Constraint::Length(2),- ])- .split(inner_area);-if state.tv_input_active {let label = if state.tv_input_is_file {"Enter playlist file path:"@@ -2046,7 +1931,7 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)};crate::tui::widgets::render_single_line_input(frame,- sections[0],+ inner_area,label,&state.tv_input_buffer,theme,@@ -2114,31 +1999,12 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)theme,state.basic_terminal,))- .highlight_symbol(if state.basic_terminal { "> " } else { "▌ " });+ .highlight_symbol("");let mut list_state = ratatui::widgets::ListState::default();list_state.select(Some(state.tv_manager_selected));- frame.render_stateful_widget(list, sections[0], &mut list_state);+ frame.render_stateful_widget(list, inner_area, &mut list_state);}-- let footer = if state.tv_input_active {- vec![- crate::tui::overlay::key_hint("Enter", "Add", theme),- ratatui::text::Span::raw(" "),- crate::tui::overlay::key_hint("Esc", "Cancel", theme),- ]- } else {- vec![- crate::tui::overlay::key_hint("↑↓", "Move", theme),- ratatui::text::Span::raw(" "),- crate::tui::overlay::key_hint("Enter", "Select", theme),- ratatui::text::Span::raw(" "),- crate::tui::overlay::key_hint("d", "Remove", theme),- ratatui::text::Span::raw(" "),- crate::tui::overlay::key_hint("Esc", "Close", theme),- ]- };- crate::tui::widgets::render_modal_footer(frame, sections[1], footer, theme);}if state.addon_manager_popup {@@ -2155,27 +2021,14 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme).render(frame, popup_area, area);if state.addon_input_active {- let sections = ratatui::layout::Layout::vertical([- ratatui::layout::Constraint::Min(1),- ratatui::layout::Constraint::Length(2),- ])- .split(inner_area);-crate::tui::widgets::render_single_line_input(frame,- sections[0],+ inner_area,"Enter Addon Manifest URL:",&state.addon_input_buffer,theme,state.basic_terminal,);-- let footer = vec![- crate::tui::overlay::key_hint("Enter", "Add", theme),- ratatui::text::Span::raw(" "),- crate::tui::overlay::key_hint("Esc", "Cancel", theme),- ];- crate::tui::widgets::render_modal_footer(frame, sections[1], footer, theme);} else {let sections = ratatui::layout::Layout::vertical([ratatui::layout::Constraint::Min(1),@@ -2196,14 +2049,7 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)for (idx, a) in state.installed_addons.iter().enumerate() {let row_idx = idx + 1;let is_selected = state.addon_manager_selected == row_idx;- let prefix = if is_selected {- ratatui::text::Span::styled(- if state.basic_terminal { "> " } else { "▌ " },- theme.sapphire,- )- } else {- ratatui::text::Span::raw(" ")- };+ let prefix = ratatui::text::Span::raw(" ");let check = if a.enabled {ratatui::text::Span::styled("[x] ", theme.success)} else {@@ -2243,60 +2089,49 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme));let mut spans = vec![ratatui::text::Span::raw(" "), prefix, check, name];spans.extend(badges);- items.push(ratatui::widgets::ListItem::new(ratatui::text::Line::from(- spans,- )));+ let item = ratatui::widgets::ListItem::new(ratatui::text::Line::from(spans));+ let item = if is_selected {+ item.style(crate::tui::overlay::selection_style(+ theme,+ state.basic_terminal,+ ))+ } else {+ item+ };+ items.push(item);}let list = ratatui::widgets::List::new(items);frame.render_widget(list, sections[0]);- let add_prefix = if is_add_selected {- if state.basic_terminal { "> " } else { "▌ " }- } else {- " "- };let add_button = if is_add_selected {ratatui::text::Span::styled(- format!("{add_prefix}[ Add Manifest URL ]"),- theme.sapphire.add_modifier(ratatui::style::Modifier::BOLD),+ " [ Add Manifest URL ]",+ crate::tui::overlay::selection_style(theme, state.basic_terminal),)} else {- ratatui::text::Span::styled(- format!("{add_prefix}[ Add Manifest URL ]"),- theme.sapphire,- )+ ratatui::text::Span::styled(" [ Add Manifest URL ]", theme.sapphire)};let button_line =ratatui::text::Line::from(vec![ratatui::text::Span::raw(" "), add_button]);frame.render_widget(ratatui::widgets::Paragraph::new(button_line), sections[1]);-- let footer = vec![- crate::tui::overlay::key_hint("↑↓←→", "Move", theme),- ratatui::text::Span::raw(" "),- crate::tui::overlay::key_hint("Enter/Space", "Toggle/Select", theme),- ratatui::text::Span::raw(" "),- crate::tui::overlay::key_hint("d", "Remove", theme),- ratatui::text::Span::raw(" "),- crate::tui::overlay::key_hint("Esc", "Close", theme),- ];- crate::tui::widgets::render_modal_footer(frame, sections[2], footer, theme);}}if state.show_browse_popup {- let raw_labels: Vec<String> = if state.mode() == crate::tui::state::AppMode::Addon {- crate::providers::addons::models::curated_catalog_presets(&state.installed_addons)- .into_iter()- .map(|target| target.label)- .collect()- } else {- crate::tui::state::BrowsePreset::ALL- .iter()- .map(|preset| preset.label().to_string())- .collect()- };+ let raw_labels: Vec<String> =+ if state.active_provider == crate::providers::models::ProviderKind::Addons {+ crate::providers::addons::models::curated_catalog_presets(&state.installed_addons)+ .into_iter()+ .map(|target| target.label)+ .collect()+ } else {+ crate::tui::state::BrowsePreset::ALL+ .iter()+ .map(|preset| preset.label().to_string())+ .collect()+ };let raw_items: Vec<String> = raw_labels.iter()@@ -2342,6 +2177,7 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)title: "Browse",confirm_label: "Open",minimum_width: 36,+ show_counter: true,},theme,state.basic_terminal,@@ -2480,25 +2316,14 @@ fn render_search_suggestions(}frame.render_widget(container_block, container_area);- for (row_idx, &(orig_idx, suggestion)) in visible_slice.iter().enumerate() {- let current_y = inner_area.y + row_idx as u16;- if current_y >= inner_area.bottom() {- break;- }+ let mut list_items = Vec::with_capacity(visible_slice.len());+ let mut selected_in_slice = None;+ for (slice_idx, &(orig_idx, suggestion)) in visible_slice.iter().enumerate() {let is_selected = Some(orig_idx) == state.suggest_index;-- let indicator_symbol = if is_selected {- if state.basic_terminal { "> " } else { "▌ " }- } else {- " "- };-- let indicator_style = if is_selected {- theme.accent.add_modifier(Modifier::BOLD)- } else {- Style::default()- };+ if is_selected {+ selected_in_slice = Some(slice_idx);+ }let is_slash_cmd = suggestion.starts_with('/');let display_name = if is_slash_cmd {@@ -2508,19 +2333,11 @@ fn render_search_suggestions(};let desc = slash_command_description(suggestion, state);-- let row_style = if is_selected {- Style::default().bg(theme.surface0.fg.unwrap_or(theme.base))- } else {- Style::default()- };-let text_style = if is_selected {theme.highlight.add_modifier(Modifier::BOLD)} else {theme.text_dim};-let desc_style = if is_selected {theme.subtext1.add_modifier(Modifier::BOLD)} else {@@ -2532,7 +2349,7 @@ fn render_search_suggestions(.as_ref().map_or(0, |b| crate::tui::text::width(&b.content));- let mut spans = vec![Span::styled(indicator_symbol, indicator_style)];+ let mut spans = vec![Span::raw(" ")];if let Some(badge) = badge_span {spans.push(badge);}@@ -2542,9 +2359,8 @@ fn render_search_suggestions(let name_len = crate::tui::text::width(display_name) + badge_width;let pad = 28usize.saturating_sub(name_len).max(2);spans.push(Span::raw(" ".repeat(pad)));- let indicator_width = crate::tui::text::width(indicator_symbol);- let desc_budget =- (inner_area.width as usize).saturating_sub(indicator_width + name_len + pad);+ let left_pad = 1;+ let desc_budget = (inner_area.width as usize).saturating_sub(left_pad + name_len + pad);if desc_budget > 0 {spans.push(Span::styled(crate::tui::text::truncate_width(description, desc_budget),@@ -2553,15 +2369,24 @@ fn render_search_suggestions(}}- let row_area = Rect {- x: inner_area.x,- y: current_y,- width: inner_area.width,- height: 1,- };-- frame.render_widget(Paragraph::new(Line::from(spans)).style(row_style), row_area);+ list_items.push(ListItem::new(Line::from(spans)));}++ let mut list_state = ListState::default();+ list_state.select(selected_in_slice);++ let hl_style = crate::tui::overlay::selection_style(theme, state.basic_terminal);+ let list = List::new(list_items)+ .highlight_symbol("")+ .highlight_style(hl_style);++ let list_area = Rect {+ x: inner_area.x,+ y: inner_area.y,+ width: inner_area.width,+ height: (visible_slice.len() as u16).min(inner_area.height),+ };+ frame.render_stateful_widget(list, list_area, &mut list_state);}pub fn search_bar_provider_pill_rect(search_card_area: Rect, state: &AppState) -> Rect {let inner_width = search_card_area.width.saturating_sub(4);@@ -2589,12 +2414,8 @@ pub fn search_bar_provider_pill_rect(search_card_area: Rect, state: &AppState) -} else {format!("[Live TV {sep} {ctrl_t}]")}- } else if state.is_addon_mode {- if is_ultra_compact {- "[Addons]".to_string()- } else {- "[Addon Mode]".to_string()- }+ } else if state.active_provider == crate::providers::models::ProviderKind::Addons {+ "[Addons]".to_string()} else {let label = state.active_provider.label();if is_ultra_compact {@@ -2627,7 +2448,6 @@ pub fn provider_popup_bounds(let popup_width = 24u16.min(area.width.saturating_sub(2)).max(min_width);let popup_height =((provider_count as u16).saturating_add(2)).min(area.height.saturating_sub(2));-let x = search_card_area.right().saturating_sub(popup_width)@@ -2687,103 +2507,65 @@ fn render_provider_popup(.borders(Borders::ALL).border_type(crate::tui::overlay::border_type(state.basic_terminal)).border_style(theme.border_focus)- .title(" Providers ");+ .title(" Providers ")+ .title_style(theme.title);frame.render_widget(container_block, container_area);- let selected_idx = state.provider_list_state.selected();-- for (idx, provider) in providers.iter().enumerate() {- let current_y = inner_area.y + idx as u16;- if current_y >= inner_area.bottom() {- break;- }-- let is_selected = selected_idx == Some(idx);- let is_active = *provider == state.active_provider;-- let cursor_symbol = if is_selected {- if state.basic_terminal { "> " } else { "▌ " }- } else {- " "- };- let cursor_style = if is_selected {- theme.accent.add_modifier(Modifier::BOLD)- } else {- Style::default()- };-- let label_style = if is_selected {- theme.highlight.add_modifier(Modifier::BOLD)- } else if is_active {- theme.sapphire.add_modifier(Modifier::BOLD)- } else {- theme.text_dim- };-- let row_style = if is_selected {- Style::default().bg(theme.surface0.fg.unwrap_or(theme.base))- } else {- Style::default()- };-- let row_area = Rect {- x: inner_area.x,- y: current_y,- width: inner_area.width,- height: 1,- };-- let line = Line::from(vec![- Span::styled(cursor_symbol, cursor_style),- Span::styled(provider.label(), label_style),- ]);+ let list_items: Vec<ListItem> = providers+ .iter()+ .map(|provider| {+ let is_active = *provider == state.active_provider;+ let active_prefix = if is_active {+ if state.basic_terminal { "* " } else { "✓ " }+ } else {+ " "+ };+ let active_style = if is_active {+ theme.success.add_modifier(Modifier::BOLD)+ } else {+ Style::default()+ };+ let label_style = theme.text;+ ListItem::new(Line::from(vec![+ Span::raw(" "),+ Span::styled(active_prefix, active_style),+ Span::styled(provider.label(), label_style),+ ]))+ })+ .collect();- frame.render_widget(Paragraph::new(line).style(row_style), row_area);- }+ let list = List::new(list_items)+ .highlight_style(crate::tui::overlay::selection_style(+ theme,+ state.basic_terminal,+ ))+ .highlight_symbol("");+ let mut list_state = state.provider_list_state;+ frame.render_stateful_widget(list, inner_area, &mut list_state);}#[inline(always)]-fn item_slot_rects(item_area: Rect, poster_width: u16) -> (Rect, Rect, Rect) {- let highlight_w = 2.min(item_area.width);+fn item_slot_rects(item_area: Rect, poster_width: u16) -> (Rect, Rect) {if poster_width == 0 {- let text_x = item_area.x + highlight_w;- let text_w = item_area.width.saturating_sub(highlight_w);return (Rect {x: item_area.x,y: item_area.y,- width: highlight_w,- height: item_area.height,- },- Rect {- x: item_area.x + highlight_w,- y: item_area.y,width: 0,height: item_area.height,},- Rect {- x: text_x,- y: item_area.y,- width: text_w,- height: item_area.height,- },+ item_area,);}- let poster_w = poster_width.min(item_area.width.saturating_sub(highlight_w));- let text_x = item_area.x + highlight_w + poster_w + 1;- let text_w = item_area.width.saturating_sub(highlight_w + poster_w + 1);+ let poster_w = poster_width.min(item_area.width);+ let text_x = item_area.x + poster_w + 1;+ let text_w = item_area.width.saturating_sub(poster_w + 1);(Rect {x: item_area.x,y: item_area.y,- width: highlight_w,- height: item_area.height,- },- Rect {- x: item_area.x + highlight_w,- y: item_area.y,width: poster_w,height: item_area.height,},@@ -2876,7 +2658,7 @@ mod tests {assert!(rendered.contains("[CMD]"));assert!(rendered.contains("[HISTORY]"));assert!(!rendered.contains("[SUGGEST]"));- assert!(rendered.contains('▌'));+ assert!(!rendered.contains('▌'));assert!(!rendered.contains('├'));assert!(!rendered.contains('└'));}@@ -3043,7 +2825,6 @@ mod tests {let mut terminal = Terminal::new(backend).unwrap();let mut state = AppState {input_mode: InputMode::Normal,- is_addon_mode: true,addons_enabled: true,active_provider: crate::providers::models::ProviderKind::Addons,..Default::default()@@ -3121,12 +2902,10 @@ mod tests {assert_eq!(inner.y, 6);assert_eq!(inner.width, 22);assert_eq!(inner.height, 4);-let bottom_bar = Rect::new(10, 20, 60, 3);let (flipped, _) = provider_popup_bounds(area, bottom_bar, 4);assert_eq!(flipped.y, 14);assert_eq!(flipped.height, 6);-let narrow_area = Rect::new(0, 0, 16, 24);let narrow_bar = Rect::new(1, 2, 14, 3);let (narrow_container, _) = provider_popup_bounds(narrow_area, narrow_bar, 4);@@ -3140,6 +2919,7 @@ mod tests {let mut terminal = Terminal::new(backend).unwrap();let mut state = AppState {show_provider_popup: true,+ basic_terminal: false,..Default::default()};state.provider_list_state.select(Some(0));@@ -3161,10 +2941,10 @@ mod tests {}rendered.push('\n');}-assert!(rendered.contains("Providers"));assert!(rendered.contains("MovieBox"));assert!(rendered.contains("4KHDHub"));+ assert!(rendered.contains("✓"));assert!(!rendered.contains('●'));assert!(!rendered.contains('○'));}@@ -3211,109 +2991,34 @@ mod tests {}#[test]- fn test_dynamic_search_placeholder_rotation() {+ fn test_dynamic_search_placeholder() {let mut state = AppState::default();assert_eq!(dynamic_search_placeholder(&state),"Search movies, series & anime…");- state.tick_count = 40;- assert_eq!(- dynamic_search_placeholder(&state),- "Try 'Interstellar', 'Dune', 'Breaking Bad'…"- );- state.tick_count = 80;- assert_eq!(- dynamic_search_placeholder(&state),- "Type /settings for preferences & themes…"- );- state.tick_count = 120;- assert_eq!(- dynamic_search_placeholder(&state),- "Type /browse for trending & top rated…"- );- state.tick_count = 160;- assert_eq!(- dynamic_search_placeholder(&state),- "Type /history to resume your watch list…"- );- state.tick_count = 200;- assert_eq!(- dynamic_search_placeholder(&state),- "Type /favorites for starred media…"- );- state.tick_count = 240;- assert_eq!(- dynamic_search_placeholder(&state),- "Type /help for interactive keybindings…"- );- state.tick_count = 280;+ state.tick_count = 100;assert_eq!(dynamic_search_placeholder(&state),"Search movies, series & anime…");- let mut tv_state = AppState {+ let tv_state = AppState {is_tv_mode: true,..Default::default()};assert_eq!(dynamic_search_placeholder(&tv_state),- "Search live TV channels & streams…"- );- tv_state.tick_count = 40;- assert_eq!(- dynamic_search_placeholder(&tv_state),- "Type /list to display all channels…"- );- tv_state.tick_count = 80;- assert_eq!(- dynamic_search_placeholder(&tv_state),- "Type /config to add M3U playlist URLs…"- );- tv_state.tick_count = 120;- assert_eq!(- dynamic_search_placeholder(&tv_state),- "Type /settings for TV & player options…"- );- tv_state.tick_count = 160;- assert_eq!(- dynamic_search_placeholder(&tv_state),- "Search live TV channels & streams…"+ "Search live TV channels…");- let mut addon_state = AppState {- is_addon_mode: true,+ let addon_state = AppState {+ active_provider: crate::providers::models::ProviderKind::Addons,..Default::default()};assert_eq!(dynamic_search_placeholder(&addon_state),- "Search movies and series via addons…"- );- addon_state.tick_count = 40;- assert_eq!(- dynamic_search_placeholder(&addon_state),- "Type /config to install Stremio addons…"- );- addon_state.tick_count = 80;- assert_eq!(- dynamic_search_placeholder(&addon_state),- "Type /browse to explore addon catalogs…"- );- addon_state.tick_count = 120;- assert_eq!(- dynamic_search_placeholder(&addon_state),- "Type /favorites for starred addon media…"- );- addon_state.tick_count = 160;- assert_eq!(- dynamic_search_placeholder(&addon_state),- "Type /settings for preferences & options…"- );- addon_state.tick_count = 200;- assert_eq!(- dynamic_search_placeholder(&addon_state),- "Search movies and series via addons…"+ "Search via addons…");}@@ -3359,9 +3064,10 @@ mod tests {}assert!(rendered.contains("Favorites"));assert!(!rendered.contains("★"));- assert!(rendered.contains(" ▌ Favorite Movie 0"));- assert!(rendered.contains(" Favorite Movie 1"));- assert!(rendered.contains("2024 Movie "));+ assert!(rendered.contains("Favorite Movie 0"));+ assert!(rendered.contains("Favorite Movie 1"));+ assert!(!rendered.contains("▌"));+ assert!(rendered.contains("2024 Movie"));assert!(rendered.contains("+5 more · /favorites"));}#[test]@@ -3407,9 +3113,9 @@ mod tests {assert!(rendered.contains("Favorites"));assert!(!rendered.contains("* Favorites"));- assert!(rendered.contains(" > Favorite Movie 0"));- assert!(rendered.contains(" Favorite Movie 1"));- assert!(rendered.contains("2024 Movie "));+ assert!(rendered.contains("Favorite Movie 0"));+ assert!(rendered.contains("Favorite Movie 1"));+ assert!(rendered.contains("2024 Movie"));assert!(rendered.contains("+5 more - /favorites"));}#[test]@@ -3558,7 +3264,7 @@ mod tests {assert!(!rendered.contains("Stream"));assert!(rendered.contains("TV"));- assert!(rendered.contains("Addon"));+ assert!(!rendered.contains("Addon"));assert!(rendered.contains("Quit"));}@@ -3664,10 +3370,9 @@ mod tests {tv_rendered.push('\n');}assert!(tv_rendered.contains("[Live TV"));- assert!(tv_rendered.contains("Search live TV channels & streams…"));-+ assert!(tv_rendered.contains("Search live TV channels…"));let mut addon_state = AppState {- is_addon_mode: true,+ active_provider: crate::providers::models::ProviderKind::Addons,basic_terminal: false,..Default::default()};@@ -3684,8 +3389,8 @@ mod tests {}addon_rendered.push('\n');}- assert!(addon_rendered.contains("[Addon Mode]"));- assert!(addon_rendered.contains("Search movies and series via addons…"));+ assert!(addon_rendered.contains("[Addons]"));+ assert!(addon_rendered.contains("Search via addons…"));}#[test]@@ -3755,21 +3460,19 @@ mod tests {#[test]fn test_item_slot_rects_responsive_zero_width() {let area = Rect::new(10, 5, 80, 4);- let (hl_zero, poster_zero, text_zero) = item_slot_rects(area, 0);- assert_eq!(hl_zero.width, 2);+ let (poster_zero, text_zero) = item_slot_rects(area, 0);assert_eq!(poster_zero.width, 0);- assert_eq!(text_zero.x, 12);- assert_eq!(text_zero.width, 78);+ assert_eq!(text_zero.x, 10);+ assert_eq!(text_zero.width, 80);- let (hl, poster, text) = item_slot_rects(area, 12);- assert_eq!(hl.width, 2);+ let (poster, text) = item_slot_rects(area, 12);assert_eq!(poster.width, 12);- assert_eq!(text.x, 25);- assert_eq!(text.width, 65);+ assert_eq!(text.x, 23);+ assert_eq!(text.width, 67);}#[test]- fn test_search_result_selection_continuous_background() {+ fn test_search_result_selection_indicator_without_opaque_background() {let backend = TestBackend::new(100, 30);let mut terminal = Terminal::new(backend).unwrap();let mut state = AppState {@@ -3785,12 +3488,13 @@ mod tests {episode: 0,provider: crate::providers::models::ProviderKind::MovieBox,}],+ has_search_settled: true,+ basic_terminal: false,..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);@@ -3800,12 +3504,135 @@ mod tests {let buffer = terminal.backend().buffer();for x in 0..100 {- assert_eq!(+ assert_ne!(buffer[(x, 2)].style().bg,Some(selected_bg),- "mismatch at x={x}"+ "opaque background leaked at x={x}");}+ let mut rendered = String::new();+ for y in 0..30 {+ for x in 0..100 {+ rendered.push_str(buffer[(x, y)].symbol());+ }+ rendered.push('\n');+ }+ assert!(+ rendered.contains("The Matrix"),+ "rendered content:\n{rendered}"+ );+ let mut title_has_highlight = false;+ let expected_hl = crate::tui::overlay::selection_style(&theme, false);+ for y in 0..30 {+ for x in 0..100 {+ let cell = &buffer[(x, y)];+ if cell.symbol() == "T"+ && buffer[(x + 1, y)].symbol() == "h"+ && buffer[(x + 2, y)].symbol() == "e"+ {+ if cell.style().bg == expected_hl.bg && cell.style().fg == expected_hl.fg {+ title_has_highlight = true;+ }+ }+ }+ }+ assert!(+ title_has_highlight,+ "expected selected card title to have selection_style highlight"+ );+ let mut meta_has_reversed = false;+ for y in 0..30 {+ for x in 0..100 {+ let cell = &buffer[(x, y)];+ if cell.symbol() == "1"+ && buffer[(x + 1, y)].symbol() == "9"+ && buffer[(x + 2, y)].symbol() == "9"+ && buffer[(x + 3, y)].symbol() == "9"+ {+ if cell.style().add_modifier.contains(Modifier::REVERSED) {+ meta_has_reversed = true;+ }+ }+ }+ }+ assert!(+ !meta_has_reversed,+ "expected metadata row to remain transparent and un-reversed"+ );+ let mut far_right_has_reversed = false;+ for y in 0..30 {+ for x in 70..100 {+ let cell = &buffer[(x, y)];+ if cell.style().add_modifier.contains(Modifier::REVERSED) {+ far_right_has_reversed = true;+ }+ }+ }+ assert!(+ !far_right_has_reversed,+ "expected title highlight to be a tight pill, not stretching across full slot width"+ );+ }+ #[test]+ fn test_search_result_selection_indicator_basic_terminal() {+ 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,+ }],+ has_search_settled: true,+ basic_terminal: true,+ ..Default::default()+ };+ state.search_list_state.select(Some(0));+ let theme = Theme::mocha();+ terminal+ .draw(|frame| {+ let area = Rect::new(0, 0, 100, 30);+ draw(frame, area, &mut state, &theme);+ })+ .unwrap();++ let buffer = terminal.backend().buffer();+ let mut rendered = String::new();+ for y in 0..30 {+ for x in 0..100 {+ rendered.push_str(buffer[(x, y)].symbol());+ }+ rendered.push('\n');+ }+ assert!(+ rendered.contains("The Matrix"),+ "rendered content:\n{rendered}"+ );+ let mut title_has_underlined = false;+ for y in 0..30 {+ for x in 0..100 {+ let cell = &buffer[(x, y)];+ if cell.symbol() == "T"+ && buffer[(x + 1, y)].symbol() == "h"+ && buffer[(x + 2, y)].symbol() == "e"+ {+ if cell.style().add_modifier.contains(Modifier::UNDERLINED) {+ title_has_underlined = true;+ }+ }+ }+ }+ assert!(+ title_has_underlined,+ "expected basic terminal selected title to have UNDERLINED style"+ );}#[test]diff --git a/src/tui/state.rs b/src/tui/state.rsindex b99d340..fee82ae 100644--- a/src/tui/state.rs+++ b/src/tui/state.rs@@ -23,7 +23,6 @@ pub enum DetailsPane {pub enum AppMode {Streaming,Tv,- Addon,}#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]@@ -77,9 +76,9 @@ impl SettingsCategory {pub fn row_count(self) -> usize {match self {Self::General => 3,- Self::ContentModes => 4,+ Self::ContentModes => 3,Self::Appearance => 1,- Self::StorageInfo => 3,+ Self::StorageInfo => 4,}}pub fn next(self) -> Self {@@ -163,6 +162,7 @@ pub struct UiState {pub details_pane: DetailsPane,pub player_picker_popup: bool,pub settings_player_picker: bool,+ pub show_sources_popup: bool,pub subtitle_popup: bool,pub is_download_subtitle_popup: bool,pub tv_config_popup: bool,@@ -284,6 +284,8 @@ pub struct AppState {pub settings_category: SettingsCategory,pub settings_selected_row: usize,pub settings_download_dir_input: Option<crate::tui::text::TextInputBuffer>,+ pub show_sources_popup: bool,+ pub sources_list_state: ListState,pub poster_protocol: Option<(ratatui::layout::Rect, ratatui_image::protocol::Protocol)>,pub image_picker: Option<ratatui_image::picker::Picker>,@@ -349,7 +351,11 @@ pub struct AppState {pub pending_play_link: Option<String>,pub pending_playback_source: Option<crate::providers::models::PlaybackSource>,pub basic_terminal: bool,- pub bdix_enabled: bool,+ pub moviebox_enabled: bool,+ pub fourkhdhub_enabled: bool,+ pub bdix_circleftp_enabled: bool,+ pub bdix_dhakaflix_enabled: bool,+ pub bdix_probed: bool,pub streaming_enabled: bool,pub is_tv_mode: bool,@@ -362,7 +368,6 @@ pub struct AppState {pub tv_input_buffer: crate::tui::text::TextInputBuffer,pub tv_input_is_file: bool,- pub is_addon_mode: bool,pub addons_enabled: bool,pub installed_addons: Vec<crate::providers::addons::models::InstalledAddon>,pub addon_manager_popup: bool,@@ -447,6 +452,8 @@ impl Default for AppState {settings_category: SettingsCategory::General,settings_selected_row: 0,settings_download_dir_input: None,+ show_sources_popup: false,+ sources_list_state: ListState::default(),poster_protocol: None,image_picker: None,@@ -510,7 +517,11 @@ impl Default for AppState {subtitle_list_state: ListState::default(),pending_play_link: None,pending_playback_source: None,- bdix_enabled: false,+ moviebox_enabled: true,+ fourkhdhub_enabled: true,+ bdix_circleftp_enabled: false,+ bdix_dhakaflix_enabled: false,+ bdix_probed: false,streaming_enabled: true,is_tv_mode: false,tv_enabled: true,@@ -521,7 +532,6 @@ impl Default for AppState {tv_input_active: false,tv_input_buffer: crate::tui::text::TextInputBuffer::new(),tv_input_is_file: false,- is_addon_mode: false,addons_enabled: false,installed_addons: Vec::new(),addon_manager_popup: false,@@ -546,10 +556,8 @@ const fn cache_capacity(n: usize) -> std::num::NonZeroUsize {impl AppState {pub fn mode(&self) -> AppMode {- if self.is_tv_mode && !self.is_addon_mode {+ if self.is_tv_mode {AppMode::Tv- } else if self.is_addon_mode && !self.is_tv_mode {- AppMode::Addon} else {AppMode::Streaming}@@ -559,15 +567,9 @@ impl AppState {match mode {AppMode::Streaming => {self.is_tv_mode = false;- self.is_addon_mode = false;}AppMode::Tv => {self.is_tv_mode = true;- self.is_addon_mode = false;- }- AppMode::Addon => {- self.is_tv_mode = false;- self.is_addon_mode = true;}}}@@ -611,11 +613,35 @@ impl AppState {})}+ pub fn provider_enabled(&self, p: ProviderKind) -> bool {+ match p {+ ProviderKind::MovieBox => self.moviebox_enabled,+ ProviderKind::FourKHdHub => self.fourkhdhub_enabled,+ ProviderKind::BdixCircleFtp => self.bdix_circleftp_enabled,+ ProviderKind::BdixDhakaFlix => self.bdix_dhakaflix_enabled,+ ProviderKind::Addons => self.addons_enabled,+ }+ }++ pub fn set_provider_enabled(&mut self, p: ProviderKind, enabled: bool) {+ match p {+ ProviderKind::MovieBox => self.moviebox_enabled = enabled,+ ProviderKind::FourKHdHub => self.fourkhdhub_enabled = enabled,+ ProviderKind::BdixCircleFtp => self.bdix_circleftp_enabled = enabled,+ ProviderKind::BdixDhakaFlix => self.bdix_dhakaflix_enabled = enabled,+ ProviderKind::Addons => self.addons_enabled = enabled,+ }+ }+pub fn available_providers(&self) -> Vec<ProviderKind> {- crate::models::ProviderKind::ENABLED+ let mut providers: Vec<ProviderKind> = crate::models::ProviderKind::ENABLED.into_iter()- .filter(|p| !p.is_bdix() || self.bdix_enabled)- .collect()+ .filter(|p| self.provider_enabled(*p))+ .collect();+ if self.addons_enabled || !self.installed_addons.is_empty() {+ providers.push(ProviderKind::Addons);+ }+ providers}pub fn next_provider(&self) -> ProviderKind {@@ -760,6 +786,7 @@ impl AppState {|| self.show_browse_popup|| self.show_provider_popup|| self.show_settings_popup+ || self.show_sources_popup|| self.addon_manager_popup|| self.tv_config_popup|| self.player_picker_popup@@ -813,8 +840,7 @@ impl AppState {}pub fn favorites_available(&self) -> bool {- (self.streaming_enabled && !self.is_tv_mode && !self.is_addon_mode)- || (self.addons_enabled && self.is_addon_mode)+ self.streaming_enabled && !self.is_tv_mode}pub fn favorites_landing_visible(&self) -> bool {@@ -1017,11 +1043,7 @@ impl AppState {}pub fn can_disable_tv_mode(&self) -> bool {- self.streaming_enabled || self.addons_enabled- }-- pub fn can_disable_addons_mode(&self) -> bool {- self.streaming_enabled || self.tv_enabled+ self.streaming_enabled}pub fn expand_download_path(raw: &str) -> Option<std::path::PathBuf> {let clean = raw.trim_matches(|c| c == '\'' || c == '"').trim();@@ -1299,6 +1321,17 @@ mod tests {assert_eq!(result_columns_for(320), 5);}+ #[test]+ fn addons_provider_appears_when_enabled() {+ let mut s = AppState {+ addons_enabled: true,+ ..Default::default()+ };+ assert!(s.available_providers().contains(&ProviderKind::Addons));+ s.addons_enabled = false;+ assert!(!s.available_providers().contains(&ProviderKind::Addons));+ }+#[test]fn poster_rows_clamp_to_viewport() {let state = AppState {diff --git a/src/tui/terminal.rs b/src/tui/terminal.rsindex 89c511d..09212d4 100644--- a/src/tui/terminal.rs+++ b/src/tui/terminal.rs@@ -4,8 +4,10 @@ fn env(name: &str) -> String {pub fn uses_basic_ui() -> bool {let term = env("TERM");-- term == "dumb" || term == "linux"+ if term == "dumb" || term == "linux" {+ return true;+ }+ crate::tui::theme::ColorSupport::current() == crate::tui::theme::ColorSupport::Basic}pub fn should_query_images() -> bool {@@ -64,7 +66,9 @@ pub fn background_is_light() -> bool {return matches!(background, 7 | 10..=15);}- std::env::var("TERM_BACKGROUND").is_ok_and(|value| value.eq_ignore_ascii_case("light"))+ std::env::var("TERM_BACKGROUND")+ .or_else(|_| std::env::var("BACKGROUND"))+ .is_ok_and(|value| value.eq_ignore_ascii_case("light"))}pub fn set_window_title(title: &str) -> std::io::Result<()> {diff --git a/src/tui/text.rs b/src/tui/text.rsindex c9d951b..bbde58d 100644--- a/src/tui/text.rs+++ b/src/tui/text.rs@@ -478,11 +478,6 @@ pub const CTRL_T_STR: &str = if cfg!(target_os = "macos") {} else {"Ctrl+T"};-pub const CTRL_A_STR: &str = if cfg!(target_os = "macos") {- "^A"-} else {- "Ctrl+A"-};pub const CTRL_P_STR: &str = if cfg!(target_os = "macos") {"^P"} else {diff --git a/src/tui/theme.rs b/src/tui/theme.rsindex 5fe6691..eb2875d 100644--- a/src/tui/theme.rs+++ b/src/tui/theme.rs@@ -146,6 +146,7 @@ impl ColorSupport {pub(crate) fn classify_terminal(colorterm: &str, term: &str, term_program: &str) -> ColorSupport {let colorterm = colorterm.to_lowercase();let term = term.to_lowercase();+ let term_program = term_program.to_lowercase();let truecolor = colorterm == "truecolor"|| colorterm == "24bit"|| term.contains("truecolor")@@ -153,25 +154,30 @@ pub(crate) fn classify_terminal(colorterm: &str, term: &str, term_program: &str)|| term.contains("ghostty")|| term.starts_with("foot")|| term.contains("alacritty")- || term_program == "iTerm.app"- || term_program == "Hyper"- || term_program == "Tabby"- || term_program == "WezTerm"- || term_program == "WarpTerminal"+ || term_program == "iterm.app"+ || term_program == "hyper"+ || term_program == "tabby"+ || term_program == "wezterm"+ || term_program == "warpterminal"+ || term_program == "warp"|| term_program == "vscode"- || term_program == "ghostty";+ || term_program == "ghostty"+ || term_program == "konsole"+ || term_program == "xfce4-terminal"+ || std::env::var("VTE_VERSION").is_ok()+ || std::env::var("WEZTERM_EXECUTABLE").is_ok()+ || std::env::var("ALACRITTY_WINDOW_ID").is_ok()+ || std::env::var("TILIX_ID").is_ok();let basic =term == "dumb" || term == "linux" || term.contains("fbterm") || term.starts_with("vt");- let apple_term = term.contains("apple") || term_program == "Apple_Terminal";+ let apple_term = term.contains("apple") || term_program == "apple_terminal";let has_256 = term.contains("256") || term.contains("xterm") || term.contains("screen");- if basic || (apple_term && !has_256) || term == "xterm" {+ if basic || (apple_term && !has_256) || (term == "xterm" && !truecolor) {ColorSupport::Basic} else if truecolor {ColorSupport::Truecolor- } else if has_256 {+ } else if has_256 || cfg!(target_os = "windows") {ColorSupport::Color256- } else if cfg!(target_os = "windows") {- ColorSupport::Truecolor} else {ColorSupport::Basic}@@ -965,6 +971,10 @@ mod tests {classify_terminal("truecolor", "xterm-256color", ""),ColorSupport::Truecolor);+ assert_eq!(+ classify_terminal("truecolor", "xterm", ""),+ ColorSupport::Truecolor+ );assert_eq!(classify_terminal("", "xterm-kitty", ""),ColorSupport::Truecolor@@ -992,12 +1002,26 @@ mod tests {);assert_eq!(classify_terminal("", "vt100", ""), ColorSupport::Basic);assert_eq!(classify_terminal("", "dumb", ""), ColorSupport::Basic);+ assert_eq!(classify_terminal("", "xterm", ""), ColorSupport::Basic);assert_eq!(classify_terminal("", "xterm", "Apple_Terminal"),ColorSupport::Basic);+ assert_eq!(+ classify_terminal("", "", "iterm.app"),+ ColorSupport::Truecolor+ );+ assert_eq!(+ classify_terminal("", "", "wezterm"),+ ColorSupport::Truecolor+ );+ assert_eq!(+ classify_terminal("", "", "warpterminal"),+ ColorSupport::Truecolor+ );+ assert_eq!(classify_terminal("", "", "warp"), ColorSupport::Truecolor);#[cfg(target_os = "windows")]- assert_eq!(classify_terminal("", "", ""), ColorSupport::Truecolor);+ assert_eq!(classify_terminal("", "", ""), ColorSupport::Color256);#[cfg(not(target_os = "windows"))]assert_eq!(classify_terminal("", "", ""), ColorSupport::Basic);}@@ -1099,4 +1123,15 @@ mod tests {let without_fg = Style::default();assert_eq!(theme_color(without_fg, Color::Blue), Color::Blue);}+ #[test]+ fn test_classify_terminal_konsole_and_xfce4_are_truecolor() {+ assert_eq!(+ classify_terminal("", "xterm-256color", "Konsole"),+ ColorSupport::Truecolor+ );+ assert_eq!(+ classify_terminal("", "xterm-256color", "xfce4-terminal"),+ ColorSupport::Truecolor+ );+ }}diff --git a/src/tui/widgets/modal.rs b/src/tui/widgets/modal.rsindex eed8332..eb22806 100644--- a/src/tui/widgets/modal.rs+++ b/src/tui/widgets/modal.rs@@ -13,6 +13,7 @@ pub struct ModalFrame<'a> {theme: &'a Theme,basic_terminal: bool,border_style: Option<Style>,+ title_style: Option<Style>,}impl<'a> ModalFrame<'a> {@@ -22,6 +23,7 @@ impl<'a> ModalFrame<'a> {theme,basic_terminal,border_style: None,+ title_style: None,}}@@ -30,16 +32,24 @@ impl<'a> ModalFrame<'a> {self}+ pub fn title_style(mut self, style: Style) -> Self {+ self.title_style = Some(style);+ self+ }pub fn render(&self, frame: &mut Frame, area: Rect, full_area: Rect) -> Rect {overlay::clear_modal_area(frame, full_area, area, self.theme);- let title_budget = (area.width as usize).saturating_sub(4);- let display_title = crate::tui::text::truncate_width(self.title.trim(), title_budget);- let block = Block::default()- .title(format!(" {display_title} "))- .title_style(self.theme.title)+ let trimmed_title = self.title.trim();+ let mut block = Block::default().borders(Borders::ALL).border_type(overlay::border_type(self.basic_terminal)).border_style(self.border_style.unwrap_or(self.theme.lavender));+ if !trimmed_title.is_empty() {+ let title_budget = (area.width as usize).saturating_sub(4);+ let display_title = crate::tui::text::truncate_width(trimmed_title, title_budget);+ block = block+ .title(format!(" {display_title} "))+ .title_style(self.title_style.unwrap_or(self.theme.title));+ }let inner = block.inner(area);frame.render_widget(block, area);innerdiff --git a/src/tui/widgets/settings.rs b/src/tui/widgets/settings.rsindex e5a0a0d..99f2200 100644--- a/src/tui/widgets/settings.rs+++ b/src/tui/widgets/settings.rs@@ -1,22 +1,18 @@use ratatui::{Frame,- layout::{Alignment, Constraint, Layout, Rect},+ layout::{Constraint, Layout, Rect},style::{Modifier, Style},text::{Line, Span},- widgets::{Block, Borders, Paragraph},+ widgets::Paragraph,};use crate::tui::{- overlay::{self, key_hint},+ overlay,state::{AppState, SettingsCategory, settings_player_label},- theme::{ColorSupport, Theme},+ theme::Theme,widgets::ModalFrame,};-pub fn category_tab_text(cat: SettingsCategory, _is_active: bool, _basic_terminal: bool) -> String {- cat.title().to_string()-}-pub fn category_tab_rects(tabs_area: Rect,_basic_terminal: bool,@@ -84,7 +80,7 @@ pub fn settings_category_tab_at(}pub fn settings_row_rects(popup_area: Rect, category: SettingsCategory) -> Vec<Rect> {- if popup_area.width < 4 || popup_area.height < 6 {+ if popup_area.width < 4 || popup_area.height < 4 {return Vec::new();}let inner = Rect {@@ -93,30 +89,21 @@ pub fn settings_row_rects(popup_area: Rect, category: SettingsCategory) -> Vec<Rwidth: popup_area.width.saturating_sub(2),height: popup_area.height.saturating_sub(2),};- let rows_height = (category.row_count() as u16 * 2).min(inner.height.saturating_sub(5));+ let rows_height = category.row_count() as u16;let sections = Layout::vertical([Constraint::Length(2),- Constraint::Length(1),Constraint::Length(rows_height),Constraint::Min(0),- Constraint::Length(2),]).split(inner);- let rows_area = sections[2];- let card_x = popup_area.x + 3;- let card_width = popup_area.width.saturating_sub(6);+ let rows_area = sections[1];+ let card_x = popup_area.x + 2;+ let card_width = popup_area.width.saturating_sub(4);let row_count = category.row_count();let mut rects = Vec::with_capacity(row_count);for i in 0..row_count {- let y = rows_area.y + (i as u16 * 2);- if y.saturating_add(1) < rows_area.bottom() {- rects.push(Rect {- x: card_x,- y,- width: card_width,- height: 2,- });- } else if y < rows_area.bottom() {+ let y = rows_area.y + i as u16;+ if y < rows_area.bottom() {rects.push(Rect {x: card_x,y,@@ -148,27 +135,26 @@ pub fn settings_row_at(pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme) {let popup_area = overlay::settings_modal_layout(area, state.settings_category);let title = " Settings & Preferences ";-- let inner = ModalFrame::new(title, theme, state.basic_terminal).render(frame, popup_area, area);- if inner.width < 10 || inner.height < 4 {+ let has_popup = has_active_settings_popup(state);+ let mut modal = ModalFrame::new(title, theme, state.basic_terminal);+ if has_popup {+ modal = modal.border_style(theme.muted).title_style(theme.muted);+ }+ let inner = modal.render(frame, popup_area, area);+ if inner.width < 10 || inner.height < 3 {return;}- let rows_height =- (state.settings_category.row_count() as u16 * 2).min(inner.height.saturating_sub(5));+ let rows_height = state.settings_category.row_count() as u16;let sections = Layout::vertical([Constraint::Length(2),- Constraint::Length(1),Constraint::Length(rows_height),Constraint::Min(0),- Constraint::Length(2),]).split(inner);render_tabs(frame, sections[0], popup_area, state, theme);- render_category_description(frame, sections[1], popup_area, state, theme);- render_category_rows(frame, sections[2], popup_area, state, theme);- render_footer(frame, sections[4], state, theme);+ render_category_rows(frame, sections[1], popup_area, state, theme);}fn render_tabs(frame: &mut Frame, area: Rect, popup_area: Rect, state: &AppState, theme: &Theme) {@@ -196,21 +182,19 @@ fn render_tabs(frame: &mut Frame, area: Rect, popup_area: Rect, state: &AppStatelet width = crate::tui::text::width(title);if is_active {- let title_style = if state.basic_terminal {- theme.text.add_modifier(Modifier::BOLD)+ let (title_style, underline_style) = if has_active_settings_popup(state) {+ (theme.muted, theme.muted)+ } else if state.basic_terminal {+ (theme.text.add_modifier(Modifier::BOLD), theme.text)} else {- theme.accent.add_modifier(Modifier::BOLD)+ (theme.accent.add_modifier(Modifier::BOLD), theme.accent)};line0_spans.push(Span::styled(title, title_style));-- let underline_style = if state.basic_terminal {- theme.text- } else {- theme.accent- };line1_spans.push(Span::styled("─".repeat(width), underline_style));} else {- let title_style = if state.basic_terminal {+ let title_style = if has_active_settings_popup(state) {+ theme.muted+ } else if state.basic_terminal {theme.text_dim} else {theme.subtext1@@ -234,40 +218,6 @@ fn render_tabs(frame: &mut Frame, area: Rect, popup_area: Rect, state: &AppStateframe.render_widget(Paragraph::new(lines), tabs_render_area);}-fn category_subtitle(cat: SettingsCategory) -> &'static str {- match cat {- SettingsCategory::General => "Application defaults & media playback settings",- SettingsCategory::ContentModes => "Toggle active content providers & streaming sources",- SettingsCategory::Appearance => "UI color theme, palette previews & terminal depth",- SettingsCategory::StorageInfo => "Cache cleanup, release updates & diagnostics",- }-}--fn render_category_description(- frame: &mut Frame,- area: Rect,- popup_area: Rect,- state: &AppState,- theme: &Theme,-) {- let desc_render_area = Rect {- x: popup_area.x + 3,- y: area.y,- width: popup_area.width.saturating_sub(6),- height: area.height.min(1),- };- let desc_style = if state.basic_terminal {- theme.text_dim- } else {- theme.overlay1- };- let line = Line::from(vec![Span::styled(- category_subtitle(state.settings_category),- desc_style,- )]);- frame.render_widget(Paragraph::new(line), desc_render_area);-}-fn render_category_rows(frame: &mut Frame,area: Rect,@@ -276,9 +226,9 @@ fn render_category_rows(theme: &Theme,) {let rows_area = Rect {- x: popup_area.x + 3,+ x: popup_area.x + 2,y: area.y,- width: popup_area.width.saturating_sub(6),+ width: popup_area.width.saturating_sub(4),height: area.height,};match state.settings_category {@@ -293,6 +243,7 @@ fn render_category_rows(fn has_active_settings_popup(state: &AppState) -> bool {state.settings_player_picker|| state.show_theme_popup+ || state.show_sources_popup|| state.player_picker_popup|| state.show_browse_popup|| state.settings_download_dir_input.is_some()@@ -302,17 +253,27 @@ struct SettingRow<'a> {is_selected: bool,has_active_popup: bool,label: &'a str,- subtext: &'a str,value_spans: Vec<Span<'a>>,}-fn on_off_spans<'a>(enabled: bool, theme: &Theme, basic_terminal: bool) -> Vec<Span<'a>> {- if enabled {+fn on_off_spans<'a>(+ enabled: bool,+ has_active_popup: bool,+ theme: &Theme,+ basic_terminal: bool,+) -> Vec<Span<'a>> {+ if has_active_popup {+ if enabled {+ vec![Span::styled("ON", theme.muted)]+ } else {+ vec![Span::styled("OFF", theme.muted)]+ }+ } else if enabled {vec![Span::styled("ON",if basic_terminal {theme.text.add_modifier(Modifier::BOLD)} else {- theme.rating.add_modifier(Modifier::BOLD)+ theme.success.add_modifier(Modifier::BOLD)},)]} else {@@ -321,7 +282,7 @@ fn on_off_spans<'a>(enabled: bool, theme: &Theme, basic_terminal: bool) -> Vec<Sif basic_terminal {theme.text_dim} else {- theme.subtext1+ theme.overlay1},)]}@@ -338,23 +299,9 @@ fn render_row(return;}let is_active_selection = row.is_selected && !row.has_active_popup;- let cursor = if is_active_selection {- if basic_terminal { "> " } else { "▸ " }- } else {- " "- };-- let cursor_style = if is_active_selection {- if basic_terminal {- theme.text.add_modifier(Modifier::BOLD)- } else {- theme.accent.add_modifier(Modifier::BOLD)- }- } else {- Style::default()- };-- let label_style = if is_active_selection {+ let label_style = if row.has_active_popup {+ theme.muted+ } else if is_active_selection {theme.highlight.add_modifier(Modifier::BOLD)} else if row.is_selected {theme.text.add_modifier(Modifier::BOLD)@@ -362,13 +309,11 @@ fn render_row(theme.text};- let row_bg = if is_active_selection && !basic_terminal {- Style::default().bg(theme.surface1.fg.unwrap_or(theme.base))+ let row_bg = if is_active_selection {+ crate::tui::overlay::selection_style(theme, basic_terminal)} else {Style::default()};-- let cursor_width = crate::tui::text::width(cursor);let label_width = crate::tui::text::width(row.label);let right_width: usize = row@@ -378,57 +323,29 @@ fn render_row(.sum();let right_margin = 1;+ let left_margin = 1;let area_width = area.width as usize;- let max_label_w = area_width.saturating_sub(cursor_width + right_width + right_margin + 1);+ let max_label_w = area_width.saturating_sub(left_margin + right_width + right_margin + 1);let display_label = if label_width > max_label_w && max_label_w >= 4 {crate::tui::text::truncate_width(row.label, max_label_w)} else {std::borrow::Cow::Borrowed(row.label)};let display_label_w = crate::tui::text::width(&display_label);- let pad =- area_width.saturating_sub(cursor_width + display_label_w + right_width + right_margin);+ let pad = area_width.saturating_sub(left_margin + display_label_w + right_width + right_margin);- let mut line1_spans = Vec::new();- line1_spans.push(Span::styled(cursor, cursor_style));- line1_spans.push(Span::styled(display_label, label_style));+ let mut line_spans = Vec::new();+ line_spans.push(Span::raw(" ".repeat(left_margin)));+ line_spans.push(Span::styled(display_label, label_style));if pad > 0 {- line1_spans.push(Span::raw(" ".repeat(pad)));+ line_spans.push(Span::raw(" ".repeat(pad)));} else {- line1_spans.push(Span::raw(" "));- }- line1_spans.extend(row.value_spans);- line1_spans.push(Span::raw(" ".repeat(right_margin)));-- let subtext_indent = " ";- let max_subtext_w = area_width.saturating_sub(subtext_indent.len());- let display_subtext = if crate::tui::text::width(row.subtext) > max_subtext_w {- crate::tui::text::truncate_width(row.subtext, max_subtext_w)- } else {- std::borrow::Cow::Borrowed(row.subtext)- };- let subtext_width = crate::tui::text::width(&display_subtext);- let subtext_pad = area_width.saturating_sub(subtext_indent.len() + subtext_width);- let mut line2_spans = Vec::new();- line2_spans.push(Span::raw(subtext_indent));- line2_spans.push(Span::styled(- display_subtext,- if row.is_selected {- theme.subtext1- } else {- theme.overlay1- },- ));- if subtext_pad > 0 {- line2_spans.push(Span::raw(" ".repeat(subtext_pad)));+ line_spans.push(Span::raw(" "));}- let lines = if area.height >= 2 {- vec![Line::from(line1_spans), Line::from(line2_spans)]- } else {- vec![Line::from(line1_spans)]- };+ line_spans.extend(row.value_spans);+ line_spans.push(Span::raw(" ".repeat(right_margin)));- frame.render_widget(Paragraph::new(lines).style(row_bg), area);+ frame.render_widget(Paragraph::new(Line::from(line_spans)).style(row_bg), area);}fn render_general_settings(frame: &mut Frame, area: Rect, state: &AppState, theme: &Theme) {@@ -437,7 +354,12 @@ fn render_general_settings(frame: &mut Frame, area: Rect, state: &AppState, themif let Some(&row_area) = row_rects.first() {let is_selected = state.settings_selected_row == 0;- let value_spans = on_off_spans(state.auto_update, theme, state.basic_terminal);+ let value_spans = on_off_spans(+ state.auto_update,+ has_active_popup,+ theme,+ state.basic_terminal,+ );render_row(frame,row_area,@@ -445,14 +367,12 @@ fn render_general_settings(frame: &mut Frame, area: Rect, state: &AppState, themis_selected,has_active_popup,label: "Automatic Updates",- subtext: "Check GitHub for new releases on startup",value_spans,},theme,state.basic_terminal,);}-if let Some(&row_area) = row_rects.get(1) {let is_selected = state.settings_selected_row == 1;let player_name = if let Some(key) = state@@ -468,7 +388,9 @@ fn render_general_settings(frame: &mut Frame, area: Rect, state: &AppState, them};let value_spans = vec![Span::styled(player_name,- if state.basic_terminal {+ if has_active_popup {+ theme.muted+ } else if state.basic_terminal {theme.text.add_modifier(Modifier::BOLD)} else {theme.accent.add_modifier(Modifier::BOLD)@@ -481,7 +403,6 @@ fn render_general_settings(frame: &mut Frame, area: Rect, state: &AppState, themis_selected,has_active_popup,label: "Default Media Player",- subtext: "Preferred player launched for video streams",value_spans,},theme,@@ -532,7 +453,9 @@ fn render_general_settings(frame: &mut Frame, area: Rect, state: &AppState, themlet truncated = crate::tui::text::truncate_middle_width(&path_str, path_budget);vec![Span::styled(truncated,- if state.basic_terminal {+ if has_active_popup {+ theme.muted+ } else if state.basic_terminal {theme.text_dim} else {theme.subtext1@@ -546,7 +469,6 @@ fn render_general_settings(frame: &mut Frame, area: Rect, state: &AppState, themis_selected,has_active_popup,label: "Download Folder",- subtext: "Directory for saving downloaded videos & subtitles",value_spans,},theme,@@ -556,12 +478,17 @@ fn render_general_settings(frame: &mut Frame, area: Rect, state: &AppState, them}fn render_content_modes_settings(frame: &mut Frame, area: Rect, state: &AppState, theme: &Theme) {- let row_rects = settings_row_rects_in_area(area, 4);+ let row_rects = settings_row_rects_in_area(area, 3);let has_active_popup = has_active_settings_popup(state);if let Some(&row_area) = row_rects.first() {let is_selected = state.settings_selected_row == 0;- let value_spans = on_off_spans(state.streaming_enabled, theme, state.basic_terminal);+ let value_spans = on_off_spans(+ state.streaming_enabled,+ has_active_popup,+ theme,+ state.basic_terminal,+ );render_row(frame,row_area,@@ -569,7 +496,6 @@ fn render_content_modes_settings(frame: &mut Frame, area: Rect, state: &AppStateis_selected,has_active_popup,label: "Streaming Mode",- subtext: "MovieBox & 4KHDHub streaming catalog",value_spans,},theme,@@ -579,15 +505,35 @@ fn render_content_modes_settings(frame: &mut Frame, area: Rect, state: &AppStateif let Some(&row_area) = row_rects.get(1) {let is_selected = state.settings_selected_row == 1;- let value_spans = on_off_spans(state.bdix_enabled, theme, state.basic_terminal);+ let is_active_selected = is_selected && !has_active_popup;+ let enabled_count = crate::providers::models::ProviderKind::ENABLED+ .iter()+ .filter(|p| state.provider_enabled(**p))+ .count();+ let glyph = if state.basic_terminal { ">" } else { "▸" };+ let value_spans = vec![Span::styled(+ format!("{enabled_count} Active {glyph}"),+ if has_active_popup {+ theme.muted+ } else if state.basic_terminal {+ if is_active_selected {+ theme.text.add_modifier(Modifier::BOLD)+ } else {+ theme.text_dim+ }+ } else if is_active_selected {+ theme.accent.add_modifier(Modifier::BOLD)+ } else {+ theme.accent+ },+ )];render_row(frame,row_area,SettingRow {is_selected,has_active_popup,- label: "BDIX FTP Mirrors",- subtext: "Local high-speed BDIX optical mirrors for streaming",+ label: "Streaming Sources",value_spans,},theme,@@ -597,33 +543,19 @@ fn render_content_modes_settings(frame: &mut Frame, area: Rect, state: &AppStateif let Some(&row_area) = row_rects.get(2) {let is_selected = state.settings_selected_row == 2;- let value_spans = on_off_spans(state.tv_enabled, theme, state.basic_terminal);- render_row(- frame,- row_area,- SettingRow {- is_selected,- has_active_popup,- label: "Live TV Mode",- subtext: "Live IPTV channels and custom M3U playlists",- value_spans,- },+ let value_spans = on_off_spans(+ state.tv_enabled,+ has_active_popup,theme,state.basic_terminal,);- }-- if let Some(&row_area) = row_rects.get(3) {- let is_selected = state.settings_selected_row == 3;- let value_spans = on_off_spans(state.addons_enabled, theme, state.basic_terminal);render_row(frame,row_area,SettingRow {is_selected,has_active_popup,- label: "Addon Mode",- subtext: "Community HTTP Stremio addons and metadata",+ label: "Live TV Mode",value_spans,},theme,@@ -646,13 +578,18 @@ fn render_appearance_settings(frame: &mut Frame, area: Rect, state: &AppState, tlet is_selected = state.settings_selected_row == 0;let mut value_spans = vec![Span::styled(format!("{theme_name} "),- theme.accent.add_modifier(Modifier::BOLD),+ if has_active_popup {+ theme.muted+ } else {+ theme.accent.add_modifier(Modifier::BOLD)+ },)];- value_spans.extend(Theme::palette_swatch_spans(- theme_name,- state.basic_terminal,- ));-+ if !has_active_popup {+ value_spans.extend(Theme::palette_swatch_spans(+ theme_name,+ state.basic_terminal,+ ));+ }render_row(frame,row_area,@@ -660,44 +597,16 @@ fn render_appearance_settings(frame: &mut Frame, area: Rect, state: &AppState, tis_selected,has_active_popup,label: "Theme",- subtext: "Active color theme and palette styling",value_spans,},theme,state.basic_terminal,);}-- if area.height >= 7 {- let info_y = area.y + 5;- let info_area = Rect {- x: area.x,- y: info_y,- width: area.width,- height: area.bottom().saturating_sub(info_y),- };- let label = "Terminal Depth";- let value = ColorSupport::current().label();- let label_width = crate::tui::text::width(label);- let val_width = crate::tui::text::width(value);- let pad = (info_area.width as usize).saturating_sub(label_width + val_width);- let lines = vec![- Line::from(vec![- Span::styled(label, theme.text),- Span::raw(" ".repeat(pad)),- Span::styled(value, theme.subtext1),- ]),- Line::from(vec![Span::styled(- "Live preview: color switches take effect instantly",- theme.overlay1,- )]),- ];- frame.render_widget(Paragraph::new(lines), info_area);- }}fn render_storage_settings(frame: &mut Frame, area: Rect, state: &AppState, theme: &Theme) {- let row_rects = settings_row_rects_in_area(area, 3);+ let row_rects = settings_row_rects_in_area(area, 4);let has_active_popup = has_active_settings_popup(state);if let Some(&row_area) = row_rects.first() {@@ -706,7 +615,9 @@ fn render_storage_settings(frame: &mut Frame, area: Rect, state: &AppState, themlet glyph = if state.basic_terminal { ">" } else { "▸" };let value_spans = vec![Span::styled(format!("Purge {glyph}"),- if state.basic_terminal {+ if has_active_popup {+ theme.muted+ } else if state.basic_terminal {if is_active_selected {theme.text.add_modifier(Modifier::BOLD)} else {@@ -725,7 +636,6 @@ fn render_storage_settings(frame: &mut Frame, area: Rect, state: &AppState, themis_selected,has_active_popup,label: "Clear Disk Cache",- subtext: "Remove temporary cached images and responses",value_spans,},theme,@@ -739,7 +649,9 @@ fn render_storage_settings(frame: &mut Frame, area: Rect, state: &AppState, themlet value_spans = if state.is_checking_updates {vec![Span::styled("Checking...",- if state.basic_terminal {+ if has_active_popup {+ theme.muted+ } else if state.basic_terminal {theme.text_dim} else {theme.sapphire@@ -749,7 +661,9 @@ fn render_storage_settings(frame: &mut Frame, area: Rect, state: &AppState, themlet glyph = if state.basic_terminal { ">" } else { "▸" };vec![Span::styled(format!("Check {glyph}"),- if state.basic_terminal {+ if has_active_popup {+ theme.muted+ } else if state.basic_terminal {if is_active_selected {theme.text.add_modifier(Modifier::BOLD)} else {@@ -769,7 +683,6 @@ fn render_storage_settings(frame: &mut Frame, area: Rect, state: &AppState, themis_selected,has_active_popup,label: "Check for Updates",- subtext: "Query GitHub API for latest binary releases",value_spans,},theme,@@ -783,7 +696,9 @@ fn render_storage_settings(frame: &mut Frame, area: Rect, state: &AppState, themlet glyph = if state.basic_terminal { "->" } else { "↗" };let value_spans = vec![Span::styled(format!("Open {glyph}"),- if state.basic_terminal {+ if has_active_popup {+ theme.muted+ } else if state.basic_terminal {if is_active_selected {theme.text.add_modifier(Modifier::BOLD)} else {@@ -802,7 +717,39 @@ fn render_storage_settings(frame: &mut Frame, area: Rect, state: &AppState, themis_selected,has_active_popup,label: "GitHub Repository",- subtext: "Open project homepage in default web browser",+ value_spans,+ },+ theme,+ state.basic_terminal,+ );+ }+ if let Some(&row_area) = row_rects.get(3) {+ let is_selected = state.settings_selected_row == 3;+ let is_active_selected = is_selected && !has_active_popup;+ let glyph = if state.basic_terminal { "->" } else { "▸" };+ let value_spans = vec![Span::styled(+ format!("Run {glyph}"),+ if has_active_popup {+ theme.muted+ } else if state.basic_terminal {+ if is_active_selected {+ theme.text.add_modifier(Modifier::BOLD)+ } else {+ theme.text_dim+ }+ } else if is_active_selected {+ theme.sapphire.add_modifier(Modifier::BOLD)+ } else {+ theme.sapphire+ },+ )];+ render_row(+ frame,+ row_area,+ SettingRow {+ is_selected,+ has_active_popup,+ label: "Re-check BDIX Network",value_spans,},theme,@@ -814,15 +761,8 @@ fn render_storage_settings(frame: &mut Frame, area: Rect, state: &AppState, themfn settings_row_rects_in_area(area: Rect, count: usize) -> Vec<Rect> {let mut rects = Vec::with_capacity(count);for i in 0..count {- let y = area.y + (i as u16 * 2);- if y.saturating_add(1) < area.bottom() {- rects.push(Rect {- x: area.x,- y,- width: area.width,- height: 2,- });- } else if y < area.bottom() {+ let y = area.y + i as u16;+ if y < area.bottom() {rects.push(Rect {x: area.x,y,@@ -834,117 +774,6 @@ fn settings_row_rects_in_area(area: Rect, count: usize) -> Vec<Rect> {rects}-fn render_footer(frame: &mut Frame, area: Rect, state: &AppState, theme: &Theme) {- let footer_spans = if state.settings_download_dir_input.is_some() {- if state.basic_terminal {- vec![- Span::raw("[Enter] Save "),- Span::raw("[Esc] Cancel "),- Span::raw("[Backspace] Delete"),- ]- } else {- vec![- key_hint("Enter", "Save", theme),- Span::raw(" "),- key_hint("Esc", "Cancel", theme),- Span::raw(" "),- key_hint("Backspace", "Delete", theme),- ]- }- } else if state.basic_terminal {- if area.width >= 66 {- vec![- Span::raw("[Tab] Category "),- Span::raw("[↑↓] Move "),- Span::raw("[←→] Edit "),- Span::raw("[Enter] Select "),- Span::raw("[Esc] Close"),- ]- } else if area.width >= 60 {- vec![- Span::raw("[Tab] Category "),- Span::raw("[↑↓] Move "),- Span::raw("[←→] Edit "),- Span::raw("[Enter] Select "),- Span::raw("[Esc] Close"),- ]- } else if area.width >= 48 {- vec![- Span::raw("[Tab] Cat "),- Span::raw("[↑↓] Move "),- Span::raw("[←→] Edit "),- Span::raw("[Enter] Sel "),- Span::raw("[Esc] Close"),- ]- } else {- vec![- Span::raw("[Tab] Cat "),- Span::raw("[↑↓] "),- Span::raw("[←→] "),- Span::raw("[Enter] "),- Span::raw("[Esc] Close"),- ]- }- } else if area.width >= 66 {- vec![- key_hint("Tab", "Category", theme),- Span::raw(" "),- key_hint("↑↓", "Move", theme),- Span::raw(" "),- key_hint("←→", "Edit", theme),- Span::raw(" "),- key_hint("Enter", "Select", theme),- Span::raw(" "),- key_hint("Esc", "Close", theme),- ]- } else if area.width >= 60 {- vec![- key_hint("Tab", "Category", theme),- Span::raw(" "),- key_hint("↑↓", "Move", theme),- Span::raw(" "),- key_hint("←→", "Edit", theme),- Span::raw(" "),- key_hint("Enter", "Select", theme),- Span::raw(" "),- key_hint("Esc", "Close", theme),- ]- } else if area.width >= 48 {- vec![- key_hint("Tab", "Cat", theme),- Span::raw(" "),- key_hint("↑↓", "Move", theme),- Span::raw(" "),- key_hint("←→", "Edit", theme),- Span::raw(" "),- key_hint("Enter", "Sel", theme),- Span::raw(" "),- key_hint("Esc", "Close", theme),- ]- } else {- vec![- key_hint("Tab", "Cat", theme),- Span::raw(" "),- key_hint("↑↓", "", theme),- Span::raw(" "),- key_hint("←→", "", theme),- Span::raw(" "),- key_hint("Enter", "", theme),- Span::raw(" "),- key_hint("Esc", "Close", theme),- ]- };-- let p = Paragraph::new(Line::from(footer_spans))- .alignment(Alignment::Center)- .block(- Block::default()- .borders(Borders::TOP)- .border_style(theme.muted),- );- frame.render_widget(p, area);-}-#[cfg(test)]mod tests {use super::*;@@ -1083,12 +912,9 @@ mod tests {.join("\n");assert!(rendered.contains("Streaming Mode"));- assert!(rendered.contains("MovieBox & 4KHDHub streaming catalog"));- assert!(rendered.contains("BDIX FTP Mirrors"));- assert!(rendered.contains("Local high-speed BDIX optical mirrors for streaming"));+ assert!(rendered.contains("Streaming Sources"));assert!(rendered.contains("Live TV Mode"));- assert!(rendered.contains("Live IPTV channels and custom M3U playlists"));- assert!(rendered.contains("Addon Mode"));+ assert!(!rendered.contains("Stremio Addons"));}#[test]@@ -1110,9 +936,8 @@ mod tests {let clicked_row = settings_row_at(popup, SettingsCategory::General, 40, row_rects[0].y);assert_eq!(clicked_row, Some(0));- let clicked_subtext =- settings_row_at(popup, SettingsCategory::General, 40, row_rects[0].y + 1);- assert_eq!(clicked_subtext, Some(0));+ let clicked_row1 = settings_row_at(popup, SettingsCategory::General, 40, row_rects[1].y);+ assert_eq!(clicked_row1, Some(1));let compact_popup = Rect::new(2, 2, 54, 16);assert_eq!(diff --git a/tests/content_pipeline.rs b/tests/content_pipeline.rsindex 316b5f7..a761afb 100644--- a/tests/content_pipeline.rs+++ b/tests/content_pipeline.rs@@ -240,8 +240,9 @@ async fn test_mode_switch_stale_response_protection() {app.state_mut().active_search_request = 1;app.state_mut().search_query.set_content("avatar");- app.handle_action(Action::ToggleAddonMode).await;- assert_eq!(app.state().mode(), AppMode::Addon);+ app.handle_action(Action::SwitchProvider(ProviderKind::Addons))+ .await;+ assert_eq!(app.state().active_provider, ProviderKind::Addons);assert_ne!(app.state().provider_generation, streaming_generation);let moviebox_items = vec![CatalogItem {diff --git a/tests/settings_hub.rs b/tests/settings_hub.rsindex ef3ce5d..752bb1f 100644--- a/tests/settings_hub.rs+++ b/tests/settings_hub.rs@@ -86,7 +86,6 @@ fn test_settings_toggle_modes_safety_guard() {};assert!(!state.can_disable_streaming_mode());assert!(state.can_disable_tv_mode());- assert!(state.can_disable_addons_mode());state.tv_enabled = true;assert!(state.can_disable_streaming_mode());@@ -220,21 +219,16 @@ async fn test_settings_modes_toggle_keeps_popup_open() {);app.state_mut().settings_selected_row = 1;- let initial_bdix = app.state().bdix_enabled;app.handle_action(Action::SettingsActivateRow).await;assert!(app.state().show_settings_popup);- assert_eq!(app.state().bdix_enabled, !initial_bdix);-- app.handle_action(Action::SettingsAdjustValue(true)).await;- assert!(app.state().show_settings_popup);- assert_eq!(app.state().bdix_enabled, initial_bdix);+ assert!(app.state().show_sources_popup);+ app.state_mut().show_sources_popup = false;app.state_mut().settings_selected_row = 2;app.state_mut().tv_enabled = false;app.handle_action(Action::SettingsActivateRow).await;assert!(app.state().show_settings_popup);assert!(app.state().tv_enabled);-app.state_mut().settings_selected_row = 0;app.state_mut().streaming_enabled = true;app.handle_action(Action::SettingsActivateRow).await;@@ -244,11 +238,6 @@ async fn test_settings_modes_toggle_keeps_popup_open() {app.handle_action(Action::SettingsActivateRow).await;assert!(app.state().show_settings_popup);- app.state_mut().settings_selected_row = 3;- app.state_mut().addons_enabled = false;- app.handle_action(Action::SettingsActivateRow).await;- assert!(app.state().show_settings_popup);- assert!(app.state().addons_enabled);app.state_mut().set_mode(moviebox_tui::tui::state::AppMode::Streaming);@@ -337,7 +326,7 @@ async fn test_settings_mouse_tab_and_row_clicks() {rows[0].x + 2,rows[0].y + 1),- Some(0)+ Some(1));assert_eq!(settings_row_at(popup, SettingsCategory::General, rows[1].x + 2, rows[1].y),diff --git a/tests/tui_acceptance.rs b/tests/tui_acceptance.rsindex fa2ebee..39ea8f8 100644--- a/tests/tui_acceptance.rs+++ b/tests/tui_acceptance.rs@@ -342,7 +342,6 @@ async fn test_mouse_scroll_maps_to_key_actions() {async fn test_full_user_journey_movie_search_details_and_back_navigation() {let mut app = App::new();app.state_mut().is_tv_mode = false;- app.state_mut().is_addon_mode = false;app.state_mut().active_screen = Screen::Home;app.state_mut().last_search_edit =std::time::Instant::now() - std::time::Duration::from_millis(600);@@ -372,14 +371,13 @@ async fn test_full_user_journey_movie_search_details_and_back_navigation() {#[tokio::test]async fn test_full_user_journey_mode_switching_and_theme_selection() {let mut app = App::new();- app.state_mut().is_addon_mode = false;app.state_mut().is_tv_mode = false;- app.handle_action(Action::ToggleAddonMode).await;- assert!(app.state().is_addon_mode);+ app.handle_action(Action::ToggleTvMode).await;+ assert!(app.state().is_tv_mode);app.handle_action(Action::SwitchToStreamingMode).await;- assert!(!app.state().is_addon_mode);+ assert!(!app.state().is_tv_mode);app.handle_action(Action::SelectTheme("TokyoNight".to_string())).await;@@ -570,6 +568,7 @@ async fn test_contextual_window_title() {app.state_mut().active_screen = Screen::Home;app.state_mut().set_mode(moviebox_tui::tui::state::AppMode::Streaming);+ app.state_mut().active_provider = moviebox_tui::providers::models::ProviderKind::MovieBox;assert_eq!(app.contextual_title(), "MovieBox-Tui — Streaming");app.state_mut()@@ -577,7 +576,8 @@ async fn test_contextual_window_title() {assert_eq!(app.contextual_title(), "MovieBox-Tui — Live TV");app.state_mut()- .set_mode(moviebox_tui::tui::state::AppMode::Addon);+ .set_mode(moviebox_tui::tui::state::AppMode::Streaming);+ app.state_mut().active_provider = moviebox_tui::providers::models::ProviderKind::Addons;assert_eq!(app.contextual_title(), "MovieBox-Tui — Addons");app.state_mut().active_screen = Screen::Details;@@ -779,7 +779,9 @@ async fn test_history_item_enter_pre_seeds_season_and_episode() {#[tokio::test]async fn test_search_series_submit_defaults_to_season_one() {let mut app = App::new();+ app.state_mut().is_tv_mode = false;app.state_mut().active_screen = Screen::Home;+ app.state_mut().is_loading = false;app.state_mut().input_mode = InputMode::Normal;app.state_mut().search_query.set_content("Breaking Bad");app.state_mut().search_results.push(SearchResult {@@ -862,10 +864,8 @@ async fn test_ctrl_p_scoped_strictly_to_streaming_mode() {app.handle_action(Action::Key(ctrl_p)).await;assert!(!app.state().tv_config_popup);- app.state_mut()- .set_mode(moviebox_tui::tui::state::AppMode::Addon);+ app.state_mut().active_provider = moviebox_tui::providers::models::ProviderKind::Addons;app.state_mut().is_tv_mode = false;- app.state_mut().is_addon_mode = true;app.state_mut().addons_enabled = true;app.state_mut().addon_manager_popup = false;app.handle_action(Action::Key(ctrl_p)).await;