aboutsummaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2014-03-10 03:15:39 +0000
committerChristopher Faylor <me@cgf.cx>2014-03-10 03:15:39 +0000
commitcda5aac102ba5161412731eae7f278781483876e (patch)
treeba608ba9b867890b5dc335c23758175609e63a9a /winsup
parentdc5694dc883799b7b28a5fbe8b0ab3439a124e94 (diff)
downloadnewlib-cda5aac102ba5161412731eae7f278781483876e.zip
newlib-cda5aac102ba5161412731eae7f278781483876e.tar.gz
newlib-cda5aac102ba5161412731eae7f278781483876e.tar.bz2
* fhandler_console.cc (fhandler_console::save_restore): Save only until last
written row and, because of this, don't bother trying to restore the screen buffer size. Set cursor position after refilling buffer. (fhandler_console::write): Use absolute paths when saving/restoring cursor position or suffer odd problems after a saved screen is restored.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog9
-rw-r--r--winsup/cygwin/fhandler_console.cc32
2 files changed, 23 insertions, 18 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 173caf0..f96e0e1 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,14 @@
2014-03-09 Christopher Faylor <me.cygwin2014@cgf.cx>
+ * fhandler_console.cc (fhandler_console::save_restore): Save only until
+ last written row and, because of this, don't bother trying to restore
+ the screen buffer size. Set cursor position after refilling buffer.
+ (fhandler_console::write): Use absolute paths when saving/restoring
+ cursor position or suffer odd problems after a saved screen is
+ restored.
+
+2014-03-09 Christopher Faylor <me.cygwin2014@cgf.cx>
+
* fhandler.h (fhandler_console::dwBufferSize): Delete.
(fhandler_console::dwCursorPosition): Ditto.
(fhandler_console::wAttributes): Ditto.
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index 10cbd97..53418ed 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -1457,7 +1457,8 @@ dev_console::save_restore (HANDLE h, char c)
if (c == 'h') /* save */
{
fillin (h);
- save_bufsize = b.dwSize; /* Assume starting from 0/0 */
+ save_bufsize.Y = dwEnd.Y + 1; /* Assume starting from 0/0 */
+ save_bufsize.X = b.dwSize.X;
if (save_buf)
cfree (save_buf);
@@ -1467,8 +1468,8 @@ dev_console::save_restore (HANDLE h, char c)
save_cursor = b.dwCursorPosition; /* Remember where we were. */
SMALL_RECT now = {}; /* Read the whole buffer */
- now.Bottom = b.dwSize.Y - 1;
- now.Right = b.dwSize.X - 1;
+ now.Bottom = save_bufsize.Y - 1;
+ now.Right = save_bufsize.X - 1;
if (!ReadConsoleOutputWrapper (h, save_buf, save_bufsize, now))
debug_printf ("ReadConsoleOutputWrapper(h, ...) failed during save, %E");
@@ -1483,21 +1484,10 @@ dev_console::save_restore (HANDLE h, char c)
}
else if (save_buf)
{
- /* Restore original buffer size, just in case. */
- if (!SetConsoleScreenBufferSize (h, save_bufsize))
- debug_printf ("SetConsoleScreenBufferSize(h, ...) failed during restore, %E", h);
-
- /* Position where we were previously */
- if (!SetConsoleCursorPosition (h, save_cursor))
- debug_printf ("SetConsoleCursorInfo(%p, ...) failed during restore, %E", h);
-
- /* Get back correct version of buffer information */
- dwEnd.X = dwEnd.Y = 0;
- fillin (h);
COORD cob = {};
SMALL_RECT now = {};
- now.Bottom = b.dwSize.Y - 1;
- now.Right = b.dwSize.X - 1;
+ now.Bottom = save_bufsize.Y - 1;
+ now.Right = save_bufsize.X - 1;
/* Restore whole buffer */
BOOL res = WriteConsoleOutputW (h, save_buf, save_bufsize, cob, &now);
if (!res)
@@ -1505,6 +1495,13 @@ dev_console::save_restore (HANDLE h, char c)
cfree (save_buf);
save_buf = NULL;
+
+ /* Position where we were previously */
+ if (!SetConsoleCursorPosition (h, save_cursor))
+ debug_printf ("SetConsoleCursorInfo(%p, ...) failed during restore, %E", h);
+ /* Get back correct version of buffer information */
+ dwEnd.X = dwEnd.Y = 0;
+ fillin (h);
}
}
@@ -2218,13 +2215,12 @@ fhandler_console::write (const void *vsrc, size_t len)
}
else if (*src == '8') /* DECRC Restore cursor position */
{
- cursor_set (true, con.savex, con.savey);
+ cursor_set (false, con.savex, con.savey);
con.state = normal;
}
else if (*src == '7') /* DECSC Save cursor position */
{
cursor_get (&con.savex, &con.savey);
- con.savey -= con.b.srWindow.Top;
con.state = normal;
}
else if (*src == 'R') /* ? */