diff --git a/local/recipes/tui/tlc/recipe.toml b/local/recipes/tui/tlc/recipe.toml index d1be54a4d1..0276df49e0 100644 --- a/local/recipes/tui/tlc/recipe.toml +++ b/local/recipes/tui/tlc/recipe.toml @@ -45,7 +45,7 @@ if [ ! -f "${TARGET_DIR}/tlc" ]; then fi mkdir -p "${COOKBOOK_STAGE}/usr/bin" -for bin in tlc tlcedit tlcview; do +for bin in tlc tlcedit tlcview tlc-pty-login; do cp "${TARGET_DIR}/${bin}" "${COOKBOOK_STAGE}/usr/bin/${bin}" chmod 0755 "${COOKBOOK_STAGE}/usr/bin/${bin}" done diff --git a/local/recipes/tui/tlc/source/src/app.rs b/local/recipes/tui/tlc/source/src/app.rs index c0cfc166c9..988d3e8e0e 100644 --- a/local/recipes/tui/tlc/source/src/app.rs +++ b/local/recipes/tui/tlc/source/src/app.rs @@ -53,8 +53,17 @@ impl Application { // Initial paint. render(&mut tui, &mut fm)?; + let mut last_size = tui.size(); + // Main event loop — blocking stdin, raw mode is active. loop { + let cur_size = tui.size(); + if cur_size != last_size { + last_size = cur_size; + let _ = tui.terminal_mut().clear(); + render(&mut tui, &mut fm)?; + } + // Handle pending external execution (subshell or command line) // before reading the next key. This runs every iteration // regardless of which code path set the flag. @@ -308,6 +317,11 @@ fn take_external_action(fm: &mut FileManager) -> Option { } /// Run an external foreground action and recreate the TUI afterwards. +/// +/// Spawn errors are caught and printed to stderr rather than propagated. +/// Propagating via `?` would exit the app when the subshell or command +/// fails to spawn (e.g. missing `tlc-pty-login` binary on Redox), which +/// is a terrible UX — the user presses Ctrl-O and the app vanishes. fn run_external( tui: Tui, shell_manager: &mut ShellManager, @@ -315,12 +329,14 @@ fn run_external( ) -> Result { drop(tui); - match action { - ExternalAction::Subshell(cwd) => shell_manager.toggle_subshell(&cwd)?, + if let Err(e) = match &action { + ExternalAction::Subshell(cwd) => shell_manager.toggle_subshell(cwd), ExternalAction::Command { cmd, cwd } => { println!(); - shell_manager.run_command(&cmd, &cwd)?; + shell_manager.run_command(cmd, cwd) } + } { + eprintln!("tlc: {e}"); } Tui::new() diff --git a/local/recipes/tui/tlc/source/src/filemanager/mod.rs b/local/recipes/tui/tlc/source/src/filemanager/mod.rs index 49d33a03d2..5d38d2ec61 100644 --- a/local/recipes/tui/tlc/source/src/filemanager/mod.rs +++ b/local/recipes/tui/tlc/source/src/filemanager/mod.rs @@ -4,17 +4,21 @@ //! and the global sort/show-hidden state. The [`Application`](crate::app::Application) //! constructs one of these and dispatches keys to it. +pub mod chattr_dialog; pub mod cmdline; pub mod compare; pub mod config_dialog; pub mod confirm_dialog; +pub mod connection_dialog; pub mod connection_manager; pub mod copy_dialog; pub mod delete_dialog; pub mod edit_history; +pub mod encoding_dialog; pub mod exec; pub mod external_panelize; pub mod filehighlight; +pub mod filter_dialog; pub mod filtered_view; pub mod find; pub mod help;