Simplify how we enable ANSI colors on Windows

This commit is contained in:
Christian Rocha
2021-07-29 17:36:29 -04:00
parent 8574b87a44
commit e1ca585c16
3 changed files with 2 additions and 6 deletions

1
tty.go
View File

@@ -20,7 +20,6 @@ func (p *Program) initTerminal() error {
}
if p.outputIsTTY {
enableAnsiColors(p.output)
hideCursor(p.output)
}

View File

@@ -3,7 +3,6 @@
package tea
import (
"io"
"os"
"github.com/containerd/console"
@@ -40,7 +39,3 @@ func openInputTTY() (*os.File, error) {
}
return f, nil
}
// enableAnsiColors is only needed for Windows, so for other systems this is
// a no-op.
func enableAnsiColors(_ io.Writer) {}

View File

@@ -34,6 +34,8 @@ func (p *Program) initInput() error {
c := console.Current()
p.console = c
enableAnsiColors(p.output)
return nil
}