Mercurial > vim
changeset 27954:3de9be15de51 v8.2.4502
patch 8.2.4502: in the GUI a modifier is not recognized after CTRL-X
Commit: https://github.com/vim/vim/commit/d979d64fa269ff47a96fc6aed2f4cdd066753c0c
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Mar 4 14:51:06 2022 +0000
patch 8.2.4502: in the GUI a modifier is not recognized after CTRL-X
Problem: In the GUI a modifier is not recognized for the key typed after
CTRL-X, which may result in a mapping to be used. (Daniel
Steinberg)
Solution: Recognize a modifier starting with CSI. (closes #9889)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 04 Mar 2022 16:00:04 +0100 |
parents | 2f9beb57e75f |
children | e88daba055ac |
files | src/getchar.c src/testdir/test_ins_complete.vim src/version.c |
diffstat | 3 files changed, 15 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/getchar.c +++ b/src/getchar.c @@ -2331,7 +2331,7 @@ at_ctrl_x_key(void) int c = *p; if (typebuf.tb_len > 3 - && c == K_SPECIAL + && (c == K_SPECIAL || c == CSI) // CSI is used by the GUI && p[1] == KS_MODIFIER && (p[2] & MOD_MASK_CTRL)) c = p[3] & 0x1f;
--- a/src/testdir/test_ins_complete.vim +++ b/src/testdir/test_ins_complete.vim @@ -1294,7 +1294,18 @@ func Test_z1_complete_no_history() exe "normal owh\<C-X>\<C-K>" exe "normal owh\<C-N>" call assert_equal(currmess, execute('messages')) - close! + bwipe! +endfunc + +" A mapping is not used for the key after CTRL-X. +func Test_no_mapping_for_ctrl_x_key() + new + inoremap <C-K> <Cmd>let was_mapped = 'yes'<CR> + setlocal dictionary=README.txt + call feedkeys("aexam\<C-X>\<C-K> ", 'xt') + call assert_equal('example ', getline(1)) + call assert_false(exists('was_mapped')) + bwipe! endfunc " Test for different ways of setting the 'completefunc' option