From 94f5479e1aa4834930a358f2b6fc1d300658042e Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 10 Jul 2022 10:04:15 +1000 Subject: 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 --- src/display_buffer.hh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/display_buffer.hh') 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(); -- cgit v1.2.3