From e4fedf5156995defc547d92cfe155febeed89872 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 31 Jul 2021 14:19:13 -0400 Subject: vim-patch:8.2.3254: win_gettype() does not recognize a quickfix window Problem: win_gettype() does not recognize a quickfix window. Solution: Add "quickfix" and "loclist". (Yegappan Lakshmanan, closes vim/vim#8676) https://github.com/vim/vim/commit/28d8421bfb3327d7a5e81369977e8fc108b0229e --- src/nvim/eval/funcs.c | 3 +++ src/nvim/testdir/test_quickfix.vim | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) (limited to 'src') diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index f4735b3751..21c858373c 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -11392,6 +11392,9 @@ static void f_win_gettype(typval_T *argvars, typval_T *rettv, FunPtr fptr) rettv->vval.v_string = vim_strsave((char_u *)"popup"); } else if (wp == curwin && cmdwin_type != 0) { rettv->vval.v_string = vim_strsave((char_u *)"command"); + } else if (bt_quickfix(wp->w_buffer)) { + rettv->vval.v_string = vim_strsave((char_u *)(wp->w_llist_ref != NULL ? + "loclist" : "quickfix")); } } diff --git a/src/nvim/testdir/test_quickfix.vim b/src/nvim/testdir/test_quickfix.vim index 5cfea483e2..5090584e41 100644 --- a/src/nvim/testdir/test_quickfix.vim +++ b/src/nvim/testdir/test_quickfix.vim @@ -5291,4 +5291,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 -- cgit