Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2001-03-30 15:10:13 +0400
committerCorinna Vinschen <corinna@vinschen.de>2001-03-30 15:10:13 +0400
commitf42da31ad6985867c9098eea4c6eab7576c10bf0 (patch)
treec15b594213700e92a0d3f5e00f6e94232ef27d31 /winsup
parent0694d8d3109d10be3c016d5f144811c618602111 (diff)
* fhandler.h (class fhandler_console): Add members `savebufsiz' and
`savebuf' to allow save/restore of screen. * fhandler_console.cc (fhandler_console::dup): Duplicate savebuf. (fhandler_console::fhandler_console): Initialize `savebufsiz' and `savebuf'. (fhandler_console::char_command): Add terminal capabilities "save screen content" = \E[?47h and "restore screen content" = \E[?47l.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog10
-rw-r--r--winsup/cygwin/fhandler.h4
-rw-r--r--winsup/cygwin/fhandler_console.cc51
3 files changed, 65 insertions, 0 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 451bc76ae..08fe7ce06 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,13 @@
+Fri Mar 30 13:02:00 2001 Corinna Vinschen <corinna@vinschen.de>
+
+ * fhandler.h (class fhandler_console): Add members `savebufsiz' and
+ `savebuf' to allow save/restore of screen.
+ * fhandler_console.cc (fhandler_console::dup): Duplicate savebuf.
+ (fhandler_console::fhandler_console): Initialize `savebufsiz' and
+ `savebuf'.
+ (fhandler_console::char_command): Add terminal capabilities
+ "save screen content" = \E[?47h and "restore screen content" = \E[?47l.
+
Wed Mar 28 19:28:50 2001 Christopher Faylor <cgf@cygnus.com>
* path.cc (chdir): Eat trailing whitespace on input path.
diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
index 239aa8650..a6ad7cb87 100644
--- a/winsup/cygwin/fhandler.h
+++ b/winsup/cygwin/fhandler.h
@@ -630,6 +630,10 @@ private:
/* saved cursor coordinates */
int savex, savey;
+ /* saved screen */
+ COORD savebufsiz;
+ PCHAR_INFO savebuf;
+
struct
{
short Top, Bottom;
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index d780f8c25..ba72dfa54 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -565,6 +565,15 @@ fhandler_console::dup (fhandler_base *child)
fhc->savex = savex;
fhc->savey = savey;
+ fhc->savebufsiz = savebufsiz;
+ if (savebuf)
+ {
+ fhc->savebuf = (PCHAR_INFO) malloc (sizeof (CHAR_INFO) *
+ savebufsiz.X * savebufsiz.Y);
+ memcpy (fhc->savebuf, savebuf, sizeof (CHAR_INFO) *
+ savebufsiz.X * savebufsiz.Y);
+ }
+
fhc->scroll_region = scroll_region;
fhc->dwLastCursorPosition = dwLastCursorPosition;
fhc->dwLastButtonState = dwLastButtonState;
@@ -784,6 +793,8 @@ fhandler_console::fhandler_console (const char *name) :
nargs_ = 0;
for (int i = 0; i < MAXARGS; i++) args_ [i] = 0;
savex = savey = 0;
+ savebufsiz.X = savebufsiz.Y = 0;
+ savebuf = NULL;
scroll_region.Top = 0;
scroll_region.Bottom = -1;
dwLastCursorPosition.X = -1;
@@ -1088,6 +1099,46 @@ fhandler_console::char_command (char c)
break;
switch (args_[0])
{
+ case 47: /* Save/Restore screen */
+ if (c == 'h') /* save */
+ {
+ CONSOLE_SCREEN_BUFFER_INFO now;
+ COORD cob = { 0, 0 };
+
+ if (!GetConsoleScreenBufferInfo (get_output_handle (), &now))
+ break;
+
+ savebufsiz.X = now.srWindow.Right - now.srWindow.Left;
+ savebufsiz.Y = now.srWindow.Bottom - now.srWindow.Top;
+
+ if (savebuf)
+ free (savebuf);
+ savebuf = (PCHAR_INFO) malloc (sizeof (CHAR_INFO) *
+ savebufsiz.X * savebufsiz.Y);
+
+ ReadConsoleOutputA (get_output_handle (), savebuf,
+ savebufsiz, cob, &now.srWindow);
+ }
+ else /* restore */
+ {
+ CONSOLE_SCREEN_BUFFER_INFO now;
+ COORD cob = { 0, 0 };
+
+ if (!GetConsoleScreenBufferInfo (get_output_handle (), &now))
+ break;
+
+ if (!savebuf)
+ break;
+
+ WriteConsoleOutputA (get_output_handle (), savebuf,
+ savebufsiz, cob, &now.srWindow);
+
+ free (savebuf);
+ savebuf = NULL;
+ savebufsiz.X = savebufsiz.Y = 0;
+ }
+ break;
+
case 1000: /* Mouse support */
use_mouse = (c == 'h') ? TRUE : FALSE;
syscall_printf("mouse support %sabled", use_mouse ? "en" : "dis");