To: vim_dev@googlegroups.com Subject: Patch 8.2.2370 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2370 Problem: Vim9: command fails in catch block. Solution: Reset force_abort and need_rethrow. (closes #7692) Files: src/vim9execute.c, src/testdir/test_vim9_script.vim *** ../vim-8.2.2369/src/vim9execute.c 2021-01-17 13:21:14.962687183 +0100 --- src/vim9execute.c 2021-01-17 19:19:00.204855428 +0100 *************** *** 2572,2577 **** --- 2572,2578 ---- trycmd->tcd_caught = TRUE; } did_emsg = got_int = did_throw = FALSE; + force_abort = need_rethrow = FALSE; catch_exception(current_exception); } break; *** ../vim-8.2.2369/src/testdir/test_vim9_script.vim 2021-01-14 21:47:03.171554574 +0100 --- src/testdir/test_vim9_script.vim 2021-01-17 19:18:42.480896395 +0100 *************** *** 558,563 **** --- 558,600 ---- assert_equal(411, n) enddef + def Test_cnext_works_in_catch() + var lines =<< trim END + vim9script + au BufEnter * eval 0 + writefile(['text'], 'Xfile1') + writefile(['text'], 'Xfile2') + var items = [ + {lnum: 1, filename: 'Xfile1', valid: true}, + {lnum: 1, filename: 'Xfile2', valid: true} + ] + setqflist([], ' ', {items: items}) + cwindow + + def CnextOrCfirst() + # if cnext fails, cfirst is used + try + cnext + catch + cfirst + endtry + enddef + + CnextOrCfirst() + CnextOrCfirst() + writefile([getqflist({idx: 0}).idx], 'Xresult') + qall + END + writefile(lines, 'XCatchCnext') + RunVim([], [], '--clean -S XCatchCnext') + assert_equal(['1'], readfile('Xresult')) + + delete('Xfile1') + delete('Xfile2') + delete('XCatchCnext') + delete('Xresult') + enddef + def Test_throw_skipped() if 0 throw dontgethere *** ../vim-8.2.2369/src/version.c 2021-01-17 16:16:19.997563189 +0100 --- src/version.c 2021-01-17 17:25:33.456845364 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2370, /**/ -- Very funny, Scotty. Now beam down my clothes. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///