Config for deleting message from message viewer

As suggested in #268, this adds a behaviour setting for
deleting message from message viewer.
This commit is contained in:
Srivathsan Murali 2019-09-20 21:22:09 +02:00 committed by Drew DeVault
parent 043a02d99d
commit 1bedb8fe06
4 changed files with 37 additions and 25 deletions

View file

@ -47,7 +47,7 @@ func (Delete) Execute(aerc *widgets.Aerc, args []string) error {
store.Next() store.Next()
if isMsgView { if isMsgView {
nextMsg := store.Selected() nextMsg := store.Selected()
if nextMsg == msg { if nextMsg == msg || !aerc.Config().Ui.NextMessageOnDelete {
aerc.RemoveTab(widget) aerc.RemoveTab(widget)
acct.Messages().Scroll() acct.Messages().Scroll()
} else { } else {

View file

@ -57,6 +57,11 @@ dirlist-format=%n %>r
# Default: "" # Default: ""
sort= sort=
# Moves to next message when the current message is deleted
#
# Default: false
next-message-on-delete=true
[viewer] [viewer]
# #
# Specifies the pager to use when displaying emails. Note that some filters # Specifies the pager to use when displaying emails. Note that some filters

View file

@ -23,20 +23,21 @@ type GeneralConfig struct {
} }
type UIConfig struct { type UIConfig struct {
IndexFormat string `ini:"index-format"` IndexFormat string `ini:"index-format"`
TimestampFormat string `ini:"timestamp-format"` TimestampFormat string `ini:"timestamp-format"`
ShowHeaders []string `delim:","` ShowHeaders []string `delim:","`
RenderAccountTabs string `ini:"render-account-tabs"` RenderAccountTabs string `ini:"render-account-tabs"`
SidebarWidth int `ini:"sidebar-width"` SidebarWidth int `ini:"sidebar-width"`
PreviewHeight int `ini:"preview-height"` PreviewHeight int `ini:"preview-height"`
EmptyMessage string `ini:"empty-message"` EmptyMessage string `ini:"empty-message"`
EmptyDirlist string `ini:"empty-dirlist"` EmptyDirlist string `ini:"empty-dirlist"`
MouseEnabled bool `ini:"mouse-enabled"` MouseEnabled bool `ini:"mouse-enabled"`
NewMessageBell bool `ini:"new-message-bell"` NewMessageBell bool `ini:"new-message-bell"`
Spinner string `ini:"spinner"` Spinner string `ini:"spinner"`
SpinnerDelimiter string `ini:"spinner-delimiter"` SpinnerDelimiter string `ini:"spinner-delimiter"`
DirListFormat string `ini:"dirlist-format"` DirListFormat string `ini:"dirlist-format"`
Sort []string `delim:" "` Sort []string `delim:" "`
NextMessageOnDelete bool `ini:"next-message-on-delete"`
} }
const ( const (
@ -346,16 +347,17 @@ func LoadConfigFromFile(root *string, sharedir string) (*AercConfig, error) {
ShowHeaders: []string{ ShowHeaders: []string{
"From", "To", "Cc", "Bcc", "Subject", "Date", "From", "To", "Cc", "Bcc", "Subject", "Date",
}, },
RenderAccountTabs: "auto", RenderAccountTabs: "auto",
SidebarWidth: 20, SidebarWidth: 20,
PreviewHeight: 12, PreviewHeight: 12,
EmptyMessage: "(no messages)", EmptyMessage: "(no messages)",
EmptyDirlist: "(no folders)", EmptyDirlist: "(no folders)",
MouseEnabled: false, MouseEnabled: false,
NewMessageBell: true, NewMessageBell: true,
Spinner: "[..] , [..] , [..] , [..] , [..], [..] , [..] , [..] ", Spinner: "[..] , [..] , [..] , [..] , [..], [..] , [..] , [..] ",
SpinnerDelimiter: ",", SpinnerDelimiter: ",",
DirListFormat: "%n %>r", DirListFormat: "%n %>r",
NextMessageOnDelete: true,
}, },
Viewer: ViewerConfig{ Viewer: ViewerConfig{

View file

@ -150,6 +150,11 @@ These options are configured in the *[ui]* section of aerc.conf.
| %>X | %>X
: make format specifier 'X' be right justified : make format specifier 'X' be right justified
*next-message-on-delete*
Moves to next message when the current message is deleted
Default: true
## VIEWER ## VIEWER
These options are configured in the *[viewer]* section of aerc.conf. These options are configured in the *[viewer]* section of aerc.conf.