[BUG] Display/output corruption with Claude 2.1.x in GNU screen (lack of synchronized output)
Preflight Checklist
- [x] I have searched existing issues 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?
After upgrading from Claude Code 2.0.76 to 2.1.12, the output is corrupted:
<img width="1634" height="1228" alt="Image" src="https://github.com/user-attachments/assets/297061bb-6bb8-43b0-b063-184c0b9d284f" />
<img width="1634" height="1228" alt="Image" src="https://github.com/user-attachments/assets/3b703bb0-3905-494e-9b5a-5c8bb698971f" />
What Should Happen?
No corruption.
Error Messages/Logs
Steps to Reproduce
I had Claude analyze the issue and here’s what it concluded:
## Root Cause Analysis
The issue appears to be related to synchronized output (DECSET 2026), a terminal feature for flicker-free rendering:
### tmux supports it (input.c):
``c ``
case 2026: /* synchronized output */
screen_write_start_sync(ictx->wp); // CSI ?2026h
...
case 2026: /* synchronized output */
screen_write_stop_sync(ictx->wp); // CSI ?2026l
### GNU screen does NOT support it (ansi.c):
Screen's DECSET handler has cases for modes 1, 2, 3, 5, 6, 7, 9, 25, 47, 1047-1049, 1000-1006, 2004 — but no case for 2026. Unknown modes are silently ignored.
### Why this causes corruption:
- Synchronized output wraps rapid updates in
\e[?2026h...\e[?2026lso terminals buffer and render atomically - In tmux: output is buffered until sync ends, then rendered all at once
- In screen: escape sequences are ignored, output flows unbuffered
- The application's cursor positioning assumptions depend on atomic rendering
- When those assumptions fail, cursor position desynchronizes, causing display corruption
### Evidence of change:
Comparing the bundled cli.js:
| Metric | v2.0.76 | v2.1.12 |
|--------|---------|---------|
| TMUX env references | 1 | 18 |
| process.env.TMUX checks | 0 | 3 |
| isTerm checks | 4 | 12 |
The newer version has significantly more terminal multiplexer detection, suggesting it enables tmux-specific features like synchronized output.
## Expected Behavior
Claude Code should detect when running in GNU screen (via $STY environment variable) and disable synchronized output or other tmux-specific features that screen doesn't support.
## Workaround
Pin to claude-code 2.0.76 or use tmux instead of screen.
## Suggested Fix
Check for process.env.STY (set by screen) and disable synchronized output when detected, similar to how the code already checks for process.env.TMUX."
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
2.0.76
Claude Code Version
2.1.12
Platform
Anthropic API
Operating System
Other Linux
Terminal/Shell
Other
Additional Information
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