1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:07:34 +00:00

Terminal: Avoid dirtying lines when clearing them has no visual effect.

This commit is contained in:
Andreas Kling 2019-02-04 08:53:53 +01:00
parent e88c8eae6a
commit 9126d08a43
2 changed files with 19 additions and 3 deletions

View file

@ -75,10 +75,22 @@ Terminal::Line::~Line()
void Terminal::Line::clear(Attribute attribute)
{
dirty = true;
memset(characters, ' ', length);
for (word i = 0 ; i < length; ++i)
if (dirty) {
memset(characters, ' ', length);
for (word i = 0 ; i < length; ++i)
attributes[i] = attribute;
return;
}
for (unsigned i = 0 ; i < length; ++i) {
if (characters[i] != ' ')
dirty = true;
characters[i] = ' ';
}
for (unsigned i = 0 ; i < length; ++i) {
if (attributes[i] != attribute)
dirty = true;
attributes[i] = attribute;
}
}
Terminal::~Terminal()

View file

@ -70,6 +70,10 @@ private:
{
return foreground_color == other.foreground_color && background_color == other.background_color;
}
bool operator!=(const Attribute& other) const
{
return !(*this == other);
}
};
struct Line {