mirror of
https://github.com/ksherlock/TwoTerm.git
synced 2026-03-14 05:17:11 +00:00
git-svn-id: svn://qnap.local/TwoTerm/trunk@1662 5590a31f-7b70-45f8-8c82-aa3a8e5f4507
This commit is contained in:
85
Screen.cpp
85
Screen.cpp
@@ -164,6 +164,91 @@ int Screen::decrementY(bool clamp)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Screen::erase(EraseRegion region)
|
||||
{
|
||||
|
||||
CharInfoIterator ciIter;
|
||||
ScreenIterator screenIter;
|
||||
|
||||
if (region == EraseAll)
|
||||
{
|
||||
ScreenIterator end = _screen.end();
|
||||
for (screenIter = _screen.begin(); screenIter < end; ++screenIter)
|
||||
{
|
||||
std::fill(screenIter->begin(), screenIter->end(), CharInfo(0,0));
|
||||
}
|
||||
_updates.push_back(iPoint(0,0));
|
||||
_updates.push_back(iPoint(_width - 1, _height - 1));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// TODO -- be smart and check if cursor is at x = 0 (or x = _width - 1)
|
||||
if (region == EraseBeforeCursor)
|
||||
{
|
||||
ScreenIterator end = _screen.begin() + _cursor.y - 1;
|
||||
for (screenIter = _screen.begin(); screenIter < end; ++screenIter)
|
||||
{
|
||||
std::fill(screenIter->begin(), screenIter->end(), CharInfo(0,0));
|
||||
}
|
||||
_updates.push_back(iPoint(0,0));
|
||||
_updates.push_back(iPoint(_width - 1, _cursor.y));
|
||||
|
||||
region = EraseLineBeforeCursor;
|
||||
}
|
||||
|
||||
if (region == EraseAfterCursor)
|
||||
{
|
||||
ScreenIterator end = _screen.end();
|
||||
for (screenIter = _screen.begin() + _cursor.y + 1; screenIter < end; ++screenIter)
|
||||
{
|
||||
std::fill(screenIter->begin(), screenIter->end(), CharInfo(0,0));
|
||||
}
|
||||
_updates.push_back(iPoint(0,_cursor.y + 1));
|
||||
_updates.push_back(iPoint(_width - 1, _height - 1));
|
||||
|
||||
region = EraseLineAfterCursor;
|
||||
}
|
||||
|
||||
if (region == EraseLineAll)
|
||||
{
|
||||
|
||||
int y = _cursor.y;
|
||||
std::fill(_screen[y].begin(), _screen[y].end(), CharInfo(0,0));
|
||||
|
||||
_updates.push_back(iPoint(0, _cursor.y));
|
||||
_updates.push_back(iPoint(_width - 1, _cursor.y));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (region == EraseLineBeforeCursor)
|
||||
{
|
||||
int y = _cursor.y;
|
||||
std::fill(_screen[y].begin(), _screen[y].begin() + _cursor.x + 1, CharInfo(0,0));
|
||||
|
||||
_updates.push_back(iPoint(0, _cursor.y));
|
||||
_updates.push_back(_cursor);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (region == EraseLineAfterCursor)
|
||||
{
|
||||
int y = _cursor.y;
|
||||
std::fill(_screen[y].begin() + _cursor.x, _screen[y].end(), CharInfo(0,0));
|
||||
|
||||
_updates.push_back(_cursor);
|
||||
_updates.push_back(iPoint(_width - 1, _cursor.y));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Screen::eraseLine()
|
||||
{
|
||||
// erases everything to the right of, and including, the cursor
|
||||
|
||||
Reference in New Issue
Block a user