agauniyal / rang

A Minimal, Header only Modern c++ library for terminal goodies 💄✨
https://agauniyal.github.io/rang/
The Unlicense
1.48k stars 142 forks source link

rang::style::reset also resets rang::fg #133

Open asmaloney opened 1 year ago

asmaloney commented 1 year ago

If I do this:

std::cout << rang::fg::blue << "foo: " << rang::style::bold << "some text"
         << rang::style::reset << " (some more text)" << std::endl;

I get this:

Screen Shot 2023-03-18 at 14 39 48 PM

but since I didn't reset fg, I expected to see this:

Screen Shot 2023-03-18 at 14 40 16 PM

Is this expected behaviour? The docs seem to imply this should not be happening.

zethon commented 11 months ago

The order of evaluation of the stream elements wasn't specified until C++17. Are you using an older C++ standard?

asmaloney commented 11 months ago

Even after using it for decades, C++ continues to surprise! 😄

It's quite possible that I was using C++14 at the time. I have since removed rang and just use fmt's styling in favour of fewer dependencies.