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

Windows behaviour #10

Open
Tieske opened this issue May 25, 2024 · 0 comments
Open

Windows behaviour #10

Tieske opened this issue May 25, 2024 · 0 comments

Comments

@Tieske
Copy link

Tieske commented May 25, 2024

Windows has gained suppprt for ANSI sequences (since 2019, a specific release of 2010 added it).

  • ANSI sequences are available
  • might not be enabled by default
  • Windows API function setconsolemode() can be used to enable it
  • It can also be enabled by using os.execute as a workaround

So imho the behaviour of this library should be adjusted. But it is slightly problematic I think;

  • enabling colors on Windows by default is breaking behaviour
  • on Posix it is assumed that the caller of the library wants to use colors (since there are no checks whatsoever, eg using an isapty function to detect a pty)
  • so enabling color by default on Windows would make sense... though support for it might not be enabled...

So I see 2 options:

  • follow Posix behaviour and enable colors by default, if the caller doesn't want colors, then just don't use the lib.
    • Caller is responsible for proper checks and balances, as well as setup.
    • Lines up best with the Posix behaviour
    • breaking
  • enable colors, but make the calls to enable color support (using an external lib to call setconsolemode or use the os.execute workaround.
    • Doing the setup for the caller.
    • less breaking
    • Responsibilities are different from Posix (since caller doesn't do the setup)

wdyt?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant