From 6d9b9547168757db4482bd71bde726ac8a404594 Mon Sep 17 00:00:00 2001 From: Jansen Price Date: Sat, 29 Aug 2020 10:52:25 -0500 Subject: [PATCH] Fixes #55 - ignore navigation keypresses while help is open (#78) --- display/display.go | 5 +++++ display/help.go | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/display/display.go b/display/display.go index 2aa331c..15cc65e 100644 --- a/display/display.go +++ b/display/display.go @@ -232,6 +232,11 @@ func Init() { // It's focused on a modal right now, nothing should interrupt return event } + _, ok = App.GetFocus().(*cview.Table) + if ok { + // It's focused on help right now + return event + } if tabs[curTab].mode == tabModeDone { // All the keys and operations that can only work while NOT loading diff --git a/display/help.go b/display/help.go index 8edd4bc..35010b9 100644 --- a/display/help.go +++ b/display/help.go @@ -12,12 +12,14 @@ var helpCells = strings.TrimSpace(` ?|Bring up this help. You can scroll! Esc|Leave the help 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. Shift-Tab|Navigate to the previous item in a popup. b, Alt-Left|Go back 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. |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 @@ -60,7 +62,7 @@ func Help() { func helpInit() { // Populate help table helpTable.SetDoneFunc(func(key tcell.Key) { - if key == tcell.KeyEsc { + if key == tcell.KeyEsc || key == tcell.KeyEnter { tabPages.SwitchToPage(strconv.Itoa(curTab)) App.SetFocus(tabs[curTab].view) App.Draw()