Skip to content

[221_2] 修复有框定理中的脚注不显示的问题#3120

Open
MoonL79 wants to merge 7 commits intomainfrom
cms/221_2/fix_theorem_footnote
Open

[221_2] 修复有框定理中的脚注不显示的问题#3120
MoonL79 wants to merge 7 commits intomainfrom
cms/221_2/fix_theorem_footnote

Conversation

@MoonL79
Copy link
Copy Markdown
Contributor

@MoonL79 MoonL79 commented Apr 9, 2026

#ISSUE #3050

@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 修复了有框定理(ornament/decorated 环境)中脚注正文不显示的问题。根本原因在于:ornament 渲染路径在将内部 page_item 重新包装为外层 box 时,未将内部 page_item 上附着的 fl(浮动对象,包含脚注)传递到外层,导致脚注上标存在但正文丢失。本次修复在 bridge 路径(bridge_ornamented_rep)和 lazy 路径(lazy_ornament_replazy_art_box_rep)均补充了 float 收集与重挂逻辑,并在 page_item.hpp/.cpp 中提取了共用工具函数 collect_attached_floats,同时添加了单元测试。

Confidence Score: 5/5

可合并,修复逻辑清晰,有单元测试覆盖,剩余反馈均为 P2 级别

核心修复(ornament/art_box 路径的脚注传播)逻辑正确,bridge 和 lazy 两条路径均已同步处理,并有对应单元测试。剩余两个问题(canvas 子类的潜在副作用和测试中的辅助函数重复)均为 P2,不影响主要功能路径,不阻碍合并。

src/Typeset/Bridge/bridge_gui.cpp — 关注 bridge_canvas_rep 是否应向外传播内部 float

Vulnerabilities

未发现安全问题。

Important Files Changed

Filename Overview
src/Typeset/Bridge/bridge_gui.cpp 在 typeset_ornament 中收集 ornament_fl,并在 insert_ornament 中重挂到外层 page_item;逻辑正确,但修改同时影响了 bridge_canvas_rep 这一子类,可能造成 canvas 中的脚注意外出现在页面底部
src/Typeset/Line/lazy_gui.cpp 在 lazy_ornament_rep::produce 和 lazy_art_box_rep::produce 的 LAZY_VSTREAM 路径中补充了 float 收集与重挂逻辑,与 bridge 路径行为一致
src/Typeset/Format/page_item.cpp 新增 collect_attached_floats 工具函数,正确提取并合并 page_item 数组中所有附着的 float
src/Typeset/Format/page_item.hpp 声明 collect_attached_floats,使 bridge 和 lazy 路径均可直接引用而无需各自重复实现
tests/Typeset/Bridge/bridge_gui/bridge_ornamented_rep_test.cpp 单元测试验证 float 附着逻辑,但测试中本地定义了 collect_attached_floats_for_test,是对 page_item.hpp 中同名公共函数的重复
tests/Typeset/Line/lazy_gui/lazy_ornament_rep_test.cpp 通过完整排版 ORNAMENT 树并检查 LAZY_VSTREAM 结果中是否含脚注,端到端验证 lazy 路径的修复效果

Sequence Diagram

sequenceDiagram
    participant BT as bridge_ornamented_rep
    participant TO as typeset_ornament()
    participant CAF as collect_attached_floats()
    participant IO as insert_ornament()
    participant PI as page_item (outer)

    BT->>TO: my_typeset(desired_status)
    TO->>TO: body->typeset() → local page_items l2
    TO->>CAF: collect_attached_floats(l2)
    CAF-->>TO: ornament_fl (脚注等 floats)
    TO->>TO: ornament_fl = 收集结果
    TO-->>BT: ornament box b

    BT->>IO: insert_ornament(b)
    IO->>IO: par->format_paragraph()
    IO->>PI: sss->l[last]->fl << ornament_fl
    IO-->>BT: ttt->insert_stack(par->sss->l, …)
Loading

Reviews (5): Last reviewed commit: "wip" | Re-trigger Greptile

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 9, 2026

Tip:

Greploop — Automatically fix all review issues by running /greploops in Claude Code. It iterates: fix, push, re-review, repeat until 5/5 confidence.

Use the Greptile plugin for Claude Code to query reviews, search comments, and manage custom context directly from your terminal.

}

box
bridge_ornamented_rep::typeset_ornament (int desired_status) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doxygen style comment in Chinese

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.

2 participants