1
0
forked from aniani/vim

patch 9.0.1036: undo misbehaves when writing from an insert mode mapping

Problem:    Undo misbehaves when writing from an insert mode mapping.
Solution:   Sync undo when writing. (closes #11674)
This commit is contained in:
Bram Moolenaar
2022-12-08 21:49:35 +00:00
parent d28d7b94f5
commit 3f8f827723
6 changed files with 56 additions and 4 deletions

View File

@@ -1049,12 +1049,19 @@ doESCkey:
case K_COMMAND: // <Cmd>command<CR>
case K_SCRIPT_COMMAND: // <ScriptCmd>command<CR>
do_cmdkey_command(c, 0);
{
do_cmdkey_command(c, 0);
#ifdef FEAT_TERMINAL
if (term_use_loop())
// Started a terminal that gets the input, exit Insert mode.
goto doESCkey;
if (term_use_loop())
// Started a terminal that gets the input, exit Insert mode.
goto doESCkey;
#endif
if (curbuf->b_u_synced)
// The command caused undo to be synced. Need to save the
// line for undo before inserting the next char.
ins_need_undo = TRUE;
}
break;
case K_CURSORHOLD: // Didn't type something for a while.