Mercurial > vim
diff src/terminal.c @ 11764:b82dad3fa176 v8.0.0764
patch 8.0.0764: 'termkey' does not work yet
commit https://github.com/vim/vim/commit/dbe948d6c350feacc01ad019b57717149c8ea5e5
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jul 23 22:50:51 2017 +0200
patch 8.0.0764: 'termkey' does not work yet
Problem: 'termkey' does not work yet.
Solution: Implement 'termkey'.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 23 Jul 2017 23:00:04 +0200 |
parents | 74abb6c84984 |
children | f33b9375ba03 |
line wrap: on
line diff
--- a/src/terminal.c +++ b/src/terminal.c @@ -60,9 +60,9 @@ * - implement term_scrape(buf, row) inspect terminal screen * - implement term_open(command, options) open terminal window * - implement term_getjob(buf) - * - implement 'termkey' * - when 'encoding' is not utf-8, or the job is using another encoding, setup * conversions. + * - In the GUI use a terminal emulator for :!cmd. */ #include "vim.h" @@ -445,6 +445,10 @@ terminal_loop(void) size_t len; static int mouse_was_outside = FALSE; int dragging_outside = FALSE; + int termkey = 0; + + if (*curwin->w_p_tk != NUL) + termkey = string_to_key(curwin->w_p_tk, TRUE); for (;;) { @@ -459,10 +463,15 @@ terminal_loop(void) --no_mapping; --allow_keys; + if (c == (termkey == 0 ? Ctrl_W : termkey)) + { + stuffcharReadbuff(Ctrl_W); + return; + } + /* Catch keys that need to be handled as in Normal mode. */ switch (c) { - case Ctrl_W: case NUL: case K_ZERO: stuffcharReadbuff(c);