From 3a817e2f96a30faef03565c510f626ac73fd46ed Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 12 Nov 2014 21:27:07 +0000 Subject: Cleanup includes --- src/display_buffer.hh | 41 ++++------------------------------------- 1 file changed, 4 insertions(+), 37 deletions(-) (limited to 'src/display_buffer.hh') diff --git a/src/display_buffer.hh b/src/display_buffer.hh index 8ad01661..83ba7d6b 100644 --- a/src/display_buffer.hh +++ b/src/display_buffer.hh @@ -1,17 +1,17 @@ #ifndef display_buffer_hh_INCLUDED #define display_buffer_hh_INCLUDED -#include "buffer.hh" #include "face.hh" #include "coord.hh" #include "string.hh" -#include "utf8.hh" #include namespace Kakoune { +class Buffer; + struct DisplayAtom { public: @@ -25,41 +25,8 @@ public: : m_type(Text), m_text(std::move(str)), face(face) { check_invariant(); } - StringView content() const - { - switch (m_type) - { - case BufferRange: - { - auto line = (*m_buffer)[m_begin.line]; - if (m_begin.line == m_end.line) - return line.substr(m_begin.column, m_end.column - m_begin.column); - else if (m_begin.line+1 == m_end.line and m_end.column == 0) - return line.substr(m_begin.column); - break; - } - case Text: - case ReplacedBufferRange: - return m_text; - } - kak_assert(false); - return {}; - } - - CharCount length() const - { - switch (m_type) - { - case BufferRange: - return utf8::distance(m_buffer->iterator_at(m_begin), - m_buffer->iterator_at(m_end)); - case Text: - case ReplacedBufferRange: - return m_text.char_length(); - } - kak_assert(false); - return 0; - } + StringView content() const; + CharCount length() const; const ByteCoord& begin() const { -- cgit v1.2.3