Buffer: fix corner case in insert
This commit is contained in:
parent
c7fc2a9317
commit
54b599c1a7
|
@ -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()) });
|
||||
|
|
Loading…
Reference in New Issue
Block a user