aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-06-18 20:02:52 +0800
committerGitHub <noreply@github.com>2022-06-18 20:02:52 +0800
commit901fde60c6a4679648e9c0bd714a0c6dac97fe31 (patch)
tree8c05b110a6ad26012992f2139a2839340b78591c /src
parent966d55effe5cbfc3d779c89591a1bec4e9ac6639 (diff)
parentdc56b442d8ae81daea533c49ac381298cfa94e5b (diff)
downloadrneovim-901fde60c6a4679648e9c0bd714a0c6dac97fe31.tar.gz
rneovim-901fde60c6a4679648e9c0bd714a0c6dac97fe31.tar.bz2
rneovim-901fde60c6a4679648e9c0bd714a0c6dac97fe31.zip
Merge pull request #19011 from zeertzjq/vim-8.2.5120
vim-patch:8.2.{5120.5121}
Diffstat (limited to 'src')
-rw-r--r--src/nvim/search.c5
-rw-r--r--src/nvim/testdir/test_interrupt.vim13
2 files changed, 14 insertions, 4 deletions
diff --git a/src/nvim/search.c b/src/nvim/search.c
index d442a5aa87..1e862f10ec 100644
--- 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
index 111752d16a..aa7f634302 100644
--- 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