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>
Johannes Schindelin committed
Mar 10, 2009 at 22:58 UTC
1897713fbd96229f3581b8e8a5653da917882195
1 file changed
+15
-3
compat/winansi.c
+15
-3
@@ -18,8 +18,6 @@
18
19
This file is git-specific. Therefore, this file does not attempt
20
to implement any codes that are not used by git.
21
-
22
- TODO: K
21
*/
22
23
static HANDLE console;
@@ -79,6 +77,20 @@ static void set_console_attr(void)
77
SetConsoleTextAttribute(console, attributes);
78
}
79
80
+static void erase_in_line(void)
81
+{
82
+ CONSOLE_SCREEN_BUFFER_INFO sbi;
83
+
84
+ if (!console)
85
+ return;
86
+
87
+ GetConsoleScreenBufferInfo(console, &sbi);
88
+ FillConsoleOutputCharacterA(console, ' ',
89
+ sbi.dwSize.X - sbi.dwCursorPosition.X, sbi.dwCursorPosition,
90
+ NULL);
91
+}
92
+
93
+
94
static const char *set_attr(const char *str)
95
{
96
const char *func;
@@ -218,7 +230,7 @@ static const char *set_attr(const char *str)
230
set_console_attr();
231
break;
232
case 'K':
221
- /* TODO */
233
+ erase_in_line();
234
break;
235
default:
236
/* Unsupported code */