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 <noreply@anthropic.com>
This commit is contained in:
Ed L
2026-03-24 12:09:10 -07:00
parent f4978a9fd4
commit acc890764b

View File

@ -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 {