diff --git a/rtv/docs.py b/rtv/docs.py index b935f158..6e1468a1 100644 --- a/rtv/docs.py +++ b/rtv/docs.py @@ -69,6 +69,8 @@ SPACE : Mark the selected submission as hidden p : Toggle between the currently viewed subreddit and /r/front f : Open a prompt to search the current subreddit for a text string + v : Open the subreddit for the selected submission + V : Open the authors user page for the selected submission [Submission Mode] h : Close the submission and return to the previous page @@ -78,6 +80,7 @@ b : Send the comment text to the system's urlviewer application J : Move the cursor down the the next comment at the same indentation K : Move the cursor up to the parent comment + V : Open the authors user page for the selected comment [Subscription Mode] h : Close your subscriptions and return to the previous page diff --git a/rtv/page.py b/rtv/page.py index bf21377c..29b1ad88 100644 --- a/rtv/page.py +++ b/rtv/page.py @@ -284,6 +284,30 @@ def downvote(self): if not self.term.loader.exception: data['likes'] = None + @PageController.register(Command('OPEN_SUBREDDIT')) + def open_subreddit(self): + """ + Open the subreddit associated with the currently selected item. + """ + data = self.get_selected_item() + if 'subreddit' in data: + subreddit = data['subreddit'] + self.selected_page = self.open_subreddit_page(subreddit) + else: + self.term.flash() + + @PageController.register(Command('OPEN_USERPAGE')) + def open_userpage(self): + """ + Open the authors user page for the currently selected item. + """ + data = self.get_selected_item() + if 'author' in data: + author = data['author'] + self.selected_page = self.open_subreddit_page('u/' + author) + else: + self.term.flash() + @PageController.register(Command('SAVE')) @logged_in def save(self): diff --git a/rtv/templates/rtv.cfg b/rtv/templates/rtv.cfg index 3cca8a2e..54d589f3 100644 --- a/rtv/templates/rtv.cfg +++ b/rtv/templates/rtv.cfg @@ -149,6 +149,8 @@ COPY_URL = Y PRIVATE_MESSAGE = C SUBSCRIPTIONS = s MULTIREDDITS = S +OPEN_SUBREDDIT = v +OPEN_USERPAGE = V ; Submission page SUBMISSION_TOGGLE_COMMENT = 0x20