* fhandler.h (fhandler_console::scroll_buffer_screen): New function.

* fhandler_console.cc (fhandler_console::scroll_buffer_screen): New function.
(fhandler_console::char_command): Use scroll_buffer_screen as appropriate.
(dev_console::scroll_buffer): Remove if 0'ed block.
This commit is contained in:
Christopher Faylor 2014-02-26 03:58:37 +00:00
parent 16a976cff4
commit 8a1a15ffd2
3 changed files with 23 additions and 15 deletions

View File

@ -1,3 +1,10 @@
2014-02-25 Christopher Faylor <me.cygwin2014@cgf.cx>
* fhandler.h (fhandler_console::scroll_buffer_screen): New function.
* fhandler_console.cc (fhandler_console::scroll_buffer_screen): New function.
(fhandler_console::char_command): Use scroll_buffer_screen as appropriate.
(dev_console::scroll_buffer): Remove if 0'ed block.
2014-02-22 Christopher Faylor <me.cygwin2014@cgf.cx>
* dev_console::scroll_buffer): Reinstate clipping region.

View File

@ -1360,6 +1360,7 @@ private:
void set_default_attr ();
void scroll_buffer (int, int, int, int, int, int);
void scroll_buffer_screen (int, int, int, int, int, int);
void __reg3 clear_screen (cltype, cltype, cltype, cltype);
void __reg3 cursor_set (bool, int, int);
void __reg3 cursor_get (int *, int *);

View File

@ -792,18 +792,6 @@ dev_console::scroll_buffer (HANDLE h, int x1, int y1, int x2, int y2, int xn, in
dest.X = xn >= 0 ? xn : dwWinSize.X - 1;
dest.Y = yn >= 0 ? yn : winBottom;
ScrollConsoleScreenBuffer (h, &sr1, &sr2, dest, &fill);
#if 0 /* CGF: 2014-01-04 Assuming that we don't need this anymore */
/* ScrollConsoleScreenBuffer on Windows 95 is buggy - when scroll distance
* is more than half of screen, filling doesn't work as expected */
if (sr1.Top == sr1.Bottom)
/* nothing to do */;
else if (dest.Y <= sr1.Top) /* forward scroll */
clear_screen (0, 1 + dest.Y + sr1.Bottom - sr1.Top, sr2.Right, sr2.Bottom);
else /* reverse scroll */
clear_screen (0, sr1.Top, sr2.Right, dest.Y - 1);
#endif
}
inline void
@ -812,6 +800,18 @@ fhandler_console::scroll_buffer (int x1, int y1, int x2, int y2, int xn, int yn)
dev_state.scroll_buffer (get_output_handle (), x1, y1, x2, y2, xn, yn);
}
inline void
fhandler_console::scroll_buffer_screen (int x1, int y1, int x2, int y2, int xn, int yn)
{
if (y1 >= 0)
y1 += dev_state.winTop;
if (y2 >= 0)
y1 += dev_state.winTop;
if (yn >= 0)
yn += dev_state.winTop;
dev_state.scroll_buffer (get_output_handle (), x1, y1, x2, y2, xn, yn);
}
int
fhandler_console::dup (fhandler_base *child, int flags)
{
@ -1853,12 +1853,12 @@ fhandler_console::char_command (char c)
break;
case 'S': /* SF - Scroll forward */
n = dev_state.args[0] ?: 1;
scroll_buffer (0, n, -1, -1, 0, 0);
scroll_buffer_screen (0, n, -1, -1, 0, 0);
break;
case 'T': /* SR - Scroll down */
dev_state.fillin (get_output_handle ());
n = dev_state.winTop + dev_state.args[0] ?: 1;
scroll_buffer (0, dev_state.winTop, -1, -1, 0, n);
scroll_buffer_screen (0, 0, -1, -1, 0, n);
break;
case 'X': /* ec - erase chars */
n = dev_state.args[0] ?: 1;
@ -2198,7 +2198,7 @@ fhandler_console::write (const void *vsrc, size_t len)
else if (*src == 'M') /* Reverse Index (scroll down) */
{
dev_state.fillin (get_output_handle ());
scroll_buffer (0, 0, -1, -1, 0, 1);
scroll_buffer_screen (0, 0, -1, -1, 0, 1);
dev_state.state = normal;
}
else if (*src == 'c') /* RIS Full Reset */