Compare commits

...

2 Commits

Author SHA1 Message Date
Mikael Fangel 38521ff870 fix: correct wrong key combination for gum write in README.md
Fixes #312

### Changes:
 - Moves the `esc` over to the cancel option together with CTRL+c, so it reflects the current behaviour of the program.
2023-03-20 17:47:23 -04:00
mikael d9a3dc5324 Added esc to keys and changed error code to 130 2023-03-20 15:17:16 -04:00
3 changed files with 9 additions and 2 deletions

View File

@ -197,7 +197,7 @@ gum input --password > password.txt
Prompt for some multi-line text.
Note: `CTRL+D` and `esc` are used to complete text entry. `CTRL+C` will cancel.
Note: `CTRL+D` is used to complete text entry. `CTRL+C` and `esc` will cancel.
```bash
gum write > story.txt

View File

@ -9,6 +9,7 @@ import (
"github.com/alecthomas/kong"
"github.com/charmbracelet/bubbles/filepicker"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/gum/internal/exit"
"github.com/charmbracelet/gum/style"
)
@ -53,6 +54,9 @@ func (o Options) Run() error {
}
m = tm.(model)
if m.aborted {
return exit.ErrAborted
}
if m.selectedPath == "" {
os.Exit(1)

View File

@ -20,6 +20,7 @@ import (
type model struct {
filepicker filepicker.Model
selectedPath string
aborted bool
quitting bool
}
@ -31,7 +32,9 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case tea.KeyMsg:
switch msg.String() {
case "ctrl+c", "q":
case "ctrl+c", "q", "esc":
m.aborted = true
m.quitting = true
return m, tea.Quit
}
}