msgstore: leave visual-mark mode after certain commands
Commit "4753cfd visual-mode: deselect messages after performing command" introduced the behavior of leaving visual mark mode after performing certain commands. Add this behavior to additional commands: - Delete - Archive - Move Remark the selected mail files if an error occurred during the operation. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
parent
db195bebf0
commit
56dabb5c9c
3 changed files with 7 additions and 0 deletions
|
@ -54,6 +54,7 @@ func (Archive) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
}
|
}
|
||||||
archiveDir := acct.AccountConfig().Archive
|
archiveDir := acct.AccountConfig().Archive
|
||||||
store.Next()
|
store.Next()
|
||||||
|
store.ClearVisualMark()
|
||||||
acct.Messages().Invalidate()
|
acct.Messages().Invalidate()
|
||||||
|
|
||||||
var uidMap map[string][]uint32
|
var uidMap map[string][]uint32
|
||||||
|
@ -90,6 +91,7 @@ func (Archive) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
aerc.PushError(msg.Error.Error())
|
aerc.PushError(msg.Error.Error())
|
||||||
success = false
|
success = false
|
||||||
wg.Done()
|
wg.Done()
|
||||||
|
store.Remark()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@ func (Delete) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
}
|
}
|
||||||
//caution, can be nil
|
//caution, can be nil
|
||||||
next := findNextNonDeleted(uids, store)
|
next := findNextNonDeleted(uids, store)
|
||||||
|
store.ClearVisualMark()
|
||||||
store.Delete(uids, func(msg types.WorkerMessage) {
|
store.Delete(uids, func(msg types.WorkerMessage) {
|
||||||
switch msg := msg.(type) {
|
switch msg := msg.(type) {
|
||||||
case *types.Done:
|
case *types.Done:
|
||||||
|
@ -79,8 +80,10 @@ func (Delete) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
}
|
}
|
||||||
acct.Messages().Invalidate()
|
acct.Messages().Invalidate()
|
||||||
case *types.Error:
|
case *types.Error:
|
||||||
|
store.Remark()
|
||||||
aerc.PushError(msg.Error.Error())
|
aerc.PushError(msg.Error.Error())
|
||||||
case *types.Unsupported:
|
case *types.Unsupported:
|
||||||
|
store.Remark()
|
||||||
// notmuch doesn't support it, we want the user to know
|
// notmuch doesn't support it, we want the user to know
|
||||||
aerc.PushError(" error, unsupported for this worker")
|
aerc.PushError(" error, unsupported for this worker")
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,7 @@ func (Move) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
aerc.RemoveTab(h.msgProvider)
|
aerc.RemoveTab(h.msgProvider)
|
||||||
}
|
}
|
||||||
store.Next()
|
store.Next()
|
||||||
|
store.ClearVisualMark()
|
||||||
acct.Messages().Invalidate()
|
acct.Messages().Invalidate()
|
||||||
joinedArgs := strings.Join(args[optind:], " ")
|
joinedArgs := strings.Join(args[optind:], " ")
|
||||||
store.Move(uids, joinedArgs, createParents, func(
|
store.Move(uids, joinedArgs, createParents, func(
|
||||||
|
@ -71,6 +72,7 @@ func (Move) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
case *types.Done:
|
case *types.Done:
|
||||||
aerc.PushStatus("Message moved to "+joinedArgs, 10*time.Second)
|
aerc.PushStatus("Message moved to "+joinedArgs, 10*time.Second)
|
||||||
case *types.Error:
|
case *types.Error:
|
||||||
|
store.Remark()
|
||||||
aerc.PushError(msg.Error.Error())
|
aerc.PushError(msg.Error.Error())
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue