From 954373d3cfa9d168f7949f12cb7b2e730d18de99 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 27 Apr 2020 13:36:12 +1000 Subject: Support multi-line replace-ranges This likely has lots of rough edges, but should be an initial proof of concept to support folding. --- src/display_buffer.hh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/display_buffer.hh') diff --git a/src/display_buffer.hh b/src/display_buffer.hh index abd1a244..308b1993 100644 --- a/src/display_buffer.hh +++ b/src/display_buffer.hh @@ -126,16 +126,27 @@ public: // returns an iterator to the first atom iterator split(iterator it, ColumnCount pos); + iterator split(BufferCoord pos); + iterator insert(iterator it, DisplayAtom atom); + + template + iterator insert(iterator it, It beg, It end) + { + auto res = m_atoms.insert(it, beg, end); + compute_range(); + return res; + } + iterator erase(iterator beg, iterator end); - void push_back(DisplayAtom atom); + void push_back(DisplayAtom atom); // 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); // Merge together consecutive atoms sharing the same display attributes - void optimize(); + void optimize(); private: void compute_range(); BufferRange m_range = { { INT_MAX, INT_MAX }, { INT_MIN, INT_MIN } }; -- cgit v1.2.3