diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-04-30 22:12:00 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-04-30 22:27:27 +0800 |
commit | 0b12f6d7bef60f644bf55d0158a11a58a21c3e71 (patch) | |
tree | 6c8d2c7bcb8c6c84ab30492f62ce12a484c3e1b3 /src/nvim/getchar.c | |
parent | db355ca4e5d1f8c3e1b749ca21336a7ebbab7317 (diff) | |
download | rneovim-0b12f6d7bef60f644bf55d0158a11a58a21c3e71.tar.gz rneovim-0b12f6d7bef60f644bf55d0158a11a58a21c3e71.tar.bz2 rneovim-0b12f6d7bef60f644bf55d0158a11a58a21c3e71.zip |
vim-patch:8.2.4848: local completion with mappings and simplification not working
Problem: Local completion with mappings and simplification not working.
Solution: Fix local completion <C-N>/<C-P> mappings not ignored if keys are
not simplified. (closes vim/vim#10323)
https://github.com/vim/vim/commit/ee4460306917431d0d17a7cb11c6646f4c6540b6
Diffstat (limited to 'src/nvim/getchar.c')
-rw-r--r-- | src/nvim/getchar.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index 9af03208b4..6dd6c51e8f 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -1769,8 +1769,8 @@ static int put_string_in_typebuf(int offset, int slen, char_u *string, int new_s } /// 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 bool at_ctrl_x_key(void) +/// in Insert mode completion. This includes the form with a CTRL modifier. +static bool at_ins_compl_key(void) { char_u *p = typebuf.tb_buf + typebuf.tb_off; int c = *p; @@ -1778,7 +1778,8 @@ static bool at_ctrl_x_key(void) 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); + return (ctrl_x_mode_not_default() && vim_is_ctrl_x_key(c)) + || ((compl_cont_status & CONT_LOCAL) && (c == Ctrl_N || c == Ctrl_P)); } /// Check if typebuf.tb_buf[] contains a modifer plus key that can be changed @@ -1883,9 +1884,7 @@ static int handle_mapping(int *keylenp, bool *timedout, int *mapdepth) && !(State == HITRETURN && (tb_c1 == CAR || tb_c1 == ' ')) && State != ASKMORE && State != CONFIRM - && !((ctrl_x_mode_not_default() && at_ctrl_x_key()) - || ((compl_cont_status & CONT_LOCAL) - && (tb_c1 == Ctrl_N || tb_c1 == Ctrl_P)))) { + && !at_ins_compl_key()) { if (tb_c1 == K_SPECIAL) { nolmaplen = 2; } else { |