summary refs log tree commit diff stats
path: root/lib/ui/textinput.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ui/textinput.go')
-rw-r--r--lib/ui/textinput.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/ui/textinput.go b/lib/ui/textinput.go
index 3e1f68a..688d91d 100644
--- a/lib/ui/textinput.go
+++ b/lib/ui/textinput.go
@@ -47,9 +47,9 @@ func (ti *TextInput) Draw(ctx *Context) {
 	ti.ctx = ctx // gross
 	ctx.Fill(0, 0, ctx.Width(), ctx.Height(), ' ', tcell.StyleDefault)
 	ctx.Printf(0, 0, tcell.StyleDefault, "%s%s", ti.prompt, string(ti.text))
-	cells := runewidth.StringWidth(string(ti.text[:ti.index]))
-	if cells != ti.cells {
-		ctx.SetCursor(cells+1, 0)
+	cells := runewidth.StringWidth(string(ti.text[:ti.index]) + ti.prompt)
+	if cells != ti.cells && ti.focus {
+		ctx.SetCursor(cells, 0)
 	}
 }