summaryrefslogtreecommitdiff
path: root/src/display_buffer.hh
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2022-07-10 10:04:15 +1000
committerMaxime Coste <mawww@kakoune.org>2022-07-10 14:58:24 +1000
commit94f5479e1aa4834930a358f2b6fc1d300658042e (patch)
tree77a745c12d433cb1f459a875490aece97bd001b2 /src/display_buffer.hh
parentf3cb2e434004a718d1225cb0d74c694e66a7248b (diff)
Refactor highlighting logic
Always start with full buffer lines and trim the display buffer at the very end, treat non-range display atoms as non-trimable in that case and keep track of how many columns are occupied by "widgets" such as line numbers or flags. Fixes #4659
Diffstat (limited to 'src/display_buffer.hh')
-rw-r--r--src/display_buffer.hh5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/display_buffer.hh b/src/display_buffer.hh
index bfa01bfb..ec5da89e 100644
--- a/src/display_buffer.hh
+++ b/src/display_buffer.hh
@@ -27,6 +27,9 @@ public:
DisplayAtom(const Buffer& buffer, BufferCoord begin, BufferCoord end)
: m_type(Range), m_buffer(&buffer), m_range{begin, end} {}
+ DisplayAtom(const Buffer& buffer, BufferCoord begin, BufferCoord end, String str)
+ : m_type(ReplacedRange), m_buffer(&buffer), m_range{begin, end}, m_text{std::move(str)} {}
+
DisplayAtom(String str, Face face)
: face(face), m_type(Text), m_text(std::move(str)) {}
@@ -143,7 +146,7 @@ public:
// remove first_col from the begining of the line, and make sure
// the line is less that col_count character
- bool trim(ColumnCount first_col, ColumnCount col_count);
+ bool trim(ColumnCount first_col, ColumnCount col_count, bool only_buffer = false);
// Merge together consecutive atoms sharing the same display attributes
void optimize();