diff --git a/src/display_buffer.cc b/src/display_buffer.cc index c19d45f4..fdf3b1c4 100644 --- a/src/display_buffer.cc +++ b/src/display_buffer.cc @@ -41,7 +41,7 @@ StringView DisplayAtom::content() const { switch (m_type) { - case BufferRange: + case Range: { auto line = (*m_buffer)[m_range.begin.line]; if (m_range.begin.line == m_range.end.line) @@ -51,7 +51,7 @@ StringView DisplayAtom::content() const break; } case Text: - case ReplacedBufferRange: + case ReplacedRange: return m_text; } kak_assert(false); @@ -62,10 +62,10 @@ ColumnCount DisplayAtom::length() const { switch (m_type) { - case BufferRange: + case Range: return column_length(*m_buffer, m_range.begin, m_range.end); case Text: - case ReplacedBufferRange: + case ReplacedRange: return m_text.column_length(); } kak_assert(false); @@ -74,7 +74,7 @@ ColumnCount DisplayAtom::length() const void DisplayAtom::trim_begin(ColumnCount count) { - if (m_type == BufferRange) + if (m_type == Range) m_range.begin = utf8::advance(m_buffer->iterator_at(m_range.begin), m_buffer->iterator_at(m_range.end), count).coord(); @@ -85,7 +85,7 @@ void DisplayAtom::trim_begin(ColumnCount count) void DisplayAtom::trim_end(ColumnCount count) { - if (m_type == BufferRange) + if (m_type == Range) m_range.end = utf8::advance(m_buffer->iterator_at(m_range.end), m_buffer->iterator_at(m_range.begin), -count).coord(); @@ -113,7 +113,7 @@ DisplayLine::DisplayLine(AtomList atoms) DisplayLine::iterator DisplayLine::split(iterator it, BufferCoord pos) { - kak_assert(it->type() == DisplayAtom::BufferRange); + kak_assert(it->type() == DisplayAtom::Range); kak_assert(it->begin() < pos); kak_assert(it->end() > pos); @@ -182,12 +182,12 @@ void DisplayLine::optimize() atom.type() == next_atom.type()) { auto type = atom.type(); - if ((type == DisplayAtom::BufferRange or - type == DisplayAtom::ReplacedBufferRange) and + if ((type == DisplayAtom::Range or + type == DisplayAtom::ReplacedRange) and next_atom.begin() == atom.end()) { atom.m_range.end = next_atom.end(); - if (type == DisplayAtom::ReplacedBufferRange) + if (type == DisplayAtom::ReplacedRange) atom.m_text += next_atom.m_text; merged = true; } diff --git a/src/display_buffer.hh b/src/display_buffer.hh index f83586d4..39563a1b 100644 --- a/src/display_buffer.hh +++ b/src/display_buffer.hh @@ -30,10 +30,10 @@ size_t hash_value(const BufferRange& range) struct DisplayAtom : public UseMemoryDomain { public: - enum Type { BufferRange, ReplacedBufferRange, Text }; + enum Type { Range, ReplacedRange, Text }; DisplayAtom(const Buffer& buffer, BufferCoord begin, BufferCoord end) - : m_type(BufferRange), m_buffer(&buffer), m_range{begin, end} + : m_type(Range), m_buffer(&buffer), m_range{begin, end} { check_invariant(); } DisplayAtom(String str, Face face = Face{}) @@ -57,14 +57,14 @@ public: void replace(String text) { - kak_assert(m_type == BufferRange); - m_type = ReplacedBufferRange; + kak_assert(m_type == Range); + m_type = ReplacedRange; m_text = std::move(text); } bool has_buffer_range() const { - return m_type == BufferRange or m_type == ReplacedBufferRange; + return m_type == Range or m_type == ReplacedRange; } const Buffer& buffer() const { kak_assert(m_buffer); return *m_buffer; } @@ -91,7 +91,7 @@ private: Type m_type; const Buffer* m_buffer = nullptr; - Kakoune::BufferRange m_range; + BufferRange m_range; String m_text; }; diff --git a/src/highlighters.cc b/src/highlighters.cc index b3e3f563..94e938e7 100644 --- a/src/highlighters.cc +++ b/src/highlighters.cc @@ -41,7 +41,7 @@ void highlight_range(DisplayBuffer& display_buffer, for (auto atom_it = line.begin(); atom_it != line.end(); ++atom_it) { - bool is_replaced = atom_it->type() == DisplayAtom::ReplacedBufferRange; + bool is_replaced = atom_it->type() == DisplayAtom::ReplacedRange; if (not atom_it->has_buffer_range() or (skip_replaced and is_replaced)) @@ -103,7 +103,7 @@ void apply_highlighter(const Context& context, if (not atom_it->has_buffer_range() or end <= atom_it->begin() or begin >= atom_it->end()) continue; - bool is_replaced = atom_it->type() == DisplayAtom::ReplacedBufferRange; + bool is_replaced = atom_it->type() == DisplayAtom::ReplacedRange; if (atom_it->begin() <= begin) { if (is_replaced or atom_it->begin() == begin) @@ -654,7 +654,7 @@ void expand_tabulations(const Context& context, HighlightFlags flags, DisplayBuf { for (auto atom_it = line.begin(); atom_it != line.end(); ++atom_it) { - if (atom_it->type() != DisplayAtom::BufferRange) + if (atom_it->type() != DisplayAtom::Range) continue; auto begin = buffer.iterator_at(atom_it->begin()); @@ -690,7 +690,7 @@ void show_whitespaces(const Context& context, HighlightFlags flags, DisplayBuffe { for (auto atom_it = line.begin(); atom_it != line.end(); ++atom_it) { - if (atom_it->type() != DisplayAtom::BufferRange) + if (atom_it->type() != DisplayAtom::Range) continue; auto begin = buffer.iterator_at(atom_it->begin()); @@ -878,7 +878,7 @@ void expand_unprintable(const Context& context, HighlightFlags flags, DisplayBuf { for (auto atom_it = line.begin(); atom_it != line.end(); ++atom_it) { - if (atom_it->type() == DisplayAtom::BufferRange) + if (atom_it->type() == DisplayAtom::Range) { for (auto it = buffer.iterator_at(atom_it->begin()), end = buffer.iterator_at(atom_it->end()); it < end;) diff --git a/src/window.cc b/src/window.cc index 44238ed6..6752dec8 100644 --- a/src/window.cc +++ b/src/window.cc @@ -197,7 +197,7 @@ static ColumnCount adapt_view_pos(const DisplayBuffer& display_buffer, ColumnCou if (atom.begin() <= pos and atom.end() > pos) { ColumnCount pos_beg, pos_end; - if (atom.type() == DisplayAtom::BufferRange) + if (atom.type() == DisplayAtom::Range) { auto& buf = atom.buffer(); pos_beg = buffer_column + @@ -271,7 +271,7 @@ ColumnCount find_display_column(const DisplayLine& line, const Buffer& buffer, if (atom.has_buffer_range() and coord >= atom.begin() and coord < atom.end()) { - if (atom.type() == DisplayAtom::BufferRange) + if (atom.type() == DisplayAtom::Range) column += column_length(buffer, atom.begin(), coord); return column; } @@ -289,7 +289,7 @@ BufferCoord find_buffer_coord(const DisplayLine& line, const Buffer& buffer, ColumnCount len = atom.length(); if (atom.has_buffer_range() and column < len) { - if (atom.type() == DisplayAtom::BufferRange) + if (atom.type() == DisplayAtom::Range) return buffer.clamp( utf8::advance(buffer.iterator_at(atom.begin()), buffer.iterator_at(range.end),