neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 901fde60c6a4679648e9c0bd714a0c6dac97fe31
parent 966d55effe5cbfc3d779c89591a1bec4e9ac6639
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Sat, 18 Jun 2022 20:02:52 +0800

Merge pull request #19011 from zeertzjq/vim-8.2.5120

vim-patch:8.2.{5120.5121}
Diffstat:
Msrc/nvim/search.c | 5+++++
Msrc/nvim/testdir/test_interrupt.vim | 13+++++++++----
2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/nvim/search.c b/src/nvim/search.c @@ -4057,6 +4057,11 @@ bool current_quote(oparg_T *oap, long count, bool include, int quotechar) // Find out if we have a quote in the selection. while (i <= col_end) { + // check for going over the end of the line, which can happen if + // the line was changed after the Visual area was selected. + if (line[i] == NUL) { + break; + } if (line[i++] == quotechar) { selected_quote = true; break; diff --git a/src/nvim/testdir/test_interrupt.vim b/src/nvim/testdir/test_interrupt.vim @@ -13,15 +13,20 @@ func s:bufwritepost() endfunction func Test_interrupt() - new Xfile + new Xinterrupt let n = 0 try - au BufWritePre Xfile call s:bufwritepre() - au BufWritePost Xfile call s:bufwritepost() + au BufWritePre Xinterrupt call s:bufwritepre() + au BufWritePost Xinterrupt call s:bufwritepost() w! catch /^Vim:Interrupt$/ endtry call assert_equal(1, s:bufwritepre_called) call assert_equal(0, s:bufwritepost_called) - call assert_equal(0, filereadable('Xfile')) + call assert_equal(0, filereadable('Xinterrupt')) + + au! BufWritePre + au! BufWritePost endfunc + +" vim: shiftwidth=2 sts=2 expandtab