aerc/commands/help.go
Tim Culverhouse ee964ad6b0 command/help: remove helpClose function
The helpClose function is used to call UpdateScreen on MessageViewer,
which has the effect of invalidating and redrawing the message view.
This logic is redundant with the addition of tcell-term and the main
event loop.

Remove the helpClose calls. Remove the UpdateScreen methods from
messageviewer: those functions are only used by the helpClose function.

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Koni Marti <koni.marti@gmail.com>
2022-10-19 21:01:55 +02:00

62 lines
1.1 KiB
Go

package commands
import (
"errors"
"git.sr.ht/~rjarry/aerc/widgets"
)
type Help struct{}
var pages = []string{
"aerc",
"config",
"imap",
"notmuch",
"search",
"sendmail",
"smtp",
"stylesets",
"templates",
"tutorial",
"keys",
}
func init() {
register(Help{})
}
func (Help) Aliases() []string {
return []string{"help"}
}
func (Help) Complete(aerc *widgets.Aerc, args []string) []string {
return CompletionFromList(aerc, pages, args)
}
func (Help) Execute(aerc *widgets.Aerc, args []string) error {
page := "aerc"
if len(args) == 2 && args[1] != "aerc" {
page = "aerc-" + args[1]
} else if len(args) > 2 {
return errors.New("Usage: help [topic]")
}
if page == "aerc-keys" {
aerc.AddDialog(widgets.NewDialog(
widgets.NewListBox(
"Bindings: Press <Esc> or <Enter> to close. "+
"Start typing to filter bindings.",
aerc.HumanReadableBindings(),
aerc.SelectedAccountUiConfig(),
func(_ string) {
aerc.CloseDialog()
},
),
func(h int) int { return h / 4 },
func(h int) int { return h / 2 },
))
}
return TermCore(aerc, []string{"term", "man", page})
}