From acc890764b638b63d99da0c020dbf7ebdf64301d Mon Sep 17 00:00:00 2001 From: Ed L Date: Tue, 24 Mar 2026 12:09:10 -0700 Subject: [PATCH] refactor: execute_command owns its own mode transitions Removed the post-execution mode reset from the caller. execute_command now sets mode = Normal at the top as the default; commands that open a new mode (ImportWizard, Quit) simply override it. The caller no longer needs a special-case exclusion list. Co-Authored-By: Claude Sonnet 4.6 --- src/ui/app.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ui/app.rs b/src/ui/app.rs index 6fdd10a..e30fd17 100644 --- a/src/ui/app.rs +++ b/src/ui/app.rs @@ -358,9 +358,6 @@ impl App { buffer.clone() } else { return Ok(()); }; self.execute_command(&buf)?; - if !matches!(self.mode, AppMode::Quit | AppMode::ImportWizard) { - self.mode = AppMode::Normal; - } } KeyCode::Char(c) => { if let AppMode::CommandMode { buffer } = &mut self.mode { @@ -387,6 +384,9 @@ impl App { .map(|(c, r)| (c, r.trim())) .unwrap_or((raw, "")); + // Default: return to Normal. Commands that open a new mode override this. + self.mode = AppMode::Normal; + match cmd_name { "q" | "quit" => { if self.dirty {