From 65af3fee61b6eccbc2ab07e71295d1a84dca30ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Ferreira?= Date: Sat, 31 Aug 2019 19:21:21 +0100 Subject: [PATCH] unit: windows: fix code for 'Windows' version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Luís Ferreira --- src/unit/source/aurorafw/unit/internal/console.d | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/unit/source/aurorafw/unit/internal/console.d b/src/unit/source/aurorafw/unit/internal/console.d index d63372b..96904d7 100644 --- a/src/unit/source/aurorafw/unit/internal/console.d +++ b/src/unit/source/aurorafw/unit/internal/console.d @@ -59,10 +59,10 @@ static struct Console { import core.sys.posix.unistd; noColours = isatty(STDOUT_FILENO) == 0; } else version(Windows) { - import core.sys.windows.winbase : GetStdHandle, STD_OUTPUT_HANDLE, INVALID_HANDLE_VALUE; - import core.sys.windows.wincon : SetConsoleOutputCP, GetConsoleMode, SetConsoleMode; - import core.sys.windows.windef : DWORD; - import core.sys.windows.winnls : CP_UTF8; + import core.sys.windows.winbase; + import core.sys.windows.wincon; + import core.sys.windows.windef; + import core.sys.windows.winnls; SetConsoleOutputCP(CP_UTF8); @@ -76,7 +76,8 @@ static struct Console { } } - static string colour(T)(T t, Colour c = Colour.none) { + static string colour(T)(T t, Colour c = Colour.none) + { return noColours ? text(t) : text("\033[", cast(int) c, "m", t, "\033[m");