aboutsummaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
Diffstat (limited to 'commands')
-rw-r--r--commands/account/view.go19
-rw-r--r--commands/msg/archive.go2
-rw-r--r--commands/msg/delete.go2
-rw-r--r--commands/msgview/next.go2
4 files changed, 19 insertions, 6 deletions
diff --git a/commands/account/view.go b/commands/account/view.go
index be8b45e4..f30ac61b 100644
--- a/commands/account/view.go
+++ b/commands/account/view.go
@@ -5,6 +5,7 @@ import (
"git.sr.ht/~rjarry/aerc/lib"
"git.sr.ht/~rjarry/aerc/widgets"
+ "git.sr.ht/~sircmpwn/getopt"
)
type ViewMessage struct{}
@@ -22,8 +23,20 @@ func (ViewMessage) Complete(aerc *widgets.Aerc, args []string) []string {
}
func (ViewMessage) Execute(aerc *widgets.Aerc, args []string) error {
- if len(args) != 1 {
- return errors.New("Usage: view-message")
+ peek := false
+ opts, optind, err := getopt.Getopts(args, "p")
+ if err != nil {
+ return err
+ }
+
+ for _, opt := range opts {
+ if opt.Option == 'p' {
+ peek = true
+ }
+ }
+
+ if len(args) != optind {
+ return errors.New("Usage: view-message [-p]")
}
acct := aerc.SelectedAccount()
if acct == nil {
@@ -45,7 +58,7 @@ func (ViewMessage) Execute(aerc *widgets.Aerc, args []string) error {
aerc.PushError(msg.Error.Error())
return nil
}
- lib.NewMessageStoreView(msg, acct.UiConfig().AutoMarkRead,
+ lib.NewMessageStoreView(msg, !peek && acct.UiConfig().AutoMarkRead,
store, aerc.Crypto, aerc.DecryptKeys,
func(view lib.MessageView, err error) {
if err != nil {
diff --git a/commands/msg/archive.go b/commands/msg/archive.go
index 2935991c..d485fd3d 100644
--- a/commands/msg/archive.go
+++ b/commands/msg/archive.go
@@ -120,7 +120,7 @@ func (Archive) Execute(aerc *widgets.Aerc, args []string) error {
acct.Messages().Invalidate()
return
}
- lib.NewMessageStoreView(next, acct.UiConfig().AutoMarkRead,
+ lib.NewMessageStoreView(next, mv.MessageView().SeenFlagSet(),
store, aerc.Crypto, aerc.DecryptKeys,
func(view lib.MessageView, err error) {
if err != nil {
diff --git a/commands/msg/delete.go b/commands/msg/delete.go
index 57cef34d..a3d024a7 100644
--- a/commands/msg/delete.go
+++ b/commands/msg/delete.go
@@ -63,7 +63,7 @@ func (Delete) Execute(aerc *widgets.Aerc, args []string) error {
acct.Messages().Invalidate()
return
}
- lib.NewMessageStoreView(next, acct.UiConfig().AutoMarkRead,
+ lib.NewMessageStoreView(next, mv.MessageView().SeenFlagSet(),
store, aerc.Crypto, aerc.DecryptKeys,
func(view lib.MessageView, err error) {
if err != nil {
diff --git a/commands/msgview/next.go b/commands/msgview/next.go
index b9e5dbda..6341f931 100644
--- a/commands/msgview/next.go
+++ b/commands/msgview/next.go
@@ -42,7 +42,7 @@ func (NextPrevMsg) Execute(aerc *widgets.Aerc, args []string) error {
aerc.RemoveTab(mv)
return nil
}
- lib.NewMessageStoreView(nextMsg, acct.UiConfig().AutoMarkRead,
+ lib.NewMessageStoreView(nextMsg, mv.MessageView().SeenFlagSet(),
store, aerc.Crypto, aerc.DecryptKeys,
func(view lib.MessageView, err error) {
if err != nil {