aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/exline.go
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/exline.go')
-rw-r--r--widgets/exline.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/widgets/exline.go b/widgets/exline.go
index 7eff74a1..5c9f065b 100644
--- a/widgets/exline.go
+++ b/widgets/exline.go
@@ -17,6 +17,7 @@ type ExLine struct {
ctx *ui.Context
cancel func()
cells int
+ focus bool
index int
scroll int
@@ -52,6 +53,14 @@ func (ex *ExLine) Draw(ctx *ui.Context) {
}
}
+func (ex *ExLine) Focus(focus bool) {
+ ex.focus = focus
+ if focus && ex.ctx != nil {
+ cells := runewidth.StringWidth(string(ex.command[:ex.index]))
+ ex.ctx.SetCursor(cells+1, 0)
+ }
+}
+
func (ex *ExLine) insert(ch rune) {
left := ex.command[:ex.index]
right := ex.command[ex.index:]