To: vim_dev@googlegroups.com Subject: Patch 8.2.5022 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.5022 Problem: 'completefunc'/'omnifunc' error does not end completion. Solution: Check if there was an error or exception. (closes #10486, closes #4218) Files: src/insexpand.c, src/testdir/test_ins_complete.vim *** ../vim-8.2.5021/src/insexpand.c 2022-05-21 20:16:51.007567185 +0100 --- src/insexpand.c 2022-05-26 15:17:36.949819013 +0100 *************** *** 4522,4532 **** return FAIL; } ! // Return value -2 means the user complete function wants to ! // cancel the complete without an error. ! // Return value -3 does the same as -2 and leaves CTRL-X mode. ! if (col == -2) return FAIL; if (col == -3) { ctrl_x_mode = CTRL_X_NORMAL; --- 4522,4533 ---- return FAIL; } ! // Return value -2 means the user complete function wants to cancel the ! // complete without an error, do the same if the function did not execute ! // successfully. ! if (col == -2 || aborting()) return FAIL; + // Return value -3 does the same as -2 and leaves CTRL-X mode. if (col == -3) { ctrl_x_mode = CTRL_X_NORMAL; *** ../vim-8.2.5021/src/testdir/test_ins_complete.vim 2022-05-04 17:51:38.374012790 +0100 --- src/testdir/test_ins_complete.vim 2022-05-26 15:17:36.949819013 +0100 *************** *** 140,145 **** --- 140,169 ---- set omnifunc= endfunc + func Test_omni_throw() + let g:CallCount = 0 + func Omni(findstart, base) + let g:CallCount += 1 + if a:findstart + throw "he he he" + endif + endfunc + set omnifunc=Omni + new + try + exe "normal ifoo\\" + call assert_false(v:true, 'command should have failed') + catch + call assert_exception('he he he') + call assert_equal(1, g:CallCount) + endtry + + bwipe! + delfunc Omni + unlet g:CallCount + set omnifunc= + endfunc + func Test_omni_autoload() let save_rtp = &rtp set rtp=Xruntime/some *** ../vim-8.2.5021/src/version.c 2022-05-26 14:06:33.065676872 +0100 --- src/version.c 2022-05-26 15:20:38.937644425 +0100 *************** *** 736,737 **** --- 736,739 ---- { /* Add new patch number below this line */ + /**/ + 5022, /**/ -- You were lucky to have a LAKE! There were a hundred and sixty of us living in a small shoebox in the middle of the road. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///