diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-09-15 17:26:07 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-09-15 17:26:07 +0200 |
commit | a046b37c22bcabdea5f0fd6d21ca4bd0aa4c768e (patch) | |
tree | 3ec383d5a61f2d46b4a354e9ecbc0aa065663e03 /src/evalwindow.c | |
parent | 1ac90b4fa63414d56750559506a3e076df6923b0 (diff) | |
download | vim-git-a046b37c22bcabdea5f0fd6d21ca4bd0aa4c768e.tar.gz |
patch 8.1.2037: can call win_gotoid() in cmdline windowv8.1.2037
Problem: Can call win_gotoid() in cmdline window.
Solution: Disallow switching windows. (Yasuhiro Matsumoto, closes #4940)
Diffstat (limited to 'src/evalwindow.c')
-rw-r--r-- | src/evalwindow.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/src/evalwindow.c b/src/evalwindow.c index 08bdb9559..6df14c592 100644 --- a/src/evalwindow.c +++ b/src/evalwindow.c @@ -50,22 +50,6 @@ win_getid(typval_T *argvars) return 0; } - static int -win_gotoid(typval_T *argvars) -{ - win_T *wp; - tabpage_T *tp; - int id = tv_get_number(&argvars[0]); - - FOR_ALL_TAB_WINDOWS(tp, wp) - if (wp->w_id == id) - { - goto_tabpage_win(tp, wp); - return 1; - } - return 0; -} - static void win_id2tabwin(typval_T *argvars, list_T *list) { @@ -705,7 +689,24 @@ f_win_getid(typval_T *argvars, typval_T *rettv) void f_win_gotoid(typval_T *argvars, typval_T *rettv) { - rettv->vval.v_number = win_gotoid(argvars); + win_T *wp; + tabpage_T *tp; + int id = tv_get_number(&argvars[0]); + +#ifdef FEAT_CMDWIN + if (cmdwin_type != 0) + { + emsg(_(e_cmdwin)); + return; + } +#endif + FOR_ALL_TAB_WINDOWS(tp, wp) + if (wp->w_id == id) + { + goto_tabpage_win(tp, wp); + rettv->vval.v_number = 1; + return; + } } /* |