anthropics / anthropics/claude-code

[BUG] Copy paste fails in Ghostty on Linux (NixOS)

Đang mở
#88,756 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
area:tui bug platform:linux
Ngôn ngữ chính
Python
Star
145k
Fork
23.1k
Chỉ số merge pull request
Chỉ số pull request đang chờ

Mô tả

### Preflight Checklist

- [x] I have searched [existing issues](https://github.com/anthropics/claude-code/issues?q=is%3Aissue%20state%3Aopen%20label%3Abug) and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code

### What's Wrong?

Pretty explanatory
```
❯ hmm. I try to copy paste from the text and it gives me 8;6u. is it a bad wimndow or a deeper bug

Searched for 1 pattern, read 1 file

That specific fragment is a strong signal: 8;6u is the tail end of a "CSI u" escape sequence (the modern kitty keyboard protocol that terminals like Ghostty use for richer key reporting). The 6 there is the standard modifier code for Ctrl+Shift. So what likely happened: something with focus received your paste keystroke (probably Ctrl+Shift+V) as a raw keyboard-protocol event instead of treating it as "paste," and the leftover bytes got echoed as literal text.

A few things worth knowing:
- This isn't something introduced by tonight's config changes — the only Ghostty setting in this repo is copy-on-select = clipboard (modules/home/nixos/ghostty.nix); nothing touches keybindings or keyboard-protocol behavior.
- It could be Ghostty itself not fully intercepting that combo before passing it to whatever program has focus, or it could be specific to this Claude Code CLI session's own input handling — Claude Code uses this same class of protocol to distinguish things like Shift+Enter, and an unhandled modifier combo could leak through the same way.

To narrow it down:

● User declined to answer questions
· Does the garbled "8;6u" text also show up if you paste at a plain shell prompt (not inside this Claude Code session), or only here? (Only inside Claude Code / Also at a plain zsh prompt / Haven't tried yet)

✻ Sautéed for 1m 56s

❯ lets just ignore for now just to let you know

Understood, noted and set aside — not a nixos-config issue, just an FYI. Let me know when you're ready to pick the wallpaper feature (or anything else) back up.

✻ Cooked for 2s

❯ ok i tried again, it works all the time EXCEPT when copyiong from claude code pasting to another window terminal.
Interrupted · What should Claude do instead?

❯ continue

That pins it down clearly — it's not Ghostty or your nixos config, it's Claude Code's own terminal rendering. When you select/copy text directly from this interactive session, the copy is picking up leftover terminal control sequences (the same kitty-keyboard-protocol/OSC codes involved in 8;6u) that are part of how the TUI renders, not part of the actual text. Paste that into a plain terminal elsewhere, and that terminal tries to interpret the stray bytes as real key/escape codes instead of literal text — hence the garbage.

This is a genuine Claude Code CLI bug, not something I can fix from inside this session or from the nixos-config repo. Two things:

- Report it: https://github.com/anthropics/claude-code/issues — worth filing with "copying terminal output from Claude Code and pasting into another terminal injects N;6u-style escape bytes," since it's cleanly reproducible on your end.
- Workaround for now: avoid mouse-selecting directly out of the interactive pane for anything you need to paste into another terminal. If you need a clean copy of something I output, ask me to write it to a file (Write/Bash > file) and copy from cat'ing that file instead — plain files never carry the TUI's control sequences.
```

### What Should Happen?

Copy paste should work.

### Error Messages/Logs

```shell

```

### Steps to Reproduce

Copy from claude, paste outside claude, in Ghostty, ideally NixOS.

### Claude Model

None

### Is this a regression?

I don't know

### Last Working Version

_No response_

### Claude Code Version

2.1.239 (Claude Code)

### Platform

Anthropic API

### Operating System

Other Linux

### Terminal/Shell

Other

### Additional Information

_No response_

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

No source files or tests are named. First reproduce the copy from a Claude Code 2.1.239 session and paste into another Ghostty terminal on NixOS, then compare it with copying from a plain shell prompt; done means pasted text contains no stray escape-sequence bytes such as 8;6u.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
nixos
Lĩnh vực
cli, operating-systems
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.