Skip to content

feat(core): 每缓冲区滚动边距 (#41) - #249

Merged
JavaZeroo merged 3 commits into
mainfrom
feat/per-buffer-margins
Oct 30, 2026
Merged

JavaZeroo merged 3 commits into
mainfrom
feat/per-buffer-margins

Conversation

@JavaZeroo

Copy link
Copy Markdown
Owner

内容

按 #41 的裁决分支(里程碑 docs/milestones/R2-local-terminal.md:66 要求"自主 C++ 核心主/备用屏各自滚动区域")实现每缓冲区滚动边距:

  • FrameState 增加 scroll_top / scroll_bottom,随 active_state_copy/swap 在缓冲切换时一起交换;
  • Screen 的同名字段随缓冲交换,region_top() / region_bottom() 取代原先的全局访问器;
  • resize() 同时重置两个缓冲的边距(此前只重置当前缓冲);
  • ?1049h/l 不再让备用屏继承主屏边距。

测试

edit_csi_test 新增:

  1. 主屏设 CSI 2;3r → 备用屏仍为整屏(未继承);
  2. 备用屏设 CSI 1;2r;
  3. 退回主屏后主屏仍是 2..3。

本地:edit csi contracts passed;experiments.core.test_recovery 35 tests OK。

背景

#41 的分析指出:产品核心此前是屏幕级单对边距,activate_buffer 只交换缓冲内容、没有边距继承策略;?1049 与 DECSTBM 的交叉没有任何用例。本条补上该缺口的一层。

边界

Refs #41 #27 #29

FrameState now carries its own DECSTBM margins, so a 1049 switch no longer inherits the other buffer region; resize resets both.
Rows above the region now move down normally and rows below it no longer scroll the region, which the 175 byte margin source exposed as a lost row.
The translated margin fixture must land on the required screen and cursor, so a regression back to the ConPTY observed rows fails here.
@JavaZeroo
JavaZeroo merged commit 43e7e51 into main Oct 30, 2026
10 checks passed
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