Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
11763:21f3930dfe6e | 11764:b82dad3fa176 |
---|---|
58 * - implement term_sendkeys(buf, keys) send keystrokes to a terminal | 58 * - implement term_sendkeys(buf, keys) send keystrokes to a terminal |
59 * - implement term_wait(buf) wait for screen to be updated | 59 * - implement term_wait(buf) wait for screen to be updated |
60 * - implement term_scrape(buf, row) inspect terminal screen | 60 * - implement term_scrape(buf, row) inspect terminal screen |
61 * - implement term_open(command, options) open terminal window | 61 * - implement term_open(command, options) open terminal window |
62 * - implement term_getjob(buf) | 62 * - implement term_getjob(buf) |
63 * - implement 'termkey' | |
64 * - when 'encoding' is not utf-8, or the job is using another encoding, setup | 63 * - when 'encoding' is not utf-8, or the job is using another encoding, setup |
65 * conversions. | 64 * conversions. |
65 * - In the GUI use a terminal emulator for :!cmd. | |
66 */ | 66 */ |
67 | 67 |
68 #include "vim.h" | 68 #include "vim.h" |
69 | 69 |
70 #ifdef FEAT_TERMINAL | 70 #ifdef FEAT_TERMINAL |
443 char buf[KEY_BUF_LEN]; | 443 char buf[KEY_BUF_LEN]; |
444 int c; | 444 int c; |
445 size_t len; | 445 size_t len; |
446 static int mouse_was_outside = FALSE; | 446 static int mouse_was_outside = FALSE; |
447 int dragging_outside = FALSE; | 447 int dragging_outside = FALSE; |
448 int termkey = 0; | |
449 | |
450 if (*curwin->w_p_tk != NUL) | |
451 termkey = string_to_key(curwin->w_p_tk, TRUE); | |
448 | 452 |
449 for (;;) | 453 for (;;) |
450 { | 454 { |
451 /* TODO: skip screen update when handling a sequence of keys. */ | 455 /* TODO: skip screen update when handling a sequence of keys. */ |
452 update_screen(0); | 456 update_screen(0); |
457 got_int = FALSE; | 461 got_int = FALSE; |
458 c = vgetc(); | 462 c = vgetc(); |
459 --no_mapping; | 463 --no_mapping; |
460 --allow_keys; | 464 --allow_keys; |
461 | 465 |
466 if (c == (termkey == 0 ? Ctrl_W : termkey)) | |
467 { | |
468 stuffcharReadbuff(Ctrl_W); | |
469 return; | |
470 } | |
471 | |
462 /* Catch keys that need to be handled as in Normal mode. */ | 472 /* Catch keys that need to be handled as in Normal mode. */ |
463 switch (c) | 473 switch (c) |
464 { | 474 { |
465 case Ctrl_W: | |
466 case NUL: | 475 case NUL: |
467 case K_ZERO: | 476 case K_ZERO: |
468 stuffcharReadbuff(c); | 477 stuffcharReadbuff(c); |
469 return; | 478 return; |
470 | 479 |