Mercurial > vim
changeset 18231:25535ef50842 v8.1.2110
patch 8.1.2110: CTRL-C closes two popups instead of one
Commit: https://github.com/vim/vim/commit/e8a7dfedfc8ea5c376c7912cb27a9405e4b8c972
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Oct 3 22:35:52 2019 +0200
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 03 Oct 2019 22:45:03 +0200 |
parents | 2a3de4cd6acb |
children | 4baa5df0f47e |
files | src/getchar.c src/testdir/test_popupwin.vim src/version.c |
diffstat | 3 files changed, 28 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/getchar.c +++ b/src/getchar.c @@ -1791,7 +1791,11 @@ vgetc(void) #endif #ifdef FEAT_TEXT_PROP if (popup_do_filter(c)) + { + if (c == Ctrl_C) + got_int = FALSE; // avoid looping c = K_IGNORE; + } #endif // Need to process the character before we know it's safe to do something
--- a/src/testdir/test_popupwin.vim +++ b/src/testdir/test_popupwin.vim @@ -2568,4 +2568,26 @@ func Test_popupwin_getoptions_tablocal() quit 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