Ctrl+Shift+C (and Ctrl+C with a selection) send ^C instead of copying on Linux/Windows
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 68/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
- Lĩnh vực
- frontend
Hướng nghiên cứu
Xử lý phím nằm trong handleKeyDown trong lib/input-handler.ts, hiện chỉ xử lý riêng trường hợp metaKey kết hợp với KeyC và chuyển đến onCopyCallback đang có. Chạy đoạn mã tái hiện từ issue và xác nhận rằng keydown có ctrlKey và shiftKey vẫn chuyển đến onData dưới dạng "\u0003". Hoàn thành khi Ctrl+Shift+C gọi callback sao chép và không gửi gì tới PTY, còn Ctrl+C chỉ sao chép khi có vùng chọn, nếu không thì vẫn gửi ^C. Kiểm tra rằng luồng Cmd+C vẫn hoạt động như cũ.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- TypeScript
- Star
- 2.9k
- Fork
- 182
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của coder/ghostty-web
-
buffer translateToString()/getChars() return '' for empty cells, collapsing cursor-positioned textĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
coder/ghostty-web#205 ·
-
Alt+<printable key> sends the bare key with no ESC prefix (readline/emacs/tmux meta bindings lost)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
coder/ghostty-web#203 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
coder/ghostty-web#199 ·
-
Public buffer getChars and translateToString truncate multi-codepoint graphemesCó thể đã có người làm @schickling-assistant đã nhận 10 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 76/100
coder/ghostty-web#200 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
coder/ghostty-web#198 ·
Tất cả issue của coder/ghostty-web
Issue tương tự
-
area:deploy task
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
wilanis/wilanis-js#1017 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation v2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
modelcontextprotocol/servers#5133 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
budget bug feature frontend good-issue medium needs-review OSCI'26 payments
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
SatyamPandey-07/WorkSphere#5990 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
lugassawan/swe-workbench#799 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug good first issue javascript
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
yukikotani231/sqlsift#326 ·
Maintainer thường phản hồi trong vòng 1 ngày