patch 9.1.1230: inconsistent CTRL-C behaviour for popup windows
Problem: Ctrl-C closes popup windows that have a filter callback,
but does not close popups without a filter callback.
Solution: Modified popup_do_filter() to also close popups without
filter callback when Ctrl-C is pressed (glepnir).
fixes: #16839
closes: #16928
Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim
index e1041ef..5082676 100644
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -3898,6 +3898,24 @@
call assert_equal({}, popup_getpos(win3))
endfunc
+func Test_popupwin_cancel_with_without_filter()
+ let win1 = popup_create('with filter', #{line: 5, filter: {... -> 0}})
+ let win2 = popup_create('no filter', #{line: 10})
+
+ call assert_equal(5, popup_getpos(win1).line)
+ call assert_equal(10, popup_getpos(win2).line)
+
+ call feedkeys("\<C-C>", 'xt')
+ call assert_equal({}, popup_getpos(win1))
+ call assert_equal(10, popup_getpos(win2).line)
+
+ call feedkeys("\<C-C>", 'xt')
+ call assert_equal({}, popup_getpos(win1))
+ call assert_equal({}, popup_getpos(win2))
+
+ call popup_clear()
+endfunc
+
func Test_popupwin_filter_redraw()
" Create two popups with a filter that closes the popup when typing "0".
" Both popups should close, even though the redraw also calls