From f1603478415f0981ee865ee7413255318a7d7d3e Mon Sep 17 00:00:00 2001 From: Toon Nolten Date: Tue, 21 Aug 2018 10:46:37 +0200 Subject: Add selection argument to move action If `selection == False` don't operate on the entire selection (the marked files) but only on the file under the cursor. Inconsistent, I noticed `move to=100 percentage=true` works as expected but `move right=1 selection=false` doesn't. You need to pass `False`, most other values test as `True` in python, so `true` works *but* surprisingly imo, `false == True`. Fixes #1233 --- ranger/core/actions.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ranger/core/actions.py b/ranger/core/actions.py index 83cfcc08..1417ac96 100644 --- a/ranger/core/actions.py +++ b/ranger/core/actions.py @@ -489,7 +489,10 @@ class Actions( # pylint: disable=too-many-instance-attributes,too-many-public-m if narg is not None: mode = narg tfile = self.thisfile - selection = self.thistab.get_selection() + if not kw.get('selection', True): + selection = [tfile] + else: + selection = self.thistab.get_selection() if tfile.is_directory: self.thistab.enter_dir(tfile) elif selection: -- cgit 1.4.1-2-gfad0 From a78adddd9bc5cb919f0d903216415522fac8c19a Mon Sep 17 00:00:00 2001 From: Toon Nolten Date: Tue, 21 Aug 2018 10:55:53 +0200 Subject: Fix type in execute_file docstring --- ranger/core/actions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ranger/core/actions.py b/ranger/core/actions.py index 1417ac96..e645e2f8 100644 --- a/ranger/core/actions.py +++ b/ranger/core/actions.py @@ -407,7 +407,7 @@ class Actions( # pylint: disable=too-many-instance-attributes,too-many-public-m are multiple choices label: a string to select an opening method by its label flags: a string specifying additional options, see `man rifle` - mimetyle: pass the mimetype to rifle, overriding its own guess + mimetype: pass the mimetype to rifle, overriding its own guess """ mode = kw['mode'] if 'mode' in kw else 0 -- cgit 1.4.1-2-gfad0 From 37d39a99185b2eb43c2c9a807a1c4ed4477ebac5 Mon Sep 17 00:00:00 2001 From: Toon Nolten Date: Tue, 21 Aug 2018 12:24:00 +0200 Subject: Switch if/else branches to minimize negation --- ranger/core/actions.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ranger/core/actions.py b/ranger/core/actions.py index e645e2f8..087758c5 100644 --- a/ranger/core/actions.py +++ b/ranger/core/actions.py @@ -489,10 +489,10 @@ class Actions( # pylint: disable=too-many-instance-attributes,too-many-public-m if narg is not None: mode = narg tfile = self.thisfile - if not kw.get('selection', True): - selection = [tfile] - else: + if kw.get('selection', True): selection = self.thistab.get_selection() + else: + selection = [tfile] if tfile.is_directory: self.thistab.enter_dir(tfile) elif selection: -- cgit 1.4.1-2-gfad0