summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2022-07-18 12:54:55 +0200
committerRobin Jarry <robin@jarry.cc>2022-07-23 22:00:21 +0200
commitc841f36513ffdaffbf4b68e5f108c97a45745092 (patch)
treee339d287ba01f8a4b1e99c721d841015bb729317
parentc49a065496ed232399b31506031711d4c1f802e0 (diff)
downloadaerc-c841f36513ffdaffbf4b68e5f108c97a45745092.zip
tabs: rename SelectedTab to SelectedTabContent
This function returns an ui.Drawable. Use a more explicit name. This prepares for adding a new SelectedTab function which will return an ui.Tab. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Koni Marti <koni.marti@gmail.com>
-rw-r--r--aerc.go4
-rw-r--r--commands/compose/abort.go2
-rw-r--r--commands/compose/attach-key.go2
-rw-r--r--commands/compose/attach.go2
-rw-r--r--commands/compose/cc-bcc.go2
-rw-r--r--commands/compose/detach.go4
-rw-r--r--commands/compose/edit.go2
-rw-r--r--commands/compose/encrypt.go2
-rw-r--r--commands/compose/header.go2
-rw-r--r--commands/compose/next-field.go2
-rw-r--r--commands/compose/postpone.go2
-rw-r--r--commands/compose/send.go2
-rw-r--r--commands/compose/sign.go2
-rw-r--r--commands/exec.go2
-rw-r--r--commands/msg/forward.go2
-rw-r--r--commands/msg/pipe.go2
-rw-r--r--commands/msg/recall.go2
-rw-r--r--commands/msg/reply.go2
-rw-r--r--commands/msg/unsubscribe.go4
-rw-r--r--commands/msg/utils.go2
-rw-r--r--commands/msgview/close.go2
-rw-r--r--commands/msgview/next-part.go2
-rw-r--r--commands/msgview/next.go2
-rw-r--r--commands/msgview/open.go4
-rw-r--r--commands/msgview/save.go4
-rw-r--r--commands/msgview/toggle-headers.go2
-rw-r--r--commands/msgview/toggle-key-passthrough.go2
-rw-r--r--commands/terminal/close.go2
-rw-r--r--widgets/aerc.go6
29 files changed, 36 insertions, 36 deletions
diff --git a/aerc.go b/aerc.go
index 6144e53..d43ed93 100644
--- a/aerc.go
+++ b/aerc.go
@@ -59,7 +59,7 @@ func getCommands(selected libui.Drawable) []*commands.Commands {
}
func execCommand(aerc *widgets.Aerc, ui *libui.UI, cmd []string) error {
- cmds := getCommands(aerc.SelectedTab())
+ cmds := getCommands(aerc.SelectedTabContent())
for i, set := range cmds {
err := set.ExecuteCommand(aerc, cmd)
if _, ok := err.(commands.NoSuchCommand); ok {
@@ -81,7 +81,7 @@ func execCommand(aerc *widgets.Aerc, ui *libui.UI, cmd []string) error {
func getCompletions(aerc *widgets.Aerc, cmd string) []string {
var completions []string
- for _, set := range getCommands(aerc.SelectedTab()) {
+ for _, set := range getCommands(aerc.SelectedTabContent()) {
completions = append(completions, set.GetCompletions(aerc, cmd)...)
}
sort.Strings(completions)
diff --git a/commands/compose/abort.go b/commands/compose/abort.go
index d4a4699..44711eb 100644
--- a/commands/compose/abort.go
+++ b/commands/compose/abort.go
@@ -24,7 +24,7 @@ func (Abort) Execute(aerc *widgets.Aerc, args []string) error {
if len(args) != 1 {
return errors.New("Usage: abort")
}
- composer, _ := aerc.SelectedTab().(*widgets.Composer)
+ composer, _ := aerc.SelectedTabContent().(*widgets.Composer)
aerc.RemoveTab(composer)
composer.Close()
diff --git a/commands/compose/attach-key.go b/commands/compose/attach-key.go
index c9212e3..208e9fd 100644
--- a/commands/compose/attach-key.go
+++ b/commands/compose/attach-key.go
@@ -25,7 +25,7 @@ func (AttachKey) Execute(aerc *widgets.Aerc, args []string) error {
return errors.New("Usage: attach-key")
}
- composer, _ := aerc.SelectedTab().(*widgets.Composer)
+ composer, _ := aerc.SelectedTabContent().(*widgets.Composer)
return composer.SetAttachKey(!composer.AttachKey())
}
diff --git a/commands/compose/attach.go b/commands/compose/attach.go
index 50abda5..6080973 100644
--- a/commands/compose/attach.go
+++ b/commands/compose/attach.go
@@ -47,7 +47,7 @@ func (Attach) Execute(aerc *widgets.Aerc, args []string) error {
return nil
}
- composer, _ := aerc.SelectedTab().(*widgets.Composer)
+ composer, _ := aerc.SelectedTabContent().(*widgets.Composer)
composer.AddAttachment(path)
aerc.PushSuccess(fmt.Sprintf("Attached %s", pathinfo.Name()))
diff --git a/commands/compose/cc-bcc.go b/commands/compose/cc-bcc.go
index 5540f83..17e925e 100644
--- a/commands/compose/cc-bcc.go
+++ b/commands/compose/cc-bcc.go
@@ -25,7 +25,7 @@ func (CC) Execute(aerc *widgets.Aerc, args []string) error {
if len(args) > 1 {
addrs = strings.Join(args[1:], " ")
}
- composer, _ := aerc.SelectedTab().(*widgets.Composer)
+ composer, _ := aerc.SelectedTabContent().(*widgets.Composer)
switch args[0] {
case "cc":
diff --git a/commands/compose/detach.go b/commands/compose/detach.go
index 31ac082..487bf22 100644
--- a/commands/compose/detach.go
+++ b/commands/compose/detach.go
@@ -18,13 +18,13 @@ func (Detach) Aliases() []string {
}
func (Detach) Complete(aerc *widgets.Aerc, args []string) []string {
- composer, _ := aerc.SelectedTab().(*widgets.Composer)
+ composer, _ := aerc.SelectedTabContent().(*widgets.Composer)
return composer.GetAttachments()
}
func (Detach) Execute(aerc *widgets.Aerc, args []string) error {
var path string
- composer, _ := aerc.SelectedTab().(*widgets.Composer)
+ composer, _ := aerc.SelectedTabContent().(*widgets.Composer)
if len(args) > 1 {
path = strings.Join(args[1:], " ")
diff --git a/commands/compose/edit.go b/commands/compose/edit.go
index 375f361..7a61f77 100644
--- a/commands/compose/edit.go
+++ b/commands/compose/edit.go
@@ -24,7 +24,7 @@ func (Edit) Execute(aerc *widgets.Aerc, args []string) error {
if len(args) != 1 {
return errors.New("Usage: edit")
}
- composer, _ := aerc.SelectedTab().(*widgets.Composer)
+ composer, _ := aerc.SelectedTabContent().(*widgets.Composer)
composer.ShowTerminal()
composer.FocusTerminal()
return nil
diff --git a/commands/compose/encrypt.go b/commands/compose/encrypt.go
index 3bd8ca4..905bdc4 100644
--- a/commands/compose/encrypt.go
+++ b/commands/compose/encrypt.go
@@ -25,7 +25,7 @@ func (Encrypt) Execute(aerc *widgets.Aerc, args []string) error {
return errors.New("Usage: encrypt")
}
- composer, _ := aerc.SelectedTab().(*widgets.Composer)
+ composer, _ := aerc.SelectedTabContent().(*widgets.Composer)
composer.SetEncrypt(!composer.Encrypt())
return nil
diff --git a/commands/compose/header.go b/commands/compose/header.go
index fc0a81b..ca5c869 100644
--- a/commands/compose/header.go
+++ b/commands/compose/header.go
@@ -60,7 +60,7 @@ func (Header) Execute(aerc *widgets.Aerc, args []string) error {
}
}
- composer, _ := aerc.SelectedTab().(*widgets.Composer)
+ composer, _ := aerc.SelectedTabContent().(*widgets.Composer)
args[optind] = strings.TrimRight(args[optind], ":")
diff --git a/commands/compose/next-field.go b/commands/compose/next-field.go
index 69b33e5..ec4db58 100644
--- a/commands/compose/next-field.go
+++ b/commands/compose/next-field.go
@@ -24,7 +24,7 @@ func (NextPrevField) Execute(aerc *widgets.Aerc, args []string) error {
if len(args) > 2 {
return nextPrevFieldUsage(args[0])
}
- composer, _ := aerc.SelectedTab().(*widgets.Composer)
+ composer, _ := aerc.SelectedTabContent().(*widgets.Composer)
if args[0] == "prev-field" {
composer.PrevField()
} else {
diff --git a/commands/compose/postpone.go b/commands/compose/postpone.go
index f826f68..e1c0568 100644
--- a/commands/compose/postpone.go
+++ b/commands/compose/postpone.go
@@ -35,7 +35,7 @@ func (Postpone) Execute(aerc *widgets.Aerc, args []string) error {
if acct == nil {
return errors.New("No account selected")
}
- composer, _ := aerc.SelectedTab().(*widgets.Composer)
+ composer, _ := aerc.SelectedTabContent().(*widgets.Composer)
config := composer.Config()
tabName := aerc.TabNames()[aerc.SelectedTabIndex()]
diff --git a/commands/compose/send.go b/commands/compose/send.go
index dd3a8d3..776779e 100644
--- a/commands/compose/send.go
+++ b/commands/compose/send.go
@@ -43,7 +43,7 @@ func (Send) Execute(aerc *widgets.Aerc, args []string) error {
if len(args) > 1 {
return errors.New("Usage: send")
}
- composer, _ := aerc.SelectedTab().(*widgets.Composer)
+ composer, _ := aerc.SelectedTabContent().(*widgets.Composer)
tabName := aerc.TabNames()[aerc.SelectedTabIndex()]
config := composer.Config()
diff --git a/commands/compose/sign.go b/commands/compose/sign.go
index 635b07c..e6afd98 100644
--- a/commands/compose/sign.go
+++ b/commands/compose/sign.go
@@ -26,7 +26,7 @@ func (Sign) Execute(aerc *widgets.Aerc, args []string) error {
return errors.New("Usage: sign")
}
- composer, _ := aerc.SelectedTab().(*widgets.Composer)
+ composer, _ := aerc.SelectedTabContent().(*widgets.Composer)
err := composer.SetSign(!composer.Sign())
if err != nil {
diff --git a/commands/exec.go b/commands/exec.go
index bce62bd..8757a51 100644
--- a/commands/exec.go
+++ b/commands/exec.go
@@ -33,7 +33,7 @@ func (ExecCmd) Execute(aerc *widgets.Aerc, args []string) error {
cmd := exec.Command(args[1], args[2:]...)
env := os.Environ()
- switch view := aerc.SelectedTab().(type) {
+ switch view := aerc.SelectedTabContent().(type) {
case *widgets.AccountView:
env = append(env, fmt.Sprintf("account=%s", view.AccountConfig().Name))
env = append(env, fmt.Sprintf("folder=%s", view.Directories().Selected()))
diff --git a/commands/msg/forward.go b/commands/msg/forward.go
index 8fc34aa..ad80fea 100644
--- a/commands/msg/forward.go
+++ b/commands/msg/forward.go
@@ -60,7 +60,7 @@ func (forward) Execute(aerc *widgets.Aerc, args []string) error {
return errors.New("Options -A and -F are mutually exclusive")
}
- widget := aerc.SelectedTab().(widgets.ProvidesMessage)
+ widget := aerc.SelectedTabContent().(widgets.ProvidesMessage)
acct := widget.SelectedAccount()
if acct == nil {
return errors.New("No account selected")
diff --git a/commands/msg/pipe.go b/commands/msg/pipe.go
index cab109e..35ee05b 100644
--- a/commands/msg/pipe.go
+++ b/commands/msg/pipe.go
@@ -63,7 +63,7 @@ func (Pipe) Execute(aerc *widgets.Aerc, args []string) error {
return errors.New("Usage: pipe [-mp] <cmd> [args...]")
}
- provider := aerc.SelectedTab().(widgets.ProvidesMessage)
+ provider := aerc.SelectedTabContent().(widgets.ProvidesMessage)
if !pipeFull && !pipePart {
if _, ok := provider.(*widgets.MessageViewer); ok {
pipePart = true
diff --git a/commands/msg/recall.go b/commands/msg/recall.go
index b59372a..3c9f0f2 100644
--- a/commands/msg/recall.go
+++ b/commands/msg/recall.go
@@ -51,7 +51,7 @@ func (Recall) Execute(aerc *widgets.Aerc, args []string) error {
return errors.New("Usage: recall [-f]")
}
- widget := aerc.SelectedTab().(widgets.ProvidesMessage)
+ widget := aerc.SelectedTabContent().(widgets.ProvidesMessage)
acct := widget.SelectedAccount()
if acct == nil {
return errors.New("No account selected")
diff --git a/commands/msg/reply.go b/commands/msg/reply.go
index 30b09b6..a1254a1 100644
--- a/commands/msg/reply.go
+++ b/commands/msg/reply.go
@@ -55,7 +55,7 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error {
}
}
- widget := aerc.SelectedTab().(widgets.ProvidesMessage)
+ widget := aerc.SelectedTabContent().(widgets.ProvidesMessage)
acct := widget.SelectedAccount()
if acct == nil {
diff --git a/commands/msg/unsubscribe.go b/commands/msg/unsubscribe.go
index ed6ad4f..126a23d 100644
--- a/commands/msg/unsubscribe.go
+++ b/commands/msg/unsubscribe.go
@@ -37,7 +37,7 @@ func (Unsubscribe) Execute(aerc *widgets.Aerc, args []string) error {
if len(args) != 1 {
return errors.New("Usage: unsubscribe")
}
- widget := aerc.SelectedTab().(widgets.ProvidesMessage)
+ widget := aerc.SelectedTabContent().(widgets.ProvidesMessage)
msg, err := widget.SelectedMessage()
if err != nil {
return err
@@ -135,7 +135,7 @@ func parseUnsubscribeMethods(header string) (methods []*url.URL) {
}
func unsubscribeMailto(aerc *widgets.Aerc, u *url.URL) error {
- widget := aerc.SelectedTab().(widgets.ProvidesMessage)
+ widget := aerc.SelectedTabContent().(widgets.ProvidesMessage)
acct := widget.SelectedAccount()
if acct == nil {
return errors.New("No account selected")
diff --git a/commands/msg/utils.go b/commands/msg/utils.go
index 212fc75..4ce82a7 100644
--- a/commands/msg/utils.go
+++ b/commands/msg/utils.go
@@ -14,7 +14,7 @@ type helper struct {
}
func newHelper(aerc *widgets.Aerc) *helper {
- return &helper{aerc.SelectedTab().(widgets.ProvidesMessages)}
+ return &helper{aerc.SelectedTabContent().(widgets.ProvidesMessages)}
}
func (h *helper) markedOrSelectedUids() ([]uint32, error) {
diff --git a/commands/msgview/close.go b/commands/msgview/close.go
index 37f66ad..1fed0b7 100644
--- a/commands/msgview/close.go
+++ b/commands/msgview/close.go
@@ -24,7 +24,7 @@ func (Close) Execute(aerc *widgets.Aerc, args []string) error {
if len(args) != 1 {
return errors.New("Usage: close")
}
- mv, _ := aerc.SelectedTab().(*widgets.MessageViewer)
+ mv, _ := aerc.SelectedTabContent().(*widgets.MessageViewer)
mv.Close()
aerc.RemoveTab(mv)
return nil
diff --git a/commands/msgview/next-part.go b/commands/msgview/next-part.go
index f44ffab..652dccb 100644
--- a/commands/msgview/next-part.go
+++ b/commands/msgview/next-part.go
@@ -35,7 +35,7 @@ func (NextPrevPart) Execute(aerc *widgets.Aerc, args []string) error {
return nextPrevPartUsage(args[0])
}
}
- mv, _ := aerc.SelectedTab().(*widgets.MessageViewer)
+ mv, _ := aerc.SelectedTabContent().(*widgets.MessageViewer)
for ; n > 0; n-- {
if args[0] == "prev-part" {
mv.PreviousPart()
diff --git a/commands/msgview/next.go b/commands/msgview/next.go
index 928b9fb..c80e0ab 100644
--- a/commands/msgview/next.go
+++ b/commands/msgview/next.go
@@ -27,7 +27,7 @@ func (NextPrevMsg) Execute(aerc *widgets.Aerc, args []string) error {
if err != nil {
return err
}
- mv, _ := aerc.SelectedTab().(*widgets.MessageViewer)
+ mv, _ := aerc.SelectedTabContent().(*widgets.MessageViewer)
acct := mv.SelectedAccount()
if acct == nil {
return errors.New("No account selected")
diff --git a/commands/msgview/open.go b/commands/msgview/open.go
index 7615e9a..05a3c63 100644
--- a/commands/msgview/open.go
+++ b/commands/msgview/open.go
@@ -25,7 +25,7 @@ func (Open) Aliases() []string {
}
func (Open) Complete(aerc *widgets.Aerc, args []string) []string {
- mv := aerc.SelectedTab().(*widgets.MessageViewer)
+ mv := aerc.SelectedTabContent().(*widgets.MessageViewer)
if mv != nil {
if p := mv.SelectedMessagePart(); p != nil {
return commands.CompletionFromList(aerc, p.Links, args)
@@ -35,7 +35,7 @@ func (Open) Complete(aerc *widgets.Aerc, args []string) []string {
}
func (Open) Execute(aerc *widgets.Aerc, args []string) error {
- mv := aerc.SelectedTab().(*widgets.MessageViewer)
+ mv := aerc.SelectedTabContent().(*widgets.MessageViewer)
p := mv.SelectedMessagePart()
if args[0] == "open-link" && len(args) > 1 {
diff --git a/commands/msgview/save.go b/commands/msgview/save.go
index 8aedd42..f27a68c 100644
--- a/commands/msgview/save.go
+++ b/commands/msgview/save.go
@@ -99,9 +99,9 @@ func (Save) Execute(aerc *widgets.Aerc, args []string) error {
return err
}
- mv, ok := aerc.SelectedTab().(*widgets.MessageViewer)
+ mv, ok := aerc.SelectedTabContent().(*widgets.MessageViewer)
if !ok {
- return fmt.Errorf("SelectedTab is not a MessageViewer")
+ return fmt.Errorf("SelectedTabContent is not a MessageViewer")
}
if params.attachments {
diff --git a/commands/msgview/toggle-headers.go b/commands/msgview/toggle-headers.go
index 75f7e46..1a59349 100644
--- a/commands/msgview/toggle-headers.go
+++ b/commands/msgview/toggle-headers.go
@@ -24,7 +24,7 @@ func (ToggleHeaders) Execute(aerc *widgets.Aerc, args []string) error {
if len(args) > 1 {
return toggleHeadersUsage(args[0])
}
- mv, _ := aerc.SelectedTab().(*widgets.MessageViewer)
+ mv, _ := aerc.SelectedTabContent().(*widgets.MessageViewer)
mv.ToggleHeaders()
return nil
}
diff --git a/commands/msgview/toggle-key-passthrough.go b/commands/msgview/toggle-key-passthrough.go
index 1ac370e..cbc4565 100644
--- a/commands/msgview/toggle-key-passthrough.go
+++ b/commands/msgview/toggle-key-passthrough.go
@@ -25,7 +25,7 @@ func (ToggleKeyPassthrough) Execute(aerc *widgets.Aerc, args []string) error {
if len(args) != 1 {
return errors.New("Usage: toggle-key-passthrough")
}
- mv, _ := aerc.SelectedTab().(*widgets.MessageViewer)
+ mv, _ := aerc.SelectedTabContent().(*widgets.MessageViewer)
keyPassthroughEnabled := mv.ToggleKeyPassthrough()
if acct := mv.SelectedAccount(); acct != nil {
acct.SetStatus(statusline.Passthrough(keyPassthroughEnabled))
diff --git a/commands/terminal/close.go b/commands/terminal/close.go
index 95ee94c..1698e93 100644
--- a/commands/terminal/close.go
+++ b/commands/terminal/close.go
@@ -24,7 +24,7 @@ func (Close) Execute(aerc *widgets.Aerc, args []string) error {
if len(args) != 1 {
return errors.New("Usage: close")
}
- term, _ := aerc.SelectedTab().(*widgets.Terminal)
+ term, _ := aerc.SelectedTabContent().(*widgets.Terminal)
term.Close(nil)
return nil
}
diff --git a/widgets/aerc.go b/widgets/aerc.go
index 5895646..f480b34 100644
--- a/widgets/aerc.go
+++ b/widgets/aerc.go
@@ -192,7 +192,7 @@ func (aerc *Aerc) getBindings() *config.KeyBindings {
if aerc.SelectedAccount() != nil {
selectedAccountName = aerc.SelectedAccount().acct.Name
}
- switch view := aerc.SelectedTab().(type) {
+ switch view := aerc.SelectedTabContent().(type) {
case *AccountView:
binds := aerc.conf.MergeContextualBinds(aerc.conf.Bindings.MessageList, config.BIND_CONTEXT_ACCOUNT, selectedAccountName, "messages")
return aerc.conf.MergeContextualBinds(binds, config.BIND_CONTEXT_FOLDER, view.SelectedDirectory(), "messages")
@@ -310,7 +310,7 @@ func (aerc *Aerc) Logger() *log.Logger {
}
func (aerc *Aerc) SelectedAccount() *AccountView {
- return aerc.account(aerc.SelectedTab())
+ return aerc.account(aerc.SelectedTabContent())
}
func (aerc *Aerc) account(d ui.Drawable) *AccountView {
@@ -333,7 +333,7 @@ func (aerc *Aerc) SelectedAccountUiConfig() *config.UIConfig {
return acct.UiConfig()
}
-func (aerc *Aerc) SelectedTab() ui.Drawable {
+func (aerc *Aerc) SelectedTabContent() ui.Drawable {
if aerc.NumTabs() == 0 || aerc.SelectedTabIndex() >= aerc.NumTabs() {
return nil
}