diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-10-20 16:00:47 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-10-20 16:00:47 +0200 |
commit | 88d3d09e07dbe0e3ea450bc554e2aadc451450d2 (patch) | |
tree | d39815b1a82893d0a6c8ae62c0d2868a35be288c /src/getchar.c | |
parent | 83e9a1ce75818a78c5ddf8dcfb820634ca6fabff (diff) | |
download | vim-git-88d3d09e07dbe0e3ea450bc554e2aadc451450d2.tar.gz |
patch 8.1.2191: when using modifyOtherKeys CTRL-X mode may not workv8.1.2191
Problem: When using modifyOtherKeys CTRL-X mode may not work.
Solution: Recognize a control character also in the form with a modifier.
Diffstat (limited to 'src/getchar.c')
-rw-r--r-- | src/getchar.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/getchar.c b/src/getchar.c index 03a67be34..f9bfab829 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -2143,6 +2143,24 @@ typedef enum { } map_result_T; /* + * Check if the bytes at the start of the typeahead buffer are a character used + * in CTRL-X mode. This includes the form with a CTRL modifier. + */ + static int +at_ctrl_x_key(void) +{ + char_u *p = typebuf.tb_buf + typebuf.tb_off; + int c = *p; + + if (typebuf.tb_len > 3 + && c == K_SPECIAL + && p[1] == KS_MODIFIER + && (p[2] & MOD_MASK_CTRL)) + c = p[3] & 0x1f; + return vim_is_ctrl_x_key(c); +} + +/* * Handle mappings in the typeahead buffer. * - When something was mapped, return map_result_retry for recursive mappings. * - When nothing mapped and typeahead has a character: return map_result_get. @@ -2193,7 +2211,7 @@ handle_mapping( && !(State == HITRETURN && (tb_c1 == CAR || tb_c1 == ' ')) && State != ASKMORE && State != CONFIRM - && !((ctrl_x_mode_not_default() && vim_is_ctrl_x_key(tb_c1)) + && !((ctrl_x_mode_not_default() && at_ctrl_x_key()) || ((compl_cont_status & CONT_LOCAL) && (tb_c1 == Ctrl_N || tb_c1 == Ctrl_P)))) { |