Ticket #2157: fixed tty_fill_region() for ncurses-based TTY layer.

If filled region is larger than screen, NCurses doesn't fill it
unlike S-Lang. This patch fixes such behaviour: only visible part
of region is filled.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2010-05-13 17:21:49 +04:00
parent 7843203257
commit 2c7bc9c1c2

View File

@ -295,6 +295,31 @@ tty_fill_region (int y, int x, int rows, int cols, unsigned char ch)
{
int i;
if (y < 0)
{
rows += y;
if (rows <= 0)
return;
y = 0;
}
if (x < 0)
{
cols += x;
if (cols <= 0)
return;
x = 0;
}
if (y + rows > LINES)
rows = LINES - y;
if (x + cols > COLS)
cols = COLS - x;
for (i = 0; i < rows; i++)
{
move (y + i, x);