Skip to content

Commit 8085157

Browse files
author
SqlRush
committed
Parse DEC margin bell mode
1 parent 80f3523 commit 8085157

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
@@ -170,6 +170,8 @@ M7 补充:terminal CSI parser 现在把 DEC `?8h/l` auto-repeat mode 解析成
170170

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

173+
M7 补充:terminal CSI parser 现在把 DEC `?44h/l` margin bell mode 解析成结构化 `marginBell` mode action,补齐 wrap/margin 相邻的响铃状态序列。
174+
173175
M7 补充:terminal CSI parser 现在把 xterm/DEC `?45h/l` reverse-wraparound mode 解析成结构化 `reverseWrap` mode action,补齐 auto-wrap 相邻的 wrap 状态序列。
174176

175177
M7 补充:terminal CSI parser 现在把 DEC `?66h/l` application keypad mode 解析成结构化 `applicationKeypad` mode action,补齐 application cursor mode 相邻的输入状态序列。

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ test/parity/ # golden tests against TS/official behavior
268268
- 本轮补充:terminal CSI parser 把 DEC `?6h/l` origin mode 和 `?7h/l` auto-wrap mode 解析成结构化 mode action,继续减少终端状态序列的 unknown fallback。
269269
- 本轮补充:terminal CSI parser 把 DEC `?8h/l` auto-repeat mode 解析成结构化 `autoRepeat` mode action,补齐键盘重复状态序列。
270270
- 本轮补充:terminal CSI parser 把 DEC `?12h/l` cursor blink mode 解析成结构化 `cursorBlink` mode action,补齐 cursor visibility/style 相邻的终端状态序列。
271+
- 本轮补充:terminal CSI parser 把 DEC `?44h/l` margin bell mode 解析成结构化 `marginBell` mode action,补齐 wrap/margin 相邻的响铃状态序列。
271272
- 本轮补充:terminal CSI parser 把 xterm/DEC `?45h/l` reverse-wraparound mode 解析成结构化 `reverseWrap` mode action,补齐 auto-wrap 相邻的 wrap 状态序列。
272273
- 本轮补充:terminal CSI parser 把 DEC `?66h/l` application keypad mode 解析成结构化 `applicationKeypad` mode action,补齐 application cursor mode 相邻的输入状态序列。
273274
- 本轮补充:terminal CSI parser 把 DEC `?67h/l` backarrow key mode 解析成结构化 `backarrowKey` mode action,补齐键盘输入状态序列。

docs/first-second-parity-audit.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ M7 progress now includes:
219219
- `internal/tui`: terminal CSI parser now recognizes DEC origin mode (`?6h/l`) and auto-wrap mode (`?7h/l`) as structured mode actions.
220220
- `internal/tui`: terminal CSI parser now recognizes DEC auto-repeat mode (`?8h/l`) as a structured `autoRepeat` mode action.
221221
- `internal/tui`: terminal CSI parser now recognizes DEC cursor blink mode (`?12h/l`) as a structured `cursorBlink` mode action.
222+
- `internal/tui`: terminal CSI parser now recognizes DEC margin bell mode (`?44h/l`) as a structured `marginBell` mode action.
222223
- `internal/tui`: terminal CSI parser now recognizes xterm/DEC reverse-wraparound mode (`?45h/l`) as a structured `reverseWrap` mode action.
223224
- `internal/tui`: terminal CSI parser now recognizes DEC application keypad mode (`?66h/l`) as a structured `applicationKeypad` mode action.
224225
- `internal/tui`: terminal CSI parser now recognizes DEC backarrow key mode (`?67h/l`) as a structured `backarrowKey` mode action.

internal/tui/terminal_csi.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ const (
7676
DECModeCursorBlink = 12
7777
DECModeCursorVisible = 25
7878
DECModeAllowColumnSwitch = 40
79+
DECModeMarginBell = 44
7980
DECModeReverseWrap = 45
8081
DECModeAltScreen = 47
8182
DECModeApplicationKeypad = 66
@@ -242,6 +243,7 @@ const (
242243
CSIModeActionOrigin CSIModeActionType = "originMode"
243244
CSIModeActionAutoWrap CSIModeActionType = "autoWrap"
244245
CSIModeActionAutoRepeat CSIModeActionType = "autoRepeat"
246+
CSIModeActionMarginBell CSIModeActionType = "marginBell"
245247
CSIModeActionReverseWrap CSIModeActionType = "reverseWrap"
246248
CSIModeActionCursorBlink CSIModeActionType = "cursorBlink"
247249
CSIModeActionApplicationKeypad CSIModeActionType = "applicationKeypad"
@@ -593,6 +595,8 @@ func csiPrivateModeAction(mode int, enabled bool) (CSIAction, bool) {
593595
return CSIAction{Type: CSIActionMode, Mode: CSIModeAction{Type: CSIModeActionAutoWrap, Enabled: enabled}}, true
594596
case DECModeAutoRepeat:
595597
return CSIAction{Type: CSIActionMode, Mode: CSIModeAction{Type: CSIModeActionAutoRepeat, Enabled: enabled}}, true
598+
case DECModeMarginBell:
599+
return CSIAction{Type: CSIActionMode, Mode: CSIModeAction{Type: CSIModeActionMarginBell, Enabled: enabled}}, true
596600
case DECModeReverseWrap:
597601
return CSIAction{Type: CSIActionMode, Mode: CSIModeAction{Type: CSIModeActionReverseWrap, Enabled: enabled}}, true
598602
case DECModeMouseX10:

internal/tui/tui_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3662,6 +3662,8 @@ func TestParseCSISequenceActions(t *testing.T) {
36623662
{seq: "\x1b[?8l", want: CSIModeAction{Type: CSIModeActionAutoRepeat, Enabled: false}},
36633663
{seq: "\x1b[?12h", want: CSIModeAction{Type: CSIModeActionCursorBlink, Enabled: true}},
36643664
{seq: "\x1b[?12l", want: CSIModeAction{Type: CSIModeActionCursorBlink, Enabled: false}},
3665+
{seq: "\x1b[?44h", want: CSIModeAction{Type: CSIModeActionMarginBell, Enabled: true}},
3666+
{seq: "\x1b[?44l", want: CSIModeAction{Type: CSIModeActionMarginBell, Enabled: false}},
36653667
{seq: "\x1b[?45h", want: CSIModeAction{Type: CSIModeActionReverseWrap, Enabled: true}},
36663668
{seq: "\x1b[?45l", want: CSIModeAction{Type: CSIModeActionReverseWrap, Enabled: false}},
36673669
{seq: "\x1b[?66h", want: CSIModeAction{Type: CSIModeActionApplicationKeypad, Enabled: true}},

0 commit comments

Comments
 (0)