fix(ui): set terminal background via OSC 11 to match theme#2223
fix(ui): set terminal background via OSC 11 to match theme#2223HUQIANTAO wants to merge 4 commits into
Conversation
Emit OSC 11 (`ESC]11;#rrggbb BEL`) before render to set the terminal's
default background to the theme's surface.bg. This eliminates white/empty
areas below Ink's content in iTerm and other terminals that don't inherit
the theme background.
Crash-safe restore: process.once("exit"), SIGINT, and SIGTERM handlers
ensure OSC 111 is emitted to restore the original background on any exit
path. The finally block also calls restoreTerminalBg() as belt-and-suspenders.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Thanks for splitting this out and fixing the crash-restore — restoring on One interaction to check though: the SIGINT/SIGTERM handlers call
The |
…cing useQuit
The terminal bg restore handlers called process.exit() directly, which
preempts useQuit's async cleanup (transcript flush + .cpuprofile save).
Now the handlers only restore the background color; useQuit owns the
exit path. The process.once('exit') listener still fires as a fallback.
|
Fixed: removed |
|
Thanks for splitting this out of the larger change and for handling the crash-restore path carefully. The OSC sequences are correct: OSC 11 ( Because this is a terminal visual change, I can't verify the actual result or the restore behavior from code or CI. Before I merge, could you attach:
Two small non-blocking items, take or leave:
Happy to approve once the recording confirms the visual and the clean restore on both exit paths. |
- Add process.env.NO_COLOR guard alongside isTTY check - Add comment explaining why non-#hex backgrounds are skipped
esengine
left a comment
There was a problem hiding this comment.
OSC 11 is the right way to sync the xterm background with the theme. Tiny diff, CI is green.
|
🙏 真诚感谢您的贡献! 感谢您为 DeepSeek-Reasonix v1 分支提交的 PR。v1 目前已 完全停止维护,项目已全面迁移至 v2 (Go rewrite)。 由于 v1 已不再接受代码变更,此 PR 将被关闭。 我们非常欢迎您将这些修复贡献到 v2 分支! 请查看 v2 Issues 或基于 再次感谢您的时间和精力!❤️ |
Summary
surface.bg, eliminating white/empty areas below Ink's content in iTerm and other terminalsprocess.once("exit"), SIGINT, and SIGTERM handlers ensure OSC 111 restores the original background on any exit pathfinallyblock also callsrestoreTerminalBg()Test plan
kill) — verify terminal background is restored🤖 Generated with Claude Code