From 577248f5e15d98a9a6522a605acd434059582bfc Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Sun, 12 May 2019 00:06:09 -0400 Subject: Add initial compose widget --- lib/ui/textinput.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/ui/textinput.go b/lib/ui/textinput.go index 542a1f8..3e1f68a 100644 --- a/lib/ui/textinput.go +++ b/lib/ui/textinput.go @@ -22,10 +22,11 @@ type TextInput struct { // Creates a new TextInput. TextInputs will render a "textbox" in the entire // context they're given, and process keypresses to build a string from user // input. -func NewTextInput() *TextInput { +func NewTextInput(text string) *TextInput { return &TextInput{ cells: -1, - text: []rune{}, + text: []rune(text), + index: len([]rune(text)), } } -- cgit v1.2.3