diff options
author | zeertzjq <zeertzjq@outlook.com> | 2025-02-28 13:40:26 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2025-02-28 18:21:07 +0800 |
commit | a3a9f86d4a11029542a94b00044b5a181a68c9cd (patch) | |
tree | a7c1400e2cf08609baa4ade617e6fcd1f617d6e9 /src/nvim/garray.c | |
parent | 9b25c68db21c4a2c1edc0d9eb2cdb80cf249193a (diff) | |
download | rneovim-a3a9f86d4a11029542a94b00044b5a181a68c9cd.tar.gz rneovim-a3a9f86d4a11029542a94b00044b5a181a68c9cd.tar.bz2 rneovim-a3a9f86d4a11029542a94b00044b5a181a68c9cd.zip |
vim-patch:8.2.4594: need to write script to a file to be able to source them
Problem: Need to write script to a file to be able to source them.
Solution: Make ":source" use lines from the current buffer. (Yegappan
Lakshmanan et al., closes vim/vim#9967)
https://github.com/vim/vim/commit/36a5b6867bb6c0bd69c8da7d788000ab8a0b0ab0
Most code and test changes are reverted or modified again in patch
8.2.4603, so only port parts that are untouched in patch 8.2.4603.
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'src/nvim/garray.c')
-rw-r--r-- | src/nvim/garray.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/nvim/garray.c b/src/nvim/garray.c index a8d15a1fa8..b3dce90b11 100644 --- a/src/nvim/garray.c +++ b/src/nvim/garray.c @@ -198,12 +198,13 @@ void ga_concat(garray_T *gap, const char *restrict s) void ga_concat_len(garray_T *const gap, const char *restrict s, const size_t len) FUNC_ATTR_NONNULL_ALL { - if (len) { - ga_grow(gap, (int)len); - char *data = gap->ga_data; - memcpy(data + gap->ga_len, s, len); - gap->ga_len += (int)len; + if (len == 0) { + return; } + ga_grow(gap, (int)len); + char *data = gap->ga_data; + memcpy(data + gap->ga_len, s, len); + gap->ga_len += (int)len; } /// Append one byte to a growarray which contains bytes. |