Repository navigation
Add friendlier Windows set/restore console API - #89
Merged
Merged
Conversation
Owner
twpayne
force-pushed
the
windows-console-api
branch
3 times, most recently
from
September 20, 2022 22:13
700a110 to
09de4e1
Compare
Contributor
Author
|
Thanks! I've rebased the PR, but I might have missed something. Please do review. The CI failure on macOS looks like it's due to some kind of GitHub rate limiting and doesn't seem to be related to this PR. On my M1 Mac, the tests pass. |
twpayne
force-pushed
the
windows-console-api
branch
from
September 20, 2022 22:35
09de4e1 to
2889461
Compare
Contributor
Author
|
The GitHub rate limiting might be fixed by #91. |
twpayne
force-pushed
the
windows-console-api
branch
from
September 20, 2022 22:55
2889461 to
be1b6a6
Compare
Contributor
Author
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.
muesli
force-pushed
the
windows-console-api
branch
from
September 21, 2022 03:27
be1b6a6 to
181ba4f
Compare
Owner
|
Thank you, @twpayne! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The existing
EnableWindowsANSIConsole/RestoreWindowsConsolefunctions have a number of limitations:This commit adds a
EnableVirtualTerminalProcessingfunction with a different API (to avoid breaking backwards compatibility) that is safe to call on all platforms, takes anio.Writeras an argument (for output flexibility). See the comments in the function for more details.Replaces #88.
Refs #86 (and this PR will probably need updating).