Skip to content

feat(qt): retain source frame and paint display projection in formal Qt path (#29) - #310

Merged
JavaZeroo merged 1 commit into
mainfrom
agent/resume-issue-29-336ac0d09719
Nov 4, 2026
Merged

JavaZeroo merged 1 commit into
mainfrom
agent/resume-issue-29-336ac0d09719

Conversation

@JavaZeroo-Bot

Copy link
Copy Markdown
Collaborator

问题与最终行为

承接 #29(接续 #27 / #308 / #309),把已确认的保留事务 + 独立显示投影接入正式 Qt 路径:

  • SessionModel::resize 改走 Screen::resize_preserving:变窄保留源 Cell、行身份与软续接,不再物理裁剪正文。
  • TerminalWidget 按当前宽度绘制 HistoryViewport::project 的显示页;协议光标保持源坐标,新增 display_cursor 只把它翻译为显示光标,供光标下划线、IME 候选位置与预编辑预览;选择/命中继续消费同一份 ViewMapping,并用页面 layout revision 拒绝过期页。
  • 无法投影的保留 Cell 或无法映射的光标回退到物理视图页,不隐藏输出。

行为出口:新增 qt_terminal_modes_retained(真实 child → 固定 ConPTY → core → widget,公开 Qt resize 80×24→60×24 只缩宽)通过 12/12 契约检查:B/C/D 保留在源行;显示页第 8 行与原生重排逐字节一致,第 11 行重排 CD;CUP 写入按已确认的保留行合同落在显示第 12 行;显示光标为保留源光标 [0,2];命中 (8,19) 经 layout revision 返回源 B 格与列 79。Qt 正式路径 CTest 5/5,核心 CTest 36/36(含新 display_cursor_core)。

旧六阶段 --resize 诊断保持原失败:stage 6 failed: core resize is not synchronized with the literal native B/CD rows,exit 1;未弱化、未设 WILL_FAIL、不进默认 CI。该断言以原生 ConPTY 重排网格为产品 oracle,与已确认的保留行坐标层冲突;同时缩宽+缩高的原版视口/滚动与后续 CUP 仍是未决前置,本 PR 不据此改写旧失败。

验证

  • 新增/更新:display_cursor_core(显示光标契约:宽/窄重排、软续接片段、空硬行、尾部 padding、宽字后光标、截断页、继续输出);qt_terminal_modes_retained(真实链 12 项检查 + 原生/显示 hex 记录);qt_terminal_modes 旧入口与旧 --resize 失败保留。
  • 固定配置:Windows x64 VS2022 Release、Qt 6.10.3 offscreen、随包固定 ConPTY 1.25.260930003、app-local CRT 14.51.36247.0、自有 Job/25 s 监督期限;身份与原始记录见 experiments/shell/results/2026-11-03-qt-retained-display/validation.json。
  • 命令:ctest -C Release -R '^(qt_cpp_(shell|resize)|qt_unicode_input|qt_terminal_modes(_retained)?)$' 5/5;ctest -R "_core$" 36/36;run_smoke.py ... --retained-contract exit 0;run_smoke.py ... --resize exit 1(保留)。
  • CI workflow 的 Qt ctest 匹配加入 qt_terminal_modes_retained;旧 repro 仍只在显式配置运行。

性能影响

未测量,不声明性能。绘制每次重建有界显示页(≤200 源行);没有帧率、内存或时延数字。

来源与限制

#29)

The formal Qt path now keeps the retained source frame: SessionModel::resize
uses Screen::resize_preserving, and TerminalWidget paints the independent
display page from HistoryViewport::project. The protocol cursor stays a
retained source position; display_cursor maps it to the caret cell used by
painting, IME geometry and the preedit preview, and selection/hit consume the
same page with its layout revision. Unsupported retained atoms fall back to
the physical viewport page instead of hiding output.

Add display_cursor_core and qt_terminal_modes_retained (real child -> fixed
ConPTY -> core -> widget, public width-only 80x24 -> 60x24 resize). The new
entry passes 12/12 contract checks: B/C/D stay retained, the reflowed display
row 8 matches the native reflow byte for byte, CUP follows the confirmed
retained-row contract, the display caret is the retained source cursor, and
the display hit-test returns the retained source cell. Qt formal-path CTest
5/5, core CTest 36/36 with the new gate.

The old six-stage --resize repro keeps its exact failure and is not used as a
passing oracle; simultaneous width+height original viewport/scroll evidence
remains the explicit next prerequisite. #27/#29 stay open.

Co-authored-by: JavaZeroo <[email protected]>
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