diff options
author | Guido van Rossum <guido@python.org> | 1999-01-05 17:16:46 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1999-01-05 17:16:46 (GMT) |
commit | 716a89c606ae15731125f75d31082598f79e5ae2 (patch) | |
tree | 4cacb980627d9e15fc8fca4a8f3908e6fb8c9141 /Modules | |
parent | 5d56d3665f53cdce6feacb42345504db9899520a (diff) | |
download | cpython-716a89c606ae15731125f75d31082598f79e5ae2.zip cpython-716a89c606ae15731125f75d31082598f79e5ae2.tar.gz cpython-716a89c606ae15731125f75d31082598f79e5ae2.tar.bz2 |
Patch by Charles Waldman to implement an optional nlines argument to
w.scroll(). (It then calls wscrl(win, nlines) instead of scoll(win).)
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_cursesmodule.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c index f46b0bc..f76bf03 100644 --- a/Modules/_cursesmodule.c +++ b/Modules/_cursesmodule.c @@ -122,6 +122,7 @@ None clear() None clrtobot() None clrtoeol() None scroll() + scroll(nlines) None touchwin() None touchline(start,count) IntObject getch(y,x) @@ -841,9 +842,24 @@ PyCursesWindow_Scroll(self,arg) PyCursesWindowObject *self; PyObject * arg; { - if (!PyArg_NoArgs(arg)) + int nlines; + int use_nlines = FALSE; + switch (ARG_COUNT(arg)) { + case 0: + break; + case 1: + if (!PyArg_Parse(arg, "i;nlines", &nlines)) return NULL; - return PyCursesCheckERR(scroll(self->win), "scroll"); + use_nlines = TRUE; + break; + default: + PyErr_SetString(PyExc_TypeError, "scroll requires 0 or 1 arguments"); + return NULL; + } + if (use_nlines) + return PyCursesCheckERR(wscrl(self->win, nlines), "scroll"); + else + return PyCursesCheckERR(scroll(self->win), "scroll"); } static PyObject * |