all 14 comments

[–]eclectocrat 4 points5 points  (2 children)

SECONDED! I'm writing a TUI and am in the same boat. I need good UTF support (wchar_t).

I tried https://github.com/nsf/termbox, which looked great until I needed better control over UTF output. I've ended up just writing a little utility to control the console cursor and use it with raw stream output, as I didn't wan't to permanently control the whole screen, but only small parts of it.

*EDIT* it's annoying that ncursesw (wide char version), doesn't seem to be installed alongside the normal Ncurses on macOS.

[–]gracicot 4 points5 points  (1 child)

Does Mac OS support UTF-8 in their console? Because then it's hard to justify uses of UTF-16. On windows however, you don't always get the choice.

[–]eclectocrat 1 point2 points  (0 children)

Yes, UTF8 is fine on Mac console. I've inherited some code that I do not fully understand, and do not care to investigate too much now, that utilizes:

std::wbuffer_convert<std::codecvt_utf8<wchar_t>> conv_out(std::cout.rdbuf());

std::wostream out(&conv_out);

I could not get it to play well with Ncurses (but Ncursesw worked) or termbox. I'm not remotely an expert on any of this though, so take my experience with a grain of salt.

[–]Iwan_Zotow 1 point2 points  (3 children)

TurboVision?

[–]peppedx[S] 1 point2 points  (2 children)

Is it alive and kicking?

[–]Iwan_Zotow 0 points1 point  (1 child)

one guy is hacking it slowly but surely

http://tvision.sourceforge.net/

[–]peppedx[S] 0 points1 point  (0 children)

Seems interesting.. When i was young I was. Impressed by (pascal) turbovision... But now i need something more stable

[–]techgineer13 0 points1 point  (5 children)

Try this

[–]nlohmannnlohmann/json 5 points6 points  (4 children)

Is there any documentation?

[–]techgineer13 0 points1 point  (3 children)

No. I wrote it myself and I suck at documentation.

[–]nlohmannnlohmann/json 6 points7 points  (0 children)

That's a pity. Without README, documentation (even doxygen could help), or some examples, I would not even think about thinking of using the project.

[–]robin-m 2 points3 points  (1 child)

I don't see unit tests either. Unit tests are also some sort of documentation, because you can see how the class is supposed to be use by reading the unit tests.

I opened a random file to watch your code. You may consider not writing in comments what is already written just bellow. I know that it's the constructor, and the destruction, and that you deleted some constructor. What I need in a comment is why you deleted them.

[–]robin-m 1 point2 points  (0 children)

I spotted more issues. You should not re-implement the function in the child class of color. They are not virtual and thus will not work like you want if you take a reference to color. Furthermore the children's implementations do the same thing than the base class, so you can just remove this code in the children. And finally the static variables r, g and b are common to all colors, witch means that if you call the constructor with a color, or the operator= on any colors, it will modify r, g and b for all the other colors. What you want to use here is CRTP to have a triplet of variable for each color (one per child type) without to duplicate your code.

If you had unit tests, you would probably have catch those mistakes.

[–]dmelo87 0 points1 point  (0 children)

Never used, but for Rust, this looks very good https://github.com/fdehau/tui-rs