Terminal interface to find, download, and stream movies, TV shows, and live TV using local media players.
refactor(tui): standardize poster containers and remove halfblocks
Samir Hossainsf7af769b5b36
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex ca1dcb0..68c29e0 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -3,11 +3,6 @@## [Unreleased]### Added-- **Optimized Halfblocks Poster Engine & Universal Windows PowerShell Support**:- - Implemented 24-bit TrueColor Unicode Halfblocks poster graphics engine (`▀`/`▄`) with dedicated 11x6 cell resolution (132 sub-pixels) and selection highlight isolation.- - Added interactive `Poster Graphics` configuration to Settings Hub (`/settings` $\to$ Appearance) with `[ Auto | Halfblocks | Off ]` modes, persisted to `config.json`.- - Added `MOVIEBOX_IMAGE_PROTOCOL=halfblocks` environment variable override to force character-cell posters in standard Windows PowerShell, legacy consoles, and basic terminals.- - Added explicit buffer clearing (`clear_area`) before rasterizing posters on search results and details screens, preventing ghost character tearing during fast list scrolling.- **Windows TrueColor & High-Contrast Terminal Theming**:- Enabled 24-bit TrueColor auto-detection by default on Windows 10/11 (`conhost.exe`, Windows Terminal, PowerShell, CMD), ensuring Windows users receive rich Catppuccin themes out of the box.- Overhauled 16-color ANSI dark fallback palette (`Theme::fallback`), replacing low-contrast dark blue and magenta with high-contrast cyan accents for borders, titles, headers, and highlights.@@ -20,13 +15,22 @@- Added environment-aware update modal actions: displays Homebrew upgrade instructions (`brew upgrade moviebox-tui`) with `[b]` shortcut on Homebrew installations, Termux installer guidance on Android, and package manager notifications on read-only installations.- Added 5-iteration retry loop with bounded 1-second backoff in the Windows update helper script (`moviebox_update_helper.bat`) to tolerate transient file locks from antivirus or Windows search indexers during binary replacement.- Cached full `Release` metadata in `AppState` and action pipeline, eliminating duplicate network queries between release checking and self-update invocation.+### Removed+- **Poster Graphics Configuration & Halfblocks Engine**:+ - Removed Unicode Halfblocks poster engine (`▀`/`▄`), eliminating low-resolution cell distortion, font scanlines, and terminal redraw lag during list scrolling.+ - Removed redundant `Poster Graphics` toggle from Settings Hub (`/settings` $\to$ Appearance) and `config.json`, delegating terminal graphics strictly to automatic native GPU protocol detection (Kitty, Sixel, iTerm2).++### Fixed+- **Standardized 'No Art' Poster Containers Across Terminals**:+ - Replaced robot eyes and broken infinite loading spinners with clean, static, centered `No Art` bordered blocks across search results and details screens on terminals without graphics support.+ - Preserved full-fidelity native GPU graphics rendering on supported terminals while standardizing card geometry and poster container boundaries across all platforms.+ - Gated background poster network requests and CPU image decoding strictly behind `image_supported`, eliminating redundant network bandwidth and CPU cycles on standard terminals.### Changed- **Provider Switching Shortcut**:- Scoped `Ctrl+P` strictly to Streaming Mode for provider cycling, eliminating redundant `Ctrl+P` handling in TV and Addon modes.- Streamlined `/config` as a direct alias for `/settings`.-- **Pruned Redundant Theme Slash Command**:- Removed standalone `/theme` slash command, parser routing, and auto-suggestions; theme selection and visual palette swatches are managed directly within the interactive Settings Hub (`/settings` $\to$ Appearance $\to$ Theme).- **Discover Categories Landing Card UX**:diff --git a/docs/config.md b/docs/config.mdindex 91b9ed4..8e551a5 100644--- a/docs/config.md+++ b/docs/config.md@@ -18,7 +18,6 @@ macOS `~/Library/Application Support/moviebox-tui`, Linux `~/.config/moviebox-tu| `addons_enabled` | bool | Enable Addon Mode navigation in bottom dock (`/settings` $\to$ 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). |-| `poster_mode` | string | Poster graphics mode: `auto` (default), `halfblocks` (character cells), `off` (disabled). |## Interactive Settings Hub (`/settings`)@@ -26,7 +25,7 @@ All settings in `config.json` can be configured interactively inside the applica- **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).-- **Appearance**: Cycle color themes live with real-time palette swatches, select poster graphics mode (`Auto`, `Halfblocks`, `Off`), or launch the visual theme swatch picker.+- **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 files@@ -50,7 +49,7 @@ All settings in `config.json` can be configured interactively inside the applica| `MOVIEBOX_FOURKHDHUB_URL` | Override the 4KHDHub base URL. || `MOVIEBOX_THEME` | Force a theme (e.g. `Mocha`, `Latte`, `Macchiato`, `Frappe`, `Nord`, `TokyoNight`, `Dracula`, `Gruvbox`, `RosePine`). When unset and no saved theme exists, the app auto-detects: `NO_COLOR` wins, truecolor terminals get full palettes, 256-color terminals get quantized palettes, and the OSC 11 background query picks light/dark variants with WCAG AA contrast. || `MOVIEBOX_NO_IMAGE` | Disable poster image queries (set to `1` or `true`). |-| `MOVIEBOX_IMAGE_PROTOCOL` | Override image protocol (`kitty`, `sixel`, `iterm2`, `halfblocks`, or `none`/`off`). |+| `MOVIEBOX_IMAGE_PROTOCOL` | Override image protocol (`kitty`, `sixel`, `iterm2`, or `none`/`off`). || `MOVIEBOX_CELL_SIZE` | Override terminal cell size as `WxH` (e.g. `10x20`) for poster scaling. |## CLIdiff --git a/docs/cross-platform.md b/docs/cross-platform.mdindex b5cfe5a..e73e6e5 100644--- a/docs/cross-platform.md+++ b/docs/cross-platform.md@@ -27,16 +27,14 @@ prevent escape sequence probe leakage (`Gi=31...`):- **Poster rendering**: Sixel, Kitty, and iTerm2 protocols where the probedetects them. Terminals that report kitty/sixel capability but no cellsize (Windows Terminal sixel, iTerm2 over SSH) are salvaged with default- cell metrics. In `Auto` mode, non-graphics terminals (e.g. standard Windows- PowerShell / conhost, macOS Apple_Terminal) gracefully display clean text- placeholders (`· ·` on Home, `No Art` on Details) to prevent scroll tearing.- Users can opt in to 24-bit TrueColor Unicode character-cell posters (`▀`/`▄`)- by setting `Poster Graphics: Halfblocks` in `/settings` (Appearance) or- `MOVIEBOX_IMAGE_PROTOCOL=halfblocks`. All poster image rendering is+ cell metrics. On terminals lacking graphics support (e.g. standard Windows+ PowerShell, legacy console host, macOS Terminal.app), search result cards+ and details screens display standardized bordered containers with centered `No Art`+ indicators, ensuring consistent layout geometry without confusing broken blocks.automatically gated behind `has_active_modal()` to prevent graphic bleedthrough modal popups and overlays. `MOVIEBOX_NO_IMAGE=1` disables queries;- `MOVIEBOX_IMAGE_PROTOCOL` forces a protocol; `MOVIEBOX_CELL_SIZE=WxH`- overrides metrics.+ `MOVIEBOX_IMAGE_PROTOCOL` forces a protocol (`kitty`, `sixel`, `iterm2`);+ `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),diff --git a/src/config.rs b/src/config.rsindex 631a18e..a913e39 100644--- a/src/config.rs+++ b/src/config.rs@@ -18,7 +18,6 @@ pub struct Config {pub addons_enabled: bool,pub default_player: Option<String>,pub download_dir: Option<String>,- pub poster_mode: String,}impl Default for Config {fn default() -> Self {@@ -34,7 +33,6 @@ impl Default for Config {addons_enabled: false,default_player: None,download_dir: None,- poster_mode: "auto".to_string(),}}}@@ -264,6 +262,5 @@ mod tests {let json = serde_json::to_string(&config).expect("serialize");let deserialized: Config = serde_json::from_str(&json).expect("deserialize");assert_eq!(deserialized.active_mode, config.active_mode);- assert_eq!(deserialized.poster_mode, "auto");}}diff --git a/src/tui/app/mod.rs b/src/tui/app/mod.rsindex 823fe99..aee8bba 100644--- a/src/tui/app/mod.rs+++ b/src/tui/app/mod.rs@@ -125,7 +125,6 @@ impl App {}}state.active_theme_kind = config.active_theme;- state.poster_mode = config.poster_mode;state.default_player = config.default_player;state.download_dir = config.download_dir.map(std::path::PathBuf::from);state.installed_addons = crate::config::load_addons();@@ -220,7 +219,6 @@ impl App {.download_dir.as_ref().map(|p| p.to_string_lossy().to_string()),- poster_mode: self.state.poster_mode.clone(),};crate::tui::config::save(&config);}diff --git a/src/tui/app/requests.rs b/src/tui/app/requests.rsindex 2db2047..2d3c872 100644--- a/src/tui/app/requests.rs+++ b/src/tui/app/requests.rs@@ -665,7 +665,9 @@ impl App {self.state.poster_protocol = None;if let Some(img) = self.state.image_cache.get(&id) {self.state.poster_image = Some(std::sync::Arc::clone(img));- } else if let Some(url) = cached.cover_url() {+ } else if self.state.image_supported+ && let Some(url) = cached.cover_url()+ {let url = url.to_string();let tx = self.action_sender.clone();let id2 = id.clone();@@ -777,7 +779,9 @@ impl App {self.state.poster_protocol = None;if let Some(cached_img) = self.state.image_cache.get(&id) {self.state.poster_image = Some(std::sync::Arc::clone(cached_img));- } else if let Some(url) = details.cover_url() {+ } else if self.state.image_supported+ && let Some(url) = details.cover_url()+ {let url_clone = url.to_string();let action_tx = self.action_sender.clone();let id_clone = id.clone();@@ -927,42 +931,48 @@ impl App {self.state.poster_image = Some(std::sync::Arc::clone(cached_img));} else if let Some(url) = details.cover_url() {self.state.history.update_cover_url(&id, url);- let url_clone = url.to_string();- let action_tx = self.action_sender.clone();- let id_clone = id.clone();- let http_client = self.service.http_client().clone();- tokio::spawn(async move {- if let Ok(Some(bytes)) = tokio::task::spawn_blocking({- let id_clone = id_clone.clone();- move || {- crate::cache::get_namespaced_image_cache("posters", &id_clone)- }- })- .await- {- if let Some(img) = network::decode_poster(bytes).await {- let _ = action_tx.send(Action::PosterSuccess(id_clone, img));- return;- }- }- if let Some(bytes) =- network::fetch_poster_bytes(&http_client, &url_clone).await- {- let bytes_clone = bytes.clone();- let id_clone2 = id_clone.clone();- let _ = tokio::task::spawn_blocking(move || {- crate::cache::set_namespaced_image_cache(- "posters",- &id_clone2,- &bytes_clone,- );+ if self.state.image_supported {+ let url_clone = url.to_string();+ let action_tx = self.action_sender.clone();+ let id_clone = id.clone();+ let http_client = self.service.http_client().clone();+ tokio::spawn(async move {+ if let Ok(Some(bytes)) = tokio::task::spawn_blocking({+ let id_clone = id_clone.clone();+ move || {+ crate::cache::get_namespaced_image_cache(+ "posters", &id_clone,+ )+ }})- .await;- if let Some(img) = network::decode_poster(bytes).await {- let _ = action_tx.send(Action::PosterSuccess(id_clone, img));+ .await+ {+ if let Some(img) = network::decode_poster(bytes).await {+ let _ =+ action_tx.send(Action::PosterSuccess(id_clone, img));+ return;+ }}- }- });+ if let Some(bytes) =+ network::fetch_poster_bytes(&http_client, &url_clone).await+ {+ let bytes_clone = bytes.clone();+ let id_clone2 = id_clone.clone();+ let _ = tokio::task::spawn_blocking(move || {+ crate::cache::set_namespaced_image_cache(+ "posters",+ &id_clone2,+ &bytes_clone,+ );+ })+ .await;+ if let Some(img) = network::decode_poster(bytes).await {+ let _ =+ action_tx.send(Action::PosterSuccess(id_clone, img));+ }+ }+ });+ }}}@@ -1132,7 +1142,9 @@ impl App {.or_else(|| self.state.search_posters.get(&id)){self.state.poster_image = Some(std::sync::Arc::clone(cached_img));- } else if let Some(details) = &self.state.selected_details {+ } else if self.state.image_supported+ && let Some(details) = &self.state.selected_details+ {if let Some(url) = details.cover_url() {let url_clone = url.to_string();let action_tx = self.action_sender.clone();diff --git a/src/tui/app/run.rs b/src/tui/app/run.rsindex 4d4ea29..6db93dc 100644--- a/src/tui/app/run.rs+++ b/src/tui/app/run.rs@@ -21,9 +21,7 @@ impl App {wherestd::io::Error: From<<B as ratatui::backend::Backend>::Error>,{- let should_probe = (self.state.image_supported- || self.state.poster_mode.eq_ignore_ascii_case("halfblocks"))- && !self.state.poster_mode.eq_ignore_ascii_case("off");+ let should_probe = self.state.image_supported;if self.state.image_picker.is_none() && should_probe {self.probe_terminal().await;}@@ -140,52 +138,30 @@ impl App {pub(super) async fn probe_terminal(&mut self) {use ratatui_image::picker::{Capability, ProtocolType};- if self.state.poster_mode.eq_ignore_ascii_case("off") {- self.state.image_supported = false;- self.state.image_picker = None;- return;- }-- let is_halfblocks_forced = matches!(- Self::forced_protocol(),- Some(ForcedProtocol::Type(ProtocolType::Halfblocks))- ) || self.state.poster_mode.eq_ignore_ascii_case("halfblocks");-match Self::forced_protocol() {Some(ForcedProtocol::None) => {self.state.image_supported = false;self.state.image_picker = None;return;}- forced => {- if forced.is_some() {- let font_size = Self::cell_size_override().unwrap_or(ratatui_image::FontSize {- width: 10,- height: 20,- });- #[allow(deprecated)]- let mut picker = ratatui_image::picker::Picker::from_fontsize(font_size);- if let Some(ForcedProtocol::Type(protocol)) = forced {- picker.set_protocol_type(protocol);- }- self.accept_picker(picker);- return;- }+ Some(ForcedProtocol::Type(ProtocolType::Halfblocks)) => {+ self.state.image_supported = false;+ self.state.image_picker = None;+ return;}+ Some(ForcedProtocol::Type(protocol)) => {+ let font_size = Self::cell_size_override().unwrap_or(ratatui_image::FontSize {+ width: 10,+ height: 20,+ });+ #[allow(deprecated)]+ let mut picker = ratatui_image::picker::Picker::from_fontsize(font_size);+ picker.set_protocol_type(protocol);+ self.accept_picker(picker);+ return;+ }+ None => {}}-- if is_halfblocks_forced {- let font_size = Self::cell_size_override().unwrap_or(ratatui_image::FontSize {- width: 10,- height: 20,- });- #[allow(deprecated)]- let mut picker = ratatui_image::picker::Picker::from_fontsize(font_size);- picker.set_protocol_type(ProtocolType::Halfblocks);- self.accept_picker(picker);- return;- }-let picker = self.query_picker().await;if self.state.theme_is_auto@@ -244,7 +220,7 @@ impl App {}}- if matches!(picker.protocol_type(), ProtocolType::Halfblocks) && !is_halfblocks_forced {+ if matches!(picker.protocol_type(), ProtocolType::Halfblocks) {self.state.image_supported = false;self.state.image_picker = None;return;@@ -257,12 +233,7 @@ impl App {if cell_h > 0 {self.state.poster_rows = (96_u16.div_ceil(cell_h)).max(3);}- if matches!(- picker.protocol_type(),- ratatui_image::picker::ProtocolType::Halfblocks- ) {- self.state.poster_rows = self.state.poster_rows.clamp(5, 7);- }+self.state.image_picker = Some(picker);self.state.image_supported = true;}@@ -290,9 +261,7 @@ impl App {.as_str(){"none" | "off" | "false" => Some(ForcedProtocol::None),- "halfblocks" => Some(ForcedProtocol::Type(- ratatui_image::picker::ProtocolType::Halfblocks,- )),+"sixel" => Some(ForcedProtocol::Type(ratatui_image::picker::ProtocolType::Sixel,)),diff --git a/src/tui/app/system.rs b/src/tui/app/system.rsindex 6af8360..81ce1bf 100644--- a/src/tui/app/system.rs+++ b/src/tui/app/system.rs@@ -432,12 +432,6 @@ impl App {self.theme = crate::tui::theme::Theme::from_kind(kind);self.persist_config();self.state.dirty = true;- } else if self.state.settings_selected_row == 1 {- self.state.cycle_poster_mode(forward);- self.state.image_picker = None;- self.action_sender.send(Action::ProbeTerminal).ok();- self.persist_config();- self.state.dirty = true;}}crate::tui::state::SettingsCategory::StorageInfo => {}@@ -597,12 +591,6 @@ impl App {} else {self.state.theme_list_state.select(Some(0));}- } else if self.state.settings_selected_row == 1 {- self.state.cycle_poster_mode(true);- self.state.image_picker = None;- self.action_sender.send(Action::ProbeTerminal).ok();- self.persist_config();- self.state.dirty = true;}}crate::tui::state::SettingsCategory::StorageInfo => {diff --git a/src/tui/screens/details.rs b/src/tui/screens/details.rsindex a3d7059..0d6d693 100644--- a/src/tui/screens/details.rs+++ b/src/tui/screens/details.rs@@ -49,9 +49,7 @@ impl DetailsLayoutTier {return minimum.min(maximum);};let synopsis = details.description.as_deref().unwrap_or_default();- let show_poster = !matches!(self, Self::Tiny | Self::Narrow)- && area.width >= 75- && details.poster_url.is_some();+ let show_poster = !matches!(self, Self::Tiny | Self::Narrow) && area.width >= 75;let text_width = area.width.saturating_sub(if show_poster { reserved_width } else { 4 })@@ -358,23 +356,16 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme).as_ref().zip(state.image_picker.as_ref()).map(|(image, picker)| {- if matches!(- picker.protocol_type(),- ratatui_image::picker::ProtocolType::Halfblocks- ) {- ((inner_area.height as f32 * 0.75).round() as u16).clamp(8, 20)- } else {- let font_size = picker.font_size();- let font_w = font_size.width.max(1);- let font_h = font_size.height.max(1);- let area_h_px = (inner_area.height as f32) * (font_h as f32);- let aspect = image.width() as f32 / (image.height() as f32).max(1.0);- let area_w_px = area_h_px * aspect;- ((area_w_px / font_w as f32).round() as u16).max(1)- }+ let font_size = picker.font_size();+ let font_w = font_size.width.max(1);+ let font_h = font_size.height.max(1);+ let area_h_px = (inner_area.height as f32) * (font_h as f32);+ let aspect = image.width() as f32 / (image.height() as f32).max(1.0);+ let area_w_px = area_h_px * aspect;+ ((area_w_px / font_w as f32).round() as u16).max(1)}).unwrap_or_else(|| ((inner_area.height as f32 * (4.0 / 3.0)).round() as u16).max(6));- width_for_height.clamp(8, 22)+ width_for_height.clamp(12, 22)} else {0};@@ -430,7 +421,7 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)}}}- } else {+ } else if state.image_supported && (state.is_loading || state.preview_loading) {let loading_block = Block::default().borders(Borders::ALL).border_type(crate::tui::overlay::border_type(state.basic_terminal))@@ -452,6 +443,23 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme).style(theme.overlay0).block(loading_block);frame.render_widget(placeholder, poster_area);+ } else {+ let art_block = Block::default()+ .borders(Borders::ALL)+ .border_type(crate::tui::overlay::border_type(state.basic_terminal))+ .border_style(theme.surface0);+ let label = if state.basic_terminal {+ "[No Art]"+ } else {+ "No Art"+ };+ let pad_top = poster_area.height.saturating_sub(3) / 2;+ let content = format!("{}{label}", "\n".repeat(pad_top as usize));+ let placeholder = Paragraph::new(content)+ .alignment(Alignment::Center)+ .style(theme.overlay0)+ .block(art_block);+ frame.render_widget(placeholder, poster_area);}chunks[2]@@ -2556,6 +2564,7 @@ mod tests {assert!(content.contains("Movie"));assert!(content.contains("Audio: Original, Hindi"));assert!(content.contains("MovieBox"));+ assert!(content.contains("No Art"));}#[test]@@ -2638,4 +2647,51 @@ mod tests {assert!(content_settled.contains("No stream sources found"));}++ #[test]+ fn test_details_poster_no_art_basic_terminal() {+ let backend = ratatui::backend::TestBackend::new(120, 30);+ let mut terminal = ratatui::Terminal::new(backend).unwrap();+ let mut state = AppState {+ basic_terminal: true,+ selected_details: Some(MediaDetails {+ id: ProviderMediaId {+ provider: ProviderKind::MovieBox,+ value: "sample".to_string(),+ },+ title: "Sample Movie".to_string(),+ media_type: MediaType::Movie,+ year: Some("2024".to_string()),+ description: Some("A movie synopsis for testing.".to_string()),+ tagline: None,+ imdb_rating: None,+ director: None,+ stars: None,+ prints: None,+ audios: None,+ poster_url: None,+ duration: None,+ genres: vec![],+ seasons: vec![],+ dubs: vec![],+ }),+ ..Default::default()+ };+ let theme = Theme::mocha();++ terminal+ .draw(|frame| {+ draw(frame, frame.area(), &mut state, &theme);+ })+ .unwrap();++ let buffer = terminal.backend().buffer();+ let content = buffer+ .content()+ .iter()+ .map(|cell| cell.symbol())+ .collect::<String>();++ assert!(content.contains("[No Art]"));+ }}diff --git a/src/tui/screens/home.rs b/src/tui/screens/home.rsindex bf2fd37..ddaac87 100644--- a/src/tui/screens/home.rs+++ b/src/tui/screens/home.rs@@ -77,56 +77,37 @@ pub(crate) fn render_poster_placeholder(return;}- let anim_frame = (tick / 4) % 3;- let eyes = if basic_terminal {- if is_in_flight {- match anim_frame {- 0 => ". .",- 1 => "o o",- _ => "O O",- }- } else {- "- -"- }- } else if is_in_flight {- match anim_frame {- 0 => "· ·",- 1 => "◦ ◦",- _ => "○ ○",- }- } else {- "· ·"- };-- let text_style = if is_in_flight {- theme.lavender- } else {- theme.text_dim+ let pad_top = inner.height.saturating_sub(1) / 2;+ let text_area = Rect {+ x: inner.x,+ y: inner.y + pad_top,+ width: inner.width,+ height: 1.min(inner.height),};- if inner.height == 1 {- let p = Paragraph::new(eyes)- .style(text_style)- .alignment(Alignment::Center);- frame.render_widget(p, inner);- } else if inner.height == 2 {- let mouth = if basic_terminal { "--" } else { "──" };- let content = format!("{eyes}\n{mouth}");- let p = Paragraph::new(content)- .style(text_style)+ if is_in_flight {+ let dots = match (tick / 4) % 4 {+ 0 => "·",+ 1 => "··",+ 2 => "···",+ _ => "····",+ };+ let p = Paragraph::new(dots)+ .style(theme.lavender).alignment(Alignment::Center);- frame.render_widget(p, inner);+ frame.render_widget(p, text_area);} else {- let pad_top = inner.height.saturating_sub(2) / 2;- let mouth = if basic_terminal { "--" } else { "──" };- let mut content = "\n".repeat(pad_top as usize);- content.push_str(eyes);- content.push('\n');- content.push_str(mouth);- let p = Paragraph::new(content)- .style(text_style)+ let label = if inner.width >= 8 {+ if basic_terminal { "[No Art]" } else { "No Art" }+ } else if inner.width >= 6 {+ "No Art"+ } else {+ "·"+ };+ let p = Paragraph::new(label)+ .style(theme.overlay0).alignment(Alignment::Center);- frame.render_widget(p, inner);+ frame.render_widget(p, text_area);}}@@ -1515,30 +1496,6 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme));let list_block = Block::default();if !state.search_results.is_empty() {- let poster_width = if state.image_supported {- state- .image_picker- .as_ref()- .map(|picker| {- if matches!(- picker.protocol_type(),- ratatui_image::picker::ProtocolType::Halfblocks- ) {- 11_u16- } else {- let font = picker.font_size();- let pixel_height =- u64::from(state.poster_rows.max(3)) * u64::from(font.height.max(1));- let pixel_width = pixel_height * 2 / 3;- u16::try_from(pixel_width.div_ceil(u64::from(font.width.max(1))))- .unwrap_or(u16::MAX)- .max(6)- }- })- .unwrap_or_else(|| state.poster_rows.saturating_mul(4).div_ceil(3).max(6))- } else {- 12- };let initial_metrics = state.result_metrics(results_chunk.height, results_chunk.width);let has_scrollbar = state.search_results.len() > initial_metrics.visible_items;let results_area = if has_scrollbar {@@ -1553,7 +1510,24 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)let selected_idx = state.search_list_state.selected();let metrics = state.result_metrics(results_area.height, results_area.width);- let poster_width = poster_width+ let target_width = if state.image_supported {+ state+ .image_picker+ .as_ref()+ .map(|picker| {+ let font = picker.font_size();+ let pixel_height =+ u64::from(state.poster_rows.max(3)) * u64::from(font.height.max(1));+ let pixel_width = pixel_height * 2 / 3;+ u16::try_from(pixel_width.div_ceil(u64::from(font.width.max(1))))+ .unwrap_or(u16::MAX)+ .max(6)+ })+ .unwrap_or_else(|| state.poster_rows.saturating_mul(4).div_ceil(3).max(6))+ } else {+ state.poster_rows.saturating_mul(4).div_ceil(3).clamp(8, 12)+ };+ let poster_width = target_width.min(metrics.col_width.saturating_sub(18).max(6)).max(6);state.last_result_metrics = Some(metrics);@@ -1637,7 +1611,7 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)..poster_area};- if state.image_supported {+ 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);let needs_protocol =@@ -1674,7 +1648,7 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)state.tick_count,);}- } else {+ } else if poster_area.width > 0 {render_poster_placeholder(frame,p_area,@@ -2540,6 +2514,30 @@ fn render_search_suggestions(#[inline(always)]fn item_slot_rects(item_area: Rect, poster_width: u16) -> (Rect, Rect, Rect) {let highlight_w = 2.min(item_area.width);+ 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,+ },+ );+ }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);@@ -3377,4 +3375,20 @@ mod tests {assert!(content.contains("Try on 4KHDHub"));assert!(content.contains("Clear Search"));}++ #[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);+ assert_eq!(poster_zero.width, 0);+ assert_eq!(text_zero.x, 12);+ assert_eq!(text_zero.width, 78);++ let (hl, poster, text) = item_slot_rects(area, 12);+ assert_eq!(hl.width, 2);+ assert_eq!(poster.width, 12);+ assert_eq!(text.x, 25);+ assert_eq!(text.width, 65);+ }}diff --git a/src/tui/state.rs b/src/tui/state.rsindex fb65b45..55dc8ac 100644--- a/src/tui/state.rs+++ b/src/tui/state.rs@@ -71,7 +71,7 @@ impl SettingsCategory {match self {Self::General => 3,Self::ContentModes => 4,- Self::Appearance => 2,+ Self::Appearance => 1,Self::StorageInfo => 3,}}@@ -277,7 +277,6 @@ pub struct AppState {pub poster_protocol: Option<(ratatui::layout::Rect, ratatui_image::protocol::Protocol)>,pub image_picker: Option<ratatui_image::picker::Picker>,- pub poster_mode: String,pub image_supported: bool,pub clear_terminal_before_draw: bool,pub poster_rows: u16,@@ -437,7 +436,6 @@ impl Default for AppState {poster_protocol: None,image_picker: None,- poster_mode: "auto".to_string(),image_supported: crate::tui::terminal::should_query_images(),clear_terminal_before_draw: false,poster_rows: 3,@@ -896,30 +894,6 @@ impl AppState {self.theme_is_auto = false;next_theme}- pub fn cycle_poster_mode(&mut self, forward: bool) -> String {- let modes = ["auto", "halfblocks", "off"];- let total = modes.len();- let current_idx = modes- .iter()- .position(|&m| m.eq_ignore_ascii_case(&self.poster_mode))- .unwrap_or(0);- let next_idx = if forward {- (current_idx + 1) % total- } else {- (current_idx + total - 1) % total- };- let next_mode = modes[next_idx].to_string();- self.poster_mode = next_mode.clone();- next_mode- }-- pub fn poster_mode_label(&self) -> &'static str {- match self.poster_mode.to_ascii_lowercase().as_str() {- "halfblocks" => "Halfblocks",- "off" => "Off",- _ => "Auto",- }- }pub fn can_disable_streaming_mode(&self) -> bool {self.tv_enabled || self.addons_enableddiff --git a/src/tui/terminal.rs b/src/tui/terminal.rsindex 26a9dbb..89c511d 100644--- a/src/tui/terminal.rs+++ b/src/tui/terminal.rs@@ -92,7 +92,7 @@ mod tests {std::env::set_var("TERM", "dumb");assert!(!should_query_images());std::env::remove_var("TERM");- std::env::set_var("MOVIEBOX_IMAGE_PROTOCOL", "halfblocks");+ std::env::set_var("MOVIEBOX_IMAGE_PROTOCOL", "kitty");assert!(should_query_images());std::env::remove_var("MOVIEBOX_IMAGE_PROTOCOL");}diff --git a/src/tui/widgets/settings.rs b/src/tui/widgets/settings.rsindex f6b49c3..5967bce 100644--- a/src/tui/widgets/settings.rs+++ b/src/tui/widgets/settings.rs@@ -633,7 +633,7 @@ fn render_content_modes_settings(frame: &mut Frame, area: Rect, state: &AppState}fn render_appearance_settings(frame: &mut Frame, area: Rect, state: &AppState, theme: &Theme) {- let row_rects = settings_row_rects_in_area(area, 2);+ let row_rects = settings_row_rects_in_area(area, 1);let has_active_popup = has_active_settings_popup(state);let theme_name = if state.active_theme_kind.is_empty() {@@ -668,32 +668,6 @@ fn render_appearance_settings(frame: &mut Frame, area: Rect, state: &AppState, t);}- if let Some(&row_area) = row_rects.get(1) {- let is_selected = state.settings_selected_row == 1;- let value_spans = vec![Span::styled(- state.poster_mode_label(),- if state.basic_terminal {- theme.text.add_modifier(Modifier::BOLD)- } else {- theme.accent.add_modifier(Modifier::BOLD)- },- )];-- render_row(- frame,- row_area,- SettingRow {- is_selected,- has_active_popup,- label: "Poster Graphics",- subtext: "Native terminal protocols, Halfblocks or disabled",- value_spans,- },- theme,- state.basic_terminal,- );- }-if area.height >= 7 {let info_y = area.y + 5;let info_area = Rect {@@ -1221,11 +1195,9 @@ mod tests {.join("\n");assert!(rendered.contains("Theme"));- assert!(rendered.contains("Poster Graphics"));- assert!(rendered.contains("Auto"));let popup = Rect::new(4, 4, 76, 17);let rows = settings_row_rects(popup, SettingsCategory::Appearance);- assert_eq!(rows.len(), 2);+ assert_eq!(rows.len(), 1);}}diff --git a/tests/settings_hub.rs b/tests/settings_hub.rsindex d8c7d88..52e8a48 100644--- a/tests/settings_hub.rs+++ b/tests/settings_hub.rs@@ -264,7 +264,6 @@ async fn test_settings_appearance_theme_cycle_and_popup() {let mut app = App::new();app.handle_action(Action::ShowSettingsPopup).await;assert!(app.state().show_settings_popup);- app.state_mut().poster_mode = "auto".to_string();app.handle_action(Action::SelectSettingsCategory(SettingsCategory::Appearance)).await;@@ -288,23 +287,6 @@ async fn test_settings_appearance_theme_cycle_and_popup() {.await;assert!(app.state().show_settings_popup);assert!(!app.state().show_theme_popup);- app.handle_action(Action::Key(KeyEvent::new(- KeyCode::Down,- KeyModifiers::empty(),- )))- .await;- assert_eq!(app.state().settings_selected_row, 1);- assert_eq!(app.state().poster_mode, "auto");-- app.handle_action(Action::SettingsAdjustValue(true)).await;- assert_eq!(app.state().poster_mode, "halfblocks");-- app.handle_action(Action::SettingsAdjustValue(true)).await;- assert_eq!(app.state().poster_mode, "off");-- app.handle_action(Action::SettingsAdjustValue(true)).await;- assert_eq!(app.state().poster_mode, "auto");-app.handle_action(Action::CloseSettingsPopup).await;assert!(!app.state().show_settings_popup);}