Patch 7.4.2215
Problem:    It's not easy to find out if a window is a quickfix or location
            list window.
Solution:   Add "loclist" and "quickfix" entries to the dict returnec by
            getwininfo(). (Yegappan Lakshmanan)
Files:      runtime/doc/eval.txt, src/evalfunc.c,
            src/testdir/test_bufwintabinfo.vim


*** ../vim-7.4.2214/runtime/doc/eval.txt        2016-08-13 15:07:38.347640696 
+0200
--- runtime/doc/eval.txt        2016-08-15 22:11:08.156779650 +0200
***************
*** 4540,4553 ****
                pages is returned.
  
                Each List item is a Dictionary with the following entries:
!                       nr              window number.
!                       tpnr            tab page number.
!                       winid           window ID.
!                       height          window height.
!                       width           window width.
!                       bufnum          number of buffer in the window.
!                       options         dictionary of window local options.
!                       variables       dictionary of window local variables.
  
  getwinvar({winnr}, {varname} [, {def}])                               
*getwinvar()*
                Like |gettabwinvar()| for the current tabpage.
--- 4584,4599 ----
                pages is returned.
  
                Each List item is a Dictionary with the following entries:
!                       bufnum          number of buffer in the window
!                       height          window height
!                       loclist         1 if showing a location list
!                       nr              window number
!                       options         dictionary of window local options
!                       quickfix        1 if quickfix or location list window
!                       tpnr            tab page number
!                       variables       dictionary of window local variables
!                       width           window width
!                       winid           window ID
  
  getwinvar({winnr}, {varname} [, {def}])                               
*getwinvar()*
                Like |gettabwinvar()| for the current tabpage.
*** ../vim-7.4.2214/src/evalfunc.c      2016-08-13 15:29:10.447871215 +0200
--- src/evalfunc.c      2016-08-15 21:32:58.310169746 +0200
***************
*** 4027,4033 ****
      }
  
      /* Return information about all the buffers or a specified buffer */
!     for (buf = firstbuf; buf != NULL; buf = buf->b_next)
      {
        if (argbuf != NULL && argbuf != buf)
            continue;
--- 4027,4033 ----
      }
  
      /* Return information about all the buffers or a specified buffer */
!     FOR_ALL_BUFFERS(buf)
      {
        if (argbuf != NULL && argbuf != buf)
            continue;
***************
*** 5030,5036 ****
  #ifdef FEAT_WINDOWS
      tabpage_T *tp, *tparg = NULL;
      dict_T    *d;
!     int               tpnr = 1;
  
      if (rettv_list_alloc(rettv) != OK)
        return;
--- 5030,5036 ----
  #ifdef FEAT_WINDOWS
      tabpage_T *tp, *tparg = NULL;
      dict_T    *d;
!     int               tpnr = 0;
  
      if (rettv_list_alloc(rettv) != OK)
        return;
***************
*** 5044,5051 ****
      }
  
      /* Get information about a specific tab page or all tab pages */
!     for (tp = first_tabpage; tp != NULL; tp = tp->tp_next, tpnr++)
      {
        if (tparg != NULL && tp != tparg)
            continue;
        d = get_tabpage_info(tp, tpnr);
--- 5044,5052 ----
      }
  
      /* Get information about a specific tab page or all tab pages */
