Patch 8.2.0123

13 views
Skip to first unread message

Bram Moolenaar

unread,
Jan 17, 2020, 12:59:51 PM1/17/20
to vim...@googlegroups.com

Patch 8.2.0123
Problem: complete_info() does not work when CompleteDone is triggered.
Solution: Trigger CompleteDone before clearing the info.
Files: src/insexpand.c, runtime/doc/autocmd.txt,
src/testdir/test_ins_complete.vim


*** ../vim-8.2.0122/src/insexpand.c 2020-01-04 19:00:07.573654631 +0100
--- src/insexpand.c 2020-01-17 18:39:20.327472711 +0100
***************
*** 1813,1818 ****
--- 1813,1819 ----
int want_cindent;
#endif
int retval = FALSE;
+ int prev_mode = ctrl_x_mode;

// Forget any previous 'special' messages if this is actually
// a ^X mode key - bar ^R, in which case we wait to see what it gives us.
***************
*** 2060,2065 ****
--- 2061,2078 ----

auto_format(FALSE, TRUE);

+ {
+ int new_mode = ctrl_x_mode;
+
+ // Trigger the CompleteDone event to give scripts a chance to
+ // act upon the completion. Do this before clearing the info,
+ // and restore ctrl_x_mode, so that complete_info() can be
+ // used.
+ ctrl_x_mode = prev_mode;
+ ins_apply_autocmds(EVENT_COMPLETEDONE);
+ ctrl_x_mode = new_mode;
+ }
+
ins_compl_free();
compl_started = FALSE;
compl_matches = 0;
***************
*** 2084,2092 ****
if (want_cindent && in_cinkeys(KEY_COMPLETE, ' ', inindent(0)))
do_c_expr_indent();
#endif
- // Trigger the CompleteDone event to give scripts a chance to act
- // upon the completion.
- ins_apply_autocmds(EVENT_COMPLETEDONE);
}
}
else if (ctrl_x_mode == CTRL_X_LOCAL_MSG)
--- 2097,2102 ----
*** ../vim-8.2.0122/runtime/doc/autocmd.txt 2019-12-17 21:27:14.686319918 +0100
--- runtime/doc/autocmd.txt 2020-01-17 18:29:04.497616771 +0100
***************
*** 610,615 ****
--- 610,617 ----
CompleteDone After Insert mode completion is done. Either
when something was completed or abandoning
completion. |ins-completion|
+ |complete_info()| can be used, the info is
+ cleared after triggering CompleteDone.
The |v:completed_item| variable contains
information about the completed item.

***************
*** 639,645 ****
Hint: to force an update of the status lines
use: >
:let &ro = &ro
! < {only on Amiga, Unix, Win32, MSDOS and all GUI
versions}
*CursorHoldI*
CursorHoldI Just like CursorHold, but in Insert mode.
--- 641,647 ----
Hint: to force an update of the status lines
use: >
:let &ro = &ro
! < {only on Amiga, Unix, Win32 and all GUI
versions}
*CursorHoldI*
CursorHoldI Just like CursorHold, but in Insert mode.
*** ../vim-8.2.0122/src/testdir/test_ins_complete.vim 2020-01-05 20:35:39.967830421 +0100
--- src/testdir/test_ins_complete.vim 2020-01-17 18:36:23.904106428 +0100
***************
*** 183,188 ****
--- 183,190 ----
call assert_equal( 'W', v:completed_item[ 'kind' ] )
call assert_equal( 'test', v:completed_item[ 'user_data' ] )

+ call assert_equal('function', complete_info().mode)
+
let s:called_completedone = 1
endfunc

*** ../vim-8.2.0122/src/version.c 2020-01-16 19:40:28.543521543 +0100
--- src/version.c 2020-01-17 18:58:01.535352759 +0100
***************
*** 744,745 ****
--- 744,747 ----
{ /* Add new patch number below this line */
+ /**/
+ 123,
/**/

--
SOLDIER: What? Ridden on a horse?
ARTHUR: Yes!
SOLDIER: You're using coconuts!
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

/// Bram Moolenaar -- Br...@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 ///
Reply all
Reply to author
Forward
0 new messages