Skip to content

Commit

Permalink
Refactor color_windows.go
Browse files Browse the repository at this point in the history
  • Loading branch information
pellared authored Mar 1, 2023
1 parent d080a5b commit 0226ec9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions color_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ func init() {
// https://learn.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences#output-sequences
var outMode uint32
out := windows.Handle(os.Stdout.Fd())
if err := windows.GetConsoleMode(out, &outMode); err == nil {
outMode |= windows.ENABLE_PROCESSED_OUTPUT | windows.ENABLE_VIRTUAL_TERMINAL_PROCESSING
_ = windows.SetConsoleMode(out, outMode)
if err := windows.GetConsoleMode(out, &outMode); err != nil {
return
}
outMode |= windows.ENABLE_PROCESSED_OUTPUT | windows.ENABLE_VIRTUAL_TERMINAL_PROCESSING
_ = windows.SetConsoleMode(out, outMode)
}

0 comments on commit 0226ec9

Please sign in to comment.