From 410067282af52c8d6ba17dcf5d3f96d1c644c511 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 23 Jan 2013 18:52:42 +0100 Subject: Buffer: end is either one past last character, or one past last line --- src/buffer.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/buffer.cc') diff --git a/src/buffer.cc b/src/buffer.cc index 266d4905..d94c5617 100644 --- a/src/buffer.cc +++ b/src/buffer.cc @@ -256,9 +256,9 @@ void Buffer::do_insert(const BufferIterator& pos, const String& content) BufferIterator begin_it; BufferIterator end_it; - // if we inserted at the end of the buffer, we may have created a new + // if we inserted at the end of the buffer, we have created a new // line without inserting a '\n' - if (pos == end() and (pos == begin() or *(pos-1) == '\n')) + if (pos.is_end()) { ByteCount start = 0; for (ByteCount i = 0; i < content.length(); ++i) @@ -361,7 +361,7 @@ void Buffer::apply_modification(const Modification& modification) { case Modification::Insert: { - do_insert(pos < end() ? pos : end(), content); + do_insert(pos, content); break; } case Modification::Erase: -- cgit v1.2.3