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)
28d8421bfb
This commit is contained in:
parent
8738ce8c41
commit
e4fedf5156
|
@ -9323,10 +9323,12 @@ win_gettype([{nr}]) *win_gettype()*
|
||||||
Return the type of the window:
|
Return the type of the window:
|
||||||
"autocmd" autocommand window. Temporary window
|
"autocmd" autocommand window. Temporary window
|
||||||
used to execute autocommands.
|
used to execute autocommands.
|
||||||
"popup" popup window |popup|
|
|
||||||
"preview" preview window |preview-window|
|
|
||||||
"command" command-line window |cmdwin|
|
"command" command-line window |cmdwin|
|
||||||
(empty) normal window
|
(empty) normal window
|
||||||
|
"loclist" |location-list-window|
|
||||||
|
"popup" popup window |popup|
|
||||||
|
"preview" preview window |preview-window|
|
||||||
|
"quickfix" |quickfix-window|
|
||||||
"unknown" window {nr} not found
|
"unknown" window {nr} not found
|
||||||
|
|
||||||
When {nr} is omitted return the type of the current window.
|
When {nr} is omitted return the type of the current window.
|
||||||
|
|
|
@ -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");
|
rettv->vval.v_string = vim_strsave((char_u *)"popup");
|
||||||
} else if (wp == curwin && cmdwin_type != 0) {
|
} else if (wp == curwin && cmdwin_type != 0) {
|
||||||
rettv->vval.v_string = vim_strsave((char_u *)"command");
|
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"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5291,4 +5291,21 @@ func Test_locationlist_open_in_newtab()
|
||||||
%bwipe!
|
%bwipe!
|
||||||
endfunc
|
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: shiftwidth=2 sts=2 expandtab
|
||||||
|
|
Loading…
Reference in New Issue