!     FOR_ALL_TABPAGES(tp)
      {
+       tpnr++;
        if (tparg != NULL && tp != tparg)
            continue;
        d = get_tabpage_info(tp, tpnr);
***************
*** 5131,5136 ****
--- 5132,5143 ----
      dict_add_nr_str(dict, "width", wp->w_width, NULL);
      dict_add_nr_str(dict, "bufnum", wp->w_buffer->b_fnum, NULL);
  
+ #ifdef FEAT_QUICKFIX
+     dict_add_nr_str(dict, "quickfix", bt_quickfix(wp->w_buffer), NULL);
+     dict_add_nr_str(dict, "loclist",
+           (bt_quickfix(wp->w_buffer) && wp->w_llist_ref != NULL), NULL);
+ #endif
+ 
      /* Copy window variables */
      vars = dict_copy(wp->w_vars, TRUE, 0);
      if (vars != NULL)
***************
*** 5155,5161 ****
      tabpage_T *tp;
      win_T     *wp = NULL, *wparg = NULL;
      dict_T    *d;
!     short     tabnr, winnr;
  #endif
  
      if (rettv_list_alloc(rettv) != OK)
--- 5162,5168 ----
      tabpage_T *tp;
      win_T     *wp = NULL, *wparg = NULL;
      dict_T    *d;
!     short     tabnr = 0, winnr;
  #endif
  
      if (rettv_list_alloc(rettv) != OK)
***************
*** 5172,5184 ****
      /* Collect information about either all the windows across all the tab
       * pages or one particular window.
       */
!     tabnr = 1;
!     for (tp = first_tabpage; tp != NULL; tp = tp->tp_next, tabnr++)
      {
!       wp = (tp == curtab) ? firstwin : tp->tp_firstwin;
!       winnr = 1;
!       for (; wp; wp = wp->w_next, winnr++)
        {
            if (wparg != NULL && wp != wparg)
                continue;
            d = get_win_info(wp, tabnr, winnr);
--- 5179,5191 ----
      /* Collect information about either all the windows across all the tab
       * pages or one particular window.
       */
!     FOR_ALL_TABPAGES(tp)
      {
!       tabnr++;
!       winnr = 0;
!       FOR_ALL_WINDOWS_IN_TAB(tp, wp)
        {
+           winnr++;
            if (wparg != NULL && wp != wparg)
                continue;
            d = get_win_info(wp, tabnr, winnr);
*** ../vim-7.4.2214/src/testdir/test_bufwintabinfo.vim  2016-08-12 
22:22:01.172781914 +0200
--- src/testdir/test_bufwintabinfo.vim  2016-08-15 22:13:29.035474460 +0200
***************
*** 14,19 ****
--- 14,40 ----
      hide enew
      call assert_equal(3, len(getbufinfo({'bufloaded':1})))
  
+     set tabstop&vim
+     let b:editor = 'vim'
+     let l = getbufinfo('%')
+     call assert_equal(bufnr('%'), l[0].nr)
+     call assert_equal(8, l[0].options.tabstop)
+     call assert_equal('vim', l[0].variables.editor)
+     call assert_notequal(-1, index(l[0].windows, bufwinid('%')))
+ 
+     if has('signs')
+       call append(0, ['Linux', 'Windows', 'Mac'])
+       sign define Mark text=>> texthl=Search
+       exe "sign place 2 line=3 name=Mark buffer=" . bufnr('%')
+       let l = getbufinfo('%')
+       call assert_equal(2, l[0].signs[0].id)
+       call assert_equal(3, l[0].signs[0].lnum)
+       call assert_equal('Mark', l[0].signs[0].name)
+       sign unplace *
+       sign undefine Mark
+       enew!
+     endif
+ 
      only
      let w1_id = win_getid()
      new
***************
*** 21,38 ****
--- 42,83 ----
      tabnew | let w3_id = win_getid()
      new | let w4_id = win_getid()
      new | let w5_id = win_getid()
+     call setwinvar(0, 'signal', 'green')
      tabfirst
      let winlist = getwininfo()
      call assert_equal(5, len(winlist))
+     call assert_equal(winbufnr(2), winlist[1].bufnum)
+     call assert_equal(winheight(2), winlist[1].height)
+     call assert_equal(1, winlist[2].nr)
+     call assert_equal('auto', winlist[0].options.signcolumn)
      call assert_equal(2, winlist[3].tpnr)
+     call assert_equal('green', winlist[2].variables.signal)
+     call assert_equal(winwidth(1), winlist[0].width)
+     call assert_equal(w4_id, winlist[3].winid)
      let winfo = getwininfo(w5_id)[0]
      call assert_equal(2, winfo.tpnr)
      call assert_equal([], getwininfo(3))
  
+     call settabvar(1, 'space', 'build')
      let tablist = gettabinfo()
      call assert_equal(2, len(tablist))
      call assert_equal(3, len(tablist[1].windows))
+     call assert_equal(2, tablist[1].nr)
+     call assert_equal('build', tablist[0].variables.space)
+     call assert_equal(w2_id, tablist[0].windows[0])
      call assert_equal([], gettabinfo(3))
  
      tabonly | only
+ 
+     lexpr ''
+     lopen
+     copen
+     let winlist = getwininfo()
+     call assert_false(winlist[0].quickfix)
+     call assert_false(winlist[0].loclist)
+     call assert_true(winlist[1].quickfix)
+     call assert_true(winlist[1].loclist)
+     call assert_true(winlist[2].quickfix)
+     call assert_false(winlist[2].loclist)
+     wincmd t | only
  endfunction
*** ../vim-7.4.2214/src/version.c       2016-08-14 20:27:22.098923658 +0200
--- src/version.c       2016-08-15 21:34:37.505239876 +0200
***************
*** 765,766 ****
--- 765,768 ----
  {   /* Add new patch number below this line */
+ /**/
+     2215,
  /**/

-- 
I have a drinking problem -- I don't have a drink!

 /// 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].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui