Kaydet (Commit) 35a92ce9 authored tarafından Michael W. Hudson's avatar Michael W. Hudson

Fix bug

[ 676342 ] after using pdb readline does not work correctly

using Michael Stone's patch so the completer functionality of
cmd is only setup between preloop and postloop.
üst c064a1d7
...@@ -86,13 +86,7 @@ class Cmd: ...@@ -86,13 +86,7 @@ class Cmd:
""" """
self.cmdqueue = [] self.cmdqueue = []
if completekey: self.completekey = completekey
try:
import readline
readline.set_completer(self.complete)
readline.parse_and_bind(completekey+": complete")
except ImportError:
pass
def cmdloop(self, intro=None): def cmdloop(self, intro=None):
"""Repeatedly issue a prompt, accept input, parse an initial prefix """Repeatedly issue a prompt, accept input, parse an initial prefix
...@@ -142,6 +136,13 @@ class Cmd: ...@@ -142,6 +136,13 @@ class Cmd:
def preloop(self): def preloop(self):
"""Hook method executed once when the cmdloop() method is called.""" """Hook method executed once when the cmdloop() method is called."""
if self.completekey:
try:
import readline
self.old_completer = readline.get_completer()
readline.set_completer(self.complete)
readline.parse_and_bind(self.completekey+": complete")
except ImportError:
pass pass
def postloop(self): def postloop(self):
...@@ -149,6 +150,11 @@ class Cmd: ...@@ -149,6 +150,11 @@ class Cmd:
return. return.
""" """
if self.completekey:
try:
import readline
readline.set_completer(self.old_completer)
except ImportError:
pass pass
def parseline(self, line): def parseline(self, line):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment