| 1 |
package msgview |
| 2 |
|
| 3 |
import ( |
| 4 |
"git.sr.ht/~rjarry/aerc/app" |
| 5 |
"git.sr.ht/~rjarry/aerc/commands" |
| 6 |
) |
| 7 |
|
| 8 |
type NextPrevPart struct { |
| 9 |
Offset int `opt:"n" minus:"true" default:"1"` |
| 10 |
} |
| 11 |
|
| 12 |
func init() { |
| 13 |
commands.Register(NextPrevPart{}) |
| 14 |
} |
| 15 |
|
| 16 |
func (NextPrevPart) Description() string { |
| 17 |
return "Cycle between message parts being shown." |
| 18 |
} |
| 19 |
|
| 20 |
func (NextPrevPart) Context() commands.CommandContext { |
| 21 |
return commands.MESSAGE_VIEWER |
| 22 |
} |
| 23 |
|
| 24 |
func (NextPrevPart) Aliases() []string { |
| 25 |
return []string{"next-part", "prev-part"} |
| 26 |
} |
| 27 |
|
| 28 |
func (np NextPrevPart) Execute(args []string) error { |
| 29 |
mv, _ := app.SelectedTabContent().(*app.MessageViewer) |
| 30 |
for n := 0; n < np.Offset; n++ { |
| 31 |
if args[0] == "prev-part" { |
| 32 |
mv.PreviousPart() |
| 33 |
} else { |
| 34 |
mv.NextPart() |
| 35 |
} |
| 36 |
} |
| 37 |
return nil |
| 38 |
} |