mirror of
https://github.com/neovim/neovim.git
synced 2025-09-18 09:18:19 +00:00
vim-patch:8.1.2037: can call win_gotoid() in cmdline window (#20015)
Problem: Can call win_gotoid() in cmdline window.
Solution: Disallow switching windows. (Yasuhiro Matsumoto, closes vim/vim#4940)
a046b37c22
This commit is contained in:
@@ -9659,7 +9659,19 @@ static void f_win_gettype(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
|||||||
/// "win_gotoid()" function
|
/// "win_gotoid()" function
|
||||||
static void f_win_gotoid(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
static void f_win_gotoid(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
||||||
{
|
{
|
||||||
rettv->vval.v_number = win_gotoid(argvars);
|
int id = (int)tv_get_number(&argvars[0]);
|
||||||
|
|
||||||
|
if (cmdwin_type != 0) {
|
||||||
|
emsg(_(e_cmdwin));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
FOR_ALL_TAB_WINDOWS(tp, wp) {
|
||||||
|
if (wp->handle == id) {
|
||||||
|
goto_tabpage_win(tp, wp);
|
||||||
|
rettv->vval.v_number = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// "win_id2tabwin()" function
|
/// "win_id2tabwin()" function
|
||||||
|
@@ -1260,6 +1260,16 @@ func Test_cmdline_overstrike()
|
|||||||
let &encoding = encoding_save
|
let &encoding = encoding_save
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_cmdwin_bug()
|
||||||
|
let winid = win_getid()
|
||||||
|
sp
|
||||||
|
try
|
||||||
|
call feedkeys("q::call win_gotoid(" .. winid .. ")\<CR>:q\<CR>", 'x!')
|
||||||
|
catch /^Vim\%((\a\+)\)\=:E11/
|
||||||
|
endtry
|
||||||
|
bw!
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_cmdwin_restore()
|
func Test_cmdwin_restore()
|
||||||
CheckScreendump
|
CheckScreendump
|
||||||
|
|
||||||
|
@@ -7396,19 +7396,6 @@ int win_getid(typval_T *argvars)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int win_gotoid(typval_T *argvars)
|
|
||||||
{
|
|
||||||
int id = (int)tv_get_number(&argvars[0]);
|
|
||||||
|
|
||||||
FOR_ALL_TAB_WINDOWS(tp, wp) {
|
|
||||||
if (wp->handle == id) {
|
|
||||||
goto_tabpage_win(tp, wp);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void win_get_tabwin(handle_T id, int *tabnr, int *winnr)
|
void win_get_tabwin(handle_T id, int *tabnr, int *winnr)
|
||||||
{
|
{
|
||||||
*tabnr = 0;
|
*tabnr = 0;
|
||||||
|
Reference in New Issue
Block a user