X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=compat%2Fwinansi.c;h=dedce2104eaf5cefbb1abef1b7921eb99c67a75e;hb=4daf6fc837f7cc84335958b9d9e8a29e41b4ee8e;hp=e2d96dfe6f75213de567174261d9aeba3e663d9d;hpb=4d9e42f8f11c57b32b976a943c8ddaf6214e64b8;p=git.git diff --git a/compat/winansi.c b/compat/winansi.c index e2d96dfe6..dedce2104 100644 --- a/compat/winansi.c +++ b/compat/winansi.c @@ -2,7 +2,6 @@ * Copyright 2008 Peter Harris */ -#include #include "../git-compat-util.h" /* @@ -18,8 +17,6 @@ This file is git-specific. Therefore, this file does not attempt to implement any codes that are not used by git. - - TODO: K */ static HANDLE console; @@ -79,6 +76,21 @@ static void set_console_attr(void) SetConsoleTextAttribute(console, attributes); } +static void erase_in_line(void) +{ + CONSOLE_SCREEN_BUFFER_INFO sbi; + DWORD dummy; /* Needed for Windows 7 (or Vista) regression */ + + if (!console) + return; + + GetConsoleScreenBufferInfo(console, &sbi); + FillConsoleOutputCharacterA(console, ' ', + sbi.dwSize.X - sbi.dwCursorPosition.X, sbi.dwCursorPosition, + &dummy); +} + + static const char *set_attr(const char *str) { const char *func; @@ -218,7 +230,7 @@ static const char *set_attr(const char *str) set_console_attr(); break; case 'K': - /* TODO */ + erase_in_line(); break; default: /* Unsupported code */