aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2023-06-20 11:07:07 -0500
committerRobin Jarry <robin@jarry.cc>2023-06-20 23:16:25 +0200
commit115fb9322ce4065bb7212e8979464d0f9c1db12d (patch)
treef52beba3d78440a46f97324214cd61e853996ec9 /widgets
parent982ee4128c584759e518b6d541ca01cce6c5d547 (diff)
downloadaerc-115fb9322ce4065bb7212e8979464d0f9c1db12d.tar.gz
worker: add context to cancellable requests
Add a Context field to requests which we may want to cancel when changing directories. Add a Cancelled meta-message to inform the UI that a request was cancelled (as opposed to Done or Error). Delete callbacks when a request is Cancelled. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'widgets')
-rw-r--r--widgets/dirlist.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/widgets/dirlist.go b/widgets/dirlist.go
index 3b5c2d91..788e197f 100644
--- a/widgets/dirlist.go
+++ b/widgets/dirlist.go
@@ -161,7 +161,10 @@ func (dirlist *DirectoryList) Select(name string) {
select {
case <-time.After(delay):
- dirlist.worker.PostAction(&types.OpenDirectory{Directory: name},
+ dirlist.worker.PostAction(&types.OpenDirectory{
+ Context: dirlist.ctx,
+ Directory: name,
+ },
func(msg types.WorkerMessage) {
switch msg.(type) {
case *types.Error: