Can also quit with the escape key.

- Also removed unnecessary color from the help docs.
This commit is contained in:
Andrew Hamilton 2021-06-02 19:33:41 +10:00
parent 0170d24abb
commit 1d3e44f7ad
3 changed files with 30 additions and 30 deletions

View file

@ -71,18 +71,18 @@ Options:
KEYS_DOC = """Keys:
arrow keys, page up/down, mouse - Move the cursor or scroll the result pane.
tab - Change the focus between summary and result pane.
*h - Show the help screen. (toggle)
*q - Quit.
*o - Orient the result pane as portrait or landscape. (toggle)
*l - Show the activity log. (toggle)
*e - Edit the current file with an editor defined by -e, $EDITOR or $VISUAL.
*n - Move to the next issue.
*N - Move to the next issue of the current tool.
*s - Sort files by type, or by directory location. (toggle)
*r - Refresh the currently selected report.
*R - Refresh all reports of the current tool.
*f - Resize the focused pane to the full screen. (toggle)
*x - Open the current file with xdg-open.
q, esc - Quit.
h - Show the help screen. (toggle)
o - Orient the result pane as portrait or landscape. (toggle)
l - Show the activity log. (toggle)
e - Edit the current file with an editor defined by -e, $EDITOR or $VISUAL.
n - Move to the next issue.
N - Move to the next issue of the current tool.
s - Sort files by type, or by directory location. (toggle)
r - Refresh the currently selected report.
R - Refresh all reports of the current tool.
f - Resize the focused pane to the full screen. (toggle)
x - Open the current file with xdg-open.
"""
@ -635,8 +635,7 @@ class Help:
def __init__(self, summary, screen):
self.summary = summary
self.screen = screen
keys_doc = highlight_chars(KEYS_DOC, Log._GREEN_STYLE)
help_text = fill3.join("\n", [__doc__, keys_doc, get_status_help()])
help_text = fill3.join("\n", [__doc__, KEYS_DOC, get_status_help()])
self.view = fill3.View.from_widget(fill3.Text(help_text))
self.widget = fill3.Border(self.view, title="Help")
portal = self.view.portal
@ -644,7 +643,7 @@ class Help:
terminal.DOWN_KEY: portal.scroll_down,
terminal.LEFT_KEY: portal.scroll_left,
terminal.RIGHT_KEY: portal.scroll_right,
"q": self._exit_help}
"q": self._exit_help, terminal.ESC: self._exit_help}
def _exit_help(self):
self.screen._is_help_visible = False
@ -1044,8 +1043,9 @@ class Screen:
terminal.PAGE_UP_KEY: cursor_page_up, "s": toggle_order,
terminal.HOME_KEY: cursor_home, terminal.END_KEY: cursor_end,
"n": move_to_next_issue, "N": move_to_next_issue_of_tool,
"e": edit_file, "q": quit_, "r": refresh, "R": refresh_tool,
"\t": toggle_focus, "f": toggle_fullscreen, "x": xdg_open}
"e": edit_file, "q": quit_, terminal.ESC: quit_, "r": refresh,
"R": refresh_tool, "\t": toggle_focus, "f": toggle_fullscreen,
"x": xdg_open}
def setup_inotify(root_path, loop, on_filesystem_event, exclude_filter):

View file

@ -522,7 +522,7 @@ class _Screen:
return self.content.appearance(dimensions)
def on_keyboard_input(self, term_code):
if term_code == "q":
if term_code in ["q", terminal.ESC]:
asyncio.get_event_loop().stop()
else:
self.content = Filler(Text(repr(term_code)))

View file

@ -12,18 +12,18 @@
│Keys: │
│ arrow keys, page up/down, mouse - Move the cursor or scroll the result pane. │
│ tab - Change the focus between summary and result pane. │
h - Show the help screen. (toggle)
q - Quit.
o - Orient the result pane as portrait or landscape. (toggle) │
l - Show the activity log. (toggle) │
e - Edit the current file with an editor defined by -e, $EDITOR or $VISUAL. │
n - Move to the next issue. │
N - Move to the next issue of the current tool. │
s - Sort files by type, or by directory location. (toggle) │
r - Refresh the currently selected report. │
R - Refresh all reports of the current tool. │
f - Resize the focused pane to the full screen. (toggle) │
x - Open the current file with xdg-open. │
q, esc - Quit.
h - Show the help screen. (toggle)
o - Orient the result pane as portrait or landscape. (toggle) │
l - Show the activity log. (toggle) │
e - Edit the current file with an editor defined by -e, $EDITOR or $VISUAL. │
n - Move to the next issue. │
N - Move to the next issue of the current tool. │
s - Sort files by type, or by directory location. (toggle) │
r - Refresh the currently selected report. │
R - Refresh all reports of the current tool. │
f - Resize the focused pane to the full screen. (toggle) │
x - Open the current file with xdg-open. │
│ │
│Statuses: │
  Normal │