diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2012-10-11 00:41:48 +0200 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2012-10-11 00:41:48 +0200 |
| commit | 0ce6bd9bf54332d9eed8c7462ab4dfe08f8fac95 (patch) | |
| tree | 662591856f7227e3fb8592d582edaf2766a3f3e6 /src/display_buffer.hh | |
| parent | 571861bc7bbe10bf831b861f7e6e0a2aa0a40839 (diff) | |
use ByteCount instead of CharCount when we are really counting bytes
(that is most of the time when we are not concerned with displaying)
Diffstat (limited to 'src/display_buffer.hh')
| -rw-r--r-- | src/display_buffer.hh | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/display_buffer.hh b/src/display_buffer.hh index e1f1442f..aa54f1f6 100644 --- a/src/display_buffer.hh +++ b/src/display_buffer.hh @@ -7,18 +7,15 @@ #include "color.hh" #include "line_and_column.hh" #include "buffer.hh" +#include "utf8.hh" namespace Kakoune { -struct DisplayCoord : LineAndColumn<DisplayCoord> +struct DisplayCoord : LineAndColumn<DisplayCoord, LineCount, CharCount> { constexpr DisplayCoord(LineCount line = 0, CharCount column = 0) : LineAndColumn(line, column) {} - - template<typename T> - explicit constexpr DisplayCoord(const LineAndColumn<T>& other) - : LineAndColumn(other.line, other.column) {} }; typedef int Attribute; @@ -64,10 +61,10 @@ public: switch (m_type) { case BufferRange: - return m_end - m_begin; + return utf8::distance(m_begin, m_end); case Text: case ReplacedBufferRange: - return m_text.length(); + return m_text.char_length(); } } |
