keymap: Preserve S- modifier when C- is present

Closes #12037
This commit is contained in:
James McCoy 2020-07-04 01:10:32 -04:00
parent e76f26d4e7
commit a88bc4d95e
No known key found for this signature in database
GPG Key ID: DFE691AE331BA3DB
2 changed files with 6 additions and 1 deletions

View File

@ -712,7 +712,8 @@ static int extract_modifiers(int key, int *modp)
{
int modifiers = *modp;
if (!(modifiers & MOD_MASK_CMD)) { // Command-key is special
// Command-key and ctrl are special
if (!(modifiers & MOD_MASK_CMD) && !(modifiers & MOD_MASK_CTRL)) {
if ((modifiers & MOD_MASK_SHIFT) && ASCII_ISALPHA(key)) {
key = TOUPPER_ASC(key);
modifiers &= ~MOD_MASK_SHIFT;

View File

@ -23,6 +23,8 @@ describe('mappings', function()
before_each(function()
clear()
cid = nvim('get_api_info')[1]
add_mapping('<C-L>', '<C-L>')
add_mapping('<C-S-L>', '<C-S-L>')
add_mapping('<s-up>', '<s-up>')
add_mapping('<s-up>', '<s-up>')
add_mapping('<c-s-up>', '<c-s-up>')
@ -51,6 +53,8 @@ describe('mappings', function()
end)
it('ok', function()
check_mapping('<C-L>', '<C-L>')
check_mapping('<C-S-L>', '<C-S-L>')
check_mapping('<s-up>', '<s-up>')
check_mapping('<c-s-up>', '<c-s-up>')
check_mapping('<s-c-up>', '<c-s-up>')