From 6440281e82674a0714edb67a002798bc1ec0f410 Mon Sep 17 00:00:00 2001 From: Ilya Grigoriev Date: Sat, 11 Feb 2023 09:00:08 -0800 Subject: [PATCH] Disallow exiting from `rename:` mode with backspace (#1060) After looking at the list of possibilities for `app.ui.cmdPrefix` by searching through the code, renaming looks to be the only remaining mode where exiting via backspace doesn't make sense. In particular, I don't think any commands other than `rename` commonly start out with some editable text in the prompt. The other dangerous mode is the `>` mode, but there exit-on-backspace was already disabled. Fixes #1052, #1059 --- eval.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/eval.go b/eval.go index a0863419..fc789a67 100644 --- a/eval.go +++ b/eval.go @@ -1887,8 +1887,9 @@ func (e *callExpr) eval(app *app, args []string) { switch app.ui.cmdPrefix { case "!", "$", "%", "&": app.ui.cmdPrefix = ":" - case ">": - // Don't mess with the program waiting for input + case ">", "rename: ": + // Don't mess with programs waiting for input. + // Exiting on backspace is also inconvenient for renames since the text field starts out nonempty. default: normal(app) }