From db2c4a66142a6277351bc975f445ec1511a3965d Mon Sep 17 00:00:00 2001 From: toonn Date: Wed, 31 Jan 2018 15:08:12 +0100 Subject: Simplify backwards compatibility logic for VISUAL. If both `EDITOR` and `VISUAL` are unset, setting `VISUAL` because it's technically the right thing to do and setting `EDITOR` for backwards compatibility complicates the logic. `rifle` will now only do the latter. --- ranger/ext/rifle.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/ranger/ext/rifle.py b/ranger/ext/rifle.py index 84b8f375..8f28cef8 100755 --- a/ranger/ext/rifle.py +++ b/ranger/ext/rifle.py @@ -343,15 +343,8 @@ class Rifle(object): # pylint: disable=too-many-instance-attributes else: if 'PAGER' not in os.environ: os.environ['PAGER'] = DEFAULT_PAGER - if 'VISUAL' not in os.environ: - if 'EDITOR' not in os.environ: - os.environ['VISUAL'] = DEFAULT_EDITOR - # necessary for compatibility with old rifle.conf - os.environ['EDITOR'] = DEFAULT_EDITOR - else: - if 'EDITOR' not in os.environ: - # similar to new behavior for old rifle.conf - os.environ['EDITOR'] = os.environ['VISUAL'] + if 'EDITOR' not in os.environ: + os.environ['EDITOR'] = os.environ.get('VISUAL', DEFAULT_EDITOR) command = self.hook_command_postprocessing(command) self.hook_before_executing(command, self._mimetype, self._app_flags) try: -- cgit 1.4.1-2-gfad0