1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 06:38:10 +00:00

Kernel+LibVT: Add function for deleting a range of characters

Previously, this was done by telling the client to put a space at each
character in the range. This was inefficient, because a large number of
function calls took place and incorrect, as the ANSI standard dictates
that character attributes should be cleared as well.

The newly added `clear_in_line` function solves this issue. It performs
just one bounds check when it's called and can be implemented as a
pretty tight loop.
This commit is contained in:
Daniel Bertalan 2021-06-05 11:12:00 +02:00 committed by Andreas Kling
parent 8f8fd9c5a8
commit 7419569a2b
7 changed files with 60 additions and 53 deletions

View file

@ -40,6 +40,7 @@ private:
virtual void scroll_up(u16 region_top, u16 region_bottom, size_t count) override;
virtual void scroll_down(u16 region_top, u16 region_bottom, size_t count) override;
virtual void put_character_at(unsigned row, unsigned column, u32 ch) override;
virtual void clear_in_line(u16 row, u16 first_column, u16 last_column) override;
virtual void ICH(Parameters) override;
virtual void DCH(Parameters) override;
@ -137,7 +138,11 @@ private:
void scroll_down(u16 region_top, u16 region_bottom, size_t count);
void scroll_up(u16 region_top, u16 region_bottom, size_t count);
void clear_line(size_t index);
void clear_line(size_t index)
{
clear_in_line(index, 0, m_console_impl.columns() - 1);
}
void clear_in_line(u16 row, u16 first_column, u16 last_column);
void put_character_at(unsigned row, unsigned column, u32 ch, const VT::Attribute&);
OwnPtr<Region> m_cells;