anthropics / anthropics/claude-code

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

Offen
#88,756 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
area:tui bug platform:linux
Vorherrschende Sprache
Python
Sterne
145k
Forks
23.1k
PR-Merge-Kennzahlen
PR-Kennzahlen ausstehend

Beschreibung

### 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_

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
nixos
Bereich
cli, operating-systems
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Aktiv
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.