@@ -2507,6 +2507,55 @@ PyCursesWindow_set_encoding(PyCursesWindowObject *self, PyObject *value, void *P
25072507
25082508#include "clinic/_cursesmodule.c.h"
25092509
2510+ PyDoc_STRVAR (_curses_window_chgat__doc__ ,
2511+ "chgat([y, x,] [n=-1,] attr)\n"
2512+ "Set the attributes of characters.\n"
2513+ "\n"
2514+ " y\n"
2515+ " Y-coordinate.\n"
2516+ " x\n"
2517+ " X-coordinate.\n"
2518+ " n\n"
2519+ " Number of characters.\n"
2520+ " attr\n"
2521+ " Attributes for characters.\n"
2522+ "\n"
2523+ "Set the attributes of num characters at the current cursor position, or at\n"
2524+ "position (y, x) if supplied. If no value of num is given or num = -1, the\n"
2525+ "attribute will be set on all the characters to the end of the line. This\n"
2526+ "function does not move the cursor. The changed line will be touched using\n"
2527+ "the touchline() method so that the contents will be redisplayed by the next\n"
2528+ "window refresh." );
2529+
2530+ PyDoc_STRVAR (_curses_window_getstr__doc__ ,
2531+ "getstr([[y, x,] n=2047])\n"
2532+ "Read a string from the user, with primitive line editing capacity.\n"
2533+ "\n"
2534+ " y\n"
2535+ " Y-coordinate.\n"
2536+ " x\n"
2537+ " X-coordinate.\n"
2538+ " n\n"
2539+ " Maximal number of characters." );
2540+
2541+ PyDoc_STRVAR (_curses_window_instr__doc__ ,
2542+ "instr([y, x,] n=2047)\n"
2543+ "Return a string of characters, extracted from the window.\n"
2544+ "\n"
2545+ " y\n"
2546+ " Y-coordinate.\n"
2547+ " x\n"
2548+ " X-coordinate.\n"
2549+ " n\n"
2550+ " Maximal number of characters.\n"
2551+ "\n"
2552+ "Return a string of characters, extracted from the window starting\n"
2553+ "at the current cursor position, or at y, x if specified, and\n"
2554+ "stopping at the end of the line. Attributes and color\n"
2555+ "information are stripped from the characters. If n is specified,\n"
2556+ "instr() returns a string at most n characters long (exclusive of\n"
2557+ "the trailing NUL)." );
2558+
25102559static PyMethodDef PyCursesWindow_Methods [] = {
25112560 _CURSES_WINDOW_ADDCH_METHODDEF
25122561 _CURSES_WINDOW_ADDNSTR_METHODDEF
@@ -2516,79 +2565,149 @@ static PyMethodDef PyCursesWindow_Methods[] = {
25162565 _CURSES_WINDOW_ATTRSET_METHODDEF
25172566 _CURSES_WINDOW_BKGD_METHODDEF
25182567#ifdef HAVE_CURSES_WCHGAT
2519- {"chgat" , (PyCFunction )PyCursesWindow_ChgAt , METH_VARARGS },
2568+ {"chgat" , (PyCFunction )PyCursesWindow_ChgAt , METH_VARARGS , _curses_window_chgat__doc__ },
25202569#endif
25212570 _CURSES_WINDOW_BKGDSET_METHODDEF
25222571 _CURSES_WINDOW_BORDER_METHODDEF
25232572 _CURSES_WINDOW_BOX_METHODDEF
2524- {"clear" , (PyCFunction )PyCursesWindow_wclear , METH_NOARGS },
2525- {"clearok" , (PyCFunction )PyCursesWindow_clearok , METH_VARARGS },
2526- {"clrtobot" , (PyCFunction )PyCursesWindow_wclrtobot , METH_NOARGS },
2527- {"clrtoeol" , (PyCFunction )PyCursesWindow_wclrtoeol , METH_NOARGS },
2528- {"cursyncup" , (PyCFunction )PyCursesWindow_wcursyncup , METH_NOARGS },
2573+ {"clear" , (PyCFunction )PyCursesWindow_wclear , METH_NOARGS ,
2574+ "clear($self, /)\n--\n\n"
2575+ "Clear the window and repaint it completely on the next refresh()." },
2576+ {"clearok" , (PyCFunction )PyCursesWindow_clearok , METH_VARARGS ,
2577+ "clearok($self, flag, /)\n--\n\n"
2578+ "Clear the window on the next refresh() if flag is true." },
2579+ {"clrtobot" , (PyCFunction )PyCursesWindow_wclrtobot , METH_NOARGS ,
2580+ "clrtobot($self, /)\n--\n\n"
2581+ "Erase from the cursor to the end of the window." },
2582+ {"clrtoeol" , (PyCFunction )PyCursesWindow_wclrtoeol , METH_NOARGS ,
2583+ "clrtoeol($self, /)\n--\n\n"
2584+ "Erase from the cursor to the end of the line." },
2585+ {"cursyncup" , (PyCFunction )PyCursesWindow_wcursyncup , METH_NOARGS ,
2586+ "cursyncup($self, /)\n--\n\n"
2587+ "Update the cursor position of all ancestor windows to match." },
25292588 _CURSES_WINDOW_DELCH_METHODDEF
2530- {"deleteln" , (PyCFunction )PyCursesWindow_wdeleteln , METH_NOARGS },
2589+ {"deleteln" , (PyCFunction )PyCursesWindow_wdeleteln , METH_NOARGS ,
2590+ "deleteln($self, /)\n--\n\n"
2591+ "Delete the line under the cursor; move following lines up by one." },
25312592 _CURSES_WINDOW_DERWIN_METHODDEF
25322593 _CURSES_WINDOW_ECHOCHAR_METHODDEF
25332594 _CURSES_WINDOW_ENCLOSE_METHODDEF
2534- {"erase ", (PyCFunction )PyCursesWindow_werase , METH_NOARGS },
2535- {"getbegyx ", (PyCFunction)PyCursesWindow_getbegyx, METH_NOARGS},
2595+ {"erase ", (PyCFunction)PyCursesWindow_werase, METH_NOARGS,
2596+ " erase ($self , /)\n -- \n \n "
2597+ " Clear the window ."},
2598+ {"getbegyx" , (PyCFunction )PyCursesWindow_getbegyx , METH_NOARGS ,
2599+ "getbegyx($self, /)\n--\n\n"
2600+ "Return a tuple (y, x) of the upper-left corner coordinates." },
25362601 _CURSES_WINDOW_GETBKGD_METHODDEF
25372602 _CURSES_WINDOW_GETCH_METHODDEF
25382603 _CURSES_WINDOW_GETKEY_METHODDEF
25392604 _CURSES_WINDOW_GET_WCH_METHODDEF
2540- {"getmaxyx" , (PyCFunction )PyCursesWindow_getmaxyx , METH_NOARGS },
2541- {"getparyx" , (PyCFunction )PyCursesWindow_getparyx , METH_NOARGS },
2542- {"getstr" , (PyCFunction )PyCursesWindow_GetStr , METH_VARARGS },
2543- {"getyx" , (PyCFunction )PyCursesWindow_getyx , METH_NOARGS },
2605+ {"getmaxyx" , (PyCFunction )PyCursesWindow_getmaxyx , METH_NOARGS ,
2606+ "getmaxyx($self, /)\n--\n\n"
2607+ "Return a tuple (y, x) of the window height and width." },
2608+ {"getparyx" , (PyCFunction )PyCursesWindow_getparyx , METH_NOARGS ,
2609+ "getparyx($self, /)\n--\n\n"
2610+ "Return (y, x) relative to the parent window, or (-1, -1) if none." },
2611+ {"getstr" , (PyCFunction )PyCursesWindow_GetStr , METH_VARARGS , _curses_window_getstr__doc__ },
2612+ {"getyx" , (PyCFunction )PyCursesWindow_getyx , METH_NOARGS ,
2613+ "getyx($self, /)\n--\n\n"
2614+ "Return a tuple (y, x) of the current cursor position." },
25442615 _CURSES_WINDOW_HLINE_METHODDEF
2545- {"idcok" , (PyCFunction )PyCursesWindow_idcok , METH_VARARGS },
2546- {"idlok" , (PyCFunction )PyCursesWindow_idlok , METH_VARARGS },
2616+ {"idcok" , (PyCFunction )PyCursesWindow_idcok , METH_VARARGS ,
2617+ "idcok($self, flag, /)\n--\n\n"
2618+ "Enable or disable the hardware insert/delete character feature." },
2619+ {"idlok" , (PyCFunction )PyCursesWindow_idlok , METH_VARARGS ,
2620+ "idlok($self, flag, /)\n--\n\n"
2621+ "Enable or disable the hardware insert/delete line feature." },
25472622#ifdef HAVE_CURSES_IMMEDOK
2548- {"immedok" , (PyCFunction )PyCursesWindow_immedok , METH_VARARGS },
2623+ {"immedok" , (PyCFunction )PyCursesWindow_immedok , METH_VARARGS ,
2624+ "immedok($self, flag, /)\n--\n\n"
2625+ "If flag is true, refresh the window on every change to it." },
25492626#endif
25502627 _CURSES_WINDOW_INCH_METHODDEF
25512628 _CURSES_WINDOW_INSCH_METHODDEF
2552- {"insdelln" , (PyCFunction )PyCursesWindow_winsdelln , METH_VARARGS },
2553- {"insertln" , (PyCFunction )PyCursesWindow_winsertln , METH_NOARGS },
2629+ {"insdelln" , (PyCFunction )PyCursesWindow_winsdelln , METH_VARARGS ,
2630+ "insdelln($self, nlines, /)\n--\n\n"
2631+ "Insert (nlines > 0) or delete (nlines < 0) lines above the cursor." },
2632+ {"insertln" , (PyCFunction )PyCursesWindow_winsertln , METH_NOARGS ,
2633+ "insertln($self, /)\n--\n\n"
2634+ "Insert a blank line under the cursor; move following lines down." },
25542635 _CURSES_WINDOW_INSNSTR_METHODDEF
25552636 _CURSES_WINDOW_INSSTR_METHODDEF
2556- {"instr" , (PyCFunction )PyCursesWindow_InStr , METH_VARARGS },
2637+ {"instr" , (PyCFunction )PyCursesWindow_InStr , METH_VARARGS , _curses_window_instr__doc__ },
25572638 _CURSES_WINDOW_IS_LINETOUCHED_METHODDEF
2558- {"is_wintouched" , (PyCFunction )PyCursesWindow_is_wintouched , METH_NOARGS },
2559- {"keypad" , (PyCFunction )PyCursesWindow_keypad , METH_VARARGS },
2560- {"leaveok" , (PyCFunction )PyCursesWindow_leaveok , METH_VARARGS },
2561- {"move" , (PyCFunction )PyCursesWindow_wmove , METH_VARARGS },
2562- {"mvderwin" , (PyCFunction )PyCursesWindow_mvderwin , METH_VARARGS },
2563- {"mvwin" , (PyCFunction )PyCursesWindow_mvwin , METH_VARARGS },
2564- {"nodelay" , (PyCFunction )PyCursesWindow_nodelay , METH_VARARGS },
2565- {"notimeout" , (PyCFunction )PyCursesWindow_notimeout , METH_VARARGS },
2639+ {"is_wintouched" , (PyCFunction )PyCursesWindow_is_wintouched , METH_NOARGS ,
2640+ "is_wintouched($self, /)\n--\n\n"
2641+ "Return True if the window changed since the last refresh()." },
2642+ {"keypad" , (PyCFunction )PyCursesWindow_keypad , METH_VARARGS ,
2643+ "keypad($self, flag, /)\n--\n\n"
2644+ "Interpret escape sequences for special keys if flag is true." },
2645+ {"leaveok" , (PyCFunction )PyCursesWindow_leaveok , METH_VARARGS ,
2646+ "leaveok($self, flag, /)\n--\n\n"
2647+ "If flag is true, leave the cursor where the update leaves it." },
2648+ {"move" , (PyCFunction )PyCursesWindow_wmove , METH_VARARGS ,
2649+ "move($self, new_y, new_x, /)\n--\n\n"
2650+ "Move the cursor to (new_y, new_x)." },
2651+ {"mvderwin" , (PyCFunction )PyCursesWindow_mvderwin , METH_VARARGS ,
2652+ "mvderwin($self, y, x, /)\n--\n\n"
2653+ "Move the window inside its parent window." },
2654+ {"mvwin" , (PyCFunction )PyCursesWindow_mvwin , METH_VARARGS ,
2655+ "mvwin($self, new_y, new_x, /)\n--\n\n"
2656+ "Move the window so its upper-left corner is at (new_y, new_x)." },
2657+ {"nodelay" , (PyCFunction )PyCursesWindow_nodelay , METH_VARARGS ,
2658+ "nodelay($self, flag, /)\n--\n\n"
2659+ "If flag is true, getch() becomes non-blocking." },
2660+ {"notimeout" , (PyCFunction )PyCursesWindow_notimeout , METH_VARARGS ,
2661+ "notimeout($self, flag, /)\n--\n\n"
2662+ "If flag is true, do not time out escape sequences." },
25662663 _CURSES_WINDOW_NOUTREFRESH_METHODDEF
25672664 _CURSES_WINDOW_OVERLAY_METHODDEF
25682665 _CURSES_WINDOW_OVERWRITE_METHODDEF
25692666 _CURSES_WINDOW_PUTWIN_METHODDEF
25702667 _CURSES_WINDOW_REDRAWLN_METHODDEF
2571- {"redrawwin" , (PyCFunction )PyCursesWindow_redrawwin , METH_NOARGS },
2668+ {"redrawwin" , (PyCFunction )PyCursesWindow_redrawwin , METH_NOARGS ,
2669+ "redrawwin($self, /)\n--\n\n"
2670+ "Mark the entire window for redraw on the next refresh()." },
25722671 _CURSES_WINDOW_REFRESH_METHODDEF
25732672#ifndef STRICT_SYSV_CURSES
2574- {"resize" , (PyCFunction )PyCursesWindow_wresize , METH_VARARGS },
2673+ {"resize" , (PyCFunction )PyCursesWindow_wresize , METH_VARARGS ,
2674+ "resize($self, nlines, ncols, /)\n--\n\n"
2675+ "Resize the window to nlines rows and ncols columns." },
25752676#endif
25762677 _CURSES_WINDOW_SCROLL_METHODDEF
2577- {"scrollok" , (PyCFunction )PyCursesWindow_scrollok , METH_VARARGS },
2678+ {"scrollok" , (PyCFunction )PyCursesWindow_scrollok , METH_VARARGS ,
2679+ "scrollok($self, flag, /)\n--\n\n"
2680+ "Control whether the window scrolls when the cursor moves off it." },
25782681 _CURSES_WINDOW_SETSCRREG_METHODDEF
2579- {"standend" , (PyCFunction )PyCursesWindow_wstandend , METH_NOARGS },
2580- {"standout" , (PyCFunction )PyCursesWindow_wstandout , METH_NOARGS },
2581- {"subpad" , (PyCFunction )_curses_window_subwin , METH_VARARGS , _curses_window_subwin__doc__ },
2682+ {"standend" , (PyCFunction )PyCursesWindow_wstandend , METH_NOARGS ,
2683+ "standend($self, /)\n--\n\n"
2684+ "Turn off the standout attribute." },
2685+ {"standout" , (PyCFunction )PyCursesWindow_wstandout , METH_NOARGS ,
2686+ "standout($self, /)\n--\n\n"
2687+ "Turn on the A_STANDOUT attribute." },
2688+ {"subpad" , (PyCFunction )_curses_window_subwin , METH_VARARGS , _curses_window_subwin__doc__ },
25822689 _CURSES_WINDOW_SUBWIN_METHODDEF
2583- {"syncdown" , (PyCFunction )PyCursesWindow_wsyncdown , METH_NOARGS },
2690+ {"syncdown" , (PyCFunction )PyCursesWindow_wsyncdown , METH_NOARGS ,
2691+ "syncdown($self, /)\n--\n\n"
2692+ "Touch each location changed in any ancestor of the window." },
25842693#ifdef HAVE_CURSES_SYNCOK
2585- {"syncok" , (PyCFunction )PyCursesWindow_syncok , METH_VARARGS },
2694+ {"syncok" , (PyCFunction )PyCursesWindow_syncok , METH_VARARGS ,
2695+ "syncok($self, flag, /)\n--\n\n"
2696+ "If flag is true, call syncup() on every change to the window." },
25862697#endif
2587- {"syncup" , (PyCFunction )PyCursesWindow_wsyncup , METH_NOARGS },
2588- {"timeout" , (PyCFunction )PyCursesWindow_wtimeout , METH_VARARGS },
2698+ {"syncup" , (PyCFunction )PyCursesWindow_wsyncup , METH_NOARGS ,
2699+ "syncup($self, /)\n--\n\n"
2700+ "Touch locations in ancestors that changed in this window." },
2701+ {"timeout" , (PyCFunction )PyCursesWindow_wtimeout , METH_VARARGS ,
2702+ "timeout($self, delay, /)\n--\n\n"
2703+ "Set blocking or non-blocking read behavior for the window." },
25892704 _CURSES_WINDOW_TOUCHLINE_METHODDEF
2590- {"touchwin" , (PyCFunction )PyCursesWindow_touchwin , METH_NOARGS },
2591- {"untouchwin" , (PyCFunction )PyCursesWindow_untouchwin , METH_NOARGS },
2705+ {"touchwin" , (PyCFunction )PyCursesWindow_touchwin , METH_NOARGS ,
2706+ "touchwin($self, /)\n--\n\n"
2707+ "Mark the whole window as changed." },
2708+ {"untouchwin" , (PyCFunction )PyCursesWindow_untouchwin , METH_NOARGS ,
2709+ "untouchwin($self, /)\n--\n\n"
2710+ "Mark all lines in the window as unchanged since last refresh()." },
25922711 _CURSES_WINDOW_VLINE_METHODDEF
25932712 {NULL, NULL } /* sentinel */
25942713};
@@ -2689,11 +2808,17 @@ PyTypeObject PyCursesWindow_Type = {
26892808/*[clinic input]
26902809_curses.filter
26912810
2811+ Restrict screen updates to the current line.
2812+
2813+ Must be called before initscr(). Afterwards curses confines the cursor
2814+ and screen updates to a single line, which is useful for enabling
2815+ character-at-a-time line editing without touching the rest of the
2816+ screen.
26922817[clinic start generated code]*/
26932818
26942819static PyObject *
26952820_curses_filter_impl (PyObject * module )
2696- /*[clinic end generated code: output=fb5b8a3642eb70b5 input=668c75a6992d3624 ]*/
2821+ /*[clinic end generated code: output=fb5b8a3642eb70b5 input=e3c64d6ab2106132 ]*/
26972822{
26982823 /* not checking for PyCursesInitialised here since filter() must
26992824 be called before initscr() */
@@ -3575,11 +3700,16 @@ _curses.intrflush
35753700 flag: bool
35763701 /
35773702
3703+ Control flushing of the output buffer when an interrupt key is pressed.
3704+
3705+ If flag is true, pressing an interrupt key (interrupt, break, or quit)
3706+ flushes all output in the terminal driver queue. If flag is false, no
3707+ flushing is done.
35783708[clinic start generated code]*/
35793709
35803710static PyObject *
35813711_curses_intrflush_impl (PyObject * module , int flag )
3582- /*[clinic end generated code: output=c1986df35e999a0f input=c65fe2ef973fe40a ]*/
3712+ /*[clinic end generated code: output=c1986df35e999a0f input=66588c2bccc7e8fa ]*/
35833713{
35843714 PyCursesInitialised ;
35853715
@@ -4081,11 +4211,14 @@ update_lines_cols(void)
40814211/*[clinic input]
40824212_curses.update_lines_cols
40834213
4214+ Update the LINES and COLS module variables.
4215+
4216+ This is useful for detecting manual screen resize.
40844217[clinic start generated code]*/
40854218
40864219static PyObject *
40874220_curses_update_lines_cols_impl (PyObject * module )
4088- /*[clinic end generated code: output=423f2b1e63ed0f75 input=5f065ab7a28a5d90 ]*/
4221+ /*[clinic end generated code: output=423f2b1e63ed0f75 input=1d8ea7c356b61a8b ]*/
40894222{
40904223 if (!update_lines_cols ()) {
40914224 return NULL ;
0 commit comments