The curses module can serialize a single window with window.putwin() / curses.getwin(), but it has no way to dump and restore the whole screen. The four X/Open functions that do this are still missing:
scr_dump(filename) — write the current virtual screen to a file.
scr_restore(filename) — set the virtual screen to a dumped file; the next doupdate()/refresh() paints it.
scr_init(filename) — use a dump as the assumed current terminal contents (e.g. after another program drew the screen).
scr_set(filename) — combine scr_restore() and scr_init().
These are the whole-screen counterpart of putwin()/getwin(). Unlike those (which take a Python file object, mirroring C putwin(WINDOW *, FILE *)), the C scr_* functions are filename-based (they fopen internally), so the Python wrappers take a filename — a str or a path-like object.
Proposed API:
curses.scr_dump(filename)
curses.scr_restore(filename)
curses.scr_init(filename)
curses.scr_set(filename)
Linked PRs
The curses module can serialize a single window with
window.putwin()/curses.getwin(), but it has no way to dump and restore the whole screen. The four X/Open functions that do this are still missing:scr_dump(filename)— write the current virtual screen to a file.scr_restore(filename)— set the virtual screen to a dumped file; the nextdoupdate()/refresh()paints it.scr_init(filename)— use a dump as the assumed current terminal contents (e.g. after another program drew the screen).scr_set(filename)— combinescr_restore()andscr_init().These are the whole-screen counterpart of
putwin()/getwin(). Unlike those (which take a Python file object, mirroring Cputwin(WINDOW *, FILE *)), the Cscr_*functions are filename-based (theyfopeninternally), so the Python wrappers take a filename — astror a path-like object.Proposed API:
Linked PRs