Skip to content

Commit

Permalink
Merge pull request #188 from pellared/patch-1
Browse files Browse the repository at this point in the history
Refactor color_windows.go
  • Loading branch information
fatih authored Mar 12, 2023
2 parents c5d9a2b + 770038b commit 12126ed
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)
}

1 comment on commit 12126ed

@Kucharz37
Copy link

Choose a reason for hiding this comment

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

Please sign in to comment.