Merge pull request #20164 from bfredl/luanull

fix(lua): make vim.str_utfindex and vim.str_byteindex handle NUL bytes
This commit is contained in:
bfredl
2022-09-13 23:17:11 +02:00
committed by GitHub
3 changed files with 13 additions and 8 deletions

View File

@@ -2252,8 +2252,9 @@ void ml_add_deleted_len_buf(buf_T *buf, char_u *ptr, ssize_t len)
if (inhibit_delete_count) {
return;
}
if (len == -1) {
len = (ssize_t)STRLEN(ptr);
ssize_t maxlen = (ssize_t)STRLEN(ptr);
if (len == -1 || len > maxlen) {
len = maxlen;
}
curbuf->deleted_bytes += (size_t)len + 1;
curbuf->deleted_bytes2 += (size_t)len + 1;