Skip to content

gh-152334: Add curses key-management functions#152338

Merged
serhiy-storchaka merged 1 commit into
python:mainfrom
serhiy-storchaka:curses-key-mgmt
Jun 26, 2026
Merged

gh-152334: Add curses key-management functions#152338
serhiy-storchaka merged 1 commit into
python:mainfrom
serhiy-storchaka:curses-key-mgmt

Conversation

@serhiy-storchaka

Copy link
Copy Markdown
Member

Add the ncurses key-management extensions define_key(), key_defined() and keyok(), which manage how control strings are recognized as key codes, beyond the predefined terminfo keys and the all-or-nothing window.keypad().

  • define_key(definition, keycode) binds the control string definition to keycode (None removes the binding for keycode; a non-positive keycode removes the binding for definition).
  • key_defined(definition) returns the key code bound to definition, 0 if none, or -1 if it is ambiguous.
  • keyok(keycode, enable) enables or disables recognition of a single key code.

They are available when built against an ncurses with NCURSES_EXT_FUNCS.

Add define_key(), key_defined() and keyok(), the ncurses extensions for
managing how control strings are recognized as key codes, beyond the
predefined terminfo keys and the all-or-nothing window.keypad().

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #33330107 | 📁 Comparing 9d61ff8 against main (bbf7786)

  🔍 Preview build  

3 files changed
± library/curses.html
± whatsnew/3.16.html
± whatsnew/changelog.html

@serhiy-storchaka serhiy-storchaka merged commit 8f4abfc into python:main Jun 26, 2026
56 checks passed
@serhiy-storchaka serhiy-storchaka deleted the curses-key-mgmt branch June 26, 2026 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant