Also parse negative numbers in CSI
This commit is contained in:
parent
aebfdaa69a
commit
05e10d8066
@ -119,7 +119,7 @@ func (self *EscapeCodeParser) write_ch(ch byte) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func csi_type(ch byte) csi_char_type {
|
func csi_type(ch byte) csi_char_type {
|
||||||
if 0x30 <= ch && ch <= 0x3f {
|
if (0x30 <= ch && ch <= 0x3f) || ch == '-' {
|
||||||
return parameter_csi_char
|
return parameter_csi_char
|
||||||
}
|
}
|
||||||
if 0x40 <= ch && ch <= 0x7E {
|
if 0x40 <= ch && ch <= 0x7E {
|
||||||
|
|||||||
@ -46,6 +46,7 @@ func TestEscapeCodeParsing(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test("\x1b[31m\xc2\x9bm", "CSI: 31m\nCSI: m")
|
test("\x1b[31m\xc2\x9bm", "CSI: 31m\nCSI: m")
|
||||||
|
test("\x1b[-31m\xc2\x9bm", "CSI: -31m\nCSI: m")
|
||||||
test("ab\nc", "CH: a\nCH: b\nCH: \n\nCH: c")
|
test("ab\nc", "CH: a\nCH: b\nCH: \n\nCH: c")
|
||||||
test("a\x1b[200m\x1b[mb\x1b[5:3;2;4~", "CH: a\nCSI: 200m\nCSI: m\nCH: b\nCSI: 5:3;2;4~")
|
test("a\x1b[200m\x1b[mb\x1b[5:3;2;4~", "CH: a\nCSI: 200m\nCSI: m\nCH: b\nCSI: 5:3;2;4~")
|
||||||
test("\x1b[200~a\x1b[201m\x1b[201~\x1b[x", "CH: a\nCH: \x1b\nCH: [\nCH: 2\nCH: 0\nCH: 1\nCH: m\nCSI: x")
|
test("\x1b[200~a\x1b[201m\x1b[201~\x1b[x", "CH: a\nCH: \x1b\nCH: [\nCH: 2\nCH: 0\nCH: 1\nCH: m\nCSI: x")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user