Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add friendlier Windows set/restore console API #89

Merged
merged 2 commits into from Sep 21, 2022

Commits on Sep 21, 2022

  1. Add EnableVirtualTerminalProcessing function

    The existing EnableWindowsANSIConsole/RestoreWindowsConsole functions
    have a number of limitations:
    * They are only defined when termenv is built on Windows, and so require
      the user to use build tags, i.e. multiple source files, to control
      whether or not they are called and are not shown on
      https://pkg.go.dev/github.com/muesli/termenv by default.
    * They are hardcoded to set the console mode of stdout, and so fail if
      stdout is not a terminal, e.g. when redirecting the output to a file
      or when run in a Go test.
    
    This commit adds a EnableVirtualTerminalProcessing function with a
    different API (to avoid breaking backwards compatibility) that is safe
    to call on all platforms, takes an io.Writer as an argument (for output
    flexibility). See the comments in the function for more details.
    twpayne authored and muesli committed Sep 21, 2022
    Copy the full SHA
    ef7fc6b View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    181ba4f View commit details
    Browse the repository at this point in the history