aboutsummaryrefslogtreecommitdiffstats
path: root/app/aerc.go
diff options
context:
space:
mode:
Diffstat (limited to 'app/aerc.go')
-rw-r--r--app/aerc.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/app/aerc.go b/app/aerc.go
index 72a60562..12bb6893 100644
--- a/app/aerc.go
+++ b/app/aerc.go
@@ -1,6 +1,7 @@
package app
import (
+ "context"
"errors"
"fmt"
"io"
@@ -29,7 +30,7 @@ type Aerc struct {
accounts map[string]*AccountView
cmd func(string, *config.AccountConfig, *models.MessageInfo) error
cmdHistory lib.History
- complete func(cmd string) ([]opt.Completion, string)
+ complete func(ctx context.Context, cmd string) ([]opt.Completion, string)
focused ui.Interactive
grid *ui.Grid
simulating int
@@ -54,7 +55,7 @@ type Choice struct {
func (aerc *Aerc) Init(
crypto crypto.Provider,
cmd func(string, *config.AccountConfig, *models.MessageInfo) error,
- complete func(cmd string) ([]opt.Completion, string), cmdHistory lib.History,
+ complete func(ctx context.Context, cmd string) ([]opt.Completion, string), cmdHistory lib.History,
deferLoop chan struct{},
) {
tabs := ui.NewTabs(func(d ui.Drawable) *config.UIConfig {
@@ -317,8 +318,8 @@ func (aerc *Aerc) simulate(strokes []config.KeyStroke) {
aerc.simulating -= 1
if exline, ok := aerc.focused.(*ExLine); ok {
// we are still focused on the exline, turn on tab complete
- exline.TabComplete(func(cmd string) ([]opt.Completion, string) {
- return aerc.complete(cmd)
+ exline.TabComplete(func(ctx context.Context, cmd string) ([]opt.Completion, string) {
+ return aerc.complete(ctx, cmd)
})
if complete {
// force completion now
@@ -633,7 +634,7 @@ func (aerc *Aerc) focus(item ui.Interactive) {
func (aerc *Aerc) BeginExCommand(cmd string) {
previous := aerc.focused
- var tabComplete func(string) ([]opt.Completion, string)
+ var tabComplete func(context.Context, string) ([]opt.Completion, string)
if aerc.simulating != 0 {
// Don't try to draw completions for simulated events
tabComplete = nil
@@ -671,7 +672,7 @@ func (aerc *Aerc) RegisterPrompt(prompt string, cmd string) {
if err != nil {
aerc.PushError(err.Error())
}
- }, func(cmd string) ([]opt.Completion, string) {
+ }, func(ctx context.Context, cmd string) ([]opt.Completion, string) {
return nil, "" // TODO: completions
})
aerc.prompts.Push(p)
@@ -698,7 +699,7 @@ func (aerc *Aerc) RegisterChoices(choices []Choice) {
if err != nil {
aerc.PushError(err.Error())
}
- }, func(cmd string) ([]opt.Completion, string) {
+ }, func(ctx context.Context, cmd string) ([]opt.Completion, string) {
return nil, "" // TODO: completions
})
aerc.prompts.Push(p)