Skip to content

Commit 4c9e18c

Browse files
authored
Merge pull request #336 from python-cmd2/refactor
Refactored function
2 parents 844fd2d + 8d9caa0 commit 4c9e18c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

cmd2.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1764,22 +1764,22 @@ def _pad_matches_to_display(matches_to_display):
17641764
Adds padding to the matches being displayed as tab completion suggestions.
17651765
The default padding of readline/pyreadine is small and not visually appealing
17661766
especially if matches have spaces. It appears very squished together.
1767+
17671768
:param matches_to_display: the matches being padded
1768-
:return: the padded matches and length of padding
1769+
:return: the padded matches and length of padding that was added
17691770
"""
1771+
if rl_type == RlType.NONE:
1772+
return matches_to_display, 0
1773+
17701774
if rl_type == RlType.GNU:
17711775
# Add 2 to the padding of 2 that readline uses for a total of 4.
17721776
padding = 2 * ' '
1773-
return [cur_match + padding for cur_match in matches_to_display], len(padding)
17741777

17751778
elif rl_type == RlType.PYREADLINE:
17761779
# Add 3 to the padding of 1 that pyreadline uses for a total of 4.
17771780
padding = 3 * ' '
1778-
return [cur_match + padding for cur_match in matches_to_display], len(padding)
17791781

1780-
else:
1781-
# This function is meaningless without readline
1782-
return matches_to_display, 0
1782+
return [cur_match + padding for cur_match in matches_to_display], len(padding)
17831783

17841784
def _display_matches_gnu_readline(self, substitution, matches, longest_match_length):
17851785
"""

0 commit comments

Comments
 (0)