summaryrefslogtreecommitdiff
path: root/cmd2.py
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2018-03-26 04:44:25 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2018-03-26 04:44:25 -0400
commitf5e009e3c3fcbc87fead5d9c204ffebe3d4149db (patch)
treec409b330a3a97357aad2eb5fdbe748b17db129a8 /cmd2.py
parenteb851f40287b93ed8e224046c215888b39b5ad8a (diff)
downloadcmd2-git-f5e009e3c3fcbc87fead5d9c204ffebe3d4149db.tar.gz
Fixed indexing bug and unit test
Diffstat (limited to 'cmd2.py')
-rwxr-xr-xcmd2.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/cmd2.py b/cmd2.py
index f0252f48..02a6493e 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -1576,15 +1576,15 @@ class Cmd(cmd.Cmd):
self.allow_closing_quote = False
# Build display_matches and add a slash to directories
- for cur_match in completion_matches:
+ for index, cur_match in enumerate(completion_matches):
# Display only the basename of this path in the tab-completion suggestions
self.display_matches.append(os.path.basename(cur_match))
# Add a separator after directories if the next character isn't already a separator
if os.path.isdir(cur_match) and add_trailing_sep_if_dir:
- completion_matches[-1] += os.path.sep
- self.display_matches[-1] += os.path.sep
+ completion_matches[index] += os.path.sep
+ self.display_matches[index] += os.path.sep
# Remove cwd if it was added
if cwd_added: