aerc

Working clone of aerc-mail.org
git clone git://git.danielmoch.com/aerc.git
Log | Files | Refs | README | LICENSE

commit 71c13c907873d603bf15d68ab0372b75b271d18d
parent 72e4b5e2b2e0de50b8572f195f73ccdd8e9d9461
Author: Drew DeVault <sir@cmpwn.com>
Date:   Sat, 11 May 2019 14:15:29 -0400

"Press any key to close" for completed processes

Diffstat:
Mcommands/account/pipe.go | 5++++-
Mwidgets/terminal.go | 6++++++
2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/commands/account/pipe.go b/commands/account/pipe.go @@ -44,9 +44,12 @@ func Pipe(aerc *widgets.Aerc, args []string) error { aerc.PushStatus(" "+err.Error(), 10*time.Second). Color(tcell.ColorDefault, tcell.ColorRed) } else { - // TODO: Tab-specific status stacks aerc.PushStatus("Process complete, press any key to close.", 10*time.Second) + term.OnEvent = func(event tcell.Event) bool { + aerc.RemoveTab(term) + return true + } } } term.OnStart = func() { diff --git a/widgets/terminal.go b/widgets/terminal.go @@ -104,6 +104,7 @@ type Terminal struct { vterm *vterm.VTerm OnClose func(err error) + OnEvent func(event tcell.Event) bool OnStart func() OnTitle func(title string) } @@ -354,6 +355,11 @@ func convertMods(mods tcell.ModMask) vterm.Modifier { } func (term *Terminal) Event(event tcell.Event) bool { + if term.OnEvent != nil { + if term.OnEvent(event) { + return true + } + } if term.closed { return false }