utf8 validity is not a buffer concern
This commit is contained in:
parent
bb3ae4ed04
commit
df79b7610a
|
@ -5,7 +5,6 @@
|
||||||
#include "assert.hh"
|
#include "assert.hh"
|
||||||
#include "utils.hh"
|
#include "utils.hh"
|
||||||
#include "context.hh"
|
#include "context.hh"
|
||||||
#include "utf8.hh"
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
@ -238,8 +237,7 @@ void Buffer::check_invariant() const
|
||||||
|
|
||||||
void Buffer::do_insert(const BufferIterator& pos, const String& content)
|
void Buffer::do_insert(const BufferIterator& pos, const String& content)
|
||||||
{
|
{
|
||||||
assert(pos.is_valid() and (pos.is_end() or utf8::is_character_start(pos)));
|
assert(pos.is_valid());
|
||||||
assert(not contains(content, '\0'));
|
|
||||||
|
|
||||||
if (content.empty())
|
if (content.empty())
|
||||||
return;
|
return;
|
||||||
|
@ -322,8 +320,6 @@ void Buffer::do_erase(const BufferIterator& begin, const BufferIterator& end)
|
||||||
{
|
{
|
||||||
assert(begin.is_valid());
|
assert(begin.is_valid());
|
||||||
assert(end.is_valid());
|
assert(end.is_valid());
|
||||||
assert(utf8::is_character_start(begin) and
|
|
||||||
(end.is_end() or utf8::is_character_start(end)));
|
|
||||||
++m_timestamp;
|
++m_timestamp;
|
||||||
const ByteCount length = end - begin;
|
const ByteCount length = end - begin;
|
||||||
String prefix = m_lines[begin.line()].content.substr(0, begin.column());
|
String prefix = m_lines[begin.line()].content.substr(0, begin.column());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user