From 6cd5d807574c44cf2230b9e9d370b660817390c7 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 30 Sep 2012 16:21:20 +0200 Subject: [PATCH] Add a length method to AtomContent --- src/display_buffer.hh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/display_buffer.hh b/src/display_buffer.hh index 3b69bd00..2b3fcc0e 100644 --- a/src/display_buffer.hh +++ b/src/display_buffer.hh @@ -57,6 +57,18 @@ public: } } + CharCount length() const + { + switch (m_type) + { + case BufferRange: + return m_end - m_begin; + case Text: + case ReplacedBufferRange: + return m_text.length(); + } + } + BufferIterator& begin() { assert(has_buffer_range());