0
0
mirror of https://github.com/vim/vim.git synced 2025-09-28 04:24:06 -04:00

patch 8.2.1762: when a timer uses :stopinsert completion isn't stopped

Problem:    When a timer uses :stopinsert Insert mode completion isn't
            stopped. (Stanley Chan)
Solution:   Call ins_compl_prep(ESC).
This commit is contained in:
Bram Moolenaar
2020-09-27 20:13:03 +02:00
parent ac564082f1
commit d0e1b7103c
4 changed files with 39 additions and 0 deletions

View File

@@ -587,8 +587,11 @@ edit(
if (stop_insert_mode) if (stop_insert_mode)
{ {
// Insert mode ended, possibly from a callback. // Insert mode ended, possibly from a callback.
if (c != K_IGNORE && c != K_NOP)
vungetc(c);
count = 0; count = 0;
nomove = TRUE; nomove = TRUE;
ins_compl_prep(ESC);
goto doESCkey; goto doESCkey;
} }
} while (c == K_IGNORE || c == K_NOP); } while (c == K_IGNORE || c == K_NOP);

View File

@@ -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|

View File

@@ -407,6 +407,28 @@ func Test_ins_completeslash()
set completeslash= set completeslash=
endfunc 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() func Test_pum_with_folds_two_tabs()
CheckScreendump CheckScreendump

View File

@@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1762,
/**/ /**/
1761, 1761,
/**/ /**/