Skip to content

Commit

Permalink
Disallow exiting from rename: mode with backspace
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ilyagr committed Dec 28, 2022
1 parent aa78b26 commit 7f2d0e1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 7f2d0e1

Please sign in to comment.