From 79f2d9f4a06d708d5d6102bcc8c356696d33e791 Mon Sep 17 00:00:00 2001
From: "Adam D. Ruppe" <destructionator@gmail.com>
Date: Mon, 22 Dec 2014 18:36:37 -0500
Subject: [PATCH] windows clear function impl

---
 terminal.d | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/terminal.d b/terminal.d
index 81d191f..40169c4 100644
--- a/terminal.d
+++ b/terminal.d
@@ -1100,9 +1100,16 @@ http://msdn.microsoft.com/en-us/library/windows/desktop/ms683193%28v=vs.85%29.as
 		version(Posix) {
 			doTermcap("cl");
 		} else version(Windows) {
-			// TBD: copy the code from here and test it:
 			// http://support.microsoft.com/kb/99261
-			assert(0, "clear not yet implemented");
+
+			DWORD c;
+			CONSOLE_SCREEN_BUFFER_INFO csbi;
+			DWORD conSize;
+			GetConsoleScreenBufferInfo(hConsole, &csbi);
+			COORD coordScreen;
+			FillConsoleOutputCharacterA(hConsole, ' ', conSize, coordScreen, &c);
+			FillConsoleOutputAttribute(hConsole, csbi.wAttributes, conSize, coordScreen, &c);
+			moveTo(0, 0);
 		}
 
 		_cursorX = 0;