Mercurial > vim
comparison src/evalwindow.c @ 18084:f4b51934d4f8 v8.1.2037
patch 8.1.2037: can call win_gotoid() in cmdline window
Commit: https://github.com/vim/vim/commit/a046b37c22bcabdea5f0fd6d21ca4bd0aa4c768e
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Sep 15 17:26:07 2019 +0200
patch 8.1.2037: can call win_gotoid() in cmdline window
Problem: Can call win_gotoid() in cmdline window.
Solution: Disallow switching windows. (Yasuhiro Matsumoto, closes https://github.com/vim/vim/issues/4940)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 15 Sep 2019 17:30:06 +0200 |
parents | a9f1656f13c9 |
children | f254dd2bc107 |
comparison
equal
deleted
inserted
replaced
18083:940067fc8f0c | 18084:f4b51934d4f8 |
---|---|
45 } | 45 } |
46 for ( ; wp != NULL; wp = wp->w_next) | 46 for ( ; wp != NULL; wp = wp->w_next) |
47 if (--winnr == 0) | 47 if (--winnr == 0) |
48 return wp->w_id; | 48 return wp->w_id; |
49 } | 49 } |
50 return 0; | |
51 } | |
52 | |
53 static int | |
54 win_gotoid(typval_T *argvars) | |
55 { | |
56 win_T *wp; | |
57 tabpage_T *tp; | |
58 int id = tv_get_number(&argvars[0]); | |
59 | |
60 FOR_ALL_TAB_WINDOWS(tp, wp) | |
61 if (wp->w_id == id) | |
62 { | |
63 goto_tabpage_win(tp, wp); | |
64 return 1; | |
65 } | |
66 return 0; | 50 return 0; |
67 } | 51 } |
68 | 52 |
69 static void | 53 static void |
70 win_id2tabwin(typval_T *argvars, list_T *list) | 54 win_id2tabwin(typval_T *argvars, list_T *list) |
703 * "win_gotoid()" function | 687 * "win_gotoid()" function |
704 */ | 688 */ |
705 void | 689 void |
706 f_win_gotoid(typval_T *argvars, typval_T *rettv) | 690 f_win_gotoid(typval_T *argvars, typval_T *rettv) |
707 { | 691 { |
708 rettv->vval.v_number = win_gotoid(argvars); | 692 win_T *wp; |
693 tabpage_T *tp; | |
694 int id = tv_get_number(&argvars[0]); | |
695 | |
696 #ifdef FEAT_CMDWIN | |
697 if (cmdwin_type != 0) | |
698 { | |
699 emsg(_(e_cmdwin)); | |
700 return; | |
701 } | |
702 #endif | |
703 FOR_ALL_TAB_WINDOWS(tp, wp) | |
704 if (wp->w_id == id) | |
705 { | |
706 goto_tabpage_win(tp, wp); | |
707 rettv->vval.v_number = 1; | |
708 return; | |
709 } | |
709 } | 710 } |
710 | 711 |
711 /* | 712 /* |
712 * "win_id2tabwin()" function | 713 * "win_id2tabwin()" function |
713 */ | 714 */ |