summaryrefslogtreecommitdiff
path: root/ui/editor.go
diff options
context:
space:
mode:
Diffstat (limited to 'ui/editor.go')
-rw-r--r--ui/editor.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/ui/editor.go b/ui/editor.go
index bf21f85..15785e8 100644
--- a/ui/editor.go
+++ b/ui/editor.go
@@ -164,6 +164,18 @@ func (e *Editor) Flush() (content string) {
return
}
+func (e *Editor) Clear() {
+ if e.TextLen() == 0 {
+ return
+ }
+ e.text[e.lineIdx] = []rune{}
+ e.textWidth = e.textWidth[:1]
+ e.cursorIdx = 0
+ e.offsetIdx = 0
+ e.autoCache = nil
+ return
+}
+
func (e *Editor) Right() {
e.right()
e.autoCache = nil