Patch 8.1.1626
Problem:    No test for closing a popup window with a modified buffer.
Solution:   Add a test.  Add "popups" to getbufinfo().
Files:      runtime/doc/eval.txt, src/evalfunc.c,
            src/testdir/test_popupwin.vim


*** ../vim-8.1.1625/runtime/doc/eval.txt        2019-06-30 20:21:30.456516156 
+0200
--- runtime/doc/eval.txt        2019-07-04 15:14:08.831355443 +0200
***************
*** 3139,3145 ****
                number.  Otherwise return the buffer number of the newly
                created buffer.  When {name} is an empty string then a new
                buffer is always created.
!               The buffer will not have' 'buflisted' set.
  
  bufexists({expr})                                     *bufexists()*
                The result is a Number, which is |TRUE| if a buffer called
--- 3140,3150 ----
                number.  Otherwise return the buffer number of the newly
                created buffer.  When {name} is an empty string then a new
                buffer is always created.
!               The buffer will not have' 'buflisted' set and not be loaded
!               yet.  To add some text to the buffer use this: >
!                       let bufnr = bufadd('someName')
!                       call bufload(bufnr)
!                       call setbufline(bufnr, 1, ['some', 'text'])
  
  bufexists({expr})                                     *bufexists()*
                The result is a Number, which is |TRUE| if a buffer called
***************
*** 4743,4748 ****
--- 4748,4755 ----
                                        buffer-local variables.
                        windows         list of |window-ID|s that display this
                                        buffer
+                       popups          list of popup |window-ID|s that
+                                       display this buffer
  
                Examples: >
                        for buf in getbufinfo()
*** ../vim-8.1.1625/src/evalfunc.c      2019-07-03 22:53:03.579656609 +0200
--- src/evalfunc.c      2019-07-04 15:21:46.440288094 +0200
***************
*** 4509,4518 ****
      dict_add_number(dict, "hidden",
                            buf->b_ml.ml_mfp != NULL && buf->b_nwindows == 0);
  
!     /* Get a reference to buffer variables */
      dict_add_dict(dict, "variables", buf->b_vars);
  
!     /* List of windows displaying this buffer */
      windows = list_alloc();
      if (windows != NULL)
      {
--- 4509,4518 ----
      dict_add_number(dict, "hidden",
                            buf->b_ml.ml_mfp != NULL && buf->b_nwindows == 0);
  
!     // Get a reference to buffer variables
      dict_add_dict(dict, "variables", buf->b_vars);
  
!     // List of windows displaying this buffer
      windows = list_alloc();
      if (windows != NULL)
      {
***************
*** 4522,4527 ****
--- 4522,4544 ----
        dict_add_list(dict, "windows", windows);
      }
  
+ #ifdef FEAT_TEXT_PROP
+     // List of popup windows displaying this buffer
+     windows = list_alloc();
+     if (windows != NULL)
+     {
+       for (wp = first_popupwin; wp != NULL; wp = wp->w_next)
+           if (wp->w_buffer == buf)
+               list_append_number(windows, (varnumber_T)wp->w_id);
+       FOR_ALL_TABPAGES(tp)
+           for (wp = tp->tp_first_popupwin; wp != NULL; wp = wp->w_next)
+               if (wp->w_buffer == buf)
+                   list_append_number(windows, (varnumber_T)wp->w_id);
+ 
+       dict_add_list(dict, "popups", windows);
+     }
+ #endif
+ 
  #ifdef FEAT_SIGNS
      if (buf->b_signlist != NULL)
      {
***************
*** 5685,5691 ****
      if (l != NULL)
      {
        for (wp = (tp == curtab) ? firstwin : tp->tp_firstwin;
!               wp; wp = wp->w_next)
            list_append_number(l, (varnumber_T)wp->w_id);
        dict_add_list(dict, "windows", l);
      }
--- 5702,5708 ----
      if (l != NULL)
      {
        for (wp = (tp == curtab) ? firstwin : tp->tp_firstwin;
!                                                  wp != NULL; wp = wp->w_next)
            list_append_number(l, (varnumber_T)wp->w_id);
        dict_add_list(dict, "windows", l);
      }
*** ../vim-8.1.1625/src/testdir/test_popupwin.vim       2019-07-03 
23:20:14.821113721 +0200
--- src/testdir/test_popupwin.vim       2019-07-04 15:22:10.092021643 +0200
***************
*** 1710,1712 ****
--- 1710,1739 ----
    endfor
    call popup_clear()
  endfunc
+ 
+ func Test_popupwin_buf_close()
+   let buf = bufadd('Xtestbuf')
+   call bufload(buf)
+   call setbufline(buf, 1, ['just', 'some', 'lines'])
+   let winid = popup_create(buf, {})
+   redraw
+   call assert_equal(3, popup_getpos(winid).height)
+   let bufinfo = getbufinfo(buf)[0]
+   call assert_equal(1, bufinfo.changed)
+   call assert_equal(0, bufinfo.hidden)
+   call assert_equal(0, bufinfo.listed)
+   call assert_equal(1, bufinfo.loaded)
+   call assert_equal([], bufinfo.windows)
+   call assert_equal([winid], bufinfo.popups)
+ 
+   call popup_close(winid)
+   call assert_equal({}, popup_getpos(winid))
+   let bufinfo = getbufinfo(buf)[0]
+   call assert_equal(1, bufinfo.changed)
+   call assert_equal(1, bufinfo.hidden)
+   call assert_equal(0, bufinfo.listed)
+   call assert_equal(1, bufinfo.loaded)
+   call assert_equal([], bufinfo.windows)
+   call assert_equal([], bufinfo.popups)
+   exe 'bwipe! ' .. buf
+ endfunc
*** ../vim-8.1.1625/src/version.c       2019-07-04 14:57:09.592696683 +0200
--- src/version.c       2019-07-04 15:22:45.475632943 +0200
***************
*** 779,780 ****
--- 779,782 ----
  {   /* Add new patch number below this line */
+ /**/
+     1626,
  /**/

-- 
Not too long ago, a program was something you watched on TV...

 /// 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/201907041339.x64DdkSS016244%40masaka.moolenaar.net.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui