Patch 8.2.4913
Problem:    Popup_hide() does not always have effect.
Solution:   Add the POPF_HIDDEN_FORCE flag. (closes #10376)
Files:      src/popupwin.c, src/vim.h, src/testdir/test_popupwin.vim,
            src/testdir/dumps/Test_popup_prop_not_visible_01a.dump,
            src/testdir/dumps/Test_popup_prop_not_visible_01b.dump


*** ../vim-8.2.4912/src/popupwin.c      2022-04-20 19:47:31.699946601 +0100
--- src/popupwin.c      2022-05-08 14:50:17.036198645 +0100
***************
*** 978,984 ****
  
      nr = dict_get_bool(dict, (char_u *)"hidden", FALSE);
      if (nr > 0)
!       wp->w_popup_flags |= POPF_HIDDEN;
  
      // when "firstline" and "cursorline" are both set and the cursor would be
      // above or below the displayed lines, move the cursor to "firstline".
--- 978,984 ----
  
      nr = dict_get_bool(dict, (char_u *)"hidden", FALSE);
      if (nr > 0)
!       wp->w_popup_flags |= POPF_HIDDEN | POPF_HIDDEN_FORCE;
  
      // when "firstline" and "cursorline" are both set and the cursor would be
      // above or below the displayed lines, move the cursor to "firstline".
***************
*** 2644,2650 ****
--- 2644,2653 ----
      id = (int)tv_get_number(argvars);
      wp = find_popup_win(id);
      if (wp != NULL)
+     {
        popup_hide(wp);
+       wp->w_popup_flags |= POPF_HIDDEN_FORCE;
+     }
  }
  
      void
***************
*** 2674,2679 ****
--- 2677,2683 ----
      wp = find_popup_win(id);
      if (wp != NULL)
      {
+       wp->w_popup_flags &= ~POPF_HIDDEN_FORCE;
        popup_show(wp);
  #ifdef FEAT_QUICKFIX
        if (wp->w_popup_flags & POPF_INFO)
***************
*** 3606,3613 ****
        textprop_T  prop;
        linenr_T    lnum;
  
!       if (find_visible_prop(wp->w_popup_prop_win,
!                   wp->w_popup_prop_type, wp->w_popup_prop_id,
                                                           &prop, &lnum) == OK)
        {
            wp->w_popup_flags &= ~POPF_HIDDEN;
--- 3610,3618 ----
        textprop_T  prop;
        linenr_T    lnum;
  
!       if ((wp->w_popup_flags & POPF_HIDDEN_FORCE) == 0
!               && find_visible_prop(wp->w_popup_prop_win,
!                                   wp->w_popup_prop_type, wp->w_popup_prop_id,
                                                           &prop, &lnum) == OK)
        {
            wp->w_popup_flags &= ~POPF_HIDDEN;
*** ../vim-8.2.4912/src/vim.h   2022-05-07 20:01:10.050731702 +0100
--- src/vim.h   2022-05-08 14:44:53.656300627 +0100
***************
*** 631,645 ****
  // Values for w_popup_flags.
  #define POPF_IS_POPUP 0x01    // this is a popup window
  #define POPF_HIDDEN   0x02    // popup is not displayed
! #define POPF_CURSORLINE       0x04    // popup is highlighting at the 
cursorline
! #define POPF_ON_CMDLINE       0x08    // popup overlaps command line
! #define POPF_DRAG     0x10    // popup can be moved by dragging border
! #define POPF_DRAGALL  0x20    // popup can be moved by dragging everywhere
! #define POPF_RESIZE   0x40    // popup can be resized by dragging
! #define POPF_MAPPING  0x80    // mapping keys
! #define POPF_INFO     0x100   // used for info of popup menu
! #define POPF_INFO_MENU        0x200   // align info popup with popup menu
! #define POPF_POSINVERT        0x400   // vertical position can be inverted
  
  // flags used in w_popup_handled
  #define POPUP_HANDLED_1           0x01    // used by mouse_find_win()
--- 631,646 ----
  // Values for w_popup_flags.
  #define POPF_IS_POPUP 0x01    // this is a popup window
  #define POPF_HIDDEN   0x02    // popup is not displayed
! #define POPF_HIDDEN_FORCE 0x04        // popup is explicitly set to not be 
displayed
! #define POPF_CURSORLINE       0x08    // popup is highlighting at the 
cursorline
! #define POPF_ON_CMDLINE       0x10    // popup overlaps command line
! #define POPF_DRAG     0x20    // popup can be moved by dragging border
! #define POPF_DRAGALL  0x40    // popup can be moved by dragging everywhere
! #define POPF_RESIZE   0x80    // popup can be resized by dragging
! #define POPF_MAPPING  0x100   // mapping keys
! #define POPF_INFO     0x200   // used for info of popup menu
! #define POPF_INFO_MENU        0x400   // align info popup with popup menu
! #define POPF_POSINVERT        0x800   // vertical position can be inverted
  
  // flags used in w_popup_handled
  #define POPUP_HANDLED_1           0x01    // used by mouse_find_win()
*** ../vim-8.2.4912/src/testdir/test_popupwin.vim       2022-04-20 
19:47:31.699946601 +0100
--- src/testdir/test_popupwin.vim       2022-05-08 14:56:54.260040971 +0100
***************
*** 4055,4061 ****
        setline(1, ['', 'some text', '', 'other text'])
        prop_type_add('someprop', {})
        prop_add(2, 9, {type: 'someprop', length: 5})
!       popup_create('attached to "some"', {
            textprop: 'someprop',
            highlight: 'ErrorMsg',
            line: -1,
--- 4055,4061 ----
        setline(1, ['', 'some text', '', 'other text'])
        prop_type_add('someprop', {})
        prop_add(2, 9, {type: 'someprop', length: 5})
!       g:some_id = popup_create('attached to "some"', {
            textprop: 'someprop',
            highlight: 'ErrorMsg',
            line: -1,
***************
*** 4076,4081 ****
--- 4076,4087 ----
    let buf = RunVimInTerminal('-S XtestPropNotVisble', #{rows: 10})
    call VerifyScreenDump(buf, 'Test_popup_prop_not_visible_01', {})
  
+   " check that hiding and unhiding the popup works
+   call term_sendkeys(buf, ":call popup_hide(g:some_id)\<CR>")
+   call VerifyScreenDump(buf, 'Test_popup_prop_not_visible_01a', {})
+   call term_sendkeys(buf, ":call popup_show(g:some_id)\<CR>")
+   call VerifyScreenDump(buf, 'Test_popup_prop_not_visible_01b', {})
+ 
    call term_sendkeys(buf, ":vert resize -14\<CR>")
    call VerifyScreenDump(buf, 'Test_popup_prop_not_visible_02', {})
  
*** ../vim-8.2.4912/src/testdir/dumps/Test_popup_prop_not_visible_01a.dump      
2022-05-08 14:59:15.095980228 +0100
--- src/testdir/dumps/Test_popup_prop_not_visible_01a.dump      2022-05-08 
14:57:51.724016410 +0100
***************
*** 0 ****
--- 1,10 ----
+ | +2&#ffffff0|2+2#e000e06&|++2#0000000&| |[|N|o| |N|a|m|e|]| | +1&&@60
+ | +0&&@42||+1&&> +0&&@30
+ |~+0#4040ff13&| @41||+1#0000000&|s+0&&|o|m|e| |t|e|x|t| @21
+ |~+0#4040ff13&| @41||+1#0000000&| +0&&@30
+ |~+0#4040ff13&| @41||+1#0000000&|o+0&&|t|h|e|r| 
|t|e|x|t|a+0#ffffff16#e000002|t@1|a|c|h|e|d| |t|o| |"|o|t|h|e|r|"| 
+0#0000000#ffffff0@1
+ |~+0#4040ff13&| @41||+1#0000000&|~+0#4040ff13&| @29
+ |~| @41||+1#0000000&|~+0#4040ff13&| @29
+ |~| @41||+1#0000000&|~+0#4040ff13&| @29
+ |[+1#0000000&|N|o| |N|a|m|e|]| @15|0|,|0|-|1| @9|A|l@1| |[+3&&|N|o| 
|N|a|m|e|]| |[|+|]| @2|1|,|0|-|1| @6|A|l@1
+ |:+0&&|c|a|l@1| |p|o|p|u|p|_|h|i|d|e|(|g|:|s|o|m|e|_|i|d|)| @47
*** ../vim-8.2.4912/src/testdir/dumps/Test_popup_prop_not_visible_01b.dump      
2022-05-08 14:59:15.099980226 +0100
--- src/testdir/dumps/Test_popup_prop_not_visible_01b.dump      2022-05-08 
14:57:52.880015915 +0100
***************
*** 0 ****
--- 1,10 ----
+ | +2&#ffffff0|2+2#e000e06&|++2#0000000&| |[|N|o| |N|a|m|e|]| | +1&&@60
+ | +0&&@42||+1&&> +0&&@30
+ |~+0#4040ff13&| @41||+1#0000000&|s+0&&|o|m|e| 
|t|e|x|t|a+0#ffffff16#e000002|t@1|a|c|h|e|d| |t|o| |"|s|o|m|e|"| 
+0#0000000#ffffff0@3
+ |~+0#4040ff13&| @41||+1#0000000&| +0&&@30
+ |~+0#4040ff13&| @41||+1#0000000&|o+0&&|t|h|e|r| 
|t|e|x|t|a+0#ffffff16#e000002|t@1|a|c|h|e|d| |t|o| |"|o|t|h|e|r|"| 
+0#0000000#ffffff0@1
+ |~+0#4040ff13&| @41||+1#0000000&|~+0#4040ff13&| @29
+ |~| @41||+1#0000000&|~+0#4040ff13&| @29
+ |~| @41||+1#0000000&|~+0#4040ff13&| @29
+ |[+1#0000000&|N|o| |N|a|m|e|]| @15|0|,|0|-|1| @9|A|l@1| |[+3&&|N|o| 
|N|a|m|e|]| |[|+|]| @2|1|,|0|-|1| @6|A|l@1
+ |:+0&&|c|a|l@1| |p|o|p|u|p|_|s|h|o|w|(|g|:|s|o|m|e|_|i|d|)| @47
*** ../vim-8.2.4912/src/version.c       2022-05-07 21:14:01.642973330 +0100
--- src/version.c       2022-05-08 14:06:33.740739684 +0100
***************
*** 748,749 ****
--- 748,751 ----
  {   /* Add new patch number below this line */
+ /**/
+     4913,
  /**/

-- 
"The sun oozed over the horizon, shoved aside darkness, crept along the
greensward, and, with sickly fingers, pushed through the castle window,
revealing the pillaged princess, hand at throat, crown asunder, gaping
in frenzied horror at the sated, sodden amphibian lying beside her,
disbelieving the magnitude of the frog's deception, screaming madly,
"You lied!"
    - Winner of the Bulwer-Lytton contest (San Jose State University),
      wherein one writes only the first line of a bad novel

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            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/20220508140043.62E921C0550%40moolenaar.net.

Raspunde prin e-mail lui