diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2014-11-12 21:27:07 +0000 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2014-11-12 21:27:07 +0000 |
| commit | 3a817e2f96a30faef03565c510f626ac73fd46ed (patch) | |
| tree | 4be12e5689f919358a5e1735ac5c8dbf04945302 /src/display_buffer.hh | |
| parent | 58c1721564ea6b52929b189463fc9f54a4711d1d (diff) | |
Cleanup includes
Diffstat (limited to 'src/display_buffer.hh')
| -rw-r--r-- | src/display_buffer.hh | 41 |
1 files changed, 4 insertions, 37 deletions
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 <vector> 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 { |
