From 77d045b3ac9218d084b27586b2f1dea23042d2b2 Mon Sep 17 00:00:00 2001 From: Araq Date: Mon, 7 Feb 2011 00:04:31 +0100 Subject: [PATCH] bugfix terminal compiles for windows again --- lib/pure/terminal.nim | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/pure/terminal.nim b/lib/pure/terminal.nim index 42bd80cb42..cd6e5bdd44 100755 --- a/lib/pure/terminal.nim +++ b/lib/pure/terminal.nim @@ -22,7 +22,7 @@ when defined(windows): # = createFile("CONOUT$", GENERIC_WRITE, 0, nil, OPEN_ALWAYS, 0, 0) block: - var hTemp = GetStdHandle(STD_OUTPUT_HANDLE()) + var hTemp = GetStdHandle(STD_OUTPUT_HANDLE) if DuplicateHandle(GetCurrentProcess(), hTemp, GetCurrentProcess(), addr(conHandle), 0, 1, DUPLICATE_SAME_ACCESS) == 0: OSError() @@ -54,9 +54,9 @@ proc setCursorPos*(x, y: int) = if SetConsoleCursorPosition(conHandle, c) == 0: OSError() else: stdout.write("\e[" & $y & ';' & $x & 'f') - + proc setCursorXPos*(x: int) = - ## sets the terminal's cursor to the x position. The y position is + ## sets the terminal's cursor to the x position. The y position is ## not changed. when defined(windows): var scrbuf: TCONSOLE_SCREEN_BUFFER_INFO @@ -64,13 +64,13 @@ proc setCursorXPos*(x: int) = if GetConsoleScreenBufferInfo(hStdout, addr(scrbuf)) == 0: OSError() var origin = scrbuf.dwCursorPosition origin.x = int16(x) - if SetConsoleCursorPosition(conHandle, origin) == 0: OSError() + if SetConsoleCursorPosition(conHandle, origin) == 0: OSError() else: stdout.write("\e[" & $x & 'G') - -when defined(windows): + +when defined(windows): proc setCursorYPos*(y: int) = - ## sets the terminal's cursor to the y position. The x position is + ## sets the terminal's cursor to the y position. The x position is ## not changed. **Warning**: This is not supported on UNIX! when defined(windows): var scrbuf: TCONSOLE_SCREEN_BUFFER_INFO @@ -78,7 +78,7 @@ when defined(windows): if GetConsoleScreenBufferInfo(hStdout, addr(scrbuf)) == 0: OSError() var origin = scrbuf.dwCursorPosition origin.y = int16(y) - if SetConsoleCursorPosition(conHandle, origin) == 0: OSError() + if SetConsoleCursorPosition(conHandle, origin) == 0: OSError() else: nil @@ -168,7 +168,7 @@ proc EraseLine* = scrbuf.dwCursorPosition, addr(numwrote)) == 0: OSError() else: - stdout.write("\e[2K") + stdout.write("\e[2K") setCursorXPos(0) proc EraseScreen* =