1
1
mirror of https://github.com/walles/moar.git synced 2024-09-11 12:15:43 +03:00

Improve CSI parsing

This commit is contained in:
Johan Walles 2023-11-13 08:51:05 +01:00
parent 8c4a133008
commit dab644878c

View File

@ -135,7 +135,9 @@ func (s *styledStringSplitter) consumeControlSequence(charAfterEsc rune) error {
return fmt.Errorf("Line ended in the middle of a control sequence")
}
if char == ';' || char == ':' || (char >= '0' && char <= '9') {
// Range from here:
// https://en.wikipedia.org/wiki/ANSI_escape_code#CSI_(Control_Sequence_Introducer)_sequences
if char >= 0x30 && char <= 0x3f {
// Sequence still in progress
if charAfterEsc == ']' && s.input[startIndex:s.nextByteIndex] == "8;;" {