Updated help, switch help screen to PAGER.
This commit is contained in:
73
rtv/docs.py
73
rtv/docs.py
@@ -17,37 +17,58 @@ Press `?` to open the help screen.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
HELP = """
|
HELP = """
|
||||||
|
Reddit Terminal Viewer
|
||||||
|
|
||||||
|
https://github.com/michael-lazar/rtv
|
||||||
|
======================
|
||||||
|
|
||||||
[Basic Commands]
|
[Basic Commands]
|
||||||
`j/k` or `UP/DOWN` : Move the cursor up/down
|
j/k or ▲/▼ : Move the cursor up/down
|
||||||
`m/n` or `PgUp/PgDn`: Jump to the previous/next page
|
m/n or PgUp/PgDn : Jump to the previous/next page
|
||||||
`o` or `ENTER` : Open the selected item as a webpage
|
1-5 : Toggle post order
|
||||||
`1`-`5` : Toggle post order
|
r or F5 : Refresh page content
|
||||||
`r` or `F5` : Refresh page content
|
u : Log in or switch accounts
|
||||||
`u` : Log in or switch accounts
|
? : Show the help screen
|
||||||
`?` : Show the help screen
|
q/Q : Quit/Force quit
|
||||||
`q/Q` : Quit/Force quit
|
|
||||||
|
|
||||||
[Authenticated Commands]
|
[Authenticated Commands]
|
||||||
`a/z` : Upvote/downvote
|
a/z : Upvote/downvote
|
||||||
`w` : Save/unsave a post
|
c : Compose a new post or comment
|
||||||
`c` : Compose a new post or comment
|
e : Edit an existing post or comment
|
||||||
`e` : Edit an existing post or comment
|
d : Delete an existing post or comment
|
||||||
`d` : Delete an existing post or comment
|
i : Display new messages prompt
|
||||||
`i` : Display new messages prompt
|
s : View a list of subscribed subreddits
|
||||||
`s` : Open subscribed subreddits
|
S : View a list of subscribed multireddits
|
||||||
`S` : Open subscribed multireddits
|
w : Save a submission
|
||||||
|
|
||||||
[Subreddit Mode]
|
[Subreddit Commands]
|
||||||
`l` or `RIGHT` : Enter the selected submission
|
l or ► : Enter the selected submission
|
||||||
`/` : Open a prompt to switch subreddits
|
o or ENTER : Open the submission link with your web browser
|
||||||
`f` : Open a prompt to search the current subreddit
|
/ : Open a prompt to switch subreddits
|
||||||
'p' : Toggle between the front page and last visited subreddit
|
f : Open a prompt to search the current subreddit
|
||||||
|
p : Return to the front page
|
||||||
|
|
||||||
[Submission Mode]
|
[Submission Commands]
|
||||||
`h` or `LEFT` : Return to subreddit mode
|
h or ◄ : Return to the subreddit
|
||||||
`l` or `RIGHT` : Open the selected comment in a new window
|
l or ► : Open the selected comment in a new window
|
||||||
`SPACE` : Fold the selected comment, or load additional comments
|
o or ENTER : Open the comment permalink with your web browser
|
||||||
`b` : Display URLs with urlview
|
SPACE : Fold the selected comment, or load additional comments
|
||||||
|
b : Display URLs with urlview
|
||||||
|
|
||||||
|
[Navigating]
|
||||||
|
The `/` prompt accepts subreddits in the following formats
|
||||||
|
|
||||||
|
- python
|
||||||
|
- /r/python
|
||||||
|
- /r/python/new (sort)
|
||||||
|
- /r/python/controversial-year (sort and order)
|
||||||
|
- /r/python+linux (multireddit)
|
||||||
|
- /r/front (front page)
|
||||||
|
- /u/me (your submissions)
|
||||||
|
- /u/saved (your saved posts)
|
||||||
|
- /u/spez (a user's submissions)
|
||||||
|
- /u/multi-mod/m/android (curated multireddit)
|
||||||
|
- /domain/python.org (search by domain)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
COMMENT_FILE = """
|
COMMENT_FILE = """
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ class Page(object):
|
|||||||
|
|
||||||
@PageController.register(Command('HELP'))
|
@PageController.register(Command('HELP'))
|
||||||
def show_help(self):
|
def show_help(self):
|
||||||
self.term.show_notification(docs.HELP.strip('\n').splitlines())
|
self.term.open_pager(docs.HELP.strip())
|
||||||
|
|
||||||
@PageController.register(Command('SORT_HOT'))
|
@PageController.register(Command('SORT_HOT'))
|
||||||
def sort_content_hot(self):
|
def sort_content_hot(self):
|
||||||
|
|||||||
@@ -71,9 +71,9 @@ def test_page_unauthenticated(reddit, terminal, config, oauth):
|
|||||||
assert sys_exit.called
|
assert sys_exit.called
|
||||||
|
|
||||||
# Show help
|
# Show help
|
||||||
page.controller.trigger('?')
|
with mock.patch('subprocess.Popen') as Popen:
|
||||||
message = '[Basic Commands]'.encode('utf-8')
|
page.controller.trigger('?')
|
||||||
terminal.stdscr.subwin.addstr.assert_any_call(1, 1, message)
|
assert Popen.called
|
||||||
|
|
||||||
# Sort content
|
# Sort content
|
||||||
page.controller.trigger('1')
|
page.controller.trigger('1')
|
||||||
|
|||||||
@@ -189,12 +189,12 @@ def test_show_notification(terminal, stdscr, use_ascii):
|
|||||||
assert stdscr.subwin.addstr.call_count == 3
|
assert stdscr.subwin.addstr.call_count == 3
|
||||||
stdscr.reset_mock()
|
stdscr.reset_mock()
|
||||||
|
|
||||||
# The whole message should fit in 40x80
|
# The text should be trimmed to fit 40x80
|
||||||
text = HELP.strip().splitlines()
|
text = HELP.strip().splitlines()
|
||||||
terminal.show_notification(text)
|
terminal.show_notification(text)
|
||||||
assert stdscr.subwin.nlines == len(text) + 2
|
assert stdscr.subwin.nlines == 40
|
||||||
assert stdscr.subwin.ncols == 80
|
assert stdscr.subwin.ncols <= 80
|
||||||
assert stdscr.subwin.addstr.call_count == len(text)
|
assert stdscr.subwin.addstr.call_count == 38
|
||||||
stdscr.reset_mock()
|
stdscr.reset_mock()
|
||||||
|
|
||||||
# The text should be trimmed to fit in 20x20
|
# The text should be trimmed to fit in 20x20
|
||||||
|
|||||||
Reference in New Issue
Block a user