diff options
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -95,8 +95,13 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { m.wordAddStatus = fmt.Sprintf("✅ Added '%s' to Anki", string(msg)) case tea.KeyMsg: switch msg.Type { - case tea.KeyCtrlC, tea.KeyEsc: + case tea.KeyCtrlC: return m, tea.Quit + case tea.KeyEsc: + m.currentWord = "" + m.currentDefinition = "" + m.wordInput.SetValue("") + m.vp.SetContent("") case tea.KeyEnter: return m, addCard(m.c, m.currentWord, m.currentDefinition) } @@ -127,7 +132,7 @@ func (m model) View() string { "Look up a word:\n\n%s\n\n%s\n%s\n\n%s\n%s", m.wordInput.View(), m.wordAddStatus, - "(esc to quit)", + "(ctrl-c to quit, esc to clear)", "Current definition:\n", m.vp.View(), ) + "\n" |
