@@ -467,9 +467,11 @@ def __init__(
467467 # An optional hint which prints above tab completion suggestions
468468 self .completion_hint = ''
469469
470- # Already formatted completion results. If this is populated, then cmd2 will print it instead
471- # of using readline's columnized results. ANSI style sequences and newlines in tab completion
472- # results are supported by this member. ArgparseCompleter uses this to print tab completion tables.
470+ # Normally cmd2 uses readline's formatter to columnize the list of completion suggestions.
471+ # If a custom format is preferred, write the formatted completions to this string. cmd2 will
472+ # then print it instead of the readline format. ANSI style sequences and newlines are supported
473+ # when using this value. Even when using formatted_completions, the full matches must still be returned
474+ # from your completer function. ArgparseCompleter writes its tab completion tables to this string.
473475 self .formatted_completions = ''
474476
475477 # Used by complete() for readline tab completion
@@ -480,7 +482,7 @@ def __init__(
480482 # want to display the final portion of the matches as the tab completion suggestions. The full matches
481483 # still must be returned from your completer function. For an example, look at path_complete() which
482484 # uses this to show only the basename of paths as the suggestions. delimiter_complete() also populates
483- # this list.
485+ # this list. These are ignored if self.formatted_completions is populated.
484486 self .display_matches = []
485487
486488 # Used by functions like path_complete() and delimiter_complete() to properly
@@ -489,6 +491,7 @@ def __init__(
489491
490492 # Set to True before returning matches to complete() in cases where matches have already been sorted.
491493 # If False, then complete() will sort the matches using self.default_sort_key before they are displayed.
494+ # This does not affect self.formatted_completions.
492495 self .matches_sorted = False
493496
494497 ############################################################################################################
@@ -1651,7 +1654,6 @@ def _display_matches_gnu_readline(
16511654 self , substitution : str , matches : List [str ], longest_match_length : int
16521655 ) -> None : # pragma: no cover
16531656 """Prints a match list using GNU readline's rl_display_match_list()
1654- This exists to print self.display_matches if it has data. Otherwise matches prints.
16551657
16561658 :param substitution: the substitution written to the command line
16571659 :param matches: the tab completion matches to display
@@ -1714,7 +1716,6 @@ def _display_matches_gnu_readline(
17141716
17151717 def _display_matches_pyreadline (self , matches : List [str ]) -> None : # pragma: no cover
17161718 """Prints a match list using pyreadline's _display_completions()
1717- This exists to print self.display_matches if it has data. Otherwise matches prints.
17181719
17191720 :param matches: the tab completion matches to display
17201721 """
0 commit comments