commit 62e1896caf091622cf6b56eb14ba5591155ac567
parent 53c51980818258036297986ef3d315c0009ead91
Author: David Schlachter <t480-debian-git@schlachter.ca>
Date: Sun, 11 Jan 2026 14:10:17 -0500
Clean apostrophes in user input as well
Diffstat:
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/ui.go b/ui.go
@@ -87,6 +87,9 @@ func (m model) Init() tea.Cmd {
func lookupWord(db *sql.DB, word string) tea.Cmd {
return func() tea.Msg {
word = strings.TrimSpace(word) // remove leading / trailing whitespace
+ // Replace apostrophes (possible if copy-pasting) with single quotes
+ word = strings.ReplaceAll(word, `’`, `'`)
+
rows, err := db.Query(`select definition from words where word = ?`, word)
if err != nil {
if errors.Is(err, sql.ErrNoRows) {