aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/mbyte_defs.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/mbyte_defs.h')
-rw-r--r--src/nvim/mbyte_defs.h31
1 files changed, 24 insertions, 7 deletions
diff --git a/src/nvim/mbyte_defs.h b/src/nvim/mbyte_defs.h
index 2904047223..8670a0595d 100644
--- a/src/nvim/mbyte_defs.h
+++ b/src/nvim/mbyte_defs.h
@@ -1,16 +1,18 @@
#pragma once
#include <stdbool.h>
+#include <stdint.h>
#include "nvim/iconv_defs.h"
-/// Maximum number of bytes in a multi-byte character. It can be one 32-bit
-/// character of up to 6 bytes, or one 16-bit character of up to three bytes
-/// plus six following composing characters of three bytes each.
-enum { MB_MAXBYTES = 21, };
-
-/// max length of an unicode char
-enum { MB_MAXCHAR = 6, };
+enum {
+ /// Maximum number of bytes in a multi-byte character. It can be one 32-bit
+ /// character of up to 6 bytes, or one 16-bit character of up to three bytes
+ /// plus six following composing characters of three bytes each.
+ MB_MAXBYTES = 21,
+ /// max length of an unicode char
+ MB_MAXCHAR = 6,
+};
/// properties used in enc_canon_table[] (first three mutually exclusive)
enum {
@@ -54,3 +56,18 @@ typedef struct {
bool vc_fail; ///< What to do with invalid characters: if true, fail,
///< otherwise use '?'.
} vimconv_T;
+
+typedef struct {
+ int32_t value; ///< Code point.
+ int len; ///< Length in bytes.
+} CharInfo;
+
+typedef struct {
+ char *ptr; ///< Pointer to the first byte of the character.
+ CharInfo chr; ///< Information about the character.
+} StrCharInfo;
+
+typedef struct {
+ int8_t begin_off; ///< Offset to the first byte of the codepoint.
+ int8_t end_off; ///< Offset to one past the end byte of the codepoint.
+} CharBoundsOff;