0
0
mirror of https://github.com/vim/vim.git synced 2025-11-14 23:04:02 -05:00

patch 9.1.1295: clientserver: does not handle :stopinsert correctly

Problem:  clientserver: When in insert mode, a :stopinsert command
          is not correctly processed (user202729)
Solution: If the :stopinsert command is received while waiting for
          input, stuff the NOP key into the type-ahead buffer and
          detect that :stopinsert was used in edit() so that the
          cursor position is decremented.

fixes: #17016
closes: #17024

Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Christian Brabandt
2025-04-12 18:09:28 +02:00
parent 6f6c0dba9f
commit cf665ccd37
4 changed files with 59 additions and 1 deletions

View File

@@ -9326,6 +9326,12 @@ ex_stopinsert(exarg_T *eap UNUSED)
{
restart_edit = 0;
stop_insert_mode = TRUE;
#if defined(FEAT_CLIENTSERVER) || defined(FEAT_EVAL)
// when called from remote_expr in insert mode, make sure insert mode is
// ended by adding K_NOP to the typeahead buffer
if (vgetc_busy)
ins_char_typebuf(K_NOP, 0);
#endif
clearmode();
}