Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions colorize/source/redub/libs/colorize/cwrite.d
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ void cwrite(S...)(File f, S args)
{
WinTermEmulation winterm;
winterm.initialize();
if (winterm.supportVT100)
{
f.write(s);
return;
}

foreach(dchar c ; s)
{
auto charAction = winterm.feed(c);
Expand Down
7 changes: 6 additions & 1 deletion colorize/source/redub/libs/colorize/winterm.d
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,17 @@ version(Windows)
struct WinTermEmulation
{
public:
@nogc void initialize() nothrow
bool supportVT100; // if true, that whole emulation is useless.

void initialize() nothrow
{
// saves console attributes
_console = GetStdHandle(STD_OUTPUT_HANDLE);
_savedInitialColor = (0 != GetConsoleScreenBufferInfo(_console, &consoleInfo));
_state = State.initial;
uint mode;
if (GetConsoleMode(_console, &mode))
supportVT100 = (mode & ENABLE_VIRTUAL_TERMINAL_INPUT) != 0;
}

@nogc ~this() nothrow
Expand Down
Loading