🐛 Reset bottomBar on invalid URL or error
This commit is contained in:
parent
2ecb4d1a55
commit
41075c8c41
4
NOTES.md
4
NOTES.md
|
@ -10,10 +10,12 @@
|
||||||
- Filed [issue 25](https://gitlab.com/tslocum/cview/-/issues/25)
|
- Filed [issue 25](https://gitlab.com/tslocum/cview/-/issues/25)
|
||||||
- Inputfield isn't repeatedly in focus
|
- Inputfield isn't repeatedly in focus
|
||||||
- Tried multiple focus options with App and Form funcs, but nothing worked
|
- 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
|
## Small todos
|
||||||
|
- Look at Github issues
|
||||||
- Look at other todos in code
|
- Look at other todos in code
|
||||||
- Add "Why the name amfora" thing to README
|
- Add "Why the name amfora" thing to README
|
||||||
- Pass `gemini://egsam.pitr.ca/` test
|
- Pass `gemini://egsam.pitr.ca/` test
|
||||||
- Timeout for server not closing connection?
|
- Timeout for server not closing connection?
|
||||||
- Add titles to modal with `modal.GetFrame()`
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ g|Go to top of document
|
||||||
G|Go to bottom of document
|
G|Go to bottom of document
|
||||||
spacebar|Open bar at the bottom - type a URL or link number
|
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.
|
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
|
q, Ctrl-Q|Quit
|
||||||
Shift-NUMBER|Go to a specific tab.
|
Shift-NUMBER|Go to a specific tab.
|
||||||
Shift-0, )|Go to the last tab.
|
Shift-0, )|Go to the last tab.
|
||||||
|
|
|
@ -96,7 +96,8 @@ func Error(title, text string) {
|
||||||
// Add spaces to title for aesthetic reasons
|
// Add spaces to title for aesthetic reasons
|
||||||
title = " " + strings.TrimSpace(title) + " "
|
title = " " + strings.TrimSpace(title) + " "
|
||||||
|
|
||||||
errorModal.SetTitle(title)
|
errorModal.GetFrame().Clear()
|
||||||
|
errorModal.GetFrame().AddText(title, true, cview.AlignCenter, tcell.ColorWhite)
|
||||||
errorModal.SetText(text)
|
errorModal.SetText(text)
|
||||||
tabPages.ShowPage("error")
|
tabPages.ShowPage("error")
|
||||||
tabPages.SendToFront("error")
|
tabPages.SendToFront("error")
|
||||||
|
|
|
@ -2,9 +2,9 @@ package display
|
||||||
|
|
||||||
var newTabContent = `# New Tab
|
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!
|
Happy browsing!
|
||||||
|
|
||||||
|
|
|
@ -109,6 +109,7 @@ func handleURL(u string) (string, bool) {
|
||||||
parsed, err := url.Parse(u)
|
parsed, err := url.Parse(u)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Error("URL Error", err.Error())
|
Error("URL Error", err.Error())
|
||||||
|
bottomBar.SetText(tabMap[curTab].Url)
|
||||||
return "", false
|
return "", false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,11 +132,13 @@ func handleURL(u string) (string, bool) {
|
||||||
Error("Error", err.Error())
|
Error("Error", err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
bottomBar.SetText(tabMap[curTab].Url)
|
||||||
return "", false
|
return "", false
|
||||||
}
|
}
|
||||||
if !strings.HasPrefix(u, "gemini") {
|
if !strings.HasPrefix(u, "gemini") {
|
||||||
// TODO: Replace it with with displaying the URL, once modal titles work
|
// TODO: Replace it with with displaying the URL, once modal titles work
|
||||||
Error("Error", "Unsupported protocol, only [::b]gemini[::-] and [::b]http[::-] are supported.")
|
Error("Error", "Unsupported protocol, only [::b]gemini[::-] and [::b]http[::-] are supported.")
|
||||||
|
bottomBar.SetText(tabMap[curTab].Url)
|
||||||
return "", false
|
return "", false
|
||||||
}
|
}
|
||||||
// Gemini URL
|
// Gemini URL
|
||||||
|
|
Loading…
Reference in New Issue