diff options
author | toonn <toonn@toonn.io> | 2018-01-31 15:08:12 +0100 |
---|---|---|
committer | toonn <toonn@toonn.io> | 2018-01-31 15:36:20 +0100 |
commit | db2c4a66142a6277351bc975f445ec1511a3965d (patch) | |
tree | 5c55b0bac7af3b83528670e504421d7fd8329688 /ranger | |
parent | a17508d5c1492af1579ae561a840cdd859946ddc (diff) | |
download | ranger-db2c4a66142a6277351bc975f445ec1511a3965d.tar.gz |
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.
Diffstat (limited to 'ranger')
-rwxr-xr-x | ranger/ext/rifle.py | 11 |
1 files 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: |