summary refs log tree commit diff stats
path: root/lib/ui
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ui')
-rw-r--r--lib/ui/textinput.go5
1 files changed, 3 insertions, 2 deletions
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)),
 	}
 }