winansi: support ESC [ K (erase in line)

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Johannes Schindelin 2009-03-10 22:58:09 +01:00 committed by Junio C Hamano
parent 34df8abaf3
commit 1897713fbd

View File

@ -18,8 +18,6 @@
This file is git-specific. Therefore, this file does not attempt This file is git-specific. Therefore, this file does not attempt
to implement any codes that are not used by git. to implement any codes that are not used by git.
TODO: K
*/ */
static HANDLE console; static HANDLE console;
@ -79,6 +77,20 @@ static void set_console_attr(void)
SetConsoleTextAttribute(console, attributes); SetConsoleTextAttribute(console, attributes);
} }
static void erase_in_line(void)
{
CONSOLE_SCREEN_BUFFER_INFO sbi;
if (!console)
return;
GetConsoleScreenBufferInfo(console, &sbi);
FillConsoleOutputCharacterA(console, ' ',
sbi.dwSize.X - sbi.dwCursorPosition.X, sbi.dwCursorPosition,
NULL);
}
static const char *set_attr(const char *str) static const char *set_attr(const char *str)
{ {
const char *func; const char *func;
@ -218,7 +230,7 @@ static const char *set_attr(const char *str)
set_console_attr(); set_console_attr();
break; break;
case 'K': case 'K':
/* TODO */ erase_in_line();
break; break;
default: default:
/* Unsupported code */ /* Unsupported code */