Skip to content

Fix Ctrl+C and other control keys not working in terminal#78

Merged
dhilgaertner merged 2 commits intomainfrom
feature/crow-49-ctrl-c-webserver
Apr 5, 2026
Merged

Fix Ctrl+C and other control keys not working in terminal#78
dhilgaertner merged 2 commits intomainfrom
feature/crow-49-ctrl-c-webserver

Conversation

@dhilgaertner
Copy link
Copy Markdown
Contributor

@dhilgaertner dhilgaertner commented Apr 5, 2026

Summary

  • Fixes control key combinations (Ctrl+C, Ctrl+D, Ctrl+L, etc.) not working in embedded Ghostty terminals
  • Root cause: key event metadata sent to libghostty was incomplete — control characters were passed as text, but Ghostty handles control-character mapping internally
  • Aligns GhosttySurfaceView key handling with upstream Ghostty: properly sets consumed_mods, unshifted_codepoint, strips control chars from text, adds flagsChanged and performKeyEquivalent overrides

Closes #49

Test plan

  • Type text in terminal, press Ctrl+C — should clear the line
  • Run sleep 100, press Ctrl+C — should interrupt the process
  • Ctrl+D sends EOF, Ctrl+L clears screen, Ctrl+A/E move cursor
  • Cmd+C still copies selected text, Cmd+V still pastes
  • Normal typing, arrows, Tab, Enter all work as before

🤖 Generated with Claude Code

Ctrl+key combinations were broken because the key event metadata sent to
libghostty was incomplete. Control characters (e.g. \x03 for Ctrl+C) were
passed as text, but Ghostty handles control-character mapping internally.

Align key event construction with upstream Ghostty: set consumed_mods and
unshifted_codepoint, strip control characters from text, add flagsChanged
for modifier tracking, and add performKeyEquivalent to prevent macOS from
intercepting Ctrl+key events.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dhilgaertner dhilgaertner force-pushed the feature/crow-49-ctrl-c-webserver branch from f2285e6 to d343a6c Compare April 5, 2026 21:02
@dhilgaertner dhilgaertner requested a review from dgershman as a code owner April 5, 2026 21:11
@dhilgaertner dhilgaertner merged commit 7e36ab7 into main Apr 5, 2026
2 checks passed
@dhilgaertner dhilgaertner deleted the feature/crow-49-ctrl-c-webserver branch April 5, 2026 21:13
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.

Running a webserver in another window, cannot quit

1 participant