summaryrefslogtreecommitdiff
path: root/tui
diff options
context:
space:
mode:
Diffstat (limited to 'tui')
-rw-r--r--tui/text_input.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/tui/text_input.go b/tui/text_input.go
index ba99f48..63335aa 100644
--- a/tui/text_input.go
+++ b/tui/text_input.go
@@ -22,6 +22,7 @@ func (t *TextInput) Text() string {
func (t *TextInput) SetText(text string) {
t.beforeCursor = ""
t.afterCursor = text
+ t.selection = ""
}
func toGraphemes(s string) []string {
@@ -167,6 +168,10 @@ func (t *TextInput) Write(text string) {
t.beforeCursor += text
}
+func (t *TextInput) IsEmpty() bool {
+ return t.beforeCursor == "" && t.selection == "" && t.afterCursor == ""
+}
+
func (t *TextInput) Update(ev Event) (usedKeybind bool) {
if Selected != t.id {
t.Deselect()