aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'widgets')
-rw-r--r--widgets/aerc.go19
-rw-r--r--widgets/exline.go4
2 files changed, 20 insertions, 3 deletions
diff --git a/widgets/aerc.go b/widgets/aerc.go
index 4cd96a83..7209b2d8 100644
--- a/widgets/aerc.go
+++ b/widgets/aerc.go
@@ -274,6 +274,12 @@ func (aerc *Aerc) simulate(strokes []config.KeyStroke) {
aerc.Event(simulated)
}
aerc.simulating -= 1
+ // If we are still focused on the exline, turn on tab complete
+ if exline, ok := aerc.focused.(*ExLine); ok {
+ exline.TabComplete(func(cmd string) ([]string, string) {
+ return aerc.complete(cmd), ""
+ })
+ }
}
func (aerc *Aerc) Event(event tcell.Event) bool {
@@ -571,6 +577,15 @@ func (aerc *Aerc) focus(item ui.Interactive) {
func (aerc *Aerc) BeginExCommand(cmd string) {
previous := aerc.focused
+ var tabComplete func(string) ([]string, string)
+ if aerc.simulating != 0 {
+ // Don't try to draw completions for simulated events
+ tabComplete = nil
+ } else {
+ tabComplete = func(cmd string) ([]string, string) {
+ return aerc.complete(cmd), ""
+ }
+ }
exline := NewExLine(aerc.conf, cmd, func(cmd string) {
parts, err := shlex.Split(cmd)
if err != nil {
@@ -588,9 +603,7 @@ func (aerc *Aerc) BeginExCommand(cmd string) {
}, func() {
aerc.statusbar.Pop()
aerc.focus(previous)
- }, func(cmd string) ([]string, string) {
- return aerc.complete(cmd), ""
- }, aerc.cmdHistory)
+ }, tabComplete, aerc.cmdHistory)
aerc.statusbar.Push(exline)
aerc.focus(exline)
}
diff --git a/widgets/exline.go b/widgets/exline.go
index d43bdecb..8d3c7ca6 100644
--- a/widgets/exline.go
+++ b/widgets/exline.go
@@ -40,6 +40,10 @@ func NewExLine(conf *config.AercConfig, cmd string, commit func(cmd string), fin
return exline
}
+func (x *ExLine) TabComplete(tabComplete func(string) ([]string, string)) {
+ x.input.TabComplete(tabComplete, x.conf.Ui.CompletionDelay)
+}
+
func NewPrompt(conf *config.AercConfig, prompt string, commit func(text string),
tabcomplete func(cmd string) ([]string, string),
) *ExLine {