Skip to content

fix: wrap c-S-c keybinding in try/except for prompt_toolkit compat - #19899

Closed
martijn-atakumi wants to merge 1 commit into
NousResearch:mainfrom
martijn-atakumi:fix/c-S-c-keybinding-compat
Closed

fix: wrap c-S-c keybinding in try/except for prompt_toolkit compat#19899
martijn-atakumi wants to merge 1 commit into
NousResearch:mainfrom
martijn-atakumi:fix/c-S-c-keybinding-compat

Conversation

@martijn-atakumi

Copy link
Copy Markdown

Problem

The @kb.add("c-S-c") keybinding (Ctrl+Shift+C) raises ValueError on startup with prompt_toolkit 3.0.x because ControlShift+letter combinations are not valid Keys values.

Error: Invalid key: c-S-c

Fix

Wrap the decorator in a try/except (ValueError, KeyError) so the binding is silently skipped on versions that don't support it. Once prompt_toolkit adds ControlShift+letter support, the binding will automatically start working.

Notes

  • The binding is a no-op (copy is handled natively by the terminal emulator)
  • No functional change on supported versions
  • Tested on prompt_toolkit 3.0.52

The 'c-S-c' (Ctrl+Shift+C) key name is not a valid Keys value in
prompt_toolkit 3.0.x — ControlShift+letter combinations are unsupported.
This causes an unhandled ValueError on startup in environments running
current prompt_toolkit versions.

Wrap the @kb.add('c-S-c') decorator in a try/except so it silently
skips the binding on versions that don't support it, and automatically
re-enables once prompt_toolkit adds ControlShift+letter support.
@alt-glitch alt-glitch added type/bug Something isn't working P0 Critical — data loss, security, crash loop comp/cli CLI entry point, hermes_cli/, setup wizard labels May 4, 2026
@teknium1

teknium1 commented May 7, 2026

Copy link
Copy Markdown
Contributor

Duplicate — the underlying bug was fixed on main before your PR landed.

Closing issue #19903 too. Thanks for jumping on it — appreciate the quick turnaround even if we only needed one of the fixes.

@teknium1 teknium1 closed this May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P0 Critical — data loss, security, crash loop type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants