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

Fixes #55 - ignore navigation keypresses while help is open (#78)

This commit is contained in:
Jansen Price 2020-08-29 10:52:25 -05:00 committed by GitHub
parent d95963aa62
commit 6d9b954716
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View File

@ -232,6 +232,11 @@ func Init() {
// It's focused on a modal right now, nothing should interrupt // It's focused on a modal right now, nothing should interrupt
return event return event
} }
_, ok = App.GetFocus().(*cview.Table)
if ok {
// It's focused on help right now
return event
}
if tabs[curTab].mode == tabModeDone { if tabs[curTab].mode == tabModeDone {
// All the keys and operations that can only work while NOT loading // All the keys and operations that can only work while NOT loading

View File

@ -12,12 +12,14 @@ var helpCells = strings.TrimSpace(`
?|Bring up this help. You can scroll! ?|Bring up this help. You can scroll!
Esc|Leave the help Esc|Leave the help
Arrow keys, h/j/k/l|Scroll and move a page. Arrow keys, h/j/k/l|Scroll and move a page.
PgUp, u|Go up a page in document
PgDn, d|Go down a page in document
g|Go to top of document
G|Go to bottom of document
Tab|Navigate to the next item in a popup. Tab|Navigate to the next item in a popup.
Shift-Tab|Navigate to the previous item in a popup. Shift-Tab|Navigate to the previous item in a popup.
b, Alt-Left|Go back in the history b, Alt-Left|Go back in the history
f, Alt-Right|Go forward in the history f, Alt-Right|Go forward in the history
g|Go to top of document
G|Go to bottom of document
spacebar|Open bar at the bottom - type a URL, link number, search term. spacebar|Open bar at the bottom - type a URL, link number, search term.
|You can also type two dots (..) to go up a directory in the URL. |You can also type two dots (..) to go up a directory in the URL.
|Typing new:N will open link number N in a new tab |Typing new:N will open link number N in a new tab
@ -60,7 +62,7 @@ func Help() {
func helpInit() { func helpInit() {
// Populate help table // Populate help table
helpTable.SetDoneFunc(func(key tcell.Key) { helpTable.SetDoneFunc(func(key tcell.Key) {
if key == tcell.KeyEsc { if key == tcell.KeyEsc || key == tcell.KeyEnter {
tabPages.SwitchToPage(strconv.Itoa(curTab)) tabPages.SwitchToPage(strconv.Itoa(curTab))
App.SetFocus(tabs[curTab].view) App.SetFocus(tabs[curTab].view)
App.Draw() App.Draw()