Skip to content

Commit ff83f21

Browse files
committed
Added comment
1 parent 202cc07 commit ff83f21

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

cmd2.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2016,6 +2016,8 @@ def complete(self, text, state):
20162016

20172017
# Check if the token being completed has an opening quote
20182018
if raw_completion_token and raw_completion_token[0] in QUOTES:
2019+
2020+
# Since the token is still being completed, we know the opening quote is unclosed
20192021
unclosed_quote = raw_completion_token[0]
20202022

20212023
# readline still performs word breaks after a quote. Therefore something like quoted search
@@ -2092,12 +2094,11 @@ def complete(self, text, state):
20922094

20932095
# Figure out what kind of quote to add
20942096
if '"' in all_matches_str:
2095-
quote = "'"
2097+
unclosed_quote = "'"
20962098
else:
2097-
quote = '"'
2099+
unclosed_quote = '"'
20982100

2099-
unclosed_quote = quote
2100-
self.completion_matches = [quote + match for match in self.completion_matches]
2101+
self.completion_matches = [unclosed_quote + match for match in self.completion_matches]
21012102

21022103
# Check if we need to remove text from the beginning of tab completions
21032104
elif text_to_remove:

0 commit comments

Comments
 (0)