From f37508a53980f38c530780650338797e81fe1e3c Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Sun, 12 May 2019 11:21:28 -0400 Subject: Implement :{next,prev}-field in compose view --- lib/ui/textinput.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/ui') 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) } } -- cgit 1.4.1-2-gfad0