Skip to content

Commit

Permalink
winansi: support ESC [ K (erase in line)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Johannes Schindelin authored and Junio C Hamano committed Mar 11, 2009
1 parent 34df8ab commit 1897713
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions compat/winansi.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,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;
Expand Down Expand Up @@ -79,6 +77,20 @@ static void set_console_attr(void)
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)
{
const char *func;
Expand Down Expand Up @@ -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 */
Expand Down

0 comments on commit 1897713

Please sign in to comment.