Skip to content

[221_3] 修复数学 tab cycling 菜单中 <lefttimesthree><righttimesthree> 显示异常#3122

Open
MoonL79 wants to merge 1 commit intomainfrom
cms/221_3/fix_t_cycling
Open

[221_3] 修复数学 tab cycling 菜单中 <lefttimesthree><righttimesthree> 显示异常#3122
MoonL79 wants to merge 1 commit intomainfrom
cms/221_3/fix_t_cycling

Conversation

@MoonL79
Copy link
Copy Markdown
Contributor

@MoonL79 MoonL79 commented Apr 9, 2026

No description provided.

@MoonL79 MoonL79 self-assigned this Apr 9, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 9, 2026

Greptile Summary

本 PR 修复了数学 tab cycling 菜单中 <lefttimesthree><righttimesthree> 显示异常的问题,根因是这两个符号为虚拟组合符号,旧的轻量预览链(widget-box → font)在非 extend 模式下跳过了虚拟字体字典,直接回退到 base font 导致渲染失败。

修复策略分两层:在 virtual_font.cpp 修正解析优先级(虚拟字典优先于 base font),并在菜单层对这两个符号单独走完整 typeset 预览链。

Confidence Score: 5/5

可安全合并,剩余问题均为 P2 级改进建议

所有发现均为 P2 级别(symbol 调用点颜色参数不一致,在极少数场景下影响夜间主题的 typeset 预览颜色),不存在 P0/P1 问题。核心修复逻辑正确,虚拟字体解析优先级调整和透明预览 widget 实现均与现有代码规范一致。

TeXmacs/progs/kernel/gui/menu-widget.scm 第 871 行的 symbol 调用点颜色参数可统一为字符串形式

Vulnerabilities

未发现安全问题。新增的 typeset 预览 widget 使用与现有 texmacs_output_widget 相同的 document 渲染流程,不涉及用户输入直接拼接或外部资源加载。

Important Files Changed

Filename Overview
TeXmacs/progs/kernel/gui/menu-widget.scm <lefttimesthree> / <righttimesthree> 增加 typeset 预览分支;调整颜色参数传递方式(字符串取代 color 值),但 symbol 调用点(第 871 行)仍传递 color 值,与 symbol-completion 不一致
src/Graphics/Fonts/virtual_font.cpp 调整 supported()compile_bis() 中虚拟字体符号解析优先级,当字典中存在该符号时优先递归展开,修复虚拟组合符号在非 extend 模式下被错误转发到 base font 的问题
src/Texmacs/Window/tm_button.cpp 新增 texmacs_output_widget_transparent,与 texmacs_output_widget 逻辑基本一致,但使用 white 背景色并启用透明标志,用于菜单符号预览
src/Texmacs/tm_window.hpp 声明新接口 texmacs_output_widget_transparent,改动最小
src/Scheme/L5/glue_widget.lua 注册 Scheme 侧接口 widget-texmacs-output-transparent,绑定正确
devel/221_3.md 新增开发记录文档,清晰描述了问题原因、修复思路及测试方法

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[用户输入 T,触发 tab cycling] --> B[symbol-completion 调用 make-menu-symbol]
    B --> C{make-menu-symbol-widget}
    C -->|menu-symbol-needs-typeset-preview? 为 true| D[make-menu-symbol-typeset-widget 完整 typeset 预览]
    C -->|普通符号| E[widget-box 轻量预览]
    D --> F[widget-texmacs-output-transparent]
    F --> G[box_widget_rep transparent=true]
    E --> H[box_widget_rep transparent=false]
    subgraph virtual_font.cpp 修复
        I{compile_bis/supported 解析 token r} -->|virt->dict 包含 r 且优先| J[递归展开虚拟定义]
        I -->|否则| K[base_fn 查字形]
    end
    D -.-> I
Loading

Comments Outside Diff (1)

  1. TeXmacs/progs/kernel/gui/menu-widget.scm, line 871 (link)

    P2 symbol 调用点仍传 color 值,与已修改的 symbol-completion 不一致

    symbol-completionsymbol-completion* 已更新为直接传字符串,但第 871 行的 symbol 调用点仍然传 (color symbol-color)(color 值而非字符串)。当 make-menu-symbol-button 收到非字符串的 clr 时,col-name 会回退到 "black"。若 <lefttimesthree><righttimesthree> 通过 (symbol ...) 上下文出现,在 liii-night 夜间主题下 typeset 预览会用黑色渲染,可能在深色背景上几乎不可见。

Reviews (1): Last reviewed commit: "[221_3] 修复数学 tab cycling 菜单中 `<lefttimes..." | Re-trigger Greptile

@MoonL79
Copy link
Copy Markdown
Contributor Author

MoonL79 commented Apr 9, 2026

#ISSUE #3030

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant