french-wiktionary-flashcards

Easily create Anki flashcards from Wiktionary data.
Log | Files | Refs | README

commit 9567725cc98b6706d25230a2558a8faf1e0794b9
parent bfa6f9641a59e1c388b33d1bc1be2bbe9e4d3a86
Author: David Schlachter <t480-debian-git@schlachter.ca>
Date:   Thu,  8 Jan 2026 01:29:08 -0500

Better UI, allow clearing the view

Diffstat:
Mmain.go | 9+++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/main.go b/main.go @@ -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"