diff --git a/display/bookmarks.go b/display/bookmarks.go index 6bbdee0..4bc6825 100644 --- a/display/bookmarks.go +++ b/display/bookmarks.go @@ -2,7 +2,6 @@ package display import ( "fmt" - "strconv" "github.com/gdamore/tcell/v2" "github.com/makeworld-the-better-one/amfora/bookmarks" @@ -103,7 +102,7 @@ func openBkmkModal(name string, exists bool, favicon string) (string, int) { App.Draw() action := <-bkmkCh - browser.SetCurrentTab(strconv.Itoa(curTab)) + panels.HidePanel("bkmk") App.SetFocus(tabs[curTab].view) App.Draw() diff --git a/display/download.go b/display/download.go index fd8e3f9..fff20cf 100644 --- a/display/download.go +++ b/display/download.go @@ -33,8 +33,8 @@ var dlChoiceCh = make(chan string) var dlModal = cview.NewModal() func dlInit() { - panels.AddPanel("dlChoice", dlChoiceModal, false, false) panels.AddPanel("dl", dlModal, false, false) + panels.AddPanel("dlChoice", dlChoiceModal, false, false) dlm := dlModal chm := dlChoiceModal @@ -84,7 +84,7 @@ func dlInit() { frame.SetTitle(" Download ") dlm.SetDoneFunc(func(buttonIndex int, buttonLabel string) { if buttonLabel == "Ok" { - browser.SetCurrentTab(strconv.Itoa(curTab)) + panels.HidePanel("dl") App.SetFocus(tabs[curTab].view) App.Draw() } @@ -148,7 +148,9 @@ func dlChoice(text, u string, resp *gemini.Response) { open(u, resp) return } - browser.SetCurrentTab(strconv.Itoa(curTab)) + + // They chose the "Cancel" button + panels.HidePanel("dlChoice") App.SetFocus(tabs[curTab].view) App.Draw() } @@ -184,9 +186,11 @@ func open(u string, resp *gemini.Response) { if path == "" { return } - browser.SetCurrentTab(strconv.Itoa(curTab)) + + panels.HidePanel("dl") App.SetFocus(tabs[curTab].view) App.Draw() + if mediaHandler.Cmd == nil { // Open with system default viewer _, err := sysopen.Open(path) diff --git a/display/modals.go b/display/modals.go index 6043df5..6cbda34 100644 --- a/display/modals.go +++ b/display/modals.go @@ -2,7 +2,6 @@ package display import ( "fmt" - "strconv" "strings" "time" @@ -120,7 +119,7 @@ func modalInit() { frame.SetTitleAlign(cview.AlignCenter) frame.SetTitle(" Info ") infoModal.SetDoneFunc(func(buttonIndex int, buttonLabel string) { - browser.SetCurrentTab(strconv.Itoa(curTab)) + panels.HidePanel("info") App.SetFocus(tabs[curTab].view) App.Draw() }) @@ -128,7 +127,7 @@ func modalInit() { errorModal.SetBorder(true) errorModal.GetFrame().SetTitleAlign(cview.AlignCenter) errorModal.SetDoneFunc(func(buttonIndex int, buttonLabel string) { - browser.SetCurrentTab(strconv.Itoa(curTab)) + panels.HidePanel("error") App.SetFocus(tabs[curTab].view) App.Draw() }) @@ -213,7 +212,7 @@ func Input(prompt string) (string, bool) { resp := <-inputCh - browser.SetCurrentTab(strconv.Itoa(curTab)) + panels.HidePanel("input") App.SetFocus(tabs[curTab].view) App.Draw() @@ -248,7 +247,7 @@ func YesNo(prompt string) bool { App.Draw() resp := <-yesNoCh - browser.SetCurrentTab(strconv.Itoa(curTab)) + panels.HidePanel("yesno") App.SetFocus(tabs[curTab].view) App.Draw() return resp @@ -286,7 +285,7 @@ func Tofu(host string, expiry time.Time) bool { App.Draw() resp := <-yesNoCh - browser.SetCurrentTab(strconv.Itoa(curTab)) + panels.HidePanel("yesno") App.SetFocus(tabs[curTab].view) App.Draw() return resp diff --git a/display/subscriptions.go b/display/subscriptions.go index b2bf1c7..5e74127 100644 --- a/display/subscriptions.go +++ b/display/subscriptions.go @@ -266,7 +266,7 @@ func openSubscriptionModal(validFeed, subscribed bool) bool { App.Draw() resp := <-yesNoCh - browser.SetCurrentTab(strconv.Itoa(curTab)) + panels.HidePanel("yesno") App.SetFocus(tabs[curTab].view) App.Draw() return resp