diff options
Diffstat (limited to 'lib/ui/textinput.go')
-rw-r--r-- | lib/ui/textinput.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/ui/textinput.go b/lib/ui/textinput.go index 542a1f88..3e1f68a8 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)), } } |