* 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.
This commit is contained in:
Christopher Faylor 2014-04-26 17:38:22 +00:00
parent e1c519b41f
commit 6e06243942
4 changed files with 27 additions and 1 deletions

View File

@ -1,3 +1,12 @@
2014-04-26 Christopher Faylor <me.cygwin2014@cgf.cx>
* 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.
2014-04-25 Corinna Vinschen <corinna@vinschen.de>
* syscalls.cc (NT_TRANSACTIONAL_ERROR): Cover all status codes up to

View File

@ -1,3 +1,12 @@
2014-04-26 cgf-000026
Forgot to clear to the end of screen when restoring a screen buffer.
That worked, for some reason, with Take Command but not with normal
consoles. I don't remember why I didn't resize the screen like a Linux
X terminal emulator but that might have made things work a little
better. Right now, there is a scroll bar for apps like less or vi and
that doesn't feel right.
2014-03-29 cgf-000025
Reorganized _cygtls::signal_debugger to avoid sending anything to the

View File

@ -1302,6 +1302,7 @@ class dev_console
COORD save_bufsize;
PCHAR_INFO save_buf;
COORD save_cursor;
SHORT save_top;
COORD dwLastCursorPosition;
COORD dwMousePosition; /* scroll-adjusted coord of mouse event */

View File

@ -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);