Mercurial > vim
changeset 23656:c6f7df86cd9d v8.2.2370
patch 8.2.2370: Vim9: command fails in catch block
Commit: https://github.com/vim/vim/commit/1430ceeb2d4185a8d60fa81007fbc8b74fd68c46
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 17 19:20:32 2021 +0100
patch 8.2.2370: Vim9: command fails in catch block
Problem: Vim9: command fails in catch block.
Solution: Reset force_abort and need_rethrow. (closes https://github.com/vim/vim/issues/7692)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 17 Jan 2021 19:30:04 +0100 |
parents | 1c9c8221f546 |
children | 71b7eeac62fc |
files | src/testdir/test_vim9_script.vim src/version.c src/vim9execute.c |
diffstat | 3 files changed, 40 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/testdir/test_vim9_script.vim +++ b/src/testdir/test_vim9_script.vim @@ -558,6 +558,43 @@ def Test_try_catch_throw() 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