1
0
mirror of https://github.com/makew0rld/amfora.git synced 2024-06-19 19:25:24 +00:00

🐛 Reset bottomBar on invalid URL or error

This commit is contained in:
makeworld 2020-06-19 11:18:28 -04:00
parent 2ecb4d1a55
commit 41075c8c41
5 changed files with 11 additions and 5 deletions

View File

@ -10,10 +10,12 @@
- Filed [issue 25](https://gitlab.com/tslocum/cview/-/issues/25)
- Inputfield isn't repeatedly in focus
- Tried multiple focus options with App and Form funcs, but nothing worked
- Modal title does not display
- See [my comment](https://gitlab.com/tslocum/cview/-/issues/24#note_364617155)
## Small todos
- Look at Github issues
- Look at other todos in code
- Add "Why the name amfora" thing to README
- Pass `gemini://egsam.pitr.ca/` test
- Timeout for server not closing connection?
- Add titles to modal with `modal.GetFrame()`

View File

@ -17,7 +17,7 @@ g|Go to top of document
G|Go to bottom of document
spacebar|Open bar at the bottom - type a URL or link number
Enter|On a page this will start link highlighting. Press Tab and Shift-Tab to pick different links. Press enter again to go to one.
Ctrl-R|Reload a page. This also clears the cache.
Ctrl-R, R|Reload a page. This also clears the cache.
q, Ctrl-Q|Quit
Shift-NUMBER|Go to a specific tab.
Shift-0, )|Go to the last tab.

View File

@ -96,7 +96,8 @@ func Error(title, text string) {
// Add spaces to title for aesthetic reasons
title = " " + strings.TrimSpace(title) + " "
errorModal.SetTitle(title)
errorModal.GetFrame().Clear()
errorModal.GetFrame().AddText(title, true, cview.AlignCenter, tcell.ColorWhite)
errorModal.SetText(text)
tabPages.ShowPage("error")
tabPages.SendToFront("error")

View File

@ -2,9 +2,9 @@ package display
var newTabContent = `# New Tab
You've opened a new tab. Use the bar at the bottom to browse around. You can start typing in it by pressing the space key, or clicking the bottom bar.
You've opened a new tab. Use the bar at the bottom to browse around. You can start typing in it by pressing the space key.
Press the ? key at any time to bring up the help, and see other keybindings. Most are what you expect, you can use h/j/k/l and the arrow keys to move around text, as well as scrolling with the mouse. Common browsers shortcuts like Ctrl-T, Ctrl-W, and Ctrl-F are also supported.
Press the ? key at any time to bring up the help, and see other keybindings. Most are what you expect.
Happy browsing!

View File

@ -109,6 +109,7 @@ func handleURL(u string) (string, bool) {
parsed, err := url.Parse(u)
if err != nil {
Error("URL Error", err.Error())
bottomBar.SetText(tabMap[curTab].Url)
return "", false
}
@ -131,11 +132,13 @@ func handleURL(u string) (string, bool) {
Error("Error", err.Error())
}
}
bottomBar.SetText(tabMap[curTab].Url)
return "", false
}
if !strings.HasPrefix(u, "gemini") {
// TODO: Replace it with with displaying the URL, once modal titles work
Error("Error", "Unsupported protocol, only [::b]gemini[::-] and [::b]http[::-] are supported.")
bottomBar.SetText(tabMap[curTab].Url)
return "", false
}
// Gemini URL