[PATCH 2/2] winansi: support ESC [ K (erase in line)

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Johannes Sixt
Date: Tuesday, March 10, 2009 - 2:58 pm

From: Johannes Schindelin <johannes.schindelin@gmx.de>

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
 This is your patch without the write() part.

 -- Hannes

 compat/winansi.c |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/compat/winansi.c b/compat/winansi.c
index e2d96df..44dc293 100644
--- a/compat/winansi.c
+++ b/compat/winansi.c
@@ -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;
@@ -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;
@@ -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 */
-- 
1.6.2.103.gb3eac.dirty

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] winansi: support ESC [ K (erase in line), Johannes Schindelin, (Mon Mar 9, 5:41 pm)
Re: [PATCH] winansi: support ESC [ K (erase in line), Johannes Sixt, (Tue Mar 10, 12:15 am)
[PATCH/RFC] recv_sideband: Band #2 always goes to stderr, Johannes Sixt, (Tue Mar 10, 12:30 am)
Re: [PATCH/RFC] recv_sideband: Band #2 always goes to stderr, Johannes Schindelin, (Tue Mar 10, 3:56 am)
Re: [PATCH] winansi: support ESC [ K (erase in line), Johannes Schindelin, (Tue Mar 10, 4:31 am)
Re: [PATCH/RFC] recv_sideband: Band #2 always goes to stderr, Johannes Schindelin, (Tue Mar 10, 4:39 am)
Re: [PATCH] winansi: support ESC [ K (erase in line), Peter Harris, (Tue Mar 10, 5:29 am)
Re: [PATCH/RFC] recv_sideband: Band #2 always goes to stderr, Johannes Schindelin, (Tue Mar 10, 5:52 am)
Re: [PATCH] winansi: support ESC [ K (erase in line), Johannes Schindelin, (Tue Mar 10, 5:54 am)
Re: [PATCH/RFC] recv_sideband: Band #2 always goes to stderr, Shawn O. Pearce, (Tue Mar 10, 7:38 am)
Re: [PATCH/RFC] recv_sideband: Band #2 always goes to stderr, Johannes Schindelin, (Tue Mar 10, 7:46 am)
Re: [PATCH/RFC] recv_sideband: Band #2 always goes to stderr, Shawn O. Pearce, (Tue Mar 10, 7:46 am)
Re: [PATCH/RFC] recv_sideband: Band #2 always goes to stderr, Johannes Schindelin, (Tue Mar 10, 8:07 am)
[PATCH 2/2] winansi: support ESC [ K (erase in line), Johannes Sixt, (Tue Mar 10, 2:58 pm)
Re: [PATCH 2/2] winansi: support ESC [ K (erase in line), Johannes Schindelin, (Wed Mar 11, 3:22 am)