| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
screen.use() makes its screen current for the callback, so a new_prescr() screen, which has no terminal, can be current without set_term(). Operations that need a terminal then crashed inside curses. Raise curses.error instead, checking that stdscr exists.
…-154787) screen.use() makes its screen current for the callback, so a new_prescr() screen, which has no terminal, can be current without set_term(). Operations that need a terminal then crashed inside curses. Raise curses.error instead, checking that stdscr exists.
| Back | FazBrowse Home | New Git URL |
screen.use() makes its screen current for the callback, by calling use_screen(), so a screen made by new_prescr() can be current without going through set_term(). It has no terminal, and operations that need one crashed inside curses.
Eleven window methods crashed -- refresh(), noutrefresh(), getch(), getkey(), get_wch(), getstr(), get_wstr(), echochar(), keypad(), idlok(), idcok() -- and newwin() and newpad() returned a window whose delwin() failed. They were found by calling every window method and every module-level function inside such a callback; some crash only for some arguments, idlok(0) is harmless while idlok(True) is not.
The check is that stdscr exists, which is true whichever way the screen became current. It is added to PyCursesStatefulInitialised(), so every module-level function that already required initscr() requires a terminal too, and to the window methods that need one. Window methods that only touch the window's own memory, such as addstr() or clearok(), are unchanged.
pre.use(lambda s: curses.use_env(False)) keeps working: affecting the state before initscr() is what such a screen is for, and those functions are not gated.