diff options
-rw-r--r-- | commands/msg/copy.go | 1 | ||||
-rw-r--r-- | commands/msg/mark.go | 8 | ||||
-rw-r--r-- | commands/msg/modify-labels.go | 1 | ||||
-rw-r--r-- | commands/msg/pipe.go | 2 | ||||
-rw-r--r-- | commands/msg/read.go | 1 | ||||
-rw-r--r-- | doc/aerc.1.scd | 4 | ||||
-rw-r--r-- | lib/msgstore.go | 6 |
7 files changed, 21 insertions, 2 deletions
diff --git a/commands/msg/copy.go b/commands/msg/copy.go index 3b3dd725..a68a22a2 100644 --- a/commands/msg/copy.go +++ b/commands/msg/copy.go @@ -59,6 +59,7 @@ func (Copy) Execute(aerc *widgets.Aerc, args []string) error { switch msg := msg.(type) { case *types.Done: aerc.PushStatus("Messages copied.", 10*time.Second) + store.ClearVisualMark() case *types.Error: aerc.PushError(msg.Error.Error()) } diff --git a/commands/msg/mark.go b/commands/msg/mark.go index d6beae46..c446fc62 100644 --- a/commands/msg/mark.go +++ b/commands/msg/mark.go @@ -14,7 +14,7 @@ func init() { } func (Mark) Aliases() []string { - return []string{"mark", "unmark"} + return []string{"mark", "unmark", "remark"} } func (Mark) Complete(aerc *widgets.Aerc, args []string) []string { @@ -93,6 +93,12 @@ func (Mark) Execute(aerc *widgets.Aerc, args []string) error { store.Unmark(selected.Uid) return nil } + case "remark": + if all || visual || toggle { + return fmt.Errorf("Usage: :remark") + } + store.Remark() + return nil } return nil // never reached } diff --git a/commands/msg/modify-labels.go b/commands/msg/modify-labels.go index ca3ccf7b..a3b49008 100644 --- a/commands/msg/modify-labels.go +++ b/commands/msg/modify-labels.go @@ -57,6 +57,7 @@ func (ModifyLabels) Execute(aerc *widgets.Aerc, args []string) error { switch msg := msg.(type) { case *types.Done: aerc.PushStatus("labels updated", 10*time.Second) + store.ClearVisualMark() case *types.Error: aerc.PushError(msg.Error.Error()) } diff --git a/commands/msg/pipe.go b/commands/msg/pipe.go index 06f2a4d2..b33254d7 100644 --- a/commands/msg/pipe.go +++ b/commands/msg/pipe.go @@ -197,7 +197,7 @@ func (Pipe) Execute(aerc *widgets.Aerc, args []string) error { } }) } - + provider.Store().ClearVisualMark() return nil } diff --git a/commands/msg/read.go b/commands/msg/read.go index 4f8880a8..c6bcd0df 100644 --- a/commands/msg/read.go +++ b/commands/msg/read.go @@ -175,6 +175,7 @@ func (FlagMsg) Execute(aerc *widgets.Aerc, args []string) error { wg.Wait() if success { aerc.PushStatus(actionName+" flag '"+flagName+"' successful", 10*time.Second) + store.ClearVisualMark() } }() diff --git a/doc/aerc.1.scd b/doc/aerc.1.scd index 0c071ea3..2c4fd31c 100644 --- a/doc/aerc.1.scd +++ b/doc/aerc.1.scd @@ -384,6 +384,10 @@ message list, the message in the message viewer, etc). *-t*: toggle the mark state instead of unmarking a message +*remark* + Re-select the last set of marked messages. Can be used to chain commands + after a selection has been acted upon + ## MESSAGE COMPOSE COMMANDS *abort* diff --git a/lib/msgstore.go b/lib/msgstore.go index 6774f59f..6ce17025 100644 --- a/lib/msgstore.go +++ b/lib/msgstore.go @@ -26,6 +26,7 @@ type MessageStore struct { //marking marked map[uint32]struct{} + lastMarked map[uint32]struct{} visualStartUid uint32 visualMarkMode bool @@ -558,6 +559,10 @@ func (store *MessageStore) Unmark(uid uint32) { delete(store.marked, uid) } +func (store *MessageStore) Remark() { + store.marked = store.lastMarked +} + // ToggleMark toggles the marked state on a MessageInfo func (store *MessageStore) ToggleMark(uid uint32) { if store.visualMarkMode { @@ -573,6 +578,7 @@ func (store *MessageStore) ToggleMark(uid uint32) { // resetMark removes the marking from all messages func (store *MessageStore) resetMark() { + store.lastMarked = store.marked store.marked = make(map[uint32]struct{}) } |