Merge pull request #19011 from zeertzjq/vim-8.2.5120

vim-patch:8.2.{5120.5121}
This commit is contained in:
zeertzjq 2022-06-18 20:02:52 +08:00 committed by GitHub
commit 901fde60c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 4 deletions

View File

@ -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. // Find out if we have a quote in the selection.
while (i <= col_end) { 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) { if (line[i++] == quotechar) {
selected_quote = true; selected_quote = true;
break; break;

View File

@ -13,15 +13,20 @@ func s:bufwritepost()
endfunction endfunction
func Test_interrupt() func Test_interrupt()
new Xfile new Xinterrupt
let n = 0 let n = 0
try try
au BufWritePre Xfile call s:bufwritepre() au BufWritePre Xinterrupt call s:bufwritepre()
au BufWritePost Xfile call s:bufwritepost() au BufWritePost Xinterrupt call s:bufwritepost()
w! w!
catch /^Vim:Interrupt$/ catch /^Vim:Interrupt$/
endtry endtry
call assert_equal(1, s:bufwritepre_called) call assert_equal(1, s:bufwritepre_called)
call assert_equal(0, s:bufwritepost_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 endfunc
" vim: shiftwidth=2 sts=2 expandtab