diff --git a/go.mod b/go.mod index f290175..986ae71 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( ) require ( - github.com/spezifisch/tview-command v0.0.0-20241013193408-213554cd0289 + github.com/spezifisch/tview-command v0.0.0-20241013195600-86c4ba9c4c88 github.com/stretchr/testify v1.9.0 github.com/supersonic-app/go-mpv v0.1.0 ) diff --git a/go.sum b/go.sum index db3a647..60cb776 100644 --- a/go.sum +++ b/go.sum @@ -63,6 +63,8 @@ github.com/spezifisch/tview-command v0.0.0-20241013173854-23b02704223f h1:6KzEn8 github.com/spezifisch/tview-command v0.0.0-20241013173854-23b02704223f/go.mod h1:BmHPVRuS00KaY6eP3VAoPJVlfN0Fulajx3Dw9CwKfFw= github.com/spezifisch/tview-command v0.0.0-20241013193408-213554cd0289 h1:tYxRaxvhmXvJpOqxAt3AImUEqHtMFUfrztOSbTqn7ZI= github.com/spezifisch/tview-command v0.0.0-20241013193408-213554cd0289/go.mod h1:BmHPVRuS00KaY6eP3VAoPJVlfN0Fulajx3Dw9CwKfFw= +github.com/spezifisch/tview-command v0.0.0-20241013195600-86c4ba9c4c88 h1:Ck4VeJ+nT0iSc708iwqjTwhaTNTTFxmNilEXVmze6n8= +github.com/spezifisch/tview-command v0.0.0-20241013195600-86c4ba9c4c88/go.mod h1:BmHPVRuS00KaY6eP3VAoPJVlfN0Fulajx3Dw9CwKfFw= github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= github.com/spf13/cast v1.7.0 h1:ntdiHjuueXFgm5nzDRdOS4yfT43P5Fnud6DH50rz/7w= diff --git a/gui.go b/gui.go index a0879a9..d96886a 100644 --- a/gui.go +++ b/gui.go @@ -107,7 +107,7 @@ func InitGui( } ui.keyContextStack.Push("Init") - logger.Print("Context: QueuePage pushed to the stack") + logger.Print("Context: Init pushed to the stack") ui.initEventLoops() @@ -213,6 +213,9 @@ func (ui *Ui) Run() error { // receive events from mpv wrapper ui.player.RegisterEventConsumer(ui) + // leave init key context + ui.keyContextStack.PopExpect("Init") + // run gui/background event handler ui.runEventLoops() @@ -224,6 +227,7 @@ func (ui *Ui) Run() error { } func (ui *Ui) ShowHelp() { + ui.keyContextStack.Push("Help") activePage := ui.menuWidget.GetActivePage() ui.helpWidget.RenderHelp(activePage) @@ -234,11 +238,13 @@ func (ui *Ui) ShowHelp() { } func (ui *Ui) CloseHelp() { + ui.keyContextStack.PopExpect("Help") ui.helpWidget.visible = false ui.pages.HidePage(PageHelpBox) } func (ui *Ui) ShowSelectPlaylist() { + ui.keyContextStack.Push("SelectPlaylist") ui.pages.ShowPage(PageSelectPlaylist) ui.pages.SendToFront(PageSelectPlaylist) ui.app.SetFocus(ui.selectPlaylistModal) @@ -246,6 +252,7 @@ func (ui *Ui) ShowSelectPlaylist() { } func (ui *Ui) CloseSelectPlaylist() { + ui.keyContextStack.PopExpect("SelectPlaylist") ui.pages.HidePage(PageSelectPlaylist) ui.selectPlaylistWidget.visible = false }