commit 26c906f54dafb37f7bc63e136a7a9373d1053fe1 parent b8c0eeaa30c478c1017ee16919d7cb263e70e8f3 Author: zeertzjq <zeertzjq@outlook.com> Date: Tue, 17 May 2022 08:07:51 +0800 vim-patch:8.2.4968: reading past end of the line when C-indenting Problem: Reading past end of the line when C-indenting. Solution: Check for NUL. https://github.com/vim/vim/commit/60ae0e71490c97f2871a6344aca61cacf220f813 Diffstat:
| M | src/nvim/indent_c.c | | | 2 | +- |
| M | src/nvim/testdir/test_cindent.vim | | | 7 | +++++++ |
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/nvim/indent_c.c b/src/nvim/indent_c.c @@ -150,7 +150,7 @@ static const char_u *skip_string(const char_u *p) i++; } } - if (p[i] == '\'') { // check for trailing ' + if (p[i - 1] != NUL && p[i] == '\'') { // check for trailing ' p += i; continue; } diff --git a/src/nvim/testdir/test_cindent.vim b/src/nvim/testdir/test_cindent.vim @@ -5311,6 +5311,13 @@ func Test_cindent_case() bwipe! endfunc +" This was reading past the end of the line +func Test_cindent_check_funcdecl() + new + sil norm o0('\0=L + bwipe! +endfunc + func Test_cindent_scopedecls() new setl cindent ts=4 sw=4