summary refs log tree commit diff stats
diff options
context:
space:
mode:
author강동훈(DongHoon Kang) <nanuda.kang@gmail.com>2017-03-12 09:56:23 +0900
committer강동훈(DongHoon Kang) <nanuda.kang@gmail.com>2017-03-12 09:56:23 +0900
commitd9129ca2da43cc9f7c070d9dfe6f676003e5ccbf (patch)
treecec77ef82b995e06bb0b2110856d81d70c352afb
parent619f2b23bb4330383afd586d21e896534b8fcf8e (diff)
downloadranger-d9129ca2da43cc9f7c070d9dfe6f676003e5ccbf.tar.gz
config.commands.cd.tab: Now tab works fine with '-r'
cd tab completion didn't work in the presence of real path argument '-r'.
Fixed that.
-rwxr-xr-xranger/config/commands.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/ranger/config/commands.py b/ranger/config/commands.py
index 8f71b241..9c1331df 100755
--- a/ranger/config/commands.py
+++ b/ranger/config/commands.py
@@ -149,7 +149,13 @@ class cd(Command):
         from os.path import dirname, basename, expanduser, join
 
         cwd = self.fm.thisdir.path
-        rel_dest = self.rest(1)
+
+        if self.arg(1) == '-r':
+            start = self.start(2)
+            rel_dest = self.arg(2)
+        else:
+            start = self.start(1)
+            rel_dest = self.arg(1)
 
         bookmarks = [v.path for v in self.fm.bookmarks.dct.values()
                      if rel_dest in v.path]
@@ -188,11 +194,11 @@ class cd(Command):
 
             # one result. since it must be a directory, append a slash.
             if len(dirnames) == 1:
-                return self.start(1) + join(rel_dirname, dirnames[0]) + '/'
+                return start + join(rel_dirname, dirnames[0]) + '/'
 
             # more than one result. append no slash, so the user can
             # manually type in the slash to advance into that directory
-            return (self.start(1) + join(rel_dirname, dirname) for dirname in dirnames)
+            return (start + join(rel_dirname, dirname) for dirname in dirnames)
 
 
 class chain(Command):