tlc: fix CTRL+O crash + terminal resize + wire LOW dialog modules
- recipe.toml: stage tlc-pty-login binary alongside tlc/tlcedit/tlcview (was missing from ISO, causing CTRL+O subshell spawn failure on Redox) - app.rs: run_external() catches spawn errors instead of propagating via ? (prevents app exit when subshell/command fails to spawn) - app.rs: add terminal resize detection to event loop (tracks last_size, calls terminal.clear() + render() on size change) - mod.rs: add missing module declarations for chattr_dialog, connection_dialog, encoding_dialog, filter_dialog (enables 36 new dialog tests, 1022 total)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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<ExternalAction> {
|
||||
}
|
||||
|
||||
/// 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<Tui> {
|
||||
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()
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user