From 24aa66f1101d8ede2bbd8ae3a79d20cb398b1eec Mon Sep 17 00:00:00 2001 From: Kevin Van Brunt Date: Wed, 23 May 2018 11:16:27 -0400 Subject: Added tab completion of Python identifiers when running the Python console --- cmd2/rl_utils.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'cmd2/rl_utils.py') diff --git a/cmd2/rl_utils.py b/cmd2/rl_utils.py index 5d278a0b..55ca4a12 100644 --- a/cmd2/rl_utils.py +++ b/cmd2/rl_utils.py @@ -33,8 +33,17 @@ rl_type = RlType.NONE if 'pyreadline' in sys.modules: rl_type = RlType.PYREADLINE - # pyreadline is incomplete in terms of the Python readline API - # Add the missing functions we need + ############################################################################################################ + # pyreadline is incomplete in terms of the Python readline API. Add the missing functions we need. + ############################################################################################################ + # readline.redisplay() + try: + getattr(readline, 'redisplay') + except AttributeError: + # noinspection PyProtectedMember + readline.redisplay = readline.rl.mode._update_line + + # readline.remove_history_item() try: getattr(readline, 'remove_history_item') except AttributeError: -- cgit v1.2.1