feat(write): ESC should be successful (#433)

Change ESC from aborting to successful quitting.

'vi' users press ESC as an uncontrollable tick, making using 'gum write'
painful when all their work is lost.
This commit is contained in:
Christian Höltje 2023-10-19 12:38:23 -04:00 committed by GitHub
parent 8e959e4cdc
commit 46328de806
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -46,11 +46,11 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
}
case tea.KeyMsg:
switch msg.String() {
case "ctrl+c", "esc":
case "ctrl+c":
m.aborted = true
m.quitting = true
return m, tea.Quit
case "ctrl+d":
case "ctrl+d", "esc":
m.quitting = true
return m, tea.Quit
}