aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorinwit <inwit@sindominio.net>2023-11-07 18:28:56 +0100
committerRobin Jarry <robin@jarry.cc>2023-11-12 12:53:11 +0100
commit2d589766d03ae7ccbd9a360e51e246e35afe394a (patch)
tree1f37381d2196b8872ca95fda643cf6ab53ded582
parentc13df799763c6b584cf4963e125361bb16c0e07d (diff)
downloadaerc-2d589766d03ae7ccbd9a360e51e246e35afe394a.tar.gz
ui: correct some push status messages
Upon success, commands :delete, :copy, :archive and :move show "Messages deleted/copied/archived/moved" in the status bar, which is obviously wrong if they are acting upon only one message. Make the success notification for those commands explicitly agree with the actual number of messages. Signed-Off-By: inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
-rw-r--r--commands/msg/archive.go8
-rw-r--r--commands/msg/copy.go9
-rw-r--r--commands/msg/delete.go9
-rw-r--r--commands/msg/move.go9
4 files changed, 31 insertions, 4 deletions
diff --git a/commands/msg/archive.go b/commands/msg/archive.go
index 5c97e2da..a46cc986 100644
--- a/commands/msg/archive.go
+++ b/commands/msg/archive.go
@@ -126,7 +126,13 @@ func archive(msgs []*models.MessageInfo, archiveType string) error {
wg.Wait()
if success {
- handleDone(acct, next, "Messages archived.", store)
+ var s string
+ if len(uids) > 1 {
+ s = "%d messages archived to %s"
+ } else {
+ s = "%d message archived to %s"
+ }
+ handleDone(acct, next, fmt.Sprintf(s, len(uids), archiveDir), store)
}
}()
return nil
diff --git a/commands/msg/copy.go b/commands/msg/copy.go
index 77c9ade1..f91d885b 100644
--- a/commands/msg/copy.go
+++ b/commands/msg/copy.go
@@ -1,6 +1,7 @@
package msg
import (
+ "fmt"
"time"
"git.sr.ht/~rjarry/aerc/app"
@@ -41,7 +42,13 @@ func (c Copy) Execute(args []string) error {
) {
switch msg := msg.(type) {
case *types.Done:
- app.PushStatus("Messages copied.", 10*time.Second)
+ var s string
+ if len(uids) > 1 {
+ s = "%d messages copied to %s"
+ } else {
+ s = "%d message copied to %s"
+ }
+ app.PushStatus(fmt.Sprintf(s, len(uids), c.Folder), 10*time.Second)
store.Marker().ClearVisualMark()
case *types.Error:
app.PushError(msg.Error.Error())
diff --git a/commands/msg/delete.go b/commands/msg/delete.go
index 1a1a130c..869c6888 100644
--- a/commands/msg/delete.go
+++ b/commands/msg/delete.go
@@ -1,6 +1,7 @@
package msg
import (
+ "fmt"
"time"
"git.sr.ht/~rjarry/aerc/app"
@@ -43,7 +44,13 @@ func (Delete) Execute(args []string) error {
store.Delete(uids, func(msg types.WorkerMessage) {
switch msg := msg.(type) {
case *types.Done:
- app.PushStatus("Messages deleted.", 10*time.Second)
+ var s string
+ if len(uids) > 1 {
+ s = "%d messages deleted"
+ } else {
+ s = "%d message deleted"
+ }
+ app.PushStatus(fmt.Sprintf(s, len(uids)), 10*time.Second)
mv, isMsgView := h.msgProvider.(*app.MessageViewer)
if isMsgView {
if !config.Ui.NextMessageOnDelete {
diff --git a/commands/msg/move.go b/commands/msg/move.go
index 06c7fc15..4eac1c14 100644
--- a/commands/msg/move.go
+++ b/commands/msg/move.go
@@ -1,6 +1,7 @@
package msg
import (
+ "fmt"
"time"
"git.sr.ht/~rjarry/aerc/app"
@@ -56,7 +57,13 @@ func (m Move) Execute(args []string) error {
) {
switch msg := msg.(type) {
case *types.Done:
- handleDone(acct, next, "Messages moved to "+m.Folder, store)
+ var s string
+ if len(uids) > 1 {
+ s = "%d messages moved to %s"
+ } else {
+ s = "%d message moved to %s"
+ }
+ handleDone(acct, next, fmt.Sprintf(s, len(uids), m.Folder), store)
case *types.Error:
app.PushError(msg.Error.Error())
marker.Remark()