add Buffer::insert_code_point()
This commit is contained in:
parent
099ea267d6
commit
e3f156c513
@ -161,3 +161,14 @@ void Buffer::exit_insert_mode()
|
||||
{
|
||||
m_insert_mode = false;
|
||||
}
|
||||
|
||||
void Buffer::insert_code_point(uint32_t code_point)
|
||||
{
|
||||
if (m_insert_mode)
|
||||
{
|
||||
uint8_t encoded[Encoding::MAX_CODE_POINT_SIZE];
|
||||
uint8_t bytes = Encoding::encode(code_point, m_encoding, encoded);
|
||||
m_gap_buffer->insert(m_insert_position, encoded, bytes);
|
||||
m_insert_position += bytes;
|
||||
}
|
||||
}
|
||||
|
@ -103,6 +103,7 @@ public:
|
||||
void enter_insert_mode(const Buffer::Iterator & position);
|
||||
void exit_insert_mode();
|
||||
bool insert_mode() const { return m_insert_mode; }
|
||||
void insert_code_point(uint32_t code_point);
|
||||
|
||||
protected:
|
||||
bool m_eol_at_eof;
|
||||
|
@ -13,9 +13,9 @@ public:
|
||||
CP_1252,
|
||||
};
|
||||
|
||||
enum
|
||||
enum : uint32_t
|
||||
{
|
||||
MAX_CODE_POINT_SIZE = 8,
|
||||
MAX_CODE_POINT_SIZE = 8u,
|
||||
};
|
||||
|
||||
static Type detect_encoding(const uint8_t * buffer, size_t length);
|
||||
|
Loading…
x
Reference in New Issue
Block a user