"Press any key to close" for completed processes

This commit is contained in:
Drew DeVault 2019-05-11 14:15:29 -04:00
parent 72e4b5e2b2
commit 71c13c9078
2 changed files with 10 additions and 1 deletions

View file

@ -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() {

View file

@ -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
}