mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.1015: popup filter gets key with modifier prepended
Problem: Popup filter gets key with modifier prepended when using modifyOtherKeys. Solution: Remove the shift modifier when it is included in the key, also when the Alt or Meta modifier is used.
This commit is contained in:
parent
1e0b7b11db
commit
20298ce679
@ -2929,9 +2929,11 @@ extract_modifiers(int key, int *modp, int simplify, int *did_simplify)
|
|||||||
if ((modifiers & MOD_MASK_SHIFT) && ASCII_ISALPHA(key))
|
if ((modifiers & MOD_MASK_SHIFT) && ASCII_ISALPHA(key))
|
||||||
{
|
{
|
||||||
key = TOUPPER_ASC(key);
|
key = TOUPPER_ASC(key);
|
||||||
// With <C-S-a> and <A-S-a> we keep the shift modifier.
|
// With <C-S-a> we keep the shift modifier.
|
||||||
// With <S-a> and <S-A> we don't keep the shift modifier.
|
// With <S-a>, <A-S-a> and <S-A> we don't keep the shift modifier.
|
||||||
if (simplify || modifiers == MOD_MASK_SHIFT)
|
if (simplify || modifiers == MOD_MASK_SHIFT
|
||||||
|
|| modifiers == (MOD_MASK_SHIFT | MOD_MASK_ALT)
|
||||||
|
|| modifiers == (MOD_MASK_SHIFT | MOD_MASK_META))
|
||||||
modifiers &= ~MOD_MASK_SHIFT;
|
modifiers &= ~MOD_MASK_SHIFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4772,11 +4772,14 @@ handle_key_with_modifier(
|
|||||||
// Some keys already have Shift included, pass them as
|
// Some keys already have Shift included, pass them as
|
||||||
// normal keys. Not when Ctrl is also used, because <C-H>
|
// normal keys. Not when Ctrl is also used, because <C-H>
|
||||||
// and <C-S-H> are different.
|
// and <C-S-H> are different.
|
||||||
if (modifiers == MOD_MASK_SHIFT
|
// Also for <A-S-a> and <M-S-a>.
|
||||||
|
if ((modifiers == MOD_MASK_SHIFT
|
||||||
|
|| modifiers == (MOD_MASK_SHIFT | MOD_MASK_ALT)
|
||||||
|
|| modifiers == (MOD_MASK_SHIFT | MOD_MASK_META))
|
||||||
&& ((key >= '@' && key <= 'Z')
|
&& ((key >= '@' && key <= 'Z')
|
||||||
|| key == '^' || key == '_'
|
|| key == '^' || key == '_'
|
||||||
|| (key >= '{' && key <= '~')))
|
|| (key >= '{' && key <= '~')))
|
||||||
modifiers = 0;
|
modifiers &= ~MOD_MASK_SHIFT;
|
||||||
|
|
||||||
// When used with Ctrl we always make a letter upper case,
|
// When used with Ctrl we always make a letter upper case,
|
||||||
// so that mapping <C-H> and <C-h> are the same. Typing
|
// so that mapping <C-H> and <C-h> are the same. Typing
|
||||||
|
@ -2079,9 +2079,9 @@ func Test_popup_scrollbar()
|
|||||||
" check size with wrapping lines
|
" check size with wrapping lines
|
||||||
call term_sendkeys(buf, "j")
|
call term_sendkeys(buf, "j")
|
||||||
call VerifyScreenDump(buf, 'Test_popupwin_scroll_12', {})
|
call VerifyScreenDump(buf, 'Test_popupwin_scroll_12', {})
|
||||||
call term_sendkeys(buf, "x")
|
|
||||||
|
|
||||||
" clean up
|
" clean up
|
||||||
|
call term_sendkeys(buf, "x")
|
||||||
call StopVimInTerminal(buf)
|
call StopVimInTerminal(buf)
|
||||||
call delete('XtestPopupScroll')
|
call delete('XtestPopupScroll')
|
||||||
endfunc
|
endfunc
|
||||||
@ -3347,6 +3347,12 @@ func Test_popupwin_filter_input_multibyte()
|
|||||||
call feedkeys("\u301b", 'xt')
|
call feedkeys("\u301b", 'xt')
|
||||||
call assert_equal([0xe3, 0x80, 0x9b], g:bytes)
|
call assert_equal([0xe3, 0x80, 0x9b], g:bytes)
|
||||||
|
|
||||||
|
if has('unix')
|
||||||
|
" with modifyOtherKeys <M-S-a> does not include a modifier sequence
|
||||||
|
call feedkeys("\<Esc>[27;4;65~", 'Lx!')
|
||||||
|
call assert_equal([0xc3, 0x81], g:bytes)
|
||||||
|
endif
|
||||||
|
|
||||||
call popup_clear()
|
call popup_clear()
|
||||||
delfunc MyPopupFilter
|
delfunc MyPopupFilter
|
||||||
unlet g:bytes
|
unlet g:bytes
|
||||||
|
@ -754,6 +754,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1015,
|
||||||
/**/
|
/**/
|
||||||
1014,
|
1014,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user