Repository navigation
core: 发布精确行序并解耦身份与文档位置 (#169) - #170
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ca3c073cfa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (live_rows.empty() || live_rows.size() > 200) | ||
| throw std::invalid_argument("published live rows must be between 1 and 200"); |
There was a problem hiding this comment.
Validate the preserved cursor against the published row count
When the incoming image has fewer live rows than the current screen, publish() accepts it while preserving a cursor that may now be out of bounds. For example, Screen(2, 4, 4), move(1, 0), then publishing one valid live row leaves row == 1 and height() == 1; the next put() indexes beyond lines (reproduced with libstdc++ bounds assertions). Since publication explicitly preserves cursor state, reject incompatible geometry or validate the preserved cursor against the incoming image before committing.
Useful? React with 👍 / 👎.
本片交付
Screen成为行结构的唯一发布者:新增publish(history, live)(拥有值镜像、校验后一次提交)、精确locate(id)(缺失不落邻行)、order_revision()(只随结构变化前进)与mark_order_unknown()保守回退。TextDocument::index_of改用locate并新增compare,HistoryViewport的活 anchor 用精确 rank(淘汰 anchor 的lower_bound回退保留),TextSearch::navigate改文档序,CandidateTerminal导入改经发布口。固定夹具
[1,3,4,5,7,6]:locate(7)=4、locate(6)=5、locate(2)缺失、文档序 7 先于 6、强制 Find previous(6)→7 / next(7)→6。证据:合同与夹具 · 验证身份
实际执行
33b58fa,Windows 11 10.0.26200 / MSVC 19.42.34433.0 / Release / Qt 与 candidate 关闭。order_query_core,其余 7 项维持通过。candidate_terminal.cpp仅/W4独立编译(exit 0、无诊断),未链接未运行。y与x、order_known期望),只改测试,不作为产品红绿。明确未做
Screen::lines/history仍公开,未封住直接写入与全部 caller 迁移。emit_from_id_/prune/rewind与match()的 ID 区间假设仍在,运行中跨重排未验收。refs #169(保持开放)