Change Buffer::erase_range() to take a Range argument
This commit is contained in:
1 parent
8a2bc444db
commit
32b272b75c
3 files changed
+12
-12
No files matched your search
+3
-6
@@ -212,15 +212,12 @@ void Buffer::erase_code_point(const Buffer::Iterator & position)
|
||||
}
|
||||
}
|
||||
|
||||
void Buffer::erase_range(const Buffer::Iterator & start,
|
||||
const Buffer::Iterator & end)
|
||||
void Buffer::erase_range(const Buffer::Range & range)
|
||||
{
|
||||
if (start.valid() && (start < end))
|
||||
if (range.valid() && (range.size() > 0u))
|
||||
{
|
||||
push_operation();
|
||||
size_t start_offset = start.offset();
|
||||
size_t end_offset = end.valid() ? end.offset() : m_gap_buffer->size();
|
||||
erase_data(start_offset, end_offset - start_offset, true);
|
||||
erase_data(range.start_offset(), range.size(), true);
|
||||
pop_operation();
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -173,8 +173,7 @@ public:
|
||||
bool insert_mode() const { return m_insert_mode; }
|
||||
void insert_code_point(const Buffer::Iterator & position, uint32_t code_point);
|
||||
void erase_code_point(const Buffer::Iterator & position);
|
||||
void erase_range(const Buffer::Iterator & start,
|
||||
const Buffer::Iterator & end);
|
||||
void erase_range(const Buffer::Range & range);
|
||||
std::shared_ptr<std::string> filename() const { return m_filename; }
|
||||
Iterator begin() const { return Iterator(this); }
|
||||
std::shared_ptr<Iterator> beginp() const { return std::make_shared<Iterator>(this); }
|
||||
|
||||
Reference in new issue
Block a user