1
0
mirror of https://github.com/makew0rld/amfora.git synced 2024-12-04 14:46:29 -05:00

🐛 Fix not being able to interact with page after modal

This was a regression, the bug was not present in v1.3.0. This could be due to the cview update?
This commit is contained in:
makeworld 2020-07-28 18:09:36 -04:00
parent 27537c7edb
commit ede504caaf
6 changed files with 22 additions and 8 deletions

View File

@ -6,7 +6,7 @@
- Pressing Escape in the bottom bar jumps back to the top of the page
## Regressions
- Can't interact with page after clicking Cancel on bkmk (and other?) modal(s)
- Switching to another tab scrolls page back to the top - same with closing
## Upstream Bugs
- Wrapping messes up on brackets

View File

@ -63,8 +63,6 @@ func bkmkInit() {
case "Cancel":
bkmkCh <- 0
}
//tabPages.SwitchToPage(strconv.Itoa(curTab)) - handled in bkmk()
})
}
@ -102,6 +100,8 @@ func openBkmkModal(name string, exists bool) (string, int) {
action := <-bkmkCh
tabPages.SwitchToPage(strconv.Itoa(curTab))
App.SetFocus(tabs[curTab].view)
App.Draw()
return bkmkModalText, action
}

View File

@ -77,6 +77,8 @@ func dlInit() {
dlModal.SetDoneFunc(func(buttonIndex int, buttonLabel string) {
if buttonLabel == "Ok" {
tabPages.SwitchToPage(strconv.Itoa(curTab))
App.SetFocus(tabs[curTab].view)
App.Draw()
}
})
}
@ -117,10 +119,12 @@ func dlChoice(text, u string, resp *gemini.Response) {
portalURL = strings.TrimPrefix(portalURL, "gemini://") + "?raw=1"
handleHTTP("https://portal.mozz.us/gemini/"+portalURL, false)
tabPages.SwitchToPage(strconv.Itoa(curTab))
App.SetFocus(tabs[curTab].view)
App.Draw()
return
}
tabPages.SwitchToPage(strconv.Itoa(curTab))
App.SetFocus(tabs[curTab].view)
App.Draw()
}

View File

@ -113,12 +113,16 @@ func modalInit() {
SetTitle(" Info ")
infoModal.SetDoneFunc(func(buttonIndex int, buttonLabel string) {
tabPages.SwitchToPage(strconv.Itoa(curTab))
App.SetFocus(tabs[curTab].view)
App.Draw()
})
errorModal.SetBorder(true)
errorModal.GetFrame().SetTitleAlign(cview.AlignCenter)
errorModal.SetDoneFunc(func(buttonIndex int, buttonLabel string) {
tabPages.SwitchToPage(strconv.Itoa(curTab))
App.SetFocus(tabs[curTab].view)
App.Draw()
})
inputModal.SetBorder(true)
@ -142,8 +146,6 @@ func modalInit() {
return
}
yesNoCh <- false
//tabPages.SwitchToPage(strconv.Itoa(curTab)) - Handled in YesNo()
})
bkmkInit()
@ -199,7 +201,11 @@ func Input(prompt string) (string, bool) {
App.Draw()
resp := <-inputCh
tabPages.SwitchToPage(strconv.Itoa(curTab))
App.SetFocus(tabs[curTab].view)
App.Draw()
if resp == "" {
return "", false
}
@ -232,6 +238,8 @@ func YesNo(prompt string) bool {
resp := <-yesNoCh
tabPages.SwitchToPage(strconv.Itoa(curTab))
App.SetFocus(tabs[curTab].view)
App.Draw()
return resp
}
@ -269,5 +277,7 @@ func Tofu(host string, expiry time.Time) bool {
resp := <-yesNoCh
tabPages.SwitchToPage(strconv.Itoa(curTab))
App.SetFocus(tabs[curTab].view)
App.Draw()
return resp
}

2
go.mod
View File

@ -18,7 +18,7 @@ require (
github.com/spf13/viper v1.7.0
github.com/stretchr/testify v1.6.0
gitlab.com/tslocum/cview v1.4.8-0.20200713214710-cc7796c4ca44
golang.org/x/sys v0.0.0-20200724161237-0e2f3a69832c // indirect
golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1 // indirect
golang.org/x/text v0.3.3
gopkg.in/ini.v1 v1.57.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20200603094226-e3079894b1e8 // indirect

4
go.sum
View File

@ -282,8 +282,8 @@ golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200610111108-226ff32320da h1:bGb80FudwxpeucJUjPYJXuJ8Hk91vNtfvrymzwiei38=
golang.org/x/sys v0.0.0-20200610111108-226ff32320da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200724161237-0e2f3a69832c h1:UIcGWL6/wpCfyGuJnRFJRurA+yj8RrW7Q6x2YMCXt6c=
golang.org/x/sys v0.0.0-20200724161237-0e2f3a69832c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1 h1:sIky/MyNRSHTrdxfsiUSS4WIAMvInbeXljJz+jDjeYE=
golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=