[0828] plugin-math-input 改用独立 string port 捕获,修复日志污染 - #4353
Merged
Conversation
Co-Authored-By: Claude <noreply@anthropic.com>
tm-with-output-to-string 基于全局 cout buffer,捕获窗口内 C++ 日志 (如 lazy 模块加载)会混入发往插件的字符串。改为 call-with-output-string + 动态绑定 plugin-input-port,plugin-convert.scm 与 maxima-input.scm 的 handler 输出统一走 plugin-output,与 cout 完全隔离。顺带移除无调用者的 debug 函数 convert-test。 新增 plugin-cmd-test.scm 覆盖 pre-serialize 各分支及 maxima 自定义 handler。 Co-Authored-By: Claude <noreply@anthropic.com>
da-liii
force-pushed
the
da/0828/protocol
branch
from
August 17, 2026 09:55
00eae23 to
3eb5634
Compare
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.
What
plugin-math-input的捕获污染 bug:原实现经tm-with-output-to-string(cout buffer)捕获,boot 层把单参display重写到全局cout,导致捕获窗口内 C++ 日志(如 lazy 模块加载日志)混入发往插件的字符串——会话中首个 math 输入会带日志前缀。call-with-output-string+dynamic-wind动态绑定plugin-input-port,plugin-convert.scm与maxima-input.scm的 handler 输出统一走plugin-output,与cout完全隔离。TeXmacs/progs/utils/plugins/plugin-cmd-test.scm纯逻辑测试:覆盖pre-serialize各分支(透传/document 剥壳/math 渲染/maxima 自定义 handler)。TeXmacs/tests/tmu/0828.tmu测试文档。Why
单参
display被 boot-s7.scm 重写到tm-output→cout,不经过current-output-port,故with-output-to-string捕获会落空,必须显式传 port。How
plugin-output:(display s plugin-input-port),带 port 参数的 display 走 original-display 真 port 语义。call-with-plugin-output-string:独立 string port 捕获,dynamic-wind保证异常时恢复端口。测试
xmake r plugin-cmd-test:13/13 通过(含首个 math 调用无污染验证)xmake r 0828:63/63 通过🤖 Generated with Claude Code