The curses module exposes most of the X/Open window operations, but dupwin() is still missing. It is the only window-duplication primitive: it returns a new window that is an exact, independent copy of an existing one (same size, position, contents and attributes), with its own cell buffer, so later changes to one do not affect the other. This differs from subwin()/derwin(), which create a view that shares the parent's cell buffer.
copywin() is intentionally left out. Its full explicit-rectangle copy is already available through the six-coordinate forms of window.overlay() and window.overwrite(), which call copywin() internally with the overlay flag fixed (non-destructive vs. destructive). A separate copywin() would only re-expose that same operation with the flag as a runtime argument, so it adds no capability.
Proposed API:
window.dupwin() -> window
Linked PRs
The curses module exposes most of the X/Open window operations, but
dupwin()is still missing. It is the only window-duplication primitive: it returns a new window that is an exact, independent copy of an existing one (same size, position, contents and attributes), with its own cell buffer, so later changes to one do not affect the other. This differs fromsubwin()/derwin(), which create a view that shares the parent's cell buffer.copywin()is intentionally left out. Its full explicit-rectangle copy is already available through the six-coordinate forms ofwindow.overlay()andwindow.overwrite(), which callcopywin()internally with the overlay flag fixed (non-destructive vs. destructive). A separatecopywin()would only re-expose that same operation with the flag as a runtime argument, so it adds no capability.Proposed API:
Linked PRs