Skip to content

feat(core): 行插入/删除 CSI(IL/DL)(#29) - #234

Merged
JavaZeroo merged 1 commit into
mainfrom
feat/insert-delete-lines
Oct 30, 2026
Merged

JavaZeroo merged 1 commit into
mainfrom
feat/insert-delete-lines

Conversation

@JavaZeroo

Copy link
Copy Markdown
Owner

内容

实现 IL/DL(#29 的编辑类行操作):

序列 语义
CSI Ps L(IL) 在光标行插入空白行,下方内容下移,越过底部的行离开屏幕
CSI Ps M(DL) 从光标行删除行,下方内容上移,底部补空白行

细节:

  • 新插入的行按普通新行处理,取新的行 id(原有行保留各自 id 与版本);
  • 被移出屏幕的行 id 视为已消耗,不会被复用;
  • 两者都取消延迟换行并使附件失效;
  • Ps=0 按 1 处理,超出剩余行数时只处理剩余部分。

测试

edit_csi_test 新增:

  1. a/b/c/d 在首行 CSI 2 L → "","","a","b",光标不动;
  2. 随后 CSI M → "","a","b","";
  3. CSI 99 L 清空整屏。

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

边界

  • 未实现 DECSTBM 滚动区域:IL/DL 目前作用于整屏(row..height),与标准在无滚动区域时的行为一致;
  • 未把这些行推入回滚缓冲(xterm 的 IL/DL 同样不写入 scrollback)。

Refs #29 #28

IL and DL shift rows inside the screen, give inserted rows fresh identities, drop rows pushed past the bottom, and are covered by three new edit_csi_test cases.
@JavaZeroo
JavaZeroo merged commit 597838d into main Oct 30, 2026
9 of 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