fix(tui): Terminal.app 不再误开 synchronized output - #28
Merged
Conversation
macOS Terminal.app(TERM_PROGRAM=Apple_Terminal)未实现 DEC mode 2026, 此前却列在探测白名单中,auto 模式会误判为支持并发送 CSI ?2026h/l。 旧版 Terminal.app 直接忽略该序列,特性静默无效。 现将其从白名单移除,auto 下默认关闭;确需该行为的终端可用 tui.sync_output_mode="always" 强制开启。 - src/utils/terminal_capability.cpp: 白名单移除 Apple_Terminal - src/utils/terminal_capability.hpp: 同步注释说明 - tests/utils/terminal_capability_test.cpp: 新增 AppleTerminalOff 用例 - openspec design.md: 同步探测规则描述 验证:单独编译 terminal_capability 相关两个单元链接 gtest,26/26 通过。
shaohaozhi286
approved these changes
Aug 31, 2026
shaohaozhi286
left a comment
Collaborator
There was a problem hiding this comment.
批准合入。
Apple_Terminal 从 DEC 2026 白名单拿掉符合「未知即关」。旧版 Terminal.app 不实现该模式,auto 下发 CSI ?2026h/l 只会被忽略。代码、注释、测试、openspec 说明一致;新测例 AppleTerminalOff 也针对。确要开启的用户走 tui.sync_output_mode="always" 即可。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
detect_synchronized_output_support()的TERM_PROGRAM白名单里包含Apple_Terminal(macOS 自带 Terminal.app),但 Terminal.app 并未实现 DEC mode 2026(synchronized output)。后果:
auto模式下用 Terminal.app 时会被误判为“支持”,从而每帧发送CSI ?2026h/CSI ?2026l,终端直接忽略该序列 —— 特性静默无效,且用户无从感知。改动
src/utils/terminal_capability.cpp:白名单移除Apple_Terminal(精确匹配,移除后不会命中任何开启路径)src/utils/terminal_capability.hpp:同步注释,说明原因与always兜底tests/utils/terminal_capability_test.cpp:白名单循环移除该条目,新增AppleTerminalOff用例断言TERM_PROGRAM=Apple_Terminal时返回falseopenspec/changes/add-synchronized-output/design.md:同步探测规则描述影响面
仅
auto模式下 Terminal.app 的行为从“开启(且无效)”变为“关闭”。其余终端不受影响。确需该行为的终端仍可通过配置强制开启:
{ "tui": { "sync_output_mode": "always" } }验证
改动仅涉及
terminal_capability.cpp/ 测试文件两个编译单元,单独编译并链接 gtest 运行:含新增的
AppleTerminalOff,以及原有 11 个同步输出探测用例(iTerm/WezTerm/ghostty/kitty/foot/vscode/mintty 开启,ConEmu/legacy conhost/tmux/screen/未知 关闭)与终端能力探测用例全部通过。(全量
acecode_unit_tests未重跑:改动头文件会被大面积 include,本机双核 i5 全量重编预计一小时以上;ninja 增量状态保留,需要时可续跑确认。)