]> granicus.if.org Git - vim/commitdiff
patch 8.2.3254: win_gettype() does not recognize a quickfix window v8.2.3254
authorYegappan Lakshmanan <yegappan@yahoo.com>
Sat, 31 Jul 2021 10:43:23 +0000 (12:43 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 31 Jul 2021 10:43:23 +0000 (12:43 +0200)
Problem:    win_gettype() does not recognize a quickfix window.
Solution:   Add "quickfix" and "loclist". (Yegappan Lakshmanan, closes #8676)

runtime/doc/eval.txt
src/evalwindow.c
src/misc2.c
src/testdir/test_quickfix.vim
src/version.c

index 5054904db0f970278691f7f15b161a7afcdb9e9a..5f047e6bdbcce4136b96bf574d132fa75924ff13 100644 (file)
@@ -11661,10 +11661,12 @@ win_gettype([{nr}])                                   *win_gettype()*
                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
+                       "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.
index 737ca7dbd03feeb04723b812492c12d4422b5529..f043c6f4d796a7f19a46ae3a280eadefd7f96ebc 100644 (file)
@@ -953,6 +953,12 @@ f_win_gettype(typval_T *argvars, typval_T *rettv)
     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
+
 }
 
 /*
index bbf55bb00cc8975687f6f26fba5f43c3a4c2f965..2e83d2dd171aac243e37996695233ba8bf38f351 100644 (file)
@@ -1574,10 +1574,10 @@ ga_concat_len(garray_T *gap, char_u *s, size_t len)
 {
     if (s == NULL || *s == NUL)
        return;
-    if (ga_grow(gap, len) == OK)
+    if (ga_grow(gap, (int)len) == OK)
     {
-       mch_memmove((char *)gap->ga_data + gap->ga_len, s, (size_t)len);
-       gap->ga_len += len;
+       mch_memmove((char *)gap->ga_data + gap->ga_len, s, len);
+       gap->ga_len += (int)len;
     }
 }
 
index e5a6d6cdbc384e89a467cf7f7f2bcbce18d95b8a..e22f6b28d9f4af0d0defcc17c53703ef9e4cc813 100644 (file)
@@ -5587,4 +5587,21 @@ func Test_locationlist_open_in_newtab()
   %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
index b01127c34efcd3fca347779655197bbc41ad9e90..c901996df642ee40ccf4057299ec117c196c7556 100644 (file)
@@ -755,6 +755,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3254,
 /**/
     3253,
 /**/