Skip to content

Commit 6041219

Browse files
author
SqlRush
committed
Parse reverse wrap mode
1 parent 7b4fcb6 commit 6041219

5 files changed

Lines changed: 10 additions & 0 deletions

File tree

docs/cc-100-roadmap.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ M7 补充:terminal CSI parser 现在把 DEC `?6h/l` origin mode 和 `?7h/l` au
166166

167167
M7 补充:terminal CSI parser 现在把 DEC `?12h/l` cursor blink mode 解析成结构化 `cursorBlink` mode action,补齐 cursor visibility/style 相邻的终端状态序列。
168168

169+
M7 补充:terminal CSI parser 现在把 xterm/DEC `?45h/l` reverse-wraparound mode 解析成结构化 `reverseWrap` mode action,补齐 auto-wrap 相邻的 wrap 状态序列。
170+
169171
M7 补充:terminal CSI parser 现在把 DEC `?66h/l` application keypad mode 解析成结构化 `applicationKeypad` mode action,补齐 application cursor mode 相邻的输入状态序列。
170172

171173
M7 补充:terminal CSI parser 现在把 REP repeat-preceding-character (`CSI b`/`CSI 4b`) 解析成 edit action,visible-text/snapshot pipeline 和 ANSI message wrapping/trim 会按重复次数展开前一个可重复 grapheme。

docs/claude-code-go-rewrite-plan.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ test/parity/ # golden tests against TS/official behavior
266266
- 本轮补充:terminal CSI parser 把普通 `CSI 20h/l` line-feed/new-line mode 解析成 `lineFeedMode` action,继续覆盖 ECMA mode set/reset 序列。
267267
- 本轮补充:terminal CSI parser 把 DEC `?6h/l` origin mode 和 `?7h/l` auto-wrap mode 解析成结构化 mode action,继续减少终端状态序列的 unknown fallback。
268268
- 本轮补充:terminal CSI parser 把 DEC `?12h/l` cursor blink mode 解析成结构化 `cursorBlink` mode action,补齐 cursor visibility/style 相邻的终端状态序列。
269+
- 本轮补充:terminal CSI parser 把 xterm/DEC `?45h/l` reverse-wraparound mode 解析成结构化 `reverseWrap` mode action,补齐 auto-wrap 相邻的 wrap 状态序列。
269270
- 本轮补充:terminal CSI parser 把 DEC `?66h/l` application keypad mode 解析成结构化 `applicationKeypad` mode action,补齐 application cursor mode 相邻的输入状态序列。
270271
- 本轮补充:terminal CSI parser 把 REP repeat-preceding-character (`CSI b`) 归入 edit action,visible-text/snapshot pipeline 和 ANSI message wrapping/trim 会按重复次数展开前一个可重复 grapheme。
271272
- 本轮补充:terminal CSI parser 按 ANSI 默认参数解析 scroll-region (`CSI r`/`CSI ;10r`),缺失 top 默认为 1,缺失 bottom 保持 0 表示 reset/full-height,避免 reset scroll region 被误判为单行区域。

docs/first-second-parity-audit.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ M7 progress now includes:
217217
- `internal/tui`: terminal CSI parser now recognizes ordinary ECMA line-feed/new-line mode (`CSI 20h/l`) as a structured `lineFeedMode` action.
218218
- `internal/tui`: terminal CSI parser now recognizes DEC origin mode (`?6h/l`) and auto-wrap mode (`?7h/l`) as structured mode actions.
219219
- `internal/tui`: terminal CSI parser now recognizes DEC cursor blink mode (`?12h/l`) as a structured `cursorBlink` mode action.
220+
- `internal/tui`: terminal CSI parser now recognizes xterm/DEC reverse-wraparound mode (`?45h/l`) as a structured `reverseWrap` mode action.
220221
- `internal/tui`: terminal CSI parser now recognizes DEC application keypad mode (`?66h/l`) as a structured `applicationKeypad` mode action.
221222
- `internal/tui`: keybinding config, keymap resolution, and interaction script named-key input now accept terminal aliases for `ctrl-h`/`ctrl-i`/`ctrl-j`/`ctrl-m`, `ctrl-[`, and `ctrl-?`, including `control-*` and compact/camel variants.
222223
- `internal/tui`: keybinding config now accepts page navigation aliases such as `pgup`, `pg-up`, `prior`, `pgdn`, `pg-down`, and `next`.

internal/tui/terminal_csi.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ const (
7474
DECModeCursorBlink = 12
7575
DECModeCursorVisible = 25
7676
DECModeAltScreen = 47
77+
DECModeReverseWrap = 45
7778
DECModeApplicationKeypad = 66
7879
DECModeAltScreenBuffer = 1047
7980
DECModeSaveRestoreCursor = 1048
@@ -234,6 +235,7 @@ const (
234235
CSIModeActionReverseVideo CSIModeActionType = "reverseVideo"
235236
CSIModeActionOrigin CSIModeActionType = "originMode"
236237
CSIModeActionAutoWrap CSIModeActionType = "autoWrap"
238+
CSIModeActionReverseWrap CSIModeActionType = "reverseWrap"
237239
CSIModeActionCursorBlink CSIModeActionType = "cursorBlink"
238240
CSIModeActionApplicationKeypad CSIModeActionType = "applicationKeypad"
239241
CSIModeActionMouseTracking CSIModeActionType = "mouseTracking"
@@ -577,6 +579,8 @@ func csiPrivateModeAction(mode int, enabled bool) (CSIAction, bool) {
577579
return CSIAction{Type: CSIActionMode, Mode: CSIModeAction{Type: CSIModeActionOrigin, Enabled: enabled}}, true
578580
case DECModeAutoWrap:
579581
return CSIAction{Type: CSIActionMode, Mode: CSIModeAction{Type: CSIModeActionAutoWrap, Enabled: enabled}}, true
582+
case DECModeReverseWrap:
583+
return CSIAction{Type: CSIActionMode, Mode: CSIModeAction{Type: CSIModeActionReverseWrap, Enabled: enabled}}, true
580584
case DECModeCursorBlink:
581585
return CSIAction{Type: CSIActionMode, Mode: CSIModeAction{Type: CSIModeActionCursorBlink, Enabled: enabled}}, true
582586
case DECModeCursorVisible:

internal/tui/tui_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3658,6 +3658,8 @@ func TestParseCSISequenceActions(t *testing.T) {
36583658
{seq: "\x1b[?7l", want: CSIModeAction{Type: CSIModeActionAutoWrap, Enabled: false}},
36593659
{seq: "\x1b[?12h", want: CSIModeAction{Type: CSIModeActionCursorBlink, Enabled: true}},
36603660
{seq: "\x1b[?12l", want: CSIModeAction{Type: CSIModeActionCursorBlink, Enabled: false}},
3661+
{seq: "\x1b[?45h", want: CSIModeAction{Type: CSIModeActionReverseWrap, Enabled: true}},
3662+
{seq: "\x1b[?45l", want: CSIModeAction{Type: CSIModeActionReverseWrap, Enabled: false}},
36613663
{seq: "\x1b[?66h", want: CSIModeAction{Type: CSIModeActionApplicationKeypad, Enabled: true}},
36623664
{seq: "\x1b[?66l", want: CSIModeAction{Type: CSIModeActionApplicationKeypad, Enabled: false}},
36633665
{seq: EnterAlternateScreen, want: CSIModeAction{Type: CSIModeActionAlternateScreen, Enabled: true}},

0 commit comments

Comments
 (0)