From 7872455021c800df9d9cf45f44b7cda03f0f927c Mon Sep 17 00:00:00 2001 From: Gokcehan Date: Tue, 19 Oct 2021 22:51:25 +0300 Subject: [PATCH] restart event polling after ui resume on windows cc #677 --- ui.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ui.go b/ui.go index 26cc27fb..ca7d011c 100644 --- a/ui.go +++ b/ui.go @@ -465,6 +465,7 @@ func (win *win) printDir(screen tcell.Screen, dir *dir, selections map[string]in type ui struct { screen tcell.Screen + polling bool wins []*win promptWin *win msgWin *win @@ -538,6 +539,7 @@ func newUI(screen tcell.Screen) *ui { ui := &ui{ screen: screen, + polling: true, wins: getWins(screen), promptWin: newWin(wtot, 1, 0, 0), msgWin: newWin(wtot, 1, 0, htot-1), @@ -561,6 +563,7 @@ func (ui *ui) pollEvents() { for { ev = ui.screen.PollEvent() if ev == nil { + ui.polling = false return } ui.tevChan <- ev @@ -1169,7 +1172,12 @@ func (ui *ui) suspend() error { } func (ui *ui) resume() error { - return ui.screen.Resume() + err := ui.screen.Resume() + if !ui.polling { + go ui.pollEvents() + ui.polling = true + } + return err } func anyKey() {