summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-09-27 20:13:03 +0200
committerBram Moolenaar <Bram@vim.org>2020-09-27 20:13:03 +0200
commitd0e1b7103c14eb0d175c6b245b4b6ed93a204da9 (patch)
tree16bd1d7d65bc1c2a5538c8e48ac11982ef540352
parentac564082f118ccdca828980c5f10b65a40bffb4d (diff)
patch 8.2.1762: when a timer uses :stopinsert completion isn't stoppedv8.2.1762
Problem: When a timer uses :stopinsert Insert mode completion isn't stopped. (Stanley Chan) Solution: Call ins_compl_prep(ESC).
-rw-r--r--src/edit.c3
-rw-r--r--src/testdir/dumps/Test_pum_stopped_by_timer.dump12
-rw-r--r--src/testdir/test_ins_complete.vim22
-rw-r--r--src/version.c2
4 files changed, 39 insertions, 0 deletions
diff --git a/src/edit.c b/src/edit.c
index 642ff958bd..e3e4624fb0 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -587,8 +587,11 @@ edit(
if (stop_insert_mode)
{
// Insert mode ended, possibly from a callback.
+ if (c != K_IGNORE && c != K_NOP)
+ vungetc(c);
count = 0;
nomove = TRUE;
+ ins_compl_prep(ESC);
goto doESCkey;
}
} while (c == K_IGNORE || c == K_NOP);
diff --git a/src/testdir/dumps/Test_pum_stopped_by_timer.dump b/src/testdir/dumps/Test_pum_stopped_by_timer.dump
new file mode 100644
index 0000000000..77ad5cefc2
--- /dev/null
+++ b/src/testdir/dumps/Test_pum_stopped_by_timer.dump
@@ -0,0 +1,12 @@
+|h+0&#ffffff0|e|l@1|o| @69
+|h|u|l@1|o| @69
+|h|e@2>e| @69
+|h|e|l@1|o| @69
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|3|,|5| @10|A|l@1|
diff --git a/src/testdir/test_ins_complete.vim b/src/testdir/test_ins_complete.vim
index f77512ae18..005e14caf0 100644
--- a/src/testdir/test_ins_complete.vim
+++ b/src/testdir/test_ins_complete.vim
@@ -407,6 +407,28 @@ func Test_ins_completeslash()
set completeslash=
endfunc
+func Test_pum_stopped_by_timer()
+ CheckScreendump
+
+ let lines =<< trim END
+ call setline(1, ['hello', 'hullo', 'heeee', ''])
+ func StartCompl()
+ call timer_start(100, { -> execute('stopinsert') })
+ call feedkeys("Gah\<C-N>")
+ endfunc
+ END
+
+ call writefile(lines, 'Xpumscript')
+ let buf = RunVimInTerminal('-S Xpumscript', #{rows: 12})
+ call term_sendkeys(buf, ":call StartCompl()\<CR>")
+ call TermWait(buf, 200)
+ call term_sendkeys(buf, "k")
+ call VerifyScreenDump(buf, 'Test_pum_stopped_by_timer', {})
+
+ call StopVimInTerminal(buf)
+ call delete('Xpumscript')
+endfunc
+
func Test_pum_with_folds_two_tabs()
CheckScreendump
diff --git a/src/version.c b/src/version.c
index ccedf6476d..d6006185cc 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1762,
+/**/
1761,
/**/
1760,