diff options
author | VanaIgr <vanaigranov@gmail.com> | 2024-02-26 04:12:55 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-26 18:12:55 +0800 |
commit | ad5a155b1f4b387d3aaa54c91d0146cb0287bb9f (patch) | |
tree | ae35dff22d4f418f040d39acc88206e64ffb1984 /src/nvim/mbyte_defs.h | |
parent | 8b4e26915612caf2d143edca31919cae18a848a1 (diff) | |
download | rneovim-ad5a155b1f4b387d3aaa54c91d0146cb0287bb9f.tar.gz rneovim-ad5a155b1f4b387d3aaa54c91d0146cb0287bb9f.tar.bz2 rneovim-ad5a155b1f4b387d3aaa54c91d0146cb0287bb9f.zip |
fix(mbyte): fix bugs in utf_cp_*_off() functions
Problems:
- Illegal bytes after valid UTF-8 char cause utf_cp_*_off() to fail.
- When stream isn't NUL-terminated, utf_cp_*_off() may go over the end.
Solution: Don't go over end of the char of end of the string.
Diffstat (limited to 'src/nvim/mbyte_defs.h')
-rw-r--r-- | src/nvim/mbyte_defs.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/nvim/mbyte_defs.h b/src/nvim/mbyte_defs.h index 058ec353e5..8670a0595d 100644 --- a/src/nvim/mbyte_defs.h +++ b/src/nvim/mbyte_defs.h @@ -66,3 +66,8 @@ 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; |