summaryrefslogtreecommitdiff
path: root/cmd2/argparse_completer.py
diff options
context:
space:
mode:
Diffstat (limited to 'cmd2/argparse_completer.py')
-rw-r--r--cmd2/argparse_completer.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/cmd2/argparse_completer.py b/cmd2/argparse_completer.py
index 7732c5c5..891622d1 100644
--- a/cmd2/argparse_completer.py
+++ b/cmd2/argparse_completer.py
@@ -70,9 +70,9 @@ from argparse import ZERO_OR_MORE, ONE_OR_MORE, ArgumentError, _, _get_action_na
from typing import List, Dict, Tuple, Callable, Union
from colorama import Fore
-from wcwidth import wcswidth
from .rl_utils import rl_force_redisplay
+from .utils import ansi_safe_wcswidth
# attribute that can optionally added to an argparse argument (called an Action) to
# define the completion choices for the argument. You may provide a Collection or a Function.
@@ -587,16 +587,16 @@ class AutoCompleter(object):
def _format_completions(self, action, completions: List[Union[str, CompletionItem]]) -> List[str]:
if completions and len(completions) > 1 and isinstance(completions[0], CompletionItem):
- # If the user has not already sorted the CompletionItems, then do that now
+ # If the user has not already sorted the CompletionItems, then sort them before appending the descriptions
if not self._cmd2_app.matches_sorted:
completions.sort(key=self._cmd2_app.matches_sort_key)
self._cmd2_app.matches_sorted = True
- token_width = wcswidth(action.dest)
+ token_width = ansi_safe_wcswidth(action.dest)
completions_with_desc = []
for item in completions:
- item_width = wcswidth(item)
+ item_width = ansi_safe_wcswidth(item)
if item_width > token_width:
token_width = item_width