diff options
author | Christopher Faylor <me@cgf.cx> | 2014-04-26 17:38:22 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2014-04-26 17:38:22 +0000 |
commit | 6e062439422d50c4092b2e1b9815771c4a74c890 (patch) | |
tree | 6e9fa4a181847c11ad60c5d28d5ab346898661e7 /winsup/cygwin/fhandler_console.cc | |
parent | e1c519b41ff08e9cffd1a687c4225566c6cc250b (diff) | |
download | cygnal-6e062439422d50c4092b2e1b9815771c4a74c890.tar.gz cygnal-6e062439422d50c4092b2e1b9815771c4a74c890.tar.bz2 cygnal-6e062439422d50c4092b2e1b9815771c4a74c890.zip |
* DevNotes: Add entry cgf-000026.
* fhandler.h (fhandler_console::save_top): Save top of screen coordinates.
* fhandler_console.cc (dev::save_restore): Record top of screen coordinates.
Clear entire buffer when restoring saved buffer and try to position the cursor
on the save relative place on the screen.
Diffstat (limited to 'winsup/cygwin/fhandler_console.cc')
-rw-r--r-- | winsup/cygwin/fhandler_console.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc index 7a97fc461..27471581a 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -1466,6 +1466,7 @@ dev_console::save_restore (HANDLE h, char c) save_buf = (PCHAR_INFO) cmalloc_abort (HEAP_1_BUF, screen_size); save_cursor = b.dwCursorPosition; /* Remember where we were. */ + save_top = b.srWindow.Top; SMALL_RECT now = {}; /* Read the whole buffer */ now.Bottom = save_bufsize.Y - 1; @@ -1489,6 +1490,7 @@ dev_console::save_restore (HANDLE h, char c) now.Bottom = save_bufsize.Y - 1; now.Right = save_bufsize.X - 1; /* Restore whole buffer */ + clear_screen (h, 0, 0, b.dwSize.X - 1, b.dwSize.Y - 1); BOOL res = WriteConsoleOutputW (h, save_buf, save_bufsize, cob, &now); if (!res) debug_printf ("WriteConsoleOutputW failed, %E"); @@ -1496,9 +1498,14 @@ dev_console::save_restore (HANDLE h, char c) cfree (save_buf); save_buf = NULL; + cob.X = 0; + cob.Y = save_top; + /* Temporarily position at top of screen */ + if (!SetConsoleCursorPosition (h, cob)) + debug_printf ("SetConsoleCursorInfo(%p, cob) failed during restore, %E", h); /* Position where we were previously */ if (!SetConsoleCursorPosition (h, save_cursor)) - debug_printf ("SetConsoleCursorInfo(%p, ...) failed during restore, %E", h); + debug_printf ("SetConsoleCursorInfo(%p, save_cursor) failed during restore, %E", h); /* Get back correct version of buffer information */ dwEnd.X = dwEnd.Y = 0; fillin (h); |