patch 8.0.0839: cannot kill a job in a terminal with CTRL-C
Problem: Cannot kill a job in a terminal with CTRL-C.
Solution: Set the controlling tty and send SIGINT. (closes #1910)
diff --git a/src/terminal.c b/src/terminal.c
index 0ef7ae2..4af0832 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 @@
/* 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;