gh-151776: Add curses state-query functions#151778
Open
serhiy-storchaka wants to merge 2 commits into
Open
Conversation
Add window methods and module functions that report curses state which could previously only be set: the window getters is_cleared(), is_idcok(), is_idlok(), is_immedok(), is_keypad(), is_leaveok(), is_nodelay(), is_notimeout(), is_pad(), is_scrollok(), is_subwin(), is_syncok(), getdelay(), getparent() and getscrreg(), and the functions is_cbreak(), is_echo(), is_nl() and is_raw(). They are available when built against an ncurses with NCURSES_EXT_FUNCS. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Documentation build overview
|
These four functions were added in ncurses 6.5; guarding them with the same NCURSES_EXT_FUNCS >= 20110404 as the window getters broke the build on older ncurses (e.g. macOS, which ships 6.0). Require NCURSES_EXT_FUNCS >= 20240427. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Wrap the ncurses "opaque" accessors that report curses state which the standard API can only set, never read back.
New window methods:
is_cleared,is_idcok,is_idlok,is_immedok,is_keypad,is_leaveok,is_nodelay,is_notimeout,is_scrollokandis_syncokreturn the value set by the matching setter.is_padandis_subwinreport the kind of window.getdelay()returns the read timeout in milliseconds (as set bynodelay()/timeout()).getscrreg()returns the current scrolling region as a(top, bottom)tuple.getparent()returns the parent window, orNoneif the window is not a subwindow.New module functions:
is_cbreak,is_echo,is_nlandis_rawreport the current terminal mode set bycbreak,echo,nlandraw.All of these are available only when Python is built against an ncurses with
NCURSES_EXT_FUNCS(ncurses 5.9 and later).🤖 Generated with Claude Code