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\<C-x>\<C-o>"
+     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 -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220526142631.1C2FE1C14D9%40moolenaar.net.

Raspunde prin e-mail lui