summaryrefslogtreecommitdiffstats
path: root/src/getchar.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-05-01 18:47:59 +0200
committerBram Moolenaar <Bram@vim.org>2018-05-01 18:47:59 +0200
commitb2ac14c0b5e23f8ab97c5c784bcd83e13ba8ded3 (patch)
treeccd71c85b849644e14fdbb4f85d2658542443dee /src/getchar.c
parent8a938af6ddefab4b4bc751d3f3545e1d95622c8a (diff)
patch 8.0.1786: no test for 'termwinkey'v8.0.1786
Problem: No test for 'termwinkey'. Solution: Add a test. Make feedkeys() handle terminal_loop() returning before characters are consumed.
Diffstat (limited to 'src/getchar.c')
-rw-r--r--src/getchar.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/getchar.c b/src/getchar.c
index 623440ecf9..5b5b3edabd 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -2059,7 +2059,7 @@ vgetorpeek(int advance)
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 @@ vgetorpeek(int advance)
* 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 @@ vgetorpeek(int advance)
} /* 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: