aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-01-07 22:28:00 +0100
committerGitHub <noreply@github.com>2019-01-07 22:28:00 +0100
commit3081f6098987d49bb6584be94b851642a4bc4355 (patch)
treec4e766f48160635a5bc545841e39ad52064e22d0
parent0c42e0e8b1e24c2f6e2336ca955a1a5f8d3e0c5b (diff)
parentb5216a3e5b519b9946dcbe68742d27b345d68cd6 (diff)
downloadrneovim-3081f6098987d49bb6584be94b851642a4bc4355.tar.gz
rneovim-3081f6098987d49bb6584be94b851642a4bc4355.tar.bz2
rneovim-3081f6098987d49bb6584be94b851642a4bc4355.zip
Merge #9466 from janlazo/vim-8.1.0696
-rw-r--r--src/nvim/edit.c13
-rw-r--r--src/nvim/testdir/runtest.vim6
2 files changed, 17 insertions, 2 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 41a2be6ad4..90da6c8abf 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -3520,6 +3520,7 @@ expand_by_function (
win_T *curwin_save;
buf_T *curbuf_save;
typval_T rettv;
+ const int save_State = State;
funcname = (type == CTRL_X_FUNCTION) ? curbuf->b_p_cfu : curbuf->b_p_ofu;
if (*funcname == NUL)
@@ -3565,6 +3566,9 @@ expand_by_function (
ins_compl_add_dict(matchdict);
theend:
+ // Restore State, it might have been changed.
+ State = save_State;
+
if (matchdict != NULL) {
tv_dict_unref(matchdict);
}
@@ -4676,6 +4680,7 @@ static int ins_complete(int c, bool enable_pum)
pos_T pos;
win_T *curwin_save;
buf_T *curbuf_save;
+ const int save_State = State;
/* Call 'completefunc' or 'omnifunc' and get pattern length as a
* string */
@@ -4693,7 +4698,9 @@ static int ins_complete(int c, bool enable_pum)
pos = curwin->w_cursor;
curwin_save = curwin;
curbuf_save = curbuf;
- col = call_func_retnr(funcname, 2, args, FALSE);
+ col = call_func_retnr(funcname, 2, args, false);
+
+ State = save_State;
if (curwin_save != curwin || curbuf_save != curbuf) {
EMSG(_(e_complwin));
return FAIL;
@@ -8667,6 +8674,7 @@ static colnr_T get_nolist_virtcol(void)
static char_u *do_insert_char_pre(int c)
{
char buf[MB_MAXBYTES + 1];
+ const int save_State = State;
// Return quickly when there is nothing to do.
if (!has_event(EVENT_INSERTCHARPRE)) {
@@ -8691,6 +8699,9 @@ static char_u *do_insert_char_pre(int c)
set_vim_var_string(VV_CHAR, NULL, -1);
textlock--;
+ // Restore the State, it may have been changed.
+ State = save_State;
+
return res;
}
diff --git a/src/nvim/testdir/runtest.vim b/src/nvim/testdir/runtest.vim
index 4fe7db135b..bfd6240f0c 100644
--- a/src/nvim/testdir/runtest.vim
+++ b/src/nvim/testdir/runtest.vim
@@ -26,7 +26,7 @@
" It will be called after each Test_ function.
"
" When debugging a test it can be useful to add messages to v:errors:
-" call add(v:errors, "this happened")
+" call add(v:errors, "this happened")
" Check that the screen size is at least 24 x 80 characters.
@@ -130,6 +130,10 @@ func RunTheTest(test)
endtry
endif
+ " In case 'insertmode' was set and something went wrong, make sure it is
+ " reset to avoid trouble with anything else.
+ set noinsertmode
+
if exists("*TearDown")
try
call TearDown()