resize by deleting lines below cursor first.

git-svn-id: svn://qnap.local/TwoTerm/trunk@1993 5590a31f-7b70-45f8-8c82-aa3a8e5f4507
This commit is contained in:
Kelvin Sherlock 2011-01-16 23:04:31 +00:00
parent 5252d7c61d
commit 4020395d97

View File

@ -868,8 +868,24 @@ void Screen::setSize(unsigned w, unsigned h)
else if (height() > h)
{
unsigned count = height() - h;
int y = _port.cursor.y;
int maxY = height() - 1;
// 1. erase from the bottom, up to the cursor (if blank)
// 2. erase lines from the top.
while (count && maxY > y)
{
// todo -- check if blank...
_screen.pop_back();
--count;
--maxY;
}
// erase lines from the top.
_screen.erase(_screen.begin(), _screen.begin() + count);
if (count)
_screen.erase(_screen.begin(), _screen.begin() + count);
}