Open MaulingMonkey opened 5 years ago
Might be worth introducing an env var or feature or something to force legacy winapi mode for testing purpouses on win10 systems.
Related to old issue: https://github.com/crossterm-rs/crossterm/issues/38 it is very strange behavior and probably has to with the order in which rust invokes the Display implemented for tose types and then how WinApi set's those collars. It is unclear to me why this happens. It was partaly solved in earlier releases. But there are still some problems with it. I will not this issue as a bug
It seems like this could be fixed by flushing before (or after) every winapi call?
The problem arises when you print at the same line. If you set style, print a string without line break and then set the style back, and then flush you won't have styled text.
Maybe this can be solved by using winapi for writing as well.
To summarize the issue:
let x = format!("{}", hello".red());
This can easily work with ansi since the ansi sequence is written to x with the original str. In winapi case, the corresponding api is called and we never modify the original str, so the color information is lost (which is the expected behavior) so when we print later it will only color in ansi's case. I think formatting and winapi simply can't coexist together, we should just mention it in the docs and that should be enough.
This works fine on windows 10, but appears completely unstyled on windows 7:
With enough flushing, you can kinda get it to work: