if (modifiers != 0)
{
// Some keys have the modifier included. Need to handle that here to
- // make mappings work.
+ // make mappings work. This may result in a special key, such as
+ // K_S_TAB.
*key = simplify_key(*key, &modifiers);
if (modifiers != 0)
{
// insert modifiers with KS_MODIFIER
new_slen = modifiers2keycode(modifiers, &key, string);
- if (has_mbyte)
+ if (IS_SPECIAL(key))
+ {
+ string[new_slen++] = K_SPECIAL;
+ string[new_slen++] = KEY2TERMCAP0(key);
+ string[new_slen++] = KEY2TERMCAP1(key);
+ }
+ else if (has_mbyte)
new_slen += (*mb_char2bytes)(key, string + new_slen);
else
string[new_slen++] = key;
set timeoutlen&
endfunc
+" Whether Shift-Tab sends "ESC [ Z" or "ESC [ 27 ; 2 ; 9 ~" is unpredictable,
+" both should work.
+func Test_modifyOtherKeys_shift_tab()
+ set timeoutlen=10
+
+ call setline(1, '')
+ call feedkeys("a\<C-K>" .. GetEscCodeCSI27("\t", '2') .. "\<Esc>", 'Lx!')
+ eval getline(1)->assert_equal('<S-Tab>')
+
+ call setline(1, '')
+ call feedkeys("a\<C-K>\<Esc>[Z\<Esc>", 'Lx!')
+ eval getline(1)->assert_equal('<S-Tab>')
+
+ set timeoutlen&
+ bwipe!
+endfunc
+
func RunTest_mapping_works_with_shift(func)
new
set timeoutlen=10