ItsASecret
ItsASecret

Reputation: 2649

C print wide chars in colors in iTerm2

I have a wide char wchar_t* string and I'd like to print it in color, with write(3)

something like this:

write(1, L"\x1b[31m", 5 * sizeof(wchar_t));
write(1, L"BLA", 3 * sizeof(wchar_t));
write(1, L"\x1b[0m", 5 * sizeof(wchar_t));

Prints [31mBLA[0m without colors.

And something like this:

write(1, "\x1b[31m", 5);
write(1, "BLA", 3);
write(1, "\x1b[0m", 5);

Correctly prints BLA in red.

Any idea how I can print wide char strings in color ?

EDIT: It seems to print correctly in Terminal.app but not in iTerm2 any idea why ?

Upvotes: 2

Views: 134

Answers (1)

ItsASecret
ItsASecret

Reputation: 2649

Ok so this just isn't implemented yet in iTerm2, I've opened an issue here: iTerm2 issue 3460.

A Milestone has been set to implement this I'll update the answer when it's done.

Upvotes: 1

Related Questions