Skip to content

Commit

Permalink
restart event polling after ui resume on windows
Browse files Browse the repository at this point in the history
cc #677
  • Loading branch information
gokcehan committed Oct 19, 2021
1 parent 1b71c33 commit 7872455
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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),
Expand All @@ -561,6 +563,7 @@ func (ui *ui) pollEvents() {
for {
ev = ui.screen.PollEvent()
if ev == nil {
ui.polling = false
return
}
ui.tevChan <- ev
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 7872455

Please sign in to comment.