From bd7361adbade8a532fbb12b9b4333a77c8c67453 Mon Sep 17 00:00:00 2001 From: Leo Vivier Date: Sun, 10 Feb 2019 15:55:58 +0100 Subject: rename_append: Use `rename` if point is on a directory When the directory at point has full-stops in it, rename_append would put the point at the last period in the dir-name, as it would with a file. --- ranger/config/commands.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ranger/config/commands.py b/ranger/config/commands.py index d177203a..93da7fe2 100755 --- a/ranger/config/commands.py +++ b/ranger/config/commands.py @@ -1000,6 +1000,10 @@ class rename_append(Command): self.fm.open_console('rename ' + relpath) return + if os.path.isdir(relpath): + self.fm.open_console('rename ' + relpath) + return + if self._flag_ext_all: pos_ext = re.search(r'[^.]+', basename).end(0) else: -- cgit 1.4.1-2-gfad0 From 94ca9a984740eaa46a342e8a7e4ad04e351e8138 Mon Sep 17 00:00:00 2001 From: Leo Vivier Date: Wed, 13 Feb 2019 19:16:53 +0100 Subject: Merge conditions with an ‘or’ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ranger/config/commands.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/ranger/config/commands.py b/ranger/config/commands.py index 93da7fe2..fe628e75 100755 --- a/ranger/config/commands.py +++ b/ranger/config/commands.py @@ -996,11 +996,7 @@ class rename_append(Command): relpath = tfile.relative_path.replace(MACRO_DELIMITER, MACRO_DELIMITER_ESC) basename = tfile.basename.replace(MACRO_DELIMITER, MACRO_DELIMITER_ESC) - if basename.find('.') <= 0: - self.fm.open_console('rename ' + relpath) - return - - if os.path.isdir(relpath): + if basename.find('.') <= 0 or os.path.isdir(relpath): self.fm.open_console('rename ' + relpath) return -- cgit 1.4.1-2-gfad0