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

LibLine: Avoid refreshing the entire line when inserting at the end

This patchset allows the editor to avoid redrawing the entire line when
the changes cause no unrecoverable style updates, and are at the end of
the line (this applies to most normal typing situations).
Cases that this does not resolve:
- When the cursor is not at the end of the buffer
- When a display refresh changes the styles on the already-drawn parts
  of the line
- When the prompt has not yet been drawn, or has somehow changed

Fixes #5296.
This commit is contained in:
AnotherTest 2021-02-20 21:33:13 +03:30 committed by Andreas Kling
parent 101c6b01ed
commit 074e2ffdfd
5 changed files with 151 additions and 41 deletions

View file

@ -35,6 +35,8 @@ namespace Line {
class Style {
public:
bool operator==(const Style&) const = default;
enum class XtermColor : int {
Default = 9,
Black = 0,
@ -57,6 +59,8 @@ public:
struct ItalicTag {
};
struct Color {
bool operator==(const Color&) const = default;
explicit Color(XtermColor color)
: m_xterm_color(color)
, m_is_rgb(false)
@ -104,6 +108,8 @@ public:
};
struct Hyperlink {
bool operator==(const Hyperlink&) const = default;
explicit Hyperlink(const StringView& link)
: m_link(link)
{