mirror of
https://github.com/jroimartin/gocui.git
synced 2025-04-27 13:48:49 +08:00
feat(escape.go): just ignore OSC
This commit is contained in:
parent
16c24668f7
commit
1b53db93f4
21
escape.go
21
escape.go
@ -39,6 +39,8 @@ const (
|
|||||||
stateEscape
|
stateEscape
|
||||||
stateCSI
|
stateCSI
|
||||||
stateParams
|
stateParams
|
||||||
|
stateOSC
|
||||||
|
stateOSCEscape
|
||||||
|
|
||||||
bold fontEffect = 1
|
bold fontEffect = 1
|
||||||
faint fontEffect = 2
|
faint fontEffect = 2
|
||||||
@ -124,11 +126,16 @@ func (ei *escapeInterpreter) parseOne(ch rune) (isEscape bool, err error) {
|
|||||||
}
|
}
|
||||||
return false, nil
|
return false, nil
|
||||||
case stateEscape:
|
case stateEscape:
|
||||||
if ch == '[' {
|
switch ch {
|
||||||
|
case '[':
|
||||||
ei.state = stateCSI
|
ei.state = stateCSI
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
case ']':
|
||||||
|
ei.state = stateOSC
|
||||||
|
return true, nil
|
||||||
|
default:
|
||||||
return false, errNotCSI
|
return false, errNotCSI
|
||||||
|
}
|
||||||
case stateCSI:
|
case stateCSI:
|
||||||
switch {
|
switch {
|
||||||
case ch >= '0' && ch <= '9':
|
case ch >= '0' && ch <= '9':
|
||||||
@ -189,6 +196,16 @@ func (ei *escapeInterpreter) parseOne(ch rune) (isEscape bool, err error) {
|
|||||||
default:
|
default:
|
||||||
return false, errCSIParseError
|
return false, errCSIParseError
|
||||||
}
|
}
|
||||||
|
case stateOSC:
|
||||||
|
switch ch {
|
||||||
|
case 0x1b:
|
||||||
|
ei.state = stateOSCEscape
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
return true, nil
|
||||||
|
case stateOSCEscape:
|
||||||
|
ei.state = stateNone
|
||||||
|
return true, nil
|
||||||
}
|
}
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user