Skip to content

Commit d092e6b

Browse files
csweichelona-agent
andauthored
fix: register CSI ^ as scroll down alias (#10)
CSI Ps ^ is an alias for CSI Ps T (scroll down) added in upstream xterm.js commit da4243c. Without this handler, the sequence is silently ignored. Fixes #1 Co-authored-by: Ona <no-reply@ona.com>
1 parent dae00f6 commit d092e6b

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

inputhandler.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ func NewInputHandler(
205205
// CSI handlers — scroll
206206
p.RegisterCsiHandler(FunctionIdentifier{Final: 'S'}, h.scrollUp)
207207
p.RegisterCsiHandler(FunctionIdentifier{Final: 'T'}, h.scrollDown)
208+
p.RegisterCsiHandler(FunctionIdentifier{Final: '^'}, h.scrollDown)
208209
p.RegisterCsiHandler(FunctionIdentifier{Intermediates: " ", Final: '@'}, h.scrollLeft)
209210
p.RegisterCsiHandler(FunctionIdentifier{Intermediates: " ", Final: 'A'}, h.scrollRight)
210211
p.RegisterCsiHandler(FunctionIdentifier{Intermediates: "'", Final: '}'}, h.insertColumns)

inputhandler_csi_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,16 @@ func TestScrollUpDown(t *testing.T) {
341341
Input: "AAA\x1b[2;1HBBB\x1b[1T",
342342
Expected: Expectation{Row0: "", Row1: "AAA"},
343343
},
344+
{
345+
Name: "SD_scroll_down_caret_alias",
346+
Input: "AAA\x1b[2;1HBBB\x1b[1^",
347+
Expected: Expectation{Row0: "", Row1: "AAA"},
348+
},
349+
{
350+
Name: "SD_scroll_down_caret_2",
351+
Input: "AAA\x1b[2;1HBBB\x1b[2^",
352+
Expected: Expectation{Row0: "", Row1: ""},
353+
},
344354
}
345355
for _, tc := range tests {
346356
t.Run(tc.Name, func(t *testing.T) {

0 commit comments

Comments
 (0)