Repository navigation
feat(core): 叠加式显示页坐标映射层(#29 的 view_mapping) - #264
Merged
Merged
Conversation
#29 的分支路线(view_mapping)与 main 已落地的行存储路线(#169 owned id / sealed rows)是两套并行实现,直接重基会替换已验证的行模型。本提交只取其中可叠加的 一层:显示行的每个片段携带它在源文档中的区间,因此选择与 Find 能回映到文档坐标, 而 Screen 的行存储、历史与淘汰策略保持 main 现状。 与分支原版的两处必要适配: - 分支用 line_id 比较文档顺序;main 明确 id 不定义文档顺序,改为 TextDocument::compare() - main 的 TextPosition 带 epoch,映射据此拒绝在旧缓冲区页面上采集的坐标 新增 experiments/core/view_mapping_test.cpp 覆盖三条路径:等宽片段的列偏移映射、 尾部合成填充无源坐标、旧 epoch 坐标解析失败。CMake 注册 view_mapping_core。
This was referenced Oct 31, 2026
5 tasks
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.
问题与最终行为
#29的四层堆叠 PR 无法重基到 main:分支是view_mapping/origin路线,而 main 已落地#169的行存储路线(ownedid、sealed rows、history_view.hpp80 行)。证据:
history_view.hppowned/anchorPiece/DisplayRow/Layout/ViewMappingview_mapping.hpptext_document.hppepoch、精确index_of、order_revision、compareindex_of用lower_bound_line会吸附邻居main 的
text_document.hpp比分支的更新。 所以本 PR 不采纳分支的整套行模型,只把其中可叠加的一层引入:显示页的每个片段携带它在源文档中的区间。最终行为:
ViewMapping::hit()把显示行列回映到TextPositionViewMapping::project()把文档区间投影回显示单元格Screen的行存储、历史与淘汰策略完全不变与分支原版的必要适配
before()用line_id排序。main 明确规定「id 不定义文档顺序」,改为TextDocument::compare()——对重排行仍正确,并顺带获得 epoch 校验。TextPosition带epoch。映射因此会拒绝在旧缓冲区页面采集的坐标,而不是按 id 误判为有效。验证
本机实际构建并运行(
cmake -G "Visual Studio 17 2022" -A x64,Release):测试覆盖三条路径:
hit/project均返回空性能影响(如适用)
不适用。纯新增头文件与测试;未接入绘制或输入路径,运行期无调用方。
来源与限制
fix/history-viewport-r29的view_mapping.hpp,按 main 的TextDocumentAPI 适配