cpython: 132b5376bf34 (original) (raw)
Mercurial > cpython
changeset 95682:132b5376bf34
Issue #4254: Adds _curses.update_lines_cols() Patch by Arnon Yaari [#4254]
Steve Dower steve.dower@microsoft.com | |
---|---|
date | Wed, 15 Apr 2015 18:06:05 -0400 |
parents | 948745d0d9cf |
children | fc0e79387a3a |
files | Doc/library/curses.rst Doc/whatsnew/3.5.rst Lib/test/test_curses.py Misc/NEWS Modules/_cursesmodule.c |
diffstat | 5 files changed, 31 insertions(+), 0 deletions(-)[+] [-] Doc/library/curses.rst 7 Doc/whatsnew/3.5.rst 5 Lib/test/test_curses.py 7 Misc/NEWS 2 Modules/_cursesmodule.c 10 |
line wrap: on
line diff
--- a/Doc/library/curses.rst
+++ b/Doc/library/curses.rst
@@ -599,6 +599,13 @@ The module :mod:curses
defines the fol
Only one ch can be pushed before :meth:getch
is called.
+.. function:: update_lines_cols()
+
- Update :envvar:
LINES
and :envvar:COLS
. Useful for detecting manual screen resize. + - .. versionadded:: 3.5 +
+
.. function:: unget_wch(ch)
Push ch so the next :meth:get_wch
will return it.
--- a/Doc/whatsnew/3.5.rst
+++ b/Doc/whatsnew/3.5.rst
@@ -289,6 +289,11 @@ contextlib
don't provide any options to redirect it.
(Contributed by Berker Peksag in :issue:22389
.)
+curses
+------
+* The new :func:curses.update_lines_cols
function updates the variables
--- a/Lib/test/test_curses.py +++ b/Lib/test/test_curses.py @@ -370,6 +370,13 @@ class TestCurses(unittest.TestCase): offset = human_readable_signature.find("[y, x,]") assert offset >= 0, ""
- def test_update_lines_cols(self):
# this doesn't actually test that LINES and COLS are updated,[](#l3.8)
# because we can't automate changing them. See Issue #4254 for[](#l3.9)
# a manual test script. We can only test that the function[](#l3.10)
# can be called.[](#l3.11)
curses.update_lines_cols()[](#l3.12)
+ if name == 'main': unittest.main()
--- a/Misc/NEWS +++ b/Misc/NEWS @@ -36,6 +36,8 @@ Core and Builtins Library ------- +- Issue #4254: Adds _curses.update_lines_cols() Patch by Arnon Yaari +
--- a/Modules/_cursesmodule.c +++ b/Modules/_cursesmodule.c @@ -2866,6 +2866,13 @@ update_lines_cols(void) Py_DECREF(m); return 1; } + +static PyObject * +PyCurses_update_lines_cols(PyObject *self) +{
#endif #ifdef HAVE_CURSES_RESIZETERM @@ -3268,6 +3275,9 @@ static PyMethodDef PyCurses_methods[] = {"typeahead", (PyCFunction)PyCurses_TypeAhead, METH_VARARGS}, {"unctrl", (PyCFunction)PyCurses_UnCtrl, METH_VARARGS}, {"ungetch", (PyCFunction)PyCurses_UngetCh, METH_VARARGS}, +#if defined(HAVE_CURSES_RESIZETERM) || defined(HAVE_CURSES_RESIZE_TERM)
+#endif #ifdef HAVE_NCURSESW {"unget_wch", (PyCFunction)PyCurses_Unget_Wch, METH_VARARGS}, #endif