patch 8.0.1786: no test for 'termwinkey'
Problem: No test for 'termwinkey'.
Solution: Add a test. Make feedkeys() handle terminal_loop() returning
before characters are consumed.
diff --git a/src/getchar.c b/src/getchar.c
index 623440e..5b5b3ed 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -2059,7 +2059,7 @@
c = inchar(typebuf.tb_buf, typebuf.tb_buflen - 1, 0L);
/*
* If inchar() returns TRUE (script file was active) or we
- * are inside a mapping, get out of insert mode.
+ * are inside a mapping, get out of Insert mode.
* Otherwise we behave like having gotten a CTRL-C.
* As a result typing CTRL-C in insert mode will
* really insert a CTRL-C.
@@ -2755,6 +2755,10 @@
* cmdline window. */
if (p_im && (State & INSERT))
c = Ctrl_L;
+#ifdef FEAT_TERMINAL
+ else if (terminal_is_active())
+ c = K_CANCEL;
+#endif
else if ((State & CMDLINE)
#ifdef FEAT_CMDWIN
|| (cmdwin_type > 0 && tc == ESC)
@@ -2898,8 +2902,8 @@
} /* for (;;) */
} /* if (!character from stuffbuf) */
- /* if advance is FALSE don't loop on NULs */
- } while (c < 0 || (advance && c == NUL));
+ /* if advance is FALSE don't loop on NULs */
+ } while ((c < 0 && c != K_CANCEL) || (advance && c == NUL));
/*
* The "INSERT" message is taken care of here: