Mercurial > vim
changeset 18683:5ed740336224 v8.1.2333
patch 8.1.2333: with modifyOtherKeys CTRL-^ doesn't work
Commit: https://github.com/vim/vim/commit/828ffd596394f714270a01a55fc3f949a8bd9b35
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Nov 21 23:24:00 2019 +0100
patch 8.1.2333: with modifyOtherKeys CTRL-^ doesn't work
Problem: With modifyOtherKeys CTRL-^ doesn't work.
Solution: Handle the exception.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 21 Nov 2019 23:30:03 +0100 |
parents | 2317cf0b268f |
children | 713c3edb1147 |
files | src/getchar.c src/testdir/test_termcodes.vim src/version.c |
diffstat | 3 files changed, 22 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/getchar.c +++ b/src/getchar.c @@ -1768,12 +1768,19 @@ vgetc(void) { // A modifier was not used for a mapping, apply it to ASCII // keys. Shift would already have been applied. - if ((mod_mask & MOD_MASK_CTRL) - && ((c >= '`' && c <= 0x7f) - || (c >= '@' && c <= '_'))) + if (mod_mask & MOD_MASK_CTRL) { - c &= 0x1f; - mod_mask &= ~MOD_MASK_CTRL; + if ((c >= '`' && c <= 0x7f) || (c >= '@' && c <= '_')) + { + c &= 0x1f; + mod_mask &= ~MOD_MASK_CTRL; + } + else if (c == '6') + { + // CTRL-6 is equivalent to CTRL-^ + c = 0x1e; + mod_mask &= ~MOD_MASK_CTRL; + } } if ((mod_mask & (MOD_MASK_META | MOD_MASK_ALT)) && c >= 0 && c <= 127)
--- a/src/testdir/test_termcodes.vim +++ b/src/testdir/test_termcodes.vim @@ -1192,6 +1192,14 @@ func RunTest_modifyOtherKeys(func) call feedkeys('a' .. a:func('X', 9) .. "\<Esc>", 'Lx!') call assert_equal("Ø", getline(1)) + " Ctrl-6 is Ctrl-^ + split aaa + edit bbb + call feedkeys(a:func('6', 5), 'Lx!') + call assert_equal("aaa", bufname()) + bwipe aaa + bwipe bbb + bwipe! set timeoutlen& endfunc