Patch 8.1.2110
Problem:    CTRL-C closes two popups instead of one.
Solution:   Reset got_int when the filter consumed the key.
Files:      src/getchar.c, src/testdir/test_popupwin.vim


*** ../vim-8.1.2109/src/getchar.c       2019-09-28 15:23:57.033274535 +0200
--- src/getchar.c       2019-10-03 22:33:45.432933921 +0200
***************
*** 1791,1797 ****
--- 1791,1801 ----
  #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
*** ../vim-8.1.2109/src/testdir/test_popupwin.vim       2019-10-02 
23:06:41.557528631 +0200
--- src/testdir/test_popupwin.vim       2019-10-03 22:34:08.304873852 +0200
***************
*** 2568,2571 ****
--- 2568,2593 ----
    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
*** ../vim-8.1.2109/src/version.c       2019-10-02 23:06:41.557528631 +0200
--- src/version.c       2019-10-03 22:34:35.064800781 +0200
***************
*** 755,756 ****
--- 755,758 ----
  {   /* Add new patch number below this line */
+ /**/
+     2110,
  /**/

-- 
ARTHUR: Listen, old crone!  Unless you tell us where we can buy a shrubbery,
        my friend and I will ... we will say "Ni!"
CRONE:  Do your worst!
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/201910032036.x93Kaglm027277%40masaka.moolenaar.net.

Raspunde prin e-mail lui