Patch 8.2.3254

6 views
Skip to first unread message

Bram Moolenaar

unread,
Jul 31, 2021, 6:44:15 AM7/31/21
to vim...@googlegroups.com

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 -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages