v/GTT
1
0
mirror of https://github.com/eeeXun/GTT.git synced 2025-05-16 07:40:44 -07:00

fix(ui): app should redraw in Goroutine

If error occurs when playing TTS, SetText would be called. But it's in
Goroutine, so we need to call app.Draw to redraw the screen.
This commit is contained in:
eeeXun 2023-05-12 09:27:52 +08:00
parent 837196dbd4
commit 2d2834c6da

2
ui.go
View File

@ -510,6 +510,7 @@ func translateWindowHandler(event *tcell.EventKey) *tcell.EventKey {
err := translator.PlayTTS(translator.GetSrcLang(), message)
if err != nil {
srcInput.SetText(err.Error(), true)
app.Draw()
}
}()
}
@ -526,6 +527,7 @@ func translateWindowHandler(event *tcell.EventKey) *tcell.EventKey {
err := translator.PlayTTS(translator.GetDstLang(), message)
if err != nil {
dstOutput.SetText(err.Error())
app.Draw()
}
}()
}