aboutsummaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
Diffstat (limited to 'commands')
-rw-r--r--commands/compose/send.go2
-rw-r--r--commands/msg/delete.go15
-rw-r--r--commands/msg/reply.go2
-rw-r--r--commands/msgview/open.go2
-rw-r--r--commands/msgview/save.go6
5 files changed, 12 insertions, 15 deletions
diff --git a/commands/compose/send.go b/commands/compose/send.go
index 12bf155c..dbdb94f9 100644
--- a/commands/compose/send.go
+++ b/commands/compose/send.go
@@ -189,7 +189,7 @@ func newSendmailSender(ctx sendCtx) (io.WriteCloser, error) {
return nil, fmt.Errorf("no command specified")
}
bin := args[0]
- rs := make([]string, len(ctx.rcpts), len(ctx.rcpts))
+ rs := make([]string, len(ctx.rcpts))
for i := range ctx.rcpts {
rs[i] = ctx.rcpts[i].Address
}
diff --git a/commands/msg/delete.go b/commands/msg/delete.go
index 34eac72f..5eb622de 100644
--- a/commands/msg/delete.go
+++ b/commands/msg/delete.go
@@ -88,15 +88,14 @@ func findNextNonDeleted(deleted []uint32, store *lib.MessageStore) *models.Messa
if !contains(deleted, selected.Uid) {
return selected
}
- for {
- store.Next()
- next := store.Selected()
- if next == selected || next == nil {
- // the last message is in the deleted state or doesn't exist
- return nil
- }
- return next
+
+ store.Next()
+ next := store.Selected()
+ if next == selected || next == nil {
+ // the last message is in the deleted state or doesn't exist
+ return nil
}
+ return next
}
func contains(uids []uint32, uid uint32) bool {
diff --git a/commands/msg/reply.go b/commands/msg/reply.go
index c3ab202c..30b09b62 100644
--- a/commands/msg/reply.go
+++ b/commands/msg/reply.go
@@ -122,7 +122,7 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error {
}
}
if len(to) == 0 {
- to = append(msg.Envelope.To)
+ to = msg.Envelope.To
}
}
diff --git a/commands/msgview/open.go b/commands/msgview/open.go
index bcfe2b48..5b199120 100644
--- a/commands/msgview/open.go
+++ b/commands/msgview/open.go
@@ -37,7 +37,7 @@ func (Open) Execute(aerc *widgets.Aerc, args []string) error {
if part, err := p.Msg.BodyStructure.PartAtIndex(p.Index); err == nil {
mimeType := fmt.Sprintf("%s/%s", part.MIMEType, part.MIMESubType)
- if exts, _ := mime.ExtensionsByType(mimeType); exts != nil && len(exts) > 0 {
+ if exts, _ := mime.ExtensionsByType(mimeType); len(exts) > 0 {
extension = exts[0]
}
}
diff --git a/commands/msgview/save.go b/commands/msgview/save.go
index 713c6d11..26a6bf2e 100644
--- a/commands/msgview/save.go
+++ b/commands/msgview/save.go
@@ -151,10 +151,8 @@ func isDirExists(path string) bool {
//pathExists returns true if path exists
func pathExists(path string) bool {
_, err := os.Stat(path)
- if err != nil {
- return false // we don't really care why it failed
- }
- return true
+
+ return err == nil
}
//isAbsPath returns true if path given is anchored to / or . or ~