+ COORD dest;
+ CONSOLE_SCREEN_BUFFER_INFO info;
+ int n;
+ DWORD r;
+
+ /* Clear the complete screen buffer. This is required because Emacs
+ sets the cursor position to the top of the buffer, but there might
+ be other output below the bottom of the Emacs frame if the screen buffer
+ is larger than the window size. */
+ GetConsoleScreenBufferInfo (cur_screen, &info);
+ dest.X = 0;
+ dest.Y = 0;
+ n = info.dwSize.X * info.dwSize.Y;
+
+ FillConsoleOutputAttribute (cur_screen, char_attr_normal, n, dest, &r);
+ FillConsoleOutputCharacter (cur_screen, ' ', n, dest, &r);
+ /* Now that the screen is clear, put the cursor at the top. */
+ SetConsoleCursorPosition (cur_screen, dest);
+