summaryrefslogtreecommitdiff
path: root/src/terminal.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-08-01 22:24:26 +0200
committerBram Moolenaar <Bram@vim.org>2017-08-01 22:24:26 +0200
commitfae428354213b54626ff9e29faa5fd86161da942 (patch)
tree26926e8d68d6d6aef91561a83b51fd5bce5f856a /src/terminal.c
parent94053a51255121713f51c122eb0dbb46c120e6d4 (diff)
downloadvim-git-fae428354213b54626ff9e29faa5fd86161da942.tar.gz
patch 8.0.0839: cannot kill a job in a terminal with CTRL-Cv8.0.0839
Problem: Cannot kill a job in a terminal with CTRL-C. Solution: Set the controlling tty and send SIGINT. (closes #1910)
Diffstat (limited to 'src/terminal.c')
-rw-r--r--src/terminal.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/terminal.c b/src/terminal.c
index 0ef7ae2ac..4af083290 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -39,8 +39,6 @@
* - don't allow exiting Vim when a terminal is still running a job
* - in bash mouse clicks are inserting characters.
* - mouse scroll: when over other window, scroll that window.
- * - typing CTRL-C is not sent to the terminal. need to setup controlling tty?
- * #1910
* - For the scrollback buffer store lines in the buffer, only attributes in
* tl_scrollback.
* - When the job ends:
@@ -962,6 +960,17 @@ terminal_loop(void)
/* job finished while waiting for a character */
break;
+#ifdef UNIX
+ may_send_sigint(c, curbuf->b_term->tl_job->jv_pid, 0);
+#endif
+#ifdef WIN3264
+ if (c == Ctrl_C)
+ /* We don't know if the job can handle CTRL-C itself or not, this
+ * may kill the shell instead of killing the command running in the
+ * shell. */
+ mch_stop_job(curbuf->b_term->tl_job, "quit")
+#endif
+
if (c == (termkey == 0 ? Ctrl_W : termkey))
{
int prev_c = c;