aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/dirlist.go
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/dirlist.go')
-rw-r--r--widgets/dirlist.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/widgets/dirlist.go b/widgets/dirlist.go
index 006771a3..ad5f048c 100644
--- a/widgets/dirlist.go
+++ b/widgets/dirlist.go
@@ -44,6 +44,8 @@ type DirectoryLister interface {
SetMsgStore(string, *lib.MessageStore)
FilterDirs([]string, []string, bool) []string
+
+ UiConfig() *config.UIConfig
}
type DirectoryList struct {
@@ -61,6 +63,7 @@ type DirectoryList struct {
skipSelect context.Context
skipSelectCancel context.CancelFunc
connected bool
+ uiConf map[string]*config.UIConfig
}
func NewDirectoryList(conf *config.AercConfig, acctConf *config.AccountConfig,
@@ -68,6 +71,8 @@ func NewDirectoryList(conf *config.AercConfig, acctConf *config.AccountConfig,
) DirectoryLister {
ctx, cancel := context.WithCancel(context.Background())
+ uiConfMap := make(map[string]*config.UIConfig)
+
dirlist := &DirectoryList{
aercConf: conf,
acctConf: acctConf,
@@ -76,6 +81,7 @@ func NewDirectoryList(conf *config.AercConfig, acctConf *config.AccountConfig,
worker: worker,
skipSelect: ctx,
skipSelectCancel: cancel,
+ uiConf: uiConfMap,
}
uiConf := dirlist.UiConfig()
dirlist.spinner = NewSpinner(uiConf)
@@ -92,10 +98,15 @@ func NewDirectoryList(conf *config.AercConfig, acctConf *config.AccountConfig,
}
func (dirlist *DirectoryList) UiConfig() *config.UIConfig {
- return dirlist.aercConf.GetUiConfig(map[config.ContextType]string{
+ if ui, ok := dirlist.uiConf[dirlist.Selected()]; ok {
+ return ui
+ }
+ ui := dirlist.aercConf.GetUiConfig(map[config.ContextType]string{
config.UI_CONTEXT_ACCOUNT: dirlist.acctConf.Name,
config.UI_CONTEXT_FOLDER: dirlist.Selected(),
})
+ dirlist.uiConf[dirlist.Selected()] = ui
+ return ui
}
func (dirlist *DirectoryList) List() []string {