ChangeFolder: do not depend on the msgstore
We need to clear the filtering etc upon folder switch. Not having a valid msgstore is however no reason not to switch directories.
This commit is contained in:
parent
9570f4b4d0
commit
3424c36d52
|
@ -34,22 +34,22 @@ func (_ ChangeFolder) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
if acct == nil {
|
if acct == nil {
|
||||||
return errors.New("No account selected")
|
return errors.New("No account selected")
|
||||||
}
|
}
|
||||||
store := acct.Store()
|
|
||||||
if store == nil {
|
|
||||||
return errors.New("Cannot perform action. Messages still loading")
|
|
||||||
}
|
|
||||||
previous := acct.Directories().Selected()
|
previous := acct.Directories().Selected()
|
||||||
if args[1] == "-" {
|
if args[1] == "-" {
|
||||||
if dir, ok := history[acct.Name()]; ok {
|
if dir, ok := history[acct.Name()]; ok {
|
||||||
store.ApplyClear()
|
|
||||||
acct.Directories().Select(dir)
|
acct.Directories().Select(dir)
|
||||||
} else {
|
} else {
|
||||||
return errors.New("No previous folder to return to")
|
return errors.New("No previous folder to return to")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
store.ApplyClear()
|
|
||||||
acct.Directories().Select(args[1])
|
acct.Directories().Select(args[1])
|
||||||
}
|
}
|
||||||
history[acct.Name()] = previous
|
history[acct.Name()] = previous
|
||||||
|
|
||||||
|
// reset store filtering if we switched folders
|
||||||
|
store := acct.Store()
|
||||||
|
if store != nil {
|
||||||
|
store.ApplyClear()
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue