summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkmvanbrunt <kmvanbrunt@gmail.com>2018-04-03 22:26:42 -0400
committerGitHub <noreply@github.com>2018-04-03 22:26:42 -0400
commit4c9e18ceec716d83b574353739cf4837002ca396 (patch)
tree186ca6e4a499b422d2bfb22f39e3e5bbb1481c90
parent844fd2d1a981a675774811852d3ef79dd2eda0b3 (diff)
parent8d9caa0751fac23475c74f02998b7e1de6fbbb65 (diff)
downloadcmd2-git-4c9e18ceec716d83b574353739cf4837002ca396.tar.gz
Merge pull request #336 from python-cmd2/refactor
Refactored function
-rwxr-xr-xcmd2.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/cmd2.py b/cmd2.py
index 8f91598e..ae37e943 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -1764,22 +1764,22 @@ class Cmd(cmd.Cmd):
Adds padding to the matches being displayed as tab completion suggestions.
The default padding of readline/pyreadine is small and not visually appealing
especially if matches have spaces. It appears very squished together.
+
:param matches_to_display: the matches being padded
- :return: the padded matches and length of padding
+ :return: the padded matches and length of padding that was added
"""
+ if rl_type == RlType.NONE:
+ return matches_to_display, 0
+
if rl_type == RlType.GNU:
# Add 2 to the padding of 2 that readline uses for a total of 4.
padding = 2 * ' '
- return [cur_match + padding for cur_match in matches_to_display], len(padding)
elif rl_type == RlType.PYREADLINE:
# Add 3 to the padding of 1 that pyreadline uses for a total of 4.
padding = 3 * ' '
- return [cur_match + padding for cur_match in matches_to_display], len(padding)
- else:
- # This function is meaningless without readline
- return matches_to_display, 0
+ return [cur_match + padding for cur_match in matches_to_display], len(padding)
def _display_matches_gnu_readline(self, substitution, matches, longest_match_length):
"""