mirror of
https://github.com/jroimartin/gocui.git
synced 2025-04-24 13:48:51 +08:00
Remove unneeded check in *escapeInterpreter.parseOne()
This commit is contained in:
parent
e27f247a3e
commit
139487f578
13
escape.go
13
escape.go
@ -76,14 +76,16 @@ func (ei *escapeInterpreter) reset() {
|
||||
// of an escape sequence, and as such should not be printed verbatim. Otherwise,
|
||||
// it's not an escape sequence.
|
||||
func (ei *escapeInterpreter) parseOne(ch rune) (isEscape bool, err error) {
|
||||
// Sanity checks to make sure we're not parsing something totally bogus.
|
||||
// Sanity checks
|
||||
if len(ei.csiParam) > 20 {
|
||||
return false, errCSITooLong
|
||||
}
|
||||
if len(ei.csiParam) > 0 && len(ei.csiParam[len(ei.csiParam)-1]) > 255 {
|
||||
return false, errCSITooLong
|
||||
}
|
||||
|
||||
ei.curch = ch
|
||||
|
||||
switch ei.state {
|
||||
case stateNone:
|
||||
if ch == 0x1b {
|
||||
@ -117,16 +119,11 @@ func (ei *escapeInterpreter) parseOne(ch rune) (isEscape bool, err error) {
|
||||
ei.csiParam = append(ei.csiParam, "")
|
||||
return true, nil
|
||||
case ch == 'm':
|
||||
if len(ei.csiParam) < 1 {
|
||||
return false, errCSIParseError
|
||||
}
|
||||
|
||||
var err error
|
||||
|
||||
switch ei.mode {
|
||||
case OutputMode(OutputNormal):
|
||||
case OutputNormal:
|
||||
err = ei.outputNormal()
|
||||
case OutputMode(Output256):
|
||||
case Output256:
|
||||
err = ei.output256()
|
||||
}
|
||||
if err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user