summaryrefslogtreecommitdiff
path: root/ui.go
diff options
context:
space:
mode:
authorDavid Schlachter <t480-debian-git@schlachter.ca>2026-01-11 14:10:17 -0500
committerDavid Schlachter <t480-debian-git@schlachter.ca>2026-01-11 14:10:17 -0500
commit62e1896caf091622cf6b56eb14ba5591155ac567 (patch)
tree03cd95b10d1ccc7c03a0e1c63ada3d256162913b /ui.go
parent53c51980818258036297986ef3d315c0009ead91 (diff)
Clean apostrophes in user input as well
Diffstat (limited to 'ui.go')
-rw-r--r--ui.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/ui.go b/ui.go
index bbffb5c..dada7c6 100644
--- 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) {