Skip to content

Commit 4447a8b

Browse files
committed
Properly copying a list
1 parent 5868fee commit 4447a8b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

cmd2/cmd2.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -591,17 +591,21 @@ def complete_submenu(_self, text, line, begidx, endidx):
591591
try:
592592
# copy over any shared attributes
593593
self._copy_in_shared_attrs(_self)
594-
submenu.allow_appended_space = _self.allow_appended_space
595-
submenu.allow_closing_quote = _self.allow_closing_quote
596-
submenu.display_matches = _self.display_matches
594+
595+
# Reset the submenu's tab completion parameters
596+
submenu.allow_appended_space = True
597+
submenu.allow_closing_quote = True
598+
submenu.display_matches = []
597599

598600
return _complete_from_cmd(submenu, text, line, begidx, endidx)
599601
finally:
600602
# copy back original attributes
601603
self._copy_out_shared_attrs(_self, original_attributes)
604+
605+
# Pass the submenu's tab completion parameters back up to the menu that called complete()
602606
_self.allow_appended_space = submenu.allow_appended_space
603607
_self.allow_closing_quote = submenu.allow_closing_quote
604-
_self.display_matches = submenu.display_matches
608+
_self.display_matches = copy.copy(submenu.display_matches)
605609

606610
original_do_help = cmd_obj.do_help
607611
original_complete_help = cmd_obj.complete_help

0 commit comments

Comments
 (0)