diff options
-rw-r--r-- | editors/vi.c | 5 | ||||
-rw-r--r-- | include/mingw.h | 1 | ||||
-rw-r--r-- | miscutils/less.c | 2 | ||||
-rw-r--r-- | win32/winansi.c | 18 |
4 files changed, 25 insertions, 1 deletions
diff --git a/editors/vi.c b/editors/vi.c index b2d185193..75ce8d396 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -3074,7 +3074,12 @@ static void go_bottom_and_clear_to_eol(void) | |||
3074 | //----- Erase from cursor to end of screen ----------------------- | 3074 | //----- Erase from cursor to end of screen ----------------------- |
3075 | static void clear_to_eos(void) | 3075 | static void clear_to_eos(void) |
3076 | { | 3076 | { |
3077 | #if !ENABLE_PLATFORM_MINGW32 | ||
3077 | write1(ESC_CLEAR2EOS); | 3078 | write1(ESC_CLEAR2EOS); |
3079 | #else | ||
3080 | /* in practice clear_to_eos() always clears the entire screen */ | ||
3081 | reset_screen(); | ||
3082 | #endif | ||
3078 | } | 3083 | } |
3079 | 3084 | ||
3080 | //----- Start standout mode ------------------------------------ | 3085 | //----- Start standout mode ------------------------------------ |
diff --git a/include/mingw.h b/include/mingw.h index 5faef41bf..555fa96b7 100644 --- a/include/mingw.h +++ b/include/mingw.h | |||
@@ -155,6 +155,7 @@ int mingw_pclose(FILE *fd); | |||
155 | */ | 155 | */ |
156 | 156 | ||
157 | void move_cursor_row(int n); | 157 | void move_cursor_row(int n); |
158 | void reset_screen(void); | ||
158 | int winansi_putchar(int c); | 159 | int winansi_putchar(int c); |
159 | int winansi_puts(const char *s); | 160 | int winansi_puts(const char *s); |
160 | size_t winansi_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream); | 161 | size_t winansi_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream); |
diff --git a/miscutils/less.c b/miscutils/less.c index 014a649e0..cc0e20bc7 100644 --- a/miscutils/less.c +++ b/miscutils/less.c | |||
@@ -1068,7 +1068,7 @@ static void reinitialize(void) | |||
1068 | printf("\033[999;999H" "\033[6n"); | 1068 | printf("\033[999;999H" "\033[6n"); |
1069 | #endif | 1069 | #endif |
1070 | #if ENABLE_PLATFORM_MINGW32 | 1070 | #if ENABLE_PLATFORM_MINGW32 |
1071 | puts(CLEAR); | 1071 | reset_screen(); |
1072 | #endif | 1072 | #endif |
1073 | buffer_fill_and_print(); | 1073 | buffer_fill_and_print(); |
1074 | } | 1074 | } |
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) |