rust-cli / anstyle

ANSI text styling
https://docs.rs/anstyle
Other
120 stars 19 forks source link

fix(wincon)!: Make styled output stateless #127

Closed epage closed 1 year ago

epage commented 1 year ago

To do this, we use cache the current colors on first check, rather than re-querying it on every check.

This enables us to just have a simple WinconStream::write_colored function.

This also fixes bugs with making sure that the stream is locked before doing our various operations on it, avoiding race conditions.