"""
self.cmdqueue = []
- if completekey:
- try:
- import readline
- readline.set_completer(self.complete)
- readline.parse_and_bind(completekey+": complete")
- except ImportError:
- pass
+ self.completekey = completekey
def cmdloop(self, intro=None):
"""Repeatedly issue a prompt, accept input, parse an initial prefix
def preloop(self):
"""Hook method executed once when the cmdloop() method is called."""
- pass
+ 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
def postloop(self):
"""Hook method executed once when the cmdloop() method is about to
return.
"""
- pass
+ if self.completekey:
+ try:
+ import readline
+ readline.set_completer(self.old_completer)
+ except ImportError:
+ pass
def parseline(self, line):
line = line.strip()
Release date: XX-XXX-2003
============================
+- Backported SF patch #676342: after using pdb, the readline command
+ completion was botched.
+
- Fix problem building on OSF1 because the compiler only accepted
preprocessor directives that start in column 1. (SF bug #691793.)
It should return the next possible completion starting with 'text'.\
";
+static PyObject *
+get_completer(PyObject *self, PyObject *args)
+{
+ if (completer == NULL) {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+ Py_INCREF(completer);
+ return completer;
+}
+
+static char doc_get_completer[] = "\
+get_completer() -> function\n\
+\n\
+Returns current completer function.\
+";
+
/* Exported function to read the current line buffer */
static PyObject *
{"get_history_length", get_history_length,
METH_VARARGS, get_history_length_doc},
{"set_completer", set_completer, METH_VARARGS, doc_set_completer},
+ {"get_completer", get_completer, METH_VARARGS, doc_get_completer},
{"get_begidx", get_begidx, METH_OLDARGS, doc_get_begidx},
{"get_endidx", get_endidx, METH_OLDARGS, doc_get_endidx},