0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.1.2110: CTRL-C closes two popups instead of one

Problem:    CTRL-C closes two popups instead of one.
Solution:   Reset got_int when the filter consumed the key.
This commit is contained in:
Bram Moolenaar
2019-10-03 22:35:52 +02:00
parent 1824f45883
commit e8a7dfedfc
3 changed files with 28 additions and 0 deletions

View File

@@ -1791,7 +1791,11 @@ vgetc(void)
#endif #endif
#ifdef FEAT_TEXT_PROP #ifdef FEAT_TEXT_PROP
if (popup_do_filter(c)) if (popup_do_filter(c))
{
if (c == Ctrl_C)
got_int = FALSE; // avoid looping
c = K_IGNORE; c = K_IGNORE;
}
#endif #endif
// Need to process the character before we know it's safe to do something // Need to process the character before we know it's safe to do something

View File

@@ -2568,4 +2568,26 @@ func Test_popupwin_getoptions_tablocal()
quit quit
endfunc endfunc
func Test_popupwin_cancel()
let win1 = popup_create('one', #{line: 5, filter: {... -> 0}})
let win2 = popup_create('two', #{line: 10, filter: {... -> 0}})
let win3 = popup_create('three', #{line: 15, filter: {... -> 0}})
call assert_equal(5, popup_getpos(win1).line)
call assert_equal(10, popup_getpos(win2).line)
call assert_equal(15, popup_getpos(win3).line)
" TODO: this also works without patch 8.1.2110
call feedkeys("\<C-C>", 'xt')
call assert_equal(5, popup_getpos(win1).line)
call assert_equal(10, popup_getpos(win2).line)
call assert_equal({}, popup_getpos(win3))
call feedkeys("\<C-C>", 'xt')
call assert_equal(5, popup_getpos(win1).line)
call assert_equal({}, popup_getpos(win2))
call assert_equal({}, popup_getpos(win3))
call feedkeys("\<C-C>", 'xt')
call assert_equal({}, popup_getpos(win1))
call assert_equal({}, popup_getpos(win2))
call assert_equal({}, popup_getpos(win3))
endfunc
" vim: shiftwidth=2 sts=2 " vim: shiftwidth=2 sts=2

View File

@@ -753,6 +753,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 */
/**/
2110,
/**/ /**/
2109, 2109,
/**/ /**/