From 9a7f488564610817a7b9d9d44d7db154e444eb7d Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Mon, 25 Apr 2016 14:48:10 +0100 Subject: winansi: fix a couple of small problems Clear the last line; move to cursor position before clearing screen with ^L. --- libbb/lineedit.c | 3 +++ win32/winansi.c | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 04361b509..37c106bd8 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c @@ -2510,6 +2510,9 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman case CTRL('L'): vi_case(CTRL('L')|VI_CMDMODE_BIT:) /* Control-l -- clear screen */ +#if ENABLE_PLATFORM_MINGW32 + printf(ESC"[0A"); /* move to current cursor postion */ +#endif printf(ESC"[H"); /* cursor to top,left */ redraw(0, command_len - cursor); break; diff --git a/win32/winansi.c b/win32/winansi.c index d9e0835ce..78d5d5f5c 100644 --- a/win32/winansi.c +++ b/win32/winansi.c @@ -124,7 +124,8 @@ static void erase_till_end_of_screen(void) &dummy); pos.X = 0; - for (pos.Y = sbi.dwCursorPosition.Y+1; pos.Y < sbi.srWindow.Bottom; pos.Y++) { + for (pos.Y = sbi.dwCursorPosition.Y+1; pos.Y <= sbi.srWindow.Bottom; + pos.Y++) { FillConsoleOutputCharacterA(console, ' ', sbi.dwSize.X, pos, &dummy); FillConsoleOutputAttribute(console, plain_attr, sbi.dwSize.X, -- cgit v1.2.3-55-g6feb