diff options
author | Koni Marti <koni.marti@gmail.com> | 2024-06-14 23:13:59 +0200 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2024-06-23 22:14:21 +0200 |
commit | 910bc95af6e8cee59ab48cb5df2e7bea85b5c94a (patch) | |
tree | 60df37a558f3ecfe2d3427008904b2c828f07b3b /app | |
parent | 2c06df8720ccf9619fbc293be3c33965672667a9 (diff) | |
download | aerc-910bc95af6e8cee59ab48cb5df2e7bea85b5c94a.tar.gz |
dirlist: store previous folder info
Store the previous folder in the dirlist and retire the global 'history'
map in the commands package. This ensures that the previous folder is
always available when using ':cf -'.
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'app')
-rw-r--r-- | app/dirlist.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/dirlist.go b/app/dirlist.go index 7dff934c..6c89aff9 100644 --- a/app/dirlist.go +++ b/app/dirlist.go @@ -23,6 +23,8 @@ type DirectoryLister interface { ui.Drawable Selected() string + Previous() string + Select(string) Open(string, string, time.Duration, func(types.WorkerMessage), bool) @@ -56,6 +58,7 @@ type DirectoryList struct { dirs []string selecting string selected string + previous string spinner *Spinner worker *types.Worker ctx context.Context @@ -112,6 +115,7 @@ func (dirlist *DirectoryList) Update(msg types.WorkerMessage) { case *types.Done: switch msg := msg.InResponseTo().(type) { case *types.OpenDirectory: + dirlist.previous = dirlist.selected dirlist.selected = msg.Directory dirlist.filterDirsByFoldersConfig() hasSelected := false @@ -222,6 +226,10 @@ func (dirlist *DirectoryList) Selected() string { return dirlist.selected } +func (dirlist *DirectoryList) Previous() string { + return dirlist.previous +} + func (dirlist *DirectoryList) Invalidate() { ui.Invalidate() } |