[Python-Dev] Re: extending readline functionality (now with patch) (original) (raw)

Michal Vitecek fuf@mageo.cz
Mon, 27 Jan 2003 17:09:47 +0100


--zhXaljGHf11kAtnf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline

and here comes the patch :)

Michal Vitecek wrote:

hello everyone,

attached is a patch against vanilla 2.2.2, which adds three new functions to module readline: removehistory(pos) -- remove history entry specified by pos replacehistoryentry(pos, line) -- replace history entry specified by pos with the given line gethistorybuffersize() -- get current number of history entries the libreadline.tex is also modified.

thank you for your consideration,

-- fuf (fuf@mageo.cz)

--zhXaljGHf11kAtnf Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="python-2.2.2-ext-readline.diff"

Binary files Python-2.2.2/Doc/lib/.libreadline.tex.swp and Python-2.2.2-ext-readline/Doc/lib/.libreadline.tex.swp differ diff -uNr Python-2.2.2/Doc/lib/libreadline.tex Python-2.2.2-ext-readline/Doc/lib/libreadline.tex --- Python-2.2.2/Doc/lib/libreadline.tex Fri Oct 19 03🔞43 2001 +++ Python-2.2.2-ext-readline/Doc/lib/libreadline.tex Mon Jan 27 16:41:57 2003 @@ -100,6 +100,18 @@ Append a line to the history buffer, as if it was the last line typed. \end{funcdesc}

+\begin{funcdesc}{remove_history}{pos} +Remove history entry specified by its position from the history. +\end{funcdesc} + +\begin{funcdesc}{replace_history_entry}{pos, line} +Replace history entry specified by its position with the given line. +\end{funcdesc} + +\begin{funcdesc}{get_history_buffer_length}{} +Get number of history entries. +\end{funcdesc} +

\begin{seealso} \seemodule{rlcompleter}{Completion of Python identifiers at the Binary files Python-2.2.2/Modules/.readline.c.swp and Python-2.2.2-ext-readline/Modules/.readline.c.swp differ diff -uNr Python-2.2.2/Modules/readline.c Python-2.2.2-ext-readline/Modules/readline.c --- Python-2.2.2/Modules/readline.c Sun Oct 6 07:43:47 2002 +++ Python-2.2.2-ext-readline/Modules/readline.c Mon Jan 27 16:55:55 2003 @@ -302,6 +302,85 @@ add_history(string) -> None\n
add a line to the history buffer";

+static PyObject * +py_remove_history(PyObject *self, PyObject *args) +{

+} + +static char doc_remove_history[] = "
+remove_history(pos) -> None\n
+removes history entry given by its position in history"; + +static PyObject * +py_replace_history_entry(PyObject *self, PyObject *args) +{

+} + +static char doc_replace_history_entry[] = "
+replace_history_entry(pos, line) -> None\n
+replaces history entry given by its position with contents of line"; + +static PyObject * +py_get_history_buffer_length(PyObject *self, PyObject *args) +{

+} + +static char doc_get_history_buffer_length[] = "
+get_history_buffer_length() -> length\n
+returns number of entries in the history";

/* get the tab-completion word-delimiters that readline uses */

@@ -391,8 +470,10 @@ {"set_completer_delims", set_completer_delims, METH_VARARGS, doc_set_completer_delims}, {"add_history", py_add_history, METH_VARARGS, doc_add_history}, - {"get_completer_delims", get_completer_delims, - METH_OLDARGS, doc_get_completer_delims},

--zhXaljGHf11kAtnf--