[issue9033] cmd module tab misbehavior

Ronald Oussoren report at bugs.python.org
Tue Jun 22 16:11:46 CEST 2010


Ronald Oussoren <ronaldoussoren at mac.com> added the comment:

This (untested) patch should fix the issue for the cmd module:


+++ Lib/cmd.py	(working copy)
@@ -112,7 +112,18 @@
                 import readline
                 self.old_completer = readline.get_completer()
                 readline.set_completer(self.complete)
-                readline.parse_and_bind(self.completekey+": complete")
+
+                if 'libedit' in readline.__doc__:
+                    # readline linked to BSD libedit
+                    if self.completekey == 'tab':
+                        key = '^I'
+                    else:
+                        key = self.completekey
+                    readline.parse_and_bind("bind %s rl_complete"%(key,))
+
+                else:
+                    # readline linked to the real readline
+                    readline.parse_and_bind(self.completekey+": complete")
             except ImportError:
                 pass
         try:

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9033>
_______________________________________


More information about the Python-bugs-list mailing list