diff options
author | Ron Yorston <rmy@pobox.com> | 2016-04-26 16:48:38 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2016-04-26 16:48:38 +0100 |
commit | 248a2600a2f4b442101ad568d1994b908bb28d4b (patch) | |
tree | 2f78acabf0a2babca275f0ef4d32ad9cd1968b43 /win32 | |
parent | 601f47a2ebcc54c995359c6f87e0eed932329e89 (diff) | |
download | busybox-w32-248a2600a2f4b442101ad568d1994b908bb28d4b.tar.gz busybox-w32-248a2600a2f4b442101ad568d1994b908bb28d4b.tar.bz2 busybox-w32-248a2600a2f4b442101ad568d1994b908bb28d4b.zip |
winansi: revert to previous console behaviour for vi/less
Recent changes to make the Windows console behave more like a *nix
terminal didn't work too well for vi/less. On *nix the terminal
buffer can't be scrolled while such screen-based applications are
running. In the Windows console this remained possible and led to
confusion.
Add a new routine to allow vi/less to revert to their previous
behaviour where the cursor is positioned at the top of the buffer
and the entire buffer is cleared.
Diffstat (limited to 'win32')
-rw-r--r-- | win32/winansi.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/win32/winansi.c b/win32/winansi.c index ebe831593..d61e8a2cf 100644 --- a/win32/winansi.c +++ b/win32/winansi.c | |||
@@ -122,7 +122,25 @@ static void erase_till_end_of_screen(void) | |||
122 | &dummy); | 122 | &dummy); |
123 | FillConsoleOutputAttribute(console, plain_attr, len, sbi.dwCursorPosition, | 123 | FillConsoleOutputAttribute(console, plain_attr, len, sbi.dwCursorPosition, |
124 | &dummy); | 124 | &dummy); |
125 | } | ||
126 | |||
127 | void reset_screen(void) | ||
128 | { | ||
129 | CONSOLE_SCREEN_BUFFER_INFO sbi; | ||
130 | COORD pos; | ||
131 | DWORD dummy, len; | ||
125 | 132 | ||
133 | if (!console) | ||
134 | return; | ||
135 | |||
136 | /* move to start of screen buffer and clear it all */ | ||
137 | GetConsoleScreenBufferInfo(console, &sbi); | ||
138 | pos.X = 0; | ||
139 | pos.Y = 0; | ||
140 | SetConsoleCursorPosition(console, pos); | ||
141 | len = sbi.dwSize.X * sbi.dwSize.Y; | ||
142 | FillConsoleOutputCharacterA(console, ' ', len, pos, &dummy); | ||
143 | FillConsoleOutputAttribute(console, plain_attr, len, pos, &dummy); | ||
126 | } | 144 | } |
127 | 145 | ||
128 | void move_cursor_row(int n) | 146 | void move_cursor_row(int n) |