Skip to content

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

fix: restore home search backspace focus

Samir Hossains192fe0729123
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 676edb2..a1f1a18 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,7 @@
### Fixed
- **External player failure reporting**: Treat every non-zero player exit, including exits after several seconds or without stderr output, as a playback error instead of reconciling false watch progress.
+- **Search focus**: Restore Backspace on the Home screen as a reliable way to focus the search input from results or Favorites.
- **Playback state safety**: Sanitize provider and subject identifiers before using them in tracker state filenames.
- **Cross-platform release validation**: Run all-feature locked builds/tests, binary startup smoke tests, Unix and Windows installer syntax checks, and release-target builds in CI.
- **Documentation accuracy**: Document Android intent limitations, the actual Termux binary model, macOS-only IINA support, native runtime verification requirements, and the current automated test count.
diff --git a/src/tui/app/keyboard.rs b/src/tui/app/keyboard.rs
index 85b1d5f..925b564 100644
--- a/src/tui/app/keyboard.rs
+++ b/src/tui/app/keyboard.rs
@@ -192,6 +192,22 @@ impl App {
return None;
}
+ if self.state.input_mode == InputMode::Normal
+ && self.state.active_screen == Screen::Home
+ && key.code == KeyCode::Backspace
+ && !self.state.addon_manager_popup
+ && !self.state.tv_config_popup
+ {
+ self.state.input_mode = InputMode::Editing;
+ self.state.favorites_focus = false;
+ self.state.favorites_landing_state.select(None);
+ self.state.search_suggestions.clear();
+ self.state.suggest_index = None;
+ self.state.set_status(String::new(), 150);
+ self.state.last_search_edit = std::time::Instant::now();
+ return None;
+ }
+
match self.state.input_mode {
InputMode::Editing => match key.code {
KeyCode::Esc => {
diff --git a/tests/tui_acceptance.rs b/tests/tui_acceptance.rs
index 6000145..efb7cfb 100644
--- a/tests/tui_acceptance.rs
+++ b/tests/tui_acceptance.rs
@@ -1,3 +1,4 @@
+use crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
use moviebox_tui::models::SearchResult;
use moviebox_tui::providers::models::ProviderKind;
use moviebox_tui::tui::action::Action;
@@ -7,6 +8,22 @@ use moviebox_tui::tui::theme::ThemeKind;
use ratatui::Terminal;
use ratatui::backend::TestBackend;
+#[tokio::test]
+async fn test_backspace_from_home_focuses_search_input() {
+ let mut app = App::new();
+ app.state_mut().active_screen = Screen::Home;
+ app.state_mut().input_mode = InputMode::Normal;
+ app.state_mut().search_query = "Inception".to_string();
+ app.state_mut().favorites_focus = true;
+
+ let key = KeyEvent::new(KeyCode::Backspace, KeyModifiers::empty());
+ app.handle_action(Action::Key(key)).await;
+
+ assert_eq!(app.state().input_mode, InputMode::Editing);
+ assert!(!app.state().favorites_focus);
+ assert_eq!(app.state().search_query, "Inception");
+}
+
#[tokio::test]
async fn test_tui_startup_and_home_screen_rendering() {
let backend = TestBackend::new(100, 30);