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 support #9

Open
retep998 opened this issue Jul 15, 2016 · 4 comments
Open

Windows support #9

retep998 opened this issue Jul 15, 2016 · 4 comments

Comments

@retep998
Copy link

Please support the Windows console. Please think about how you're going to support it before you commit to certain API design choices. In order to provide formatting in the Windows console, you have to control how stuff is written to the console. println! will not work. No ansi escape codes (unless you're on Windows 10 with a certain console mode enabled, which offers some escape codes).

@Munksgaard
Copy link
Owner

That's a very good point @retep998. Unfortunately, I'm not very familiar with formatting in the Windows console. Do you know of any good resources?

@retep998
Copy link
Author

Well, I am actually working on an API for interacting with the console in wio. You can see an example of it here.

Basically the console is just a 2D grid buffer of u16 characters and each cell has a background and a foreground color (you can only choose from a palette of 16 colors although that palette can be any 24-bit RGB colors you want), no other formatting. Note that you can create multiple such buffers with different sizes and palettes and swap between them easily, but only one buffer is active (visible) at a given time. All output is done by interacting with such a buffer through API calls.

@killercup
Copy link
Contributor

@retep998, do you think it'd be possible to implement Windows support in termion? I'm not sure what features it currently supports (and which of these are available on Windows).

@retep998
Copy link
Author

@killercup Look at the code from the example.

    let stdout = io::stdout();
    let mut stdout = stdout.lock();

    stdout.color(color::Red).unwrap();

In order to do colors in the windows console you need the stdout handle. Unfortunately libstd does not allow access to the underlying handle. As a result, this API as it stands right now is not compatible with the windows console. If you get the handle via GetStdHandle, then it isn't compatible with libtest stdout redirection, and also would require flushing rust's stdout before each windows console api function.

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

3 participants