aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/mattn/go-colorable/noncolorable.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/mattn/go-colorable/noncolorable.go')
-rw-r--r--vendor/github.com/mattn/go-colorable/noncolorable.go12
1 files changed, 3 insertions, 9 deletions
diff --git a/vendor/github.com/mattn/go-colorable/noncolorable.go b/vendor/github.com/mattn/go-colorable/noncolorable.go
index ca588c78a..9721e16f4 100644
--- a/vendor/github.com/mattn/go-colorable/noncolorable.go
+++ b/vendor/github.com/mattn/go-colorable/noncolorable.go
@@ -7,8 +7,7 @@ import (
// NonColorable hold writer but remove escape sequence.
type NonColorable struct {
- out io.Writer
- lastbuf bytes.Buffer
+ out io.Writer
}
// NewNonColorable return new instance of Writer which remove escape sequence from Writer.
@@ -33,12 +32,9 @@ loop:
}
c2, err := er.ReadByte()
if err != nil {
- w.lastbuf.WriteByte(c1)
break loop
}
if c2 != 0x5b {
- w.lastbuf.WriteByte(c1)
- w.lastbuf.WriteByte(c2)
continue
}
@@ -46,9 +42,6 @@ loop:
for {
c, err := er.ReadByte()
if err != nil {
- w.lastbuf.WriteByte(c1)
- w.lastbuf.WriteByte(c2)
- w.lastbuf.Write(buf.Bytes())
break loop
}
if ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || c == '@' {
@@ -57,5 +50,6 @@ loop:
buf.Write([]byte(string(c)))
}
}
- return len(data) - w.lastbuf.Len(), nil
+
+ return len(data), nil
}