Skip to content

Commit

Permalink
Revert "Use correct output when enabling ANSI colors on Windows (see #39
Browse files Browse the repository at this point in the history
)"

This reverts commit 64da3bc.
  • Loading branch information
meowgorithm committed Dec 31, 2020
1 parent 64da3bc commit 6604f4a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
2 changes: 1 addition & 1 deletion tty.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func initTerminal(w io.Writer) error {
return err
}

enableAnsiColors(w)
enableAnsiColors()
hideCursor(w)
return nil
}
Expand Down
4 changes: 1 addition & 3 deletions tty_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

package tea

import "io"

// enableAnsiColors is only needed for Windows, so for other systems this is
// a no-op.
func enableAnsiColors(w io.Writer) {}
func enableAnsiColors() {}
10 changes: 2 additions & 8 deletions tty_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,15 @@
package tea

import (
"io"
"os"

"golang.org/x/sys/windows"
)

// enableAnsiColors enables support for ANSI color sequences in Windows
// default console. Note that this only works with Windows 10.
func enableAnsiColors(w io.Writer) {
f, ok := w.(*os.File)
if !ok {
return
}

stdout := windows.Handle(f.Fd())
func enableAnsiColors() {
stdout := windows.Handle(os.Stdout.Fd())
var originalMode uint32

windows.GetConsoleMode(stdout, &originalMode)
Expand Down

1 comment on commit 6604f4a

@meowgorithm
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orphan (and an accident). This was never merged.

Please sign in to comment.