Skip to content

Commit 7b9b4bf

Browse files
committed
Changed opening quote check and comment for clarity
1 parent daab800 commit 7b9b4bf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cmd2.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2087,9 +2087,9 @@ def complete(self, text, state):
20872087
# Join all matches into 1 string for ease of searching
20882088
all_matches_str = ''.join(self.completion_matches)
20892089

2090-
# If there is a tab completion that will alter the text on the command line and
2091-
# any of the matches have a space, then we must add an opening quote to the matches.
2092-
if common_prefix != text and ' ' in all_matches_str:
2090+
# If the tab completion will extend the text on the command line and any of
2091+
# the matches have a space, then we will add an opening quote to the matches.
2092+
if len(common_prefix) > len(text) and ' ' in all_matches_str:
20932093

20942094
# Figure out what kind of quote to add and save it as the unclosed_quote
20952095
if '"' in all_matches_str:

0 commit comments

Comments
 (0)