Skip to content

writeOsc52 broken under GNU screen — uses tmux DCS format, no chunking #28590

@lingfish

Description

@lingfish

Description

writeOsc52 in packages/opencode/src/cli/cmd/tui/util/clipboard.ts treats GNU screen and tmux the same way, wrapping both in \x1bPtmux;\x1b...\x1b\\. This was originally reported by @valdemardi in #26491 / #26492 (closed before merging).

The tmux; prefix is specific to tmux. Under screen, it is output verbatim alongside the escape sequences. The embedded OSC52 usually still reaches the clipboard (\x1b]52;c;...\x07 is valid enough), but the tmux; garbage and leaked escape sequences corrupt the terminal output and scramble the TUI display.

Screen also has a 768-byte DCS buffer limit (MAXSTR), so clipboard writes larger than ~750 bytes are silently truncated. Screen requires chunking with \x1b\\\x1bP between segments.

Plugins

N/A

OpenCode version

1.15.6

Steps to reproduce

  1. Run inside a GNU screen session (STY is set)
  2. Try any clipboard copy
  3. Text may reach the clipboard but the TUI display gets corrupted with garbage characters and escape artifacts

Screenshot and/or share link

N/A

Operating System

Linux

Terminal

Alacritty and GNU screen v5

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions