diff options
| author | Maxime Coste <mawww@kakoune.org> | 2022-12-06 17:51:28 +1100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2022-12-06 17:51:28 +1100 |
| commit | 93c50b3cd97ef78c678aa84010a5481ce0f11245 (patch) | |
| tree | 22c616dafb1070f6c1e029818f6d0e58f20d2804 /src/display_buffer.hh | |
| parent | 933e4a599cfd3fc09edd67a024b8af08bbec7c01 (diff) | |
Avoid calculating atom length in DisplayLine::trim_from
Calculating the length of an atom means we need to decode every
codepoint and compute its column width. This can prove quite expensive
in trim_from as we can have full buffer lines, so on buffer with long
lines we might have to go through megabytes of undisplayed data.
Diffstat (limited to 'src/display_buffer.hh')
| -rw-r--r-- | src/display_buffer.hh | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/display_buffer.hh b/src/display_buffer.hh index c164cb08..c81fc2f6 100644 --- a/src/display_buffer.hh +++ b/src/display_buffer.hh @@ -38,6 +38,7 @@ public: StringView content() const; ColumnCount length() const; + bool empty() const; const BufferCoord& begin() const { @@ -74,8 +75,8 @@ public: Type type() const { return m_type; } - void trim_begin(ColumnCount count); - void trim_end(ColumnCount count); + ColumnCount trim_begin(ColumnCount count); + ColumnCount trim_end_to_length(ColumnCount count); bool operator==(const DisplayAtom& other) const { |
