To: vim_dev@googlegroups.com Subject: Patch 8.0.0960 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0960 Problem: Job in terminal does not get CTRL-C, we send a SIGINT instead. Solution: Don't call may_send_sigint() on CTRL-C. Make CTRL-W CTRL-C end the job. Files: src/terminal.c, runtime/doc/terminal.c *** ../vim-8.0.0959/src/terminal.c 2017-08-18 20:50:26.441516959 +0200 --- src/terminal.c 2017-08-18 22:55:45.901876673 +0200 *************** *** 1367,1375 **** if (c == K_IGNORE) continue; - #ifdef UNIX - may_send_sigint(c, curbuf->b_term->tl_job->jv_pid, 0); - #endif #ifdef WIN3264 /* On Windows winpty handles CTRL-C, don't send a CTRL_C_EVENT. * Use CTRL-BREAK to kill the job. */ --- 1367,1372 ---- *************** *** 1405,1410 **** --- 1402,1412 ---- /* Send both keys to the terminal. */ send_keys_to_term(curbuf->b_term, prev_c, TRUE); } + else if (c == Ctrl_C) + { + /* "CTRL-W CTRL-C" or 'termkey' CTRL-C: end the job */ + mch_signal_job(curbuf->b_term->tl_job, (char_u *)"kill"); + } else if (termkey == 0 && c == '.') { /* "CTRL-W .": send CTRL-W to the job */ *** ../vim-8.0.0959/runtime/doc/terminal.txt 2017-08-12 14:32:25.902039902 +0200 --- runtime/doc/terminal.txt 2017-08-18 22:56:24.509637491 +0200 *************** *** 52,57 **** --- 52,58 ---- CTRL-W " {reg} paste register {reg} *CTRL-W_quote* Also works with the = register to insert the result of evaluating an expression. + CTRL-W CTRL-C ends the job, see below |t_CTRL-W_CTRL-C| See option 'termkey' for specifying another key instead of CTRL-W that will work like CTRL-W. However, typing 'termkey' twice sends 'termkey' to *************** *** 62,77 **** 'termkey' . send a CTRL-W to the job in the terminal 'termkey' N go to terminal Normal mode, see below 'termkey' CTRL-N same as CTRL-W N *t_CTRL-\_CTRL-N* The special key combination CTRL-\ CTRL-N can be used to switch to Normal mode, just like this works in any other mode. ! Size ~ See option 'termsize' for controlling the size of the terminal window. (TODO: scrolling when the terminal is larger than the window) Syntax ~ --- 63,91 ---- 'termkey' . send a CTRL-W to the job in the terminal 'termkey' N go to terminal Normal mode, see below 'termkey' CTRL-N same as CTRL-W N + 'termkey' CTRL-C same as |t_CTRL-W_CTRL-C| *t_CTRL-\_CTRL-N* The special key combination CTRL-\ CTRL-N can be used to switch to Normal mode, just like this works in any other mode. + *t_CTRL-W_CTRL-C* + CTRL-W CTRL-C can be typed to forcefully end the job. On MS-Windows a + CTRL-BREAK will also kill the job. + If you type CTRL-C the effect depends on what the pty has been configured to + do. For simple commands this causes a SIGINT to be sent to the job, which + would end it. Other commands may ignore the SIGINT or handle the CTRL-C + themselves (like Vim does). ! ! Size and color ~ See option 'termsize' for controlling the size of the terminal window. (TODO: scrolling when the terminal is larger than the window) + The terminal uses the 'background' option to decide whether the terminal + window will start with a white or black background. The job running in the + terminal can change the colors. + Syntax ~ *************** *** 115,122 **** If you want to use more options use the |term_start()| function. ! When the buffer associated with the terminal is wiped out the job is killed, ! similar to calling `job_stop(job, "kill")` By default the 'bufhidden' option of the buffer will be set to "hide". So long as the job is running: If the window is closed the buffer becomes --- 129,136 ---- If you want to use more options use the |term_start()| function. ! When the buffer associated with the terminal is unloaded or wiped out the job ! is killed, similar to calling `job_stop(job, "kill")` By default the 'bufhidden' option of the buffer will be set to "hide". So long as the job is running: If the window is closed the buffer becomes *************** *** 130,136 **** Note that the window will open at an unexpected moment, this will interrupt what you are doing. ! *E947* So long as the job is running, the buffer is considered modified and Vim cannot be quit easily, see |abandon|. --- 144,150 ---- Note that the window will open at an unexpected moment, this will interrupt what you are doing. ! *E947* *E948* So long as the job is running, the buffer is considered modified and Vim cannot be quit easily, see |abandon|. *************** *** 187,192 **** --- 201,208 ---- the job ends while in Terminal-Normal mode this changes to "(Terminal-finished)". + It is not possible to enter Insert mode from Terminal-Job mode. + Unix ~ *************** *** 226,232 **** https://github.com/rprichard/winpty ! Just put the files somewhere in your PATH. ============================================================================== 2. Remote testing *terminal-testing* --- 242,251 ---- https://github.com/rprichard/winpty ! Just put the files somewhere in your PATH. You can set the 'winptydll' option ! to point to the right file, if needed. If you have both the 32-bit and 64-bit ! version, rename to winpty32.dll and winpty64.dll to match the way Vim was ! build. ============================================================================== 2. Remote testing *terminal-testing* *** ../vim-8.0.0959/src/version.c 2017-08-18 21:53:18.069438798 +0200 --- src/version.c 2017-08-18 22:53:38.170667616 +0200 *************** *** 771,772 **** --- 771,774 ---- { /* Add new patch number below this line */ + /**/ + 960, /**/ -- BLACK KNIGHT: I'm invincible! ARTHUR: You're a looney. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///