completion: install panic handler in completion callback

This callback is actually invoked in a goroutine by time.AfterFunc. The
panic handler must be explicitly installed.

Link: https://github.com/golang/go/blob/go1.18/src/time/sleep.go#L160-L173
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Moritz Poldrack <moritz@poldrack.dev>
This commit is contained in:
Robin Jarry 2022-03-25 09:27:20 +01:00
parent 037676f7cc
commit 73b64f2bf9

View file

@ -9,6 +9,7 @@ import (
"github.com/mattn/go-runewidth" "github.com/mattn/go-runewidth"
"git.sr.ht/~rjarry/aerc/config" "git.sr.ht/~rjarry/aerc/config"
"git.sr.ht/~rjarry/aerc/logging"
) )
// TODO: Attach history providers // TODO: Attach history providers
@ -280,6 +281,7 @@ func (ti *TextInput) updateCompletions() {
} }
if ti.completeDebouncer == nil { if ti.completeDebouncer == nil {
ti.completeDebouncer = time.AfterFunc(ti.completeDelay, func() { ti.completeDebouncer = time.AfterFunc(ti.completeDelay, func() {
defer logging.PanicHandler()
ti.showCompletions() ti.showCompletions()
}) })
} else { } else {