summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2012-01-26 22:34:48 +0100
committerhut <hut@lavabit.com>2012-01-26 22:35:27 +0100
commit30f17d752f75f5950315e328b21bff50eac86ab4 (patch)
tree2704b90899e7dacd463fb54280088e2fc00b55cb /ranger
parent9e146c8272e25b98d0f196bc34ac1725f894863a (diff)
downloadranger-30f17d752f75f5950315e328b21bff50eac86ab4.tar.gz
api.commands: Fix slashes in _tab_directory_content()
Previously, when the tab completion result is unique, a slash was always
added, even if it's a file, not a directory.

Thanks to gwash for pointing out this bug.
Diffstat (limited to 'ranger')
-rw-r--r--ranger/api/commands.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/ranger/api/commands.py b/ranger/api/commands.py
index ea0df16b..a2501c7f 100644
--- a/ranger/api/commands.py
+++ b/ranger/api/commands.py
@@ -266,9 +266,11 @@ class Command(FileManagerAware):
 			if len(names) == 0:
 				return
 
-			# one result. since it must be a directory, append a slash.
+			# one result. append a slash if it's a directory
 			if len(names) == 1:
-				return self.start(1) + join(rel_dirname, names[0]) + '/'
+				path = join(rel_dirname, names[0])
+				slash = '/' if os.path.isdir(path) else ''
+				return self.start(1) + path + slash
 
 			# more than one result. append no slash, so the user can
 			# manually type in the slash to advance into that directory