1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-19 01:11:36 +03:00

Buffer: fix corner case in insert

This commit is contained in:
Maxime Coste 2012-08-10 14:22:57 +02:00
parent c7fc2a9317
commit 54b599c1a7

View File

@ -273,8 +273,10 @@ void Buffer::insert(const BufferIterator& pos, const String& content)
}
if (start == 0)
line_it = m_lines.insert(line_it, { offset + start - (int)prefix.length(), prefix + content + suffix });
else
else if (start != content.length() or not suffix.empty())
line_it = m_lines.insert(line_it, { offset + start, content.substr(start) + suffix });
else
--line_it;
begin_it = pos;
end_it = BufferIterator(*this, { int(line_it - m_lines.begin()), int(line_it->length() - suffix.length()) });