From c5777d78647984ffab62d3ef608be962f3018ab1 Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Mon, 11 Jul 2016 18:33:07 -0700 Subject: [PATCH 1/4] Upping version. --- CHANGELOG.rst | 17 +++++++++++++++++ rtv.1 | 6 +++++- rtv/__version__.py | 2 +- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e68eda0..ac93868 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,7 @@ RTV Changelog ============= +.. _1.10.0: http://github.com/michael-lazar/rtv/releases/tag/v1.10.0 .. _1.9.1: http://github.com/michael-lazar/rtv/releases/tag/v1.9.1 .. _1.9.0: http://github.com/michael-lazar/rtv/releases/tag/v1.9.0 .. _1.8.1: http://github.com/michael-lazar/rtv/releases/tag/v1.8.1 @@ -18,6 +19,22 @@ RTV Changelog .. _1.2.1: http://github.com/michael-lazar/rtv/releases/tag/v1.2.1 .. _1.2: http://github.com/michael-lazar/rtv/releases/tag/v1.2 +-------------------- +1.10.0_ (2016-07-11) +-------------------- +Features + +* New key added, `b` extracts urls from comments with using urlviewer. +* Comment files are saved to **/tmp** if rtv encounters an error while posting. +* The terminal title now displays the subreddit name or submission url. + +Bugfixes + +* Fixed ia bug where the terminal title wasn't getting set. +* Fixed crash when entering empty or invalid subreddit name. +* **/r/me** is now displayed as "My Submissions" in the header. +* x-posts that link to subreddits should no longer crash. + ------------------- 1.9.1_ (2016-06-13) ------------------- diff --git a/rtv.1 b/rtv.1 index f3028a9..43571c3 100644 --- a/rtv.1 +++ b/rtv.1 @@ -1,4 +1,4 @@ -.TH "RTV" "1" "June 14, 2016" "Version 1.9.1" "Usage and Commands" +.TH "RTV" "1" "July 12, 2016" "Version 1.10.0" "Usage and Commands" .SH NAME RTV - Reddit Terminal Viewer .SH SYNOPSIS @@ -73,6 +73,10 @@ for future sessions. You can disable this behavior by setting the option Text editor to use when editing comments and submissions. Will fallback to \fI$EDITOR\fR. .TP +.BR RTV_URLVIEWER +Url Viewer to use to extract links from comments. Requires a compatible +Url Viewer to be installed +.TP .BR BROWSER Web browser to use when opening links. .TP diff --git a/rtv/__version__.py b/rtv/__version__.py index b158713..18284e2 100644 --- a/rtv/__version__.py +++ b/rtv/__version__.py @@ -1,4 +1,4 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -__version__ = '1.9.1' +__version__ = '1.10.0' From 131e64273a9245d322cccb4735272e6e707a971f Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Mon, 11 Jul 2016 22:08:28 -0700 Subject: [PATCH 2/4] CHANGELOG wording. --- CHANGELOG.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ac93868..c728377 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -24,16 +24,16 @@ RTV Changelog -------------------- Features -* New key added, `b` extracts urls from comments with using urlviewer. -* Comment files are saved to **/tmp** if rtv encounters an error while posting. -* The terminal title now displays the subreddit name or submission url. +* New command, `b` extracts urls from comments using urlviewer. +* Comment files will no longer be destroyed if RTV encounters an error while posting. +* The terminal title now displays the subreddit name/url. Bugfixes -* Fixed ia bug where the terminal title wasn't getting set. * Fixed crash when entering empty or invalid subreddit name. -* **/r/me** is now displayed as "My Submissions" in the header. -* x-posts that link to subreddits should no longer crash. +* Fixed crash when opening x-posts linked to subreddits. +* Fixed a bug where the terminal title wasn't getting set. +* **/r/me** is now displayed as *My Submissions* in the header. ------------------- 1.9.1_ (2016-06-13) From 797ea5d072713202e70597b8607df31f1ee694eb Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Fri, 15 Jul 2016 16:22:54 -0700 Subject: [PATCH 3/4] Only set title if DISPLAY is set, change os x behavior to check DISPLAY. --- rtv/__main__.py | 18 ++++++++++++++---- rtv/page.py | 9 +++++---- rtv/terminal.py | 9 ++++++++- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/rtv/__main__.py b/rtv/__main__.py index 03e5fc3..e38d9fa 100644 --- a/rtv/__main__.py +++ b/rtv/__main__.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals +import os import sys import locale import logging @@ -29,16 +30,17 @@ _logger = logging.getLogger(__name__) def main(): - "Main entry point" + """Main entry point""" # Squelch SSL warnings logging.captureWarnings(True) locale.setlocale(locale.LC_ALL, '') # Set the terminal title - title = 'rtv {0}'.format(__version__) - sys.stdout.write('\x1b]2;{0}\x07'.format(title)) - sys.stdout.flush() + if os.getenv('DISPLAY'): + title = 'rtv {0}'.format(__version__) + sys.stdout.write('\x1b]2;{0}\x07'.format(title)) + sys.stdout.flush() args = Config.get_args() fargs, bindings = Config.get_file(args.get('config')) @@ -79,6 +81,14 @@ def main(): filename=config['log'], format='%(asctime)s:%(levelname)s:%(filename)s:%(lineno)d:%(message)s') _logger.info('Starting new session, RTV v%s', __version__) + env = [ + ('$DISPLAY', os.getenv('DISPLAY')), + ('$XDG_CONFIG_HOME', os.getenv('XDG_CONFIG_HOME')), + ('$BROWSER', os.getenv('BROWSER')), + ('$PAGER', os.getenv('PAGER')), + ('$RTV_EDITOR', os.getenv('RTV_EDITOR')), + ('$RTV_URLVIEWER', os.getenv('RTV_URLVIEWER'))] + _logger.info('Environment: %s', env) else: # Add an empty handler so the logger doesn't complain logging.root.addHandler(logging.NullHandler()) diff --git a/rtv/page.py b/rtv/page.py index 312efc3..8fc3cb3 100644 --- a/rtv/page.py +++ b/rtv/page.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals +import os import sys import time import curses @@ -233,7 +234,6 @@ class Page(object): else: raise TemporaryFileError() - @PageController.register(Command('INBOX')) @logged_in def get_inbox(self): @@ -291,9 +291,10 @@ class Page(object): else: title = sub_name - title += ' - rtv {0}'.format(__version__) - sys.stdout.write('\x1b]2;{0}\x07'.format(title)) - sys.stdout.flush() + if os.getenv('DISPLAY'): + title += ' - rtv {0}'.format(__version__) + sys.stdout.write('\x1b]2;{0}\x07'.format(title)) + sys.stdout.flush() if self.reddit.user is not None: # The starting position of the name depends on if we're converting diff --git a/rtv/terminal.py b/rtv/terminal.py index 90dc698..ec0d952 100644 --- a/rtv/terminal.py +++ b/rtv/terminal.py @@ -99,7 +99,14 @@ class Terminal(object): if self._display is None: if sys.platform == 'darwin': # OSX doesn't always set DISPLAY so we can't use this to check - display = True + # Note: Disabling for now, with the hope that if this + # is a widespread issue then people will complain and we can + # come up with a better solution. Checking for $DISPLAY is + # used extensively in mailcap files, so it really *should* be + # set properly. I don't have a mac anymore so I can't test. + + # display = True + display = bool(os.environ.get("DISPLAY")) else: display = bool(os.environ.get("DISPLAY")) From a1a26aa30853210b2ebb8718f3ef4b5414fb7ead Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Fri, 15 Jul 2016 16:30:22 -0700 Subject: [PATCH 4/4] Fixed test. --- tests/test_terminal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_terminal.py b/tests/test_terminal.py index ef3808b..f584836 100644 --- a/tests/test_terminal.py +++ b/tests/test_terminal.py @@ -37,7 +37,7 @@ def test_terminal_properties(terminal, config): with mock.patch('rtv.terminal.sys') as sys, \ mock.patch.dict('os.environ', {'DISPLAY': ''}): sys.platform = 'darwin' - assert terminal.display is True + assert terminal.display is False terminal._display = None with mock.patch.dict('os.environ', {'DISPLAY': ':0', 'BROWSER': 'w3m'}):