Patch 8.2.3254
Problem:    win_gettype() does not recognize a quickfix window.
Solution:   Add "quickfix" and "loclist". (Yegappan Lakshmanan, closes #8676)
Files:      runtime/doc/eval.txt, src/evalwindow.c, src/misc2.c,
            src/testdir/test_quickfix.vim


*** ../vim-8.2.3253/runtime/doc/eval.txt        2021-07-28 16:51:49.853364333 
+0200
--- runtime/doc/eval.txt        2021-07-31 12:39:27.357462768 +0200
***************
*** 11581,11590 ****
                Return the type of the window:
                        "autocmd"       autocommand window. Temporary window
                                        used to execute autocommands.
-                       "popup"         popup window |popup|
-                       "preview"       preview window |preview-window|
                        "command"       command-line window |cmdwin|
                        (empty)         normal window
                        "unknown"       window {nr} not found
  
                When {nr} is omitted return the type of the current window.
--- 11678,11689 ----
                Return the type of the window:
                        "autocmd"       autocommand window. Temporary window
                                        used to execute autocommands.
                        "command"       command-line window |cmdwin|
                        (empty)         normal window
+                       "loclist"       |location-list-window|
+                       "popup"         popup window |popup|
+                       "preview"       preview window |preview-window|
+                       "quickfix"      |quickfix-window|
                        "unknown"       window {nr} not found
  
                When {nr} is omitted return the type of the current window.
*** ../vim-8.2.3253/src/evalwindow.c    2021-07-27 22:00:39.741712405 +0200
--- src/evalwindow.c    2021-07-31 12:39:27.357462768 +0200
***************
*** 953,958 ****
--- 953,964 ----
      else if (wp == curwin && cmdwin_type != 0)
        rettv->vval.v_string = vim_strsave((char_u *)"command");
  #endif
+ #ifdef FEAT_QUICKFIX
+     else if (bt_quickfix(wp->w_buffer))
+       rettv->vval.v_string = vim_strsave((char_u *)
+               (wp->w_llist_ref != NULL ? "loclist" : "quickfix"));
+ #endif
+ 
  }
  
  /*
*** ../vim-8.2.3253/src/misc2.c 2021-07-29 20:22:10.734009550 +0200
--- src/misc2.c 2021-07-31 12:39:27.357462768 +0200
***************
*** 1574,1583 ****
  {
      if (s == NULL || *s == NUL)
        return;
!     if (ga_grow(gap, len) == OK)
      {
!       mch_memmove((char *)gap->ga_data + gap->ga_len, s, (size_t)len);
!       gap->ga_len += len;
      }
  }
  
--- 1574,1583 ----
  {
      if (s == NULL || *s == NUL)
        return;
!     if (ga_grow(gap, (int)len) == OK)
      {
!       mch_memmove((char *)gap->ga_data + gap->ga_len, s, len);
!       gap->ga_len += (int)len;
      }
  }
  
*** ../vim-8.2.3253/src/testdir/test_quickfix.vim       2021-07-15 
13:13:35.689833492 +0200
--- src/testdir/test_quickfix.vim       2021-07-31 12:39:27.357462768 +0200
***************
*** 5587,5590 ****
--- 5587,5607 ----
    %bwipe!
  endfunc
  
+ " Test for win_gettype() in quickfix and location list windows
+ func Test_win_gettype()
+   copen
+   call assert_equal("quickfix", win_gettype())
+   let wid = win_getid()
+   wincmd p
+   call assert_equal("quickfix", win_gettype(wid))
+   cclose
+   lexpr ''
+   lopen
+   call assert_equal("loclist", win_gettype())
+   let wid = win_getid()
+   wincmd p
+   call assert_equal("loclist", win_gettype(wid))
+   lclose
+ endfunc
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.3253/src/version.c       2021-07-30 21:56:07.114143129 +0200
--- src/version.c       2021-07-31 12:40:46.305249915 +0200
***************
*** 757,758 ****
--- 757,760 ----
  {   /* Add new patch number below this line */
+ /**/
+     3254,
  /**/

-- 
Facepalm statement #8: "Drive faster, the petrol is running out"

 /// 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/202107311044.16VAi7tj2636886%40masaka.moolenaar.net.

Raspunde prin e-mail lui