By registering with us, you'll be able to discuss, share and private message with other members of our community.
SignUp Now!Yes, error colors are red on default (black). But the same thing happens regardless of that setting. Here's default on default.Not reproducible here.
Do you have something defined for error colors (OPTION / Command Line)? Or ANSI disabled in that section?
And are you doing this in a console window, a Terminal window, or a TCMD tab window?
Yes, error colors are red on default (black). But the same thing happens regardless of that setting. Here's default on default.
View attachment 4923
It's the same in all three places, console, WT, TCMD
1>&2 echo ^e[91mfoo^e[0m
it uses console APIs to write the text & attributes directly to the screen.
;ErrorColors=Red on Black
fwprintf(stderr, L"\x01b[32;1mfoo\x01b[0m\n");
WriteConsoleW(GetStdHandle(STD_ERROR_HANDLE), L"\x01b[32;1mfoo\x01b[0m\n", 15, NULL, NULL);
HANDLE h = CreateFileW(L"CONOUT$", GENERIC_WRITE, FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, 0, nullptr);
WriteConsoleW(h, L"\x01b[32;1mfoo\x01b[0m\r\n", 16, nullptr, nullptr);
CloseHandle(h);
Have the same behaviour as Vince described in posting #1 (3rd is failing) ...
View attachment 4927
is here in red (as Rex posted).Code:1>&2 echo ^e[91mfoo^e[0m
View attachment 4928
Yes, indeed - set to red on black here.And did you define colors for error output?
What does that mean?
In my experience, if VT processing is enabled the sequences are honored (period!). Is ECHOERR setting the console output mode?
ECHOERR is OK with this INI line commented.
Code:;ErrorColors=Red on Black
In InitializePlugin, all of these (first 3 foos below) work.
Code:fwprintf(stderr, L"\x01b[32;1mfoo\x01b[0m\n"); WriteConsoleW(GetStdHandle(STD_ERROR_HANDLE), L"\x01b[32;1mfoo\x01b[0m\n", 15, NULL, NULL); HANDLE h = CreateFileW(L"CONOUT$", GENERIC_WRITE, FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, 0, nullptr); WriteConsoleW(h, L"\x01b[32;1mfoo\x01b[0m\r\n", 16, nullptr, nullptr); CloseHandle(h);
View attachment 4926
Oh! Is there any chance that the behavior will change?VT sequences are ignored in all of the other console output APIs -- like WriteConsoleOutputCharacter / FillConsoleOutputAttribute, which are used by ECHOERR to write colored text.
This is very old TCC behavior.
Oh! Is there any chance that the behavior will change?
I think of it as overriding my usual red on bla.
I was thinking of something other than WriteConsoleOutputCharacter / FillConsoleOutputAttribute. Can't you momenrtarily change the output attributes and use WriteConsole?
Maybe I'm missing something. We're still talking about ECHOERR, right? An INI spec for ErrorColors could be a signal (yes/no?).Ahhh - no. How would TCC know it was supposed to do that?
Maybe I'm missing something. We're still talking about ECHOERR, right? An INI spec for ErrorColors could be a signal (yes/no?).
This doesn't make sense. You are already specifying an INI value for ErrorColors (red on black). You want to specify another INI value saying TCC should ignore the first INI value you set?
Yes. I think of it more as overriding the INI directive (perhaps to call more attention, add bold, italics, underline ...). TCC can still set the text attributes to the INI spec, but the control sequences will have last say and override them. I suppose I could change them temporarily with OPTION but I can't do the other things I just mentioned.
A question: In a little testing (more to come), it seemed that Qprintf(GetStdHandle() ... takes the console out of VT mode. Is that right?
#define str L"\x1b[92mfoo\x1b[0m\r\n"
Qprintf(GetStdHandle(STD_ERROR_HANDLE), L"1" str);
Qprintf(GetStdHandle(STD_OUTPUT_HANDLE), L"2" str);
How do you suppose theseI understand Rex as saying that writing to printing error messages with ErrorColors set does not use the write-to-handle APIs. It isn't using STD_ERROR_HANDLE at all. What Qprintf() can do with that handle isn't relevant; it's a different set of APIs.
#define str L"\x1b[92mfoo\x1b[0m\r\n"
Qprintf(GetStdHandle(STD_ERROR_HANDLE), L"1" str);
Qprintf(GetStdHandle(STD_OUTPUT_HANDLE), L"2" str);