add Buffer::insert_code_point()
This commit is contained in:
1 parent
099ea267d6
commit
e3f156c513
3 files changed
+14
-2
No files matched your search
@@ -161,3 +161,14 @@ void Buffer::exit_insert_mode()
|
|||||||
{
|
{
|
||||||
m_insert_mode = false;
|
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 enter_insert_mode(const Buffer::Iterator & position);
|
||||||
void exit_insert_mode();
|
void exit_insert_mode();
|
||||||
bool insert_mode() const { return m_insert_mode; }
|
bool insert_mode() const { return m_insert_mode; }
|
||||||
|
void insert_code_point(uint32_t code_point);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool m_eol_at_eof;
|
bool m_eol_at_eof;
|
||||||
|
|||||||
+2
-2
@@ -13,9 +13,9 @@ public:
|
|||||||
CP_1252,
|
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);
|
static Type detect_encoding(const uint8_t * buffer, size_t length);
|
||||||
|
|||||||
Reference in new issue
Block a user