Problem
requestMode (CSI $ p / CSI ? $ p) returns NOT_RECOGNIZED (Pm=0) for several modes that upstream xterm.js reports as PERMANENTLY_SET (Pm=3) or PERMANENTLY_RESET (Pm=4).
Affected modes:
| Mode |
Type |
Upstream Response |
Go Port Response |
| 2 (KAM) |
ANSI |
PERMANENTLY_RESET (4) |
NOT_RECOGNIZED (0) |
| 12 (SRM) |
ANSI |
PERMANENTLY_SET (3) |
NOT_RECOGNIZED (0) |
| 8 (DECARM) |
DEC private |
PERMANENTLY_SET (3) |
NOT_RECOGNIZED (0) |
| 67 (DECBKM) |
DEC private |
PERMANENTLY_RESET (4) |
NOT_RECOGNIZED (0) |
| 1005 (UTF-8 mouse) |
DEC private |
PERMANENTLY_RESET (4) |
NOT_RECOGNIZED (0) |
| 1015 (urxvt mouse) |
DEC private |
PERMANENTLY_RESET (4) |
NOT_RECOGNIZED (0) |
Reproduction
term := xterm.New(xterm.WithCols(80), xterm.WithRows(24))
defer term.Dispose()
var resp string
term.OnData(func(data string) { resp += data })
// ANSI mode 2 — should respond with Pm=4 (PERMANENTLY_RESET)
term.WriteString("\x1b[2$p")
// Got: "\x1b[2;0$y" (NOT_RECOGNIZED)
// Want: "\x1b[2;4$y" (PERMANENTLY_RESET)
Fix
In inputhandler_csi.go, add cases to ansiModeSetting and privateModeSetting:
// ansiModeSetting
case 2:
return 4 // PERMANENTLY_RESET
case 12:
return 3 // PERMANENTLY_SET
// privateModeSetting
case 8:
return 3 // PERMANENTLY_SET
case 67:
return 4 // PERMANENTLY_RESET
case 1005:
return 4 // PERMANENTLY_RESET
case 1015:
return 4 // PERMANENTLY_RESET
Upstream Reference
- File:
src/common/InputHandler.ts, method requestMode, lines 2330–2395
- Commit:
6ba731d73bfbe074e84b57abb62080bed2f4db03
Problem
requestMode(CSI $ p/CSI ? $ p) returnsNOT_RECOGNIZED(Pm=0) for several modes that upstream xterm.js reports asPERMANENTLY_SET(Pm=3) orPERMANENTLY_RESET(Pm=4).Affected modes:
PERMANENTLY_RESET(4)NOT_RECOGNIZED(0)PERMANENTLY_SET(3)NOT_RECOGNIZED(0)PERMANENTLY_SET(3)NOT_RECOGNIZED(0)PERMANENTLY_RESET(4)NOT_RECOGNIZED(0)PERMANENTLY_RESET(4)NOT_RECOGNIZED(0)PERMANENTLY_RESET(4)NOT_RECOGNIZED(0)Reproduction
Fix
In
inputhandler_csi.go, add cases toansiModeSettingandprivateModeSetting:Upstream Reference
src/common/InputHandler.ts, methodrequestMode, lines 2330–23956ba731d73bfbe074e84b57abb62080bed2f4db03