summaryrefslogtreecommitdiff
path: root/ui/editor.go
diff options
context:
space:
mode:
Diffstat (limited to 'ui/editor.go')
-rw-r--r--ui/editor.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/ui/editor.go b/ui/editor.go
index f4bd247..606bf8d 100644
--- a/ui/editor.go
+++ b/ui/editor.go
@@ -214,6 +214,19 @@ func (e *Editor) Clear() bool {
return true
}
+func (e *Editor) Set(text string) {
+ r := []rune(text)
+ e.text[e.lineIdx] = r
+ e.cursorIdx = len(r)
+ e.computeTextWidth()
+ e.offsetIdx = 0
+ for e.width < e.textWidth[e.cursorIdx]-e.textWidth[e.offsetIdx]+16 {
+ e.offsetIdx++
+ }
+ e.autoCache = nil
+ e.backsearchEnd()
+}
+
func (e *Editor) Right() {
e.right()
e.autoCache = nil