aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2022-06-10 17:24:12 -0500
committerRobin Jarry <robin@jarry.cc>2022-06-14 22:12:42 +0200
commit4753cfd3e33f985ec22c5600a8d7e68b72175607 (patch)
tree3fd0cc2260257ddcc0e45264be66c207a6732a15 /lib
parentaf0e5879765f3a54b13dc89fdbc1cd6722607bee (diff)
downloadaerc-4753cfd3e33f985ec22c5600a8d7e68b72175607.tar.gz
visual-mode: deselect messages after performing command
In order to better align to vim functionality: deselect visual mode selections after performing a command on the selection. This patch also introduces a new command to allow for re-selecting (remarking) the previous selection set so that commands can be chained together. The deselection only applies to msg commands that *do not* move the message from the store (those types of commands already deselect): - read/unread - flag/unflag - modify-labels - copy - pipe Previous usage to mark several messages as read and deselect all: Vjjj:read<Enter>:unmark -a<Enter> New usage, similar to vim: Vjjj:read<Enter> To chain a command together: Vjjj:read<Enter>:remark<Enter>{next command}<Enter> Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'lib')
-rw-r--r--lib/msgstore.go6
1 files changed, 6 insertions, 0 deletions
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{})
}