Skip to content

Windows behaviour #10

@Tieske

Description

@Tieske

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions