aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ui/textinput.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ui/textinput.go')
-rw-r--r--lib/ui/textinput.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/ui/textinput.go b/lib/ui/textinput.go
index d1d46045..9886da9f 100644
--- a/lib/ui/textinput.go
+++ b/lib/ui/textinput.go
@@ -408,10 +408,17 @@ type completions struct {
uiConfig *config.UIConfig
}
+func unquote(s string) string {
+ if strings.HasPrefix(s, "'") && strings.HasSuffix(s, "'") {
+ s = strings.ReplaceAll(s[1:len(s)-1], `'"'"'`, "'")
+ }
+ return s
+}
+
func maxLen(ss []string) int {
max := 0
for _, s := range ss {
- l := runewidth.StringWidth(s)
+ l := runewidth.StringWidth(unquote(s))
if l > max {
max = l
}
@@ -443,9 +450,9 @@ func (c *completions) Draw(ctx *Context) {
}
if c.idx == idx {
ctx.Fill(0, idx-startIdx, ctx.Width(), 1, ' ', sel)
- ctx.Printf(0, idx-startIdx, sel, " %s ", opt)
+ ctx.Printf(0, idx-startIdx, sel, " %s ", unquote(opt))
} else {
- ctx.Printf(0, idx-startIdx, bg, " %s ", opt)
+ ctx.Printf(0, idx-startIdx, bg, " %s ", unquote(opt))
}
}