aboutsummaryrefslogtreecommitdiffstats
path: root/commands
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 /commands
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 'commands')
-rw-r--r--commands/msg/copy.go1
-rw-r--r--commands/msg/mark.go8
-rw-r--r--commands/msg/modify-labels.go1
-rw-r--r--commands/msg/pipe.go2
-rw-r--r--commands/msg/read.go1
5 files changed, 11 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()
}
}()