Ctrl+Shift+C (and Ctrl+C with a selection) send ^C instead of copying on Linux/Windows
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- frontend
Research direction
The key handling lives in handleKeyDown in lib/input-handler.ts, which currently special-cases only metaKey plus KeyC and reaches the existing onCopyCallback. Run the reproduction snippet from the issue and confirm that a keydown with ctrlKey and shiftKey still reaches onData as "\u0003". Done means Ctrl+Shift+C invokes the copy callback and sends nothing to the PTY, and Ctrl+C copies only when a selection exists, otherwise it still sends ^C. Check the Cmd+C path still behaves the same.
Written by the indexing model from the issue text.
Description
Summary
On Linux and Windows there is no keyboard way to copy the terminal selection: Ctrl+Shift+C (the terminal copy chord everywhere on those platforms) is passed to the key encoder and sent to the PTY as ^C (0x03), and plain Ctrl+C with text selected also sends ^C. Only Cmd+C (macOS, event.metaKey && event.code === 'KeyC') triggers the copy path. In a shell this means the user selects text, presses the copy shortcut, and interrupts their running program.
Seen on [email protected]; main (lib/input-handler.ts) still only special-cases metaKey + KeyC.
Minimal reproduction
<div id="t"></div>
<script type="module">
import { init, Terminal } from 'ghostty-web';
await init();
const term = new Terminal();
term.open(document.getElementById('t'));
term.onData((d) => console.log(JSON.stringify(d)));
term.write('hello world');
term.select(0, 0, 5); // "hello"
console.log(term.getSelection()); // "hello"
term.focus();
term.element.dispatchEvent(new KeyboardEvent('keydown', { key: 'C', code: 'KeyC', ctrlKey: true, shiftKey: true, bubbles: true, cancelable: true }));
</script>
Actual: onData receives "\u0003"; the clipboard is untouched. Expected: the selection is copied and nothing is sent to the PTY (Ctrl+Shift+C), and ideally Ctrl+C copies instead of interrupting when a selection exists (xterm.js users get this from attachCustomKeyEventHandler; Windows Terminal and GNOME Terminal behave this way).
Suggested fix
In handleKeyDown, treat (ctrlKey && shiftKey && code === 'KeyC') as copy using the existing onCopyCallback (always swallow it, never forward ^C), and ctrlKey && !shiftKey && code === 'KeyC' as copy when onCopyCallback() reports a selection.
Found while evaluating ghostty-web as a PTY renderer for https://github.com/erisera-code/clawser; the host currently works around it with attachCustomKeyEventHandler.
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 182
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from coder/ghostty-web
-
buffer translateToString()/getChars() return '' for empty cells, collapsing cursor-positioned textOpen
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
coder/ghostty-web#205 ·
-
Alt+<printable key> sends the bare key with no ESC prefix (readline/emacs/tmux meta bindings lost)Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
coder/ghostty-web#203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
coder/ghostty-web#199 ·
-
Public buffer getChars and translateToString truncate multi-codepoint graphemesPossibly taken @schickling-assistant claimed this 10 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 76/100
coder/ghostty-web#200 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
coder/ghostty-web#198 ·
All issues in coder/ghostty-web
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
cline/mcp-marketplace#2932 ·
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 82/100
lingdojo/kana-dojo#32188 · 1 comment · 5 reactions ·
Maintainers usually reply within 1 day
-
triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Portkey-AI/gateway#1844 ·
Maintainers usually reply within 1 day
-
needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 61/100
rjsf-team/react-jsonschema-form#5495 ·
Maintainers usually reply within 2 days