Skip to content

Add curses.window.dupwin() #152258

Description

@serhiy-storchaka

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirtype-featureA feature request or enhancement
    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions