From 0fc5ffb260f764f2e7313506aa0f73ad98cbea40 Mon Sep 17 00:00:00 2001 From: Koni Marti Date: Wed, 21 Jun 2023 21:36:30 +0200 Subject: textinput: fix stemming with multi-byte chars Fix a panic in the textinput when using multi-byte chars in the completions. Fixes: https://todo.sr.ht/~rjarry/aerc/180 Signed-off-by: Koni Marti Tested-by: Bence Ferdinandy --- lib/ui/textinput.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/ui') diff --git a/lib/ui/textinput.go b/lib/ui/textinput.go index b2ba33f6..e41cff75 100644 --- a/lib/ui/textinput.go +++ b/lib/ui/textinput.go @@ -144,7 +144,7 @@ func (ti *TextInput) drawPopover(ctx *Context) { }, onStem: func(stem string) { ti.Set(ti.prefix + stem + ti.StringRight()) - ti.index = len(ti.prefix + stem) + ti.index = runewidth.StringWidth(ti.prefix + stem) ti.Invalidate() }, uiConfig: ti.uiConfig, -- cgit