Mercurial > vim
annotate src/evalwindow.c @ 23694:7d29116429d0
Added tag v8.2.2388 for changeset cd06cc37f53f615b38724878f8a269424d30e8d8
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 21 Jan 2021 21:45:05 +0100 |
parents | 9fa72351c18f |
children | 3c165c7432ff |
rev | line source |
---|---|
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1 /* vi:set ts=8 sts=4 sw=4 noet: |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2 * |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3 * VIM - Vi IMproved by Bram Moolenaar |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4 * |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
5 * Do ":help uganda" in Vim to read copying and usage conditions. |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
6 * Do ":help credits" in Vim to see a list of people who contributed. |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
7 * See README.txt for an overview of the Vim source code. |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
8 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
9 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
10 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
11 * evalwindow.c: Window related builtin functions |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
12 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
13 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
14 #include "vim.h" |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
15 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
16 #if defined(FEAT_EVAL) || defined(PROTO) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
17 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
18 static int |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
19 win_getid(typval_T *argvars) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
20 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
21 int winnr; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
22 win_T *wp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
23 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
24 if (argvars[0].v_type == VAR_UNKNOWN) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
25 return curwin->w_id; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
26 winnr = tv_get_number(&argvars[0]); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
27 if (winnr > 0) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
28 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
29 if (argvars[1].v_type == VAR_UNKNOWN) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
30 wp = firstwin; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
31 else |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
32 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
33 tabpage_T *tp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
34 int tabnr = tv_get_number(&argvars[1]); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
35 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
36 FOR_ALL_TABPAGES(tp) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
37 if (--tabnr == 0) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
38 break; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
39 if (tp == NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
40 return -1; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
41 if (tp == curtab) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
42 wp = firstwin; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
43 else |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
44 wp = tp->tp_firstwin; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
45 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
46 for ( ; wp != NULL; wp = wp->w_next) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
47 if (--winnr == 0) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
48 return wp->w_id; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
49 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
50 return 0; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
51 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
52 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
53 static void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
54 win_id2tabwin(typval_T *argvars, list_T *list) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
55 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
56 win_T *wp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
57 tabpage_T *tp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
58 int winnr = 1; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
59 int tabnr = 1; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
60 int id = tv_get_number(&argvars[0]); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
61 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
62 FOR_ALL_TABPAGES(tp) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
63 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
64 FOR_ALL_WINDOWS_IN_TAB(tp, wp) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
65 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
66 if (wp->w_id == id) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
67 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
68 list_append_number(list, tabnr); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
69 list_append_number(list, winnr); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
70 return; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
71 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
72 ++winnr; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
73 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
74 ++tabnr; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
75 winnr = 1; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
76 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
77 list_append_number(list, 0); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
78 list_append_number(list, 0); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
79 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
80 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
81 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
82 * Return the window pointer of window "id". |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
83 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
84 win_T * |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
85 win_id2wp(int id) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
86 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
87 return win_id2wp_tp(id, NULL); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
88 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
89 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
90 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
91 * Return the window and tab pointer of window "id". |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
92 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
93 win_T * |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
94 win_id2wp_tp(int id, tabpage_T **tpp) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
95 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
96 win_T *wp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
97 tabpage_T *tp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
98 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
99 FOR_ALL_TAB_WINDOWS(tp, wp) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
100 if (wp->w_id == id) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
101 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
102 if (tpp != NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
103 *tpp = tp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
104 return wp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
105 } |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18259
diff
changeset
|
106 #ifdef FEAT_PROP_POPUP |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
107 // popup windows are in separate lists |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
108 FOR_ALL_TABPAGES(tp) |
19888
435726a03481
patch 8.2.0500: using the same loop in many places
Bram Moolenaar <Bram@vim.org>
parents:
19732
diff
changeset
|
109 FOR_ALL_POPUPWINS_IN_TAB(tp, wp) |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
110 if (wp->w_id == id) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
111 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
112 if (tpp != NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
113 *tpp = tp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
114 return wp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
115 } |
19888
435726a03481
patch 8.2.0500: using the same loop in many places
Bram Moolenaar <Bram@vim.org>
parents:
19732
diff
changeset
|
116 FOR_ALL_POPUPWINS(wp) |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
117 if (wp->w_id == id) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
118 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
119 if (tpp != NULL) |
22063
0716b3299872
patch 8.2.1581: using line() for global popup window doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
21703
diff
changeset
|
120 *tpp = curtab; // any tabpage would do |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
121 return wp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
122 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
123 #endif |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
124 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
125 return NULL; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
126 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
127 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
128 static int |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
129 win_id2win(typval_T *argvars) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
130 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
131 win_T *wp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
132 int nr = 1; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
133 int id = tv_get_number(&argvars[0]); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
134 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
135 FOR_ALL_WINDOWS(wp) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
136 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
137 if (wp->w_id == id) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
138 return nr; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
139 ++nr; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
140 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
141 return 0; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
142 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
143 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
144 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
145 win_findbuf(typval_T *argvars, list_T *list) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
146 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
147 win_T *wp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
148 tabpage_T *tp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
149 int bufnr = tv_get_number(&argvars[0]); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
150 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
151 FOR_ALL_TAB_WINDOWS(tp, wp) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
152 if (wp->w_buffer->b_fnum == bufnr) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
153 list_append_number(list, wp->w_id); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
154 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
155 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
156 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
157 * Find window specified by "vp" in tabpage "tp". |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
158 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
159 win_T * |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
160 find_win_by_nr( |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
161 typval_T *vp, |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
162 tabpage_T *tp) // NULL for current tab page |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
163 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
164 win_T *wp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
165 int nr = (int)tv_get_number_chk(vp, NULL); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
166 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
167 if (nr < 0) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
168 return NULL; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
169 if (nr == 0) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
170 return curwin; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
171 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
172 FOR_ALL_WINDOWS_IN_TAB(tp, wp) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
173 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
174 if (nr >= LOWEST_WIN_ID) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
175 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
176 if (wp->w_id == nr) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
177 return wp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
178 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
179 else if (--nr <= 0) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
180 break; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
181 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
182 if (nr >= LOWEST_WIN_ID) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
183 { |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18259
diff
changeset
|
184 #ifdef FEAT_PROP_POPUP |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
185 // check tab-local popup windows |
19114
3856047f2211
patch 8.2.0117: crash when using gettabwinvar() with invalid arguments
Bram Moolenaar <Bram@vim.org>
parents:
19065
diff
changeset
|
186 for (wp = (tp == NULL ? curtab : tp)->tp_first_popupwin; |
3856047f2211
patch 8.2.0117: crash when using gettabwinvar() with invalid arguments
Bram Moolenaar <Bram@vim.org>
parents:
19065
diff
changeset
|
187 wp != NULL; wp = wp->w_next) |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
188 if (wp->w_id == nr) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
189 return wp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
190 // check global popup windows |
19888
435726a03481
patch 8.2.0500: using the same loop in many places
Bram Moolenaar <Bram@vim.org>
parents:
19732
diff
changeset
|
191 FOR_ALL_POPUPWINS(wp) |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
192 if (wp->w_id == nr) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
193 return wp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
194 #endif |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
195 return NULL; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
196 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
197 return wp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
198 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
199 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
200 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
201 * Find a window: When using a Window ID in any tab page, when using a number |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
202 * in the current tab page. |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18259
diff
changeset
|
203 * Returns NULL when not found. |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
204 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
205 win_T * |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
206 find_win_by_nr_or_id(typval_T *vp) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
207 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
208 int nr = (int)tv_get_number_chk(vp, NULL); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
209 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
210 if (nr >= LOWEST_WIN_ID) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
211 return win_id2wp(tv_get_number(vp)); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
212 return find_win_by_nr(vp, NULL); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
213 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
214 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
215 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
216 * Find window specified by "wvp" in tabpage "tvp". |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
217 * Returns the tab page in 'ptp' |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
218 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
219 win_T * |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
220 find_tabwin( |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
221 typval_T *wvp, // VAR_UNKNOWN for current window |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
222 typval_T *tvp, // VAR_UNKNOWN for current tab page |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
223 tabpage_T **ptp) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
224 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
225 win_T *wp = NULL; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
226 tabpage_T *tp = NULL; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
227 long n; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
228 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
229 if (wvp->v_type != VAR_UNKNOWN) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
230 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
231 if (tvp->v_type != VAR_UNKNOWN) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
232 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
233 n = (long)tv_get_number(tvp); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
234 if (n >= 0) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
235 tp = find_tabpage(n); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
236 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
237 else |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
238 tp = curtab; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
239 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
240 if (tp != NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
241 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
242 wp = find_win_by_nr(wvp, tp); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
243 if (wp == NULL && wvp->v_type == VAR_NUMBER |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
244 && wvp->vval.v_number != -1) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
245 // A window with the specified number is not found |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
246 tp = NULL; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
247 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
248 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
249 else |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
250 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
251 wp = curwin; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
252 tp = curtab; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
253 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
254 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
255 if (ptp != NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
256 *ptp = tp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
257 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
258 return wp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
259 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
260 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
261 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
262 * Get the layout of the given tab page for winlayout(). |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
263 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
264 static void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
265 get_framelayout(frame_T *fr, list_T *l, int outer) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
266 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
267 frame_T *child; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
268 list_T *fr_list; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
269 list_T *win_list; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
270 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
271 if (fr == NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
272 return; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
273 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
274 if (outer) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
275 // outermost call from f_winlayout() |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
276 fr_list = l; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
277 else |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
278 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
279 fr_list = list_alloc(); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
280 if (fr_list == NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
281 return; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
282 list_append_list(l, fr_list); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
283 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
284 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
285 if (fr->fr_layout == FR_LEAF) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
286 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
287 if (fr->fr_win != NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
288 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
289 list_append_string(fr_list, (char_u *)"leaf", -1); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
290 list_append_number(fr_list, fr->fr_win->w_id); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
291 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
292 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
293 else |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
294 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
295 list_append_string(fr_list, |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
296 fr->fr_layout == FR_ROW ? (char_u *)"row" : (char_u *)"col", -1); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
297 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
298 win_list = list_alloc(); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
299 if (win_list == NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
300 return; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
301 list_append_list(fr_list, win_list); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
302 child = fr->fr_child; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
303 while (child != NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
304 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
305 get_framelayout(child, win_list, FALSE); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
306 child = child->fr_next; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
307 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
308 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
309 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
310 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
311 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
312 * Common code for tabpagewinnr() and winnr(). |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
313 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
314 static int |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
315 get_winnr(tabpage_T *tp, typval_T *argvar) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
316 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
317 win_T *twin; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
318 int nr = 1; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
319 win_T *wp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
320 char_u *arg; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
321 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
322 twin = (tp == curtab) ? curwin : tp->tp_curwin; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
323 if (argvar->v_type != VAR_UNKNOWN) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
324 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
325 int invalid_arg = FALSE; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
326 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
327 arg = tv_get_string_chk(argvar); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
328 if (arg == NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
329 nr = 0; // type error; errmsg already given |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
330 else if (STRCMP(arg, "$") == 0) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
331 twin = (tp == curtab) ? lastwin : tp->tp_lastwin; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
332 else if (STRCMP(arg, "#") == 0) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
333 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
334 twin = (tp == curtab) ? prevwin : tp->tp_prevwin; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
335 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
336 else |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
337 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
338 long count; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
339 char_u *endp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
340 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
341 // Extract the window count (if specified). e.g. winnr('3j') |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
342 count = strtol((char *)arg, (char **)&endp, 10); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
343 if (count <= 0) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
344 count = 1; // if count is not specified, default to 1 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
345 if (endp != NULL && *endp != '\0') |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
346 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
347 if (STRCMP(endp, "j") == 0) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
348 twin = win_vert_neighbor(tp, twin, FALSE, count); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
349 else if (STRCMP(endp, "k") == 0) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
350 twin = win_vert_neighbor(tp, twin, TRUE, count); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
351 else if (STRCMP(endp, "h") == 0) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
352 twin = win_horz_neighbor(tp, twin, TRUE, count); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
353 else if (STRCMP(endp, "l") == 0) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
354 twin = win_horz_neighbor(tp, twin, FALSE, count); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
355 else |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
356 invalid_arg = TRUE; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
357 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
358 else |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
359 invalid_arg = TRUE; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
360 } |
19291
1d6bc6b31c2e
patch 8.2.0204: crash when using winnr('j') in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19114
diff
changeset
|
361 if (twin == NULL) |
1d6bc6b31c2e
patch 8.2.0204: crash when using winnr('j') in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19114
diff
changeset
|
362 nr = 0; |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
363 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
364 if (invalid_arg) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
365 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
366 semsg(_(e_invexpr2), arg); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
367 nr = 0; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
368 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
369 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
370 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
371 if (nr > 0) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
372 for (wp = (tp == curtab) ? firstwin : tp->tp_firstwin; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
373 wp != twin; wp = wp->w_next) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
374 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
375 if (wp == NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
376 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
377 // didn't find it in this tabpage |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
378 nr = 0; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
379 break; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
380 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
381 ++nr; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
382 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
383 return nr; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
384 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
385 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
386 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
387 * Returns information about a window as a dictionary. |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
388 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
389 static dict_T * |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
390 get_win_info(win_T *wp, short tpnr, short winnr) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
391 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
392 dict_T *dict; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
393 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
394 dict = dict_alloc(); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
395 if (dict == NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
396 return NULL; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
397 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
398 dict_add_number(dict, "tabnr", tpnr); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
399 dict_add_number(dict, "winnr", winnr); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
400 dict_add_number(dict, "winid", wp->w_id); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
401 dict_add_number(dict, "height", wp->w_height); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
402 dict_add_number(dict, "winrow", wp->w_winrow + 1); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
403 dict_add_number(dict, "topline", wp->w_topline); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
404 dict_add_number(dict, "botline", wp->w_botline - 1); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
405 #ifdef FEAT_MENU |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
406 dict_add_number(dict, "winbar", wp->w_winbar_height); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
407 #endif |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
408 dict_add_number(dict, "width", wp->w_width); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
409 dict_add_number(dict, "wincol", wp->w_wincol + 1); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
410 dict_add_number(dict, "bufnr", wp->w_buffer->b_fnum); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
411 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
412 #ifdef FEAT_TERMINAL |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
413 dict_add_number(dict, "terminal", bt_terminal(wp->w_buffer)); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
414 #endif |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
415 #ifdef FEAT_QUICKFIX |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
416 dict_add_number(dict, "quickfix", bt_quickfix(wp->w_buffer)); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
417 dict_add_number(dict, "loclist", |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
418 (bt_quickfix(wp->w_buffer) && wp->w_llist_ref != NULL)); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
419 #endif |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
420 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
421 // Add a reference to window variables |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
422 dict_add_dict(dict, "variables", wp->w_vars); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
423 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
424 return dict; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
425 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
426 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
427 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
428 * Returns information (variables, options, etc.) about a tab page |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
429 * as a dictionary. |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
430 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
431 static dict_T * |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
432 get_tabpage_info(tabpage_T *tp, int tp_idx) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
433 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
434 win_T *wp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
435 dict_T *dict; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
436 list_T *l; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
437 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
438 dict = dict_alloc(); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
439 if (dict == NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
440 return NULL; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
441 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
442 dict_add_number(dict, "tabnr", tp_idx); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
443 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
444 l = list_alloc(); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
445 if (l != NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
446 { |
19934
3ff714d765ba
patch 8.2.0523: loops are repeated
Bram Moolenaar <Bram@vim.org>
parents:
19888
diff
changeset
|
447 FOR_ALL_WINDOWS_IN_TAB(tp, wp) |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
448 list_append_number(l, (varnumber_T)wp->w_id); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
449 dict_add_list(dict, "windows", l); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
450 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
451 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
452 // Make a reference to tabpage variables |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
453 dict_add_dict(dict, "variables", tp->tp_vars); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
454 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
455 return dict; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
456 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
457 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
458 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
459 * "gettabinfo()" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
460 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
461 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
462 f_gettabinfo(typval_T *argvars, typval_T *rettv) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
463 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
464 tabpage_T *tp, *tparg = NULL; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
465 dict_T *d; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
466 int tpnr = 0; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
467 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
468 if (rettv_list_alloc(rettv) != OK) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
469 return; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
470 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
471 if (argvars[0].v_type != VAR_UNKNOWN) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
472 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
473 // Information about one tab page |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
474 tparg = find_tabpage((int)tv_get_number_chk(&argvars[0], NULL)); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
475 if (tparg == NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
476 return; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
477 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
478 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
479 // Get information about a specific tab page or all tab pages |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
480 FOR_ALL_TABPAGES(tp) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
481 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
482 tpnr++; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
483 if (tparg != NULL && tp != tparg) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
484 continue; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
485 d = get_tabpage_info(tp, tpnr); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
486 if (d != NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
487 list_append_dict(rettv->vval.v_list, d); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
488 if (tparg != NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
489 return; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
490 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
491 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
492 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
493 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
494 * "getwininfo()" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
495 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
496 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
497 f_getwininfo(typval_T *argvars, typval_T *rettv) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
498 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
499 tabpage_T *tp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
500 win_T *wp = NULL, *wparg = NULL; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
501 dict_T *d; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
502 short tabnr = 0, winnr; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
503 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
504 if (rettv_list_alloc(rettv) != OK) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
505 return; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
506 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
507 if (argvars[0].v_type != VAR_UNKNOWN) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
508 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
509 wparg = win_id2wp(tv_get_number(&argvars[0])); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
510 if (wparg == NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
511 return; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
512 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
513 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
514 // Collect information about either all the windows across all the tab |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
515 // pages or one particular window. |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
516 FOR_ALL_TABPAGES(tp) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
517 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
518 tabnr++; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
519 winnr = 0; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
520 FOR_ALL_WINDOWS_IN_TAB(tp, wp) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
521 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
522 winnr++; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
523 if (wparg != NULL && wp != wparg) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
524 continue; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
525 d = get_win_info(wp, tabnr, winnr); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
526 if (d != NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
527 list_append_dict(rettv->vval.v_list, d); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
528 if (wparg != NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
529 // found information about a specific window |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
530 return; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
531 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
532 } |
22357
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22135
diff
changeset
|
533 #ifdef FEAT_PROP_POPUP |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22135
diff
changeset
|
534 if (wparg != NULL) |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22135
diff
changeset
|
535 { |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22135
diff
changeset
|
536 tabnr = 0; |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22135
diff
changeset
|
537 FOR_ALL_TABPAGES(tp) |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22135
diff
changeset
|
538 { |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22135
diff
changeset
|
539 tabnr++; |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22135
diff
changeset
|
540 FOR_ALL_POPUPWINS_IN_TAB(tp, wp) |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22135
diff
changeset
|
541 if (wp == wparg) |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22135
diff
changeset
|
542 break; |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22135
diff
changeset
|
543 } |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22135
diff
changeset
|
544 d = get_win_info(wparg, tp == NULL ? 0 : tabnr, 0); |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22135
diff
changeset
|
545 if (d != NULL) |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22135
diff
changeset
|
546 list_append_dict(rettv->vval.v_list, d); |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22135
diff
changeset
|
547 } |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22135
diff
changeset
|
548 #endif |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
549 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
550 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
551 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
552 * "getwinpos({timeout})" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
553 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
554 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
555 f_getwinpos(typval_T *argvars UNUSED, typval_T *rettv) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
556 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
557 int x = -1; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
558 int y = -1; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
559 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
560 if (rettv_list_alloc(rettv) == FAIL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
561 return; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
562 #if defined(FEAT_GUI) \ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
563 || (defined(HAVE_TGETENT) && defined(FEAT_TERMRESPONSE)) \ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
564 || defined(MSWIN) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
565 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
566 varnumber_T timeout = 100; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
567 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
568 if (argvars[0].v_type != VAR_UNKNOWN) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
569 timeout = tv_get_number(&argvars[0]); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
570 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
571 (void)ui_get_winpos(&x, &y, timeout); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
572 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
573 #endif |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
574 list_append_number(rettv->vval.v_list, (varnumber_T)x); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
575 list_append_number(rettv->vval.v_list, (varnumber_T)y); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
576 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
577 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
578 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
579 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
580 * "getwinposx()" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
581 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
582 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
583 f_getwinposx(typval_T *argvars UNUSED, typval_T *rettv) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
584 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
585 rettv->vval.v_number = -1; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
586 #if defined(FEAT_GUI) \ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
587 || (defined(HAVE_TGETENT) && defined(FEAT_TERMRESPONSE)) \ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
588 || defined(MSWIN) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
589 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
590 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
591 int x, y; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
592 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
593 if (ui_get_winpos(&x, &y, 100) == OK) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
594 rettv->vval.v_number = x; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
595 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
596 #endif |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
597 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
598 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
599 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
600 * "getwinposy()" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
601 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
602 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
603 f_getwinposy(typval_T *argvars UNUSED, typval_T *rettv) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
604 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
605 rettv->vval.v_number = -1; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
606 #if defined(FEAT_GUI) \ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
607 || (defined(HAVE_TGETENT) && defined(FEAT_TERMRESPONSE)) \ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
608 || defined(MSWIN) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
609 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
610 int x, y; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
611 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
612 if (ui_get_winpos(&x, &y, 100) == OK) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
613 rettv->vval.v_number = y; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
614 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
615 #endif |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
616 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
617 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
618 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
619 * "tabpagenr()" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
620 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
621 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
622 f_tabpagenr(typval_T *argvars UNUSED, typval_T *rettv) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
623 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
624 int nr = 1; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
625 char_u *arg; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
626 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
627 if (argvars[0].v_type != VAR_UNKNOWN) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
628 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
629 arg = tv_get_string_chk(&argvars[0]); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
630 nr = 0; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
631 if (arg != NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
632 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
633 if (STRCMP(arg, "$") == 0) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
634 nr = tabpage_index(NULL) - 1; |
21703
22583b9d4efd
patch 8.2.1401: cannot jump to the last used tabpage
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
635 else if (STRCMP(arg, "#") == 0) |
22583b9d4efd
patch 8.2.1401: cannot jump to the last used tabpage
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
636 nr = valid_tabpage(lastused_tabpage) ? |
22583b9d4efd
patch 8.2.1401: cannot jump to the last used tabpage
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
637 tabpage_index(lastused_tabpage) : 0; |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
638 else |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
639 semsg(_(e_invexpr2), arg); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
640 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
641 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
642 else |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
643 nr = tabpage_index(curtab); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
644 rettv->vval.v_number = nr; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
645 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
646 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
647 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
648 * "tabpagewinnr()" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
649 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
650 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
651 f_tabpagewinnr(typval_T *argvars UNUSED, typval_T *rettv) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
652 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
653 int nr = 1; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
654 tabpage_T *tp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
655 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
656 tp = find_tabpage((int)tv_get_number(&argvars[0])); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
657 if (tp == NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
658 nr = 0; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
659 else |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
660 nr = get_winnr(tp, &argvars[1]); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
661 rettv->vval.v_number = nr; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
662 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
663 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
664 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
665 * "win_execute()" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
666 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
667 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
668 f_win_execute(typval_T *argvars, typval_T *rettv) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
669 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
670 int id = (int)tv_get_number(argvars); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
671 tabpage_T *tp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
672 win_T *wp = win_id2wp_tp(id, &tp); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
673 win_T *save_curwin; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
674 tabpage_T *save_curtab; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
675 |
23596
9fa72351c18f
patch 8.2.2340: win_execute() unexpectedly returns number zero when failing
Bram Moolenaar <Bram@vim.org>
parents:
23404
diff
changeset
|
676 // Return an empty string if something fails. |
9fa72351c18f
patch 8.2.2340: win_execute() unexpectedly returns number zero when failing
Bram Moolenaar <Bram@vim.org>
parents:
23404
diff
changeset
|
677 rettv->v_type = VAR_STRING; |
9fa72351c18f
patch 8.2.2340: win_execute() unexpectedly returns number zero when failing
Bram Moolenaar <Bram@vim.org>
parents:
23404
diff
changeset
|
678 rettv->vval.v_string = NULL; |
9fa72351c18f
patch 8.2.2340: win_execute() unexpectedly returns number zero when failing
Bram Moolenaar <Bram@vim.org>
parents:
23404
diff
changeset
|
679 |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
680 if (wp != NULL && tp != NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
681 { |
18259
f254dd2bc107
patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents:
18084
diff
changeset
|
682 pos_T curpos = wp->w_cursor; |
f254dd2bc107
patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents:
18084
diff
changeset
|
683 |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
684 if (switch_win_noblock(&save_curwin, &save_curtab, wp, tp, TRUE) == OK) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
685 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
686 check_cursor(); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
687 execute_common(argvars, rettv, 1); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
688 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
689 restore_win_noblock(save_curwin, save_curtab, TRUE); |
18259
f254dd2bc107
patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents:
18084
diff
changeset
|
690 |
f254dd2bc107
patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents:
18084
diff
changeset
|
691 // Update the status line if the cursor moved. |
f254dd2bc107
patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents:
18084
diff
changeset
|
692 if (win_valid(wp) && !EQUAL_POS(curpos, wp->w_cursor)) |
f254dd2bc107
patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents:
18084
diff
changeset
|
693 wp->w_redr_status = TRUE; |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
694 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
695 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
696 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
697 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
698 * "win_findbuf()" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
699 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
700 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
701 f_win_findbuf(typval_T *argvars, typval_T *rettv) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
702 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
703 if (rettv_list_alloc(rettv) != FAIL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
704 win_findbuf(argvars, rettv->vval.v_list); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
705 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
706 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
707 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
708 * "win_getid()" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
709 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
710 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
711 f_win_getid(typval_T *argvars, typval_T *rettv) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
712 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
713 rettv->vval.v_number = win_getid(argvars); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
714 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
715 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
716 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
717 * "win_gotoid()" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
718 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
719 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
720 f_win_gotoid(typval_T *argvars, typval_T *rettv) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
721 { |
18084
f4b51934d4f8
patch 8.1.2037: can call win_gotoid() in cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
18049
diff
changeset
|
722 win_T *wp; |
f4b51934d4f8
patch 8.1.2037: can call win_gotoid() in cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
18049
diff
changeset
|
723 tabpage_T *tp; |
f4b51934d4f8
patch 8.1.2037: can call win_gotoid() in cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
18049
diff
changeset
|
724 int id = tv_get_number(&argvars[0]); |
f4b51934d4f8
patch 8.1.2037: can call win_gotoid() in cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
18049
diff
changeset
|
725 |
f4b51934d4f8
patch 8.1.2037: can call win_gotoid() in cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
18049
diff
changeset
|
726 #ifdef FEAT_CMDWIN |
f4b51934d4f8
patch 8.1.2037: can call win_gotoid() in cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
18049
diff
changeset
|
727 if (cmdwin_type != 0) |
f4b51934d4f8
patch 8.1.2037: can call win_gotoid() in cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
18049
diff
changeset
|
728 { |
f4b51934d4f8
patch 8.1.2037: can call win_gotoid() in cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
18049
diff
changeset
|
729 emsg(_(e_cmdwin)); |
f4b51934d4f8
patch 8.1.2037: can call win_gotoid() in cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
18049
diff
changeset
|
730 return; |
f4b51934d4f8
patch 8.1.2037: can call win_gotoid() in cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
18049
diff
changeset
|
731 } |
f4b51934d4f8
patch 8.1.2037: can call win_gotoid() in cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
18049
diff
changeset
|
732 #endif |
f4b51934d4f8
patch 8.1.2037: can call win_gotoid() in cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
18049
diff
changeset
|
733 FOR_ALL_TAB_WINDOWS(tp, wp) |
f4b51934d4f8
patch 8.1.2037: can call win_gotoid() in cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
18049
diff
changeset
|
734 if (wp->w_id == id) |
f4b51934d4f8
patch 8.1.2037: can call win_gotoid() in cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
18049
diff
changeset
|
735 { |
f4b51934d4f8
patch 8.1.2037: can call win_gotoid() in cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
18049
diff
changeset
|
736 goto_tabpage_win(tp, wp); |
f4b51934d4f8
patch 8.1.2037: can call win_gotoid() in cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
18049
diff
changeset
|
737 rettv->vval.v_number = 1; |
f4b51934d4f8
patch 8.1.2037: can call win_gotoid() in cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
18049
diff
changeset
|
738 return; |
f4b51934d4f8
patch 8.1.2037: can call win_gotoid() in cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
18049
diff
changeset
|
739 } |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
740 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
741 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
742 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
743 * "win_id2tabwin()" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
744 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
745 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
746 f_win_id2tabwin(typval_T *argvars, typval_T *rettv) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
747 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
748 if (rettv_list_alloc(rettv) != FAIL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
749 win_id2tabwin(argvars, rettv->vval.v_list); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
750 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
751 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
752 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
753 * "win_id2win()" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
754 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
755 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
756 f_win_id2win(typval_T *argvars, typval_T *rettv) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
757 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
758 rettv->vval.v_number = win_id2win(argvars); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
759 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
760 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
761 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
762 * "win_screenpos()" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
763 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
764 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
765 f_win_screenpos(typval_T *argvars, typval_T *rettv) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
766 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
767 win_T *wp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
768 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
769 if (rettv_list_alloc(rettv) == FAIL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
770 return; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
771 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
772 wp = find_win_by_nr_or_id(&argvars[0]); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
773 list_append_number(rettv->vval.v_list, wp == NULL ? 0 : wp->w_winrow + 1); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
774 list_append_number(rettv->vval.v_list, wp == NULL ? 0 : wp->w_wincol + 1); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
775 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
776 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
777 /* |
18049
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
778 * Move the window wp into a new split of targetwin in a given direction |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
779 */ |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
780 static void |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
781 win_move_into_split(win_T *wp, win_T *targetwin, int size, int flags) |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
782 { |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
783 int dir; |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
784 int height = wp->w_height; |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
785 win_T *oldwin = curwin; |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
786 |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
787 if (wp == targetwin) |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
788 return; |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
789 |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
790 // Jump to the target window |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
791 if (curwin != targetwin) |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
792 win_goto(targetwin); |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
793 |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
794 // Remove the old window and frame from the tree of frames |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
795 (void)winframe_remove(wp, &dir, NULL); |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
796 win_remove(wp, NULL); |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
797 last_status(FALSE); // may need to remove last status line |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
798 (void)win_comp_pos(); // recompute window positions |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
799 |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
800 // Split a window on the desired side and put the old window there |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
801 (void)win_split_ins(size, flags, wp, dir); |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
802 |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
803 // If splitting horizontally, try to preserve height |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
804 if (size == 0 && !(flags & WSP_VERT)) |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
805 { |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
806 win_setheight_win(height, wp); |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
807 if (p_ea) |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
808 win_equal(wp, TRUE, 'v'); |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
809 } |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
810 |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
811 #if defined(FEAT_GUI) |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
812 // When 'guioptions' includes 'L' or 'R' may have to remove or add |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
813 // scrollbars. Have to update them anyway. |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
814 gui_may_update_scrollbars(); |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
815 #endif |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
816 |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
817 if (oldwin != curwin) |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
818 win_goto(oldwin); |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
819 } |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
820 |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
821 /* |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
822 * "win_splitmove()" function |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
823 */ |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
824 void |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
825 f_win_splitmove(typval_T *argvars, typval_T *rettv) |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
826 { |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
827 win_T *wp; |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
828 win_T *targetwin; |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
829 int flags = 0, size = 0; |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
830 |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
831 wp = find_win_by_nr_or_id(&argvars[0]); |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
832 targetwin = find_win_by_nr_or_id(&argvars[1]); |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
833 |
19065
ef3633932b0c
patch 8.2.0093: win_splitmove() can make Vim hang
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
834 if (wp == NULL || targetwin == NULL || wp == targetwin |
19732
e292acf16e26
patch 8.2.0422: crash when passing popup window to win_splitmove()
Bram Moolenaar <Bram@vim.org>
parents:
19398
diff
changeset
|
835 || !win_valid(wp) || !win_valid(targetwin) |
e292acf16e26
patch 8.2.0422: crash when passing popup window to win_splitmove()
Bram Moolenaar <Bram@vim.org>
parents:
19398
diff
changeset
|
836 || win_valid_popup(wp) || win_valid_popup(targetwin)) |
18049
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
837 { |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
838 emsg(_(e_invalwindow)); |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
839 rettv->vval.v_number = -1; |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
840 return; |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
841 } |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
842 |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
843 if (argvars[2].v_type != VAR_UNKNOWN) |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
844 { |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
845 dict_T *d; |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
846 dictitem_T *di; |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
847 |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
848 if (argvars[2].v_type != VAR_DICT || argvars[2].vval.v_dict == NULL) |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
849 { |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
850 emsg(_(e_invarg)); |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
851 return; |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
852 } |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
853 |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
854 d = argvars[2].vval.v_dict; |
22135
f45127fbe9ba
patch 8.2.1617: Vim9: cannot pass "true" to win_splitmove()
Bram Moolenaar <Bram@vim.org>
parents:
22063
diff
changeset
|
855 if (dict_get_bool(d, (char_u *)"vertical", FALSE)) |
18049
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
856 flags |= WSP_VERT; |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
857 if ((di = dict_find(d, (char_u *)"rightbelow", -1)) != NULL) |
22135
f45127fbe9ba
patch 8.2.1617: Vim9: cannot pass "true" to win_splitmove()
Bram Moolenaar <Bram@vim.org>
parents:
22063
diff
changeset
|
858 flags |= tv_get_bool(&di->di_tv) ? WSP_BELOW : WSP_ABOVE; |
18049
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
859 size = (int)dict_get_number(d, (char_u *)"size"); |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
860 } |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
861 |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
862 win_move_into_split(wp, targetwin, size, flags); |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
863 } |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
864 |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
865 /* |
19398
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
866 * "win_gettype(nr)" function |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
867 */ |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
868 void |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
869 f_win_gettype(typval_T *argvars, typval_T *rettv) |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
870 { |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
871 win_T *wp = curwin; |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
872 |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
873 rettv->v_type = VAR_STRING; |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
874 rettv->vval.v_string = NULL; |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
875 if (argvars[0].v_type != VAR_UNKNOWN) |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
876 { |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
877 wp = find_win_by_nr_or_id(&argvars[0]); |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
878 if (wp == NULL) |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
879 { |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
880 rettv->vval.v_string = vim_strsave((char_u *)"unknown"); |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
881 return; |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
882 } |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
883 } |
20879
0ab45b558621
patch 8.2.0991: cannot get window type for autocmd and preview window
Bram Moolenaar <Bram@vim.org>
parents:
19934
diff
changeset
|
884 if (wp == aucmd_win) |
20889
27401f09fe9b
patch 8.2.0996: using "aucmdwin" in win_gettype() is not ideal
Bram Moolenaar <Bram@vim.org>
parents:
20879
diff
changeset
|
885 rettv->vval.v_string = vim_strsave((char_u *)"autocmd"); |
20879
0ab45b558621
patch 8.2.0991: cannot get window type for autocmd and preview window
Bram Moolenaar <Bram@vim.org>
parents:
19934
diff
changeset
|
886 #if defined(FEAT_QUICKFIX) |
0ab45b558621
patch 8.2.0991: cannot get window type for autocmd and preview window
Bram Moolenaar <Bram@vim.org>
parents:
19934
diff
changeset
|
887 else if (wp->w_p_pvw) |
0ab45b558621
patch 8.2.0991: cannot get window type for autocmd and preview window
Bram Moolenaar <Bram@vim.org>
parents:
19934
diff
changeset
|
888 rettv->vval.v_string = vim_strsave((char_u *)"preview"); |
0ab45b558621
patch 8.2.0991: cannot get window type for autocmd and preview window
Bram Moolenaar <Bram@vim.org>
parents:
19934
diff
changeset
|
889 #endif |
19398
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
890 #ifdef FEAT_PROP_POPUP |
20879
0ab45b558621
patch 8.2.0991: cannot get window type for autocmd and preview window
Bram Moolenaar <Bram@vim.org>
parents:
19934
diff
changeset
|
891 else if (WIN_IS_POPUP(wp)) |
19398
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
892 rettv->vval.v_string = vim_strsave((char_u *)"popup"); |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
893 #endif |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
894 #ifdef FEAT_CMDWIN |
20879
0ab45b558621
patch 8.2.0991: cannot get window type for autocmd and preview window
Bram Moolenaar <Bram@vim.org>
parents:
19934
diff
changeset
|
895 else if (wp == curwin && cmdwin_type != 0) |
19398
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
896 rettv->vval.v_string = vim_strsave((char_u *)"command"); |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
897 #endif |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
898 } |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
899 |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
900 /* |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
901 * "getcmdwintype()" function |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
902 */ |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
903 void |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
904 f_getcmdwintype(typval_T *argvars UNUSED, typval_T *rettv) |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
905 { |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
906 rettv->v_type = VAR_STRING; |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
907 rettv->vval.v_string = NULL; |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
908 #ifdef FEAT_CMDWIN |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
909 rettv->vval.v_string = alloc(2); |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
910 if (rettv->vval.v_string != NULL) |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
911 { |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
912 rettv->vval.v_string[0] = cmdwin_type; |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
913 rettv->vval.v_string[1] = NUL; |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
914 } |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
915 #endif |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
916 } |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
917 |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
918 /* |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
919 * "winbufnr(nr)" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
920 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
921 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
922 f_winbufnr(typval_T *argvars, typval_T *rettv) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
923 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
924 win_T *wp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
925 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
926 wp = find_win_by_nr_or_id(&argvars[0]); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
927 if (wp == NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
928 rettv->vval.v_number = -1; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
929 else |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
930 rettv->vval.v_number = wp->w_buffer->b_fnum; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
931 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
932 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
933 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
934 * "wincol()" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
935 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
936 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
937 f_wincol(typval_T *argvars UNUSED, typval_T *rettv) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
938 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
939 validate_cursor(); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
940 rettv->vval.v_number = curwin->w_wcol + 1; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
941 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
942 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
943 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
944 * "winheight(nr)" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
945 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
946 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
947 f_winheight(typval_T *argvars, typval_T *rettv) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
948 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
949 win_T *wp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
950 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
951 wp = find_win_by_nr_or_id(&argvars[0]); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
952 if (wp == NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
953 rettv->vval.v_number = -1; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
954 else |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
955 rettv->vval.v_number = wp->w_height; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
956 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
957 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
958 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
959 * "winlayout()" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
960 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
961 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
962 f_winlayout(typval_T *argvars, typval_T *rettv) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
963 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
964 tabpage_T *tp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
965 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
966 if (rettv_list_alloc(rettv) != OK) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
967 return; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
968 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
969 if (argvars[0].v_type == VAR_UNKNOWN) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
970 tp = curtab; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
971 else |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
972 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
973 tp = find_tabpage((int)tv_get_number(&argvars[0])); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
974 if (tp == NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
975 return; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
976 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
977 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
978 get_framelayout(tp->tp_topframe, rettv->vval.v_list, TRUE); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
979 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
980 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
981 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
982 * "winline()" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
983 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
984 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
985 f_winline(typval_T *argvars UNUSED, typval_T *rettv) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
986 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
987 validate_cursor(); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
988 rettv->vval.v_number = curwin->w_wrow + 1; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
989 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
990 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
991 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
992 * "winnr()" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
993 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
994 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
995 f_winnr(typval_T *argvars UNUSED, typval_T *rettv) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
996 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
997 int nr = 1; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
998 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
999 nr = get_winnr(curtab, &argvars[0]); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1000 rettv->vval.v_number = nr; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1001 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1002 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1003 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1004 * "winrestcmd()" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1005 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1006 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1007 f_winrestcmd(typval_T *argvars UNUSED, typval_T *rettv) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1008 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1009 win_T *wp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1010 int winnr = 1; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1011 garray_T ga; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1012 char_u buf[50]; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1013 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1014 ga_init2(&ga, (int)sizeof(char), 70); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1015 FOR_ALL_WINDOWS(wp) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1016 { |
23404
a6b6bcc004f2
patch 8.2.2245: Vim9: return value of winrestcmd() cannot be executed
Bram Moolenaar <Bram@vim.org>
parents:
22357
diff
changeset
|
1017 sprintf((char *)buf, ":%dresize %d|", winnr, wp->w_height); |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1018 ga_concat(&ga, buf); |
23404
a6b6bcc004f2
patch 8.2.2245: Vim9: return value of winrestcmd() cannot be executed
Bram Moolenaar <Bram@vim.org>
parents:
22357
diff
changeset
|
1019 sprintf((char *)buf, "vert :%dresize %d|", winnr, wp->w_width); |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1020 ga_concat(&ga, buf); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1021 ++winnr; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1022 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1023 ga_append(&ga, NUL); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1024 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1025 rettv->vval.v_string = ga.ga_data; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1026 rettv->v_type = VAR_STRING; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1027 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1028 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1029 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1030 * "winrestview()" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1031 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1032 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1033 f_winrestview(typval_T *argvars, typval_T *rettv UNUSED) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1034 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1035 dict_T *dict; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1036 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1037 if (argvars[0].v_type != VAR_DICT |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1038 || (dict = argvars[0].vval.v_dict) == NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1039 emsg(_(e_invarg)); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1040 else |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1041 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1042 if (dict_find(dict, (char_u *)"lnum", -1) != NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1043 curwin->w_cursor.lnum = (linenr_T)dict_get_number(dict, (char_u *)"lnum"); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1044 if (dict_find(dict, (char_u *)"col", -1) != NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1045 curwin->w_cursor.col = (colnr_T)dict_get_number(dict, (char_u *)"col"); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1046 if (dict_find(dict, (char_u *)"coladd", -1) != NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1047 curwin->w_cursor.coladd = (colnr_T)dict_get_number(dict, (char_u *)"coladd"); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1048 if (dict_find(dict, (char_u *)"curswant", -1) != NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1049 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1050 curwin->w_curswant = (colnr_T)dict_get_number(dict, (char_u *)"curswant"); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1051 curwin->w_set_curswant = FALSE; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1052 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1053 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1054 if (dict_find(dict, (char_u *)"topline", -1) != NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1055 set_topline(curwin, (linenr_T)dict_get_number(dict, (char_u *)"topline")); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1056 #ifdef FEAT_DIFF |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1057 if (dict_find(dict, (char_u *)"topfill", -1) != NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1058 curwin->w_topfill = (int)dict_get_number(dict, (char_u *)"topfill"); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1059 #endif |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1060 if (dict_find(dict, (char_u *)"leftcol", -1) != NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1061 curwin->w_leftcol = (colnr_T)dict_get_number(dict, (char_u *)"leftcol"); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1062 if (dict_find(dict, (char_u *)"skipcol", -1) != NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1063 curwin->w_skipcol = (colnr_T)dict_get_number(dict, (char_u *)"skipcol"); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1064 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1065 check_cursor(); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1066 win_new_height(curwin, curwin->w_height); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1067 win_new_width(curwin, curwin->w_width); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1068 changed_window_setting(); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1069 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1070 if (curwin->w_topline <= 0) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1071 curwin->w_topline = 1; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1072 if (curwin->w_topline > curbuf->b_ml.ml_line_count) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1073 curwin->w_topline = curbuf->b_ml.ml_line_count; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1074 #ifdef FEAT_DIFF |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1075 check_topfill(curwin, TRUE); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1076 #endif |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1077 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1078 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1079 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1080 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1081 * "winsaveview()" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1082 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1083 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1084 f_winsaveview(typval_T *argvars UNUSED, typval_T *rettv) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1085 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1086 dict_T *dict; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1087 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1088 if (rettv_dict_alloc(rettv) == FAIL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1089 return; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1090 dict = rettv->vval.v_dict; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1091 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1092 dict_add_number(dict, "lnum", (long)curwin->w_cursor.lnum); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1093 dict_add_number(dict, "col", (long)curwin->w_cursor.col); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1094 dict_add_number(dict, "coladd", (long)curwin->w_cursor.coladd); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1095 update_curswant(); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1096 dict_add_number(dict, "curswant", (long)curwin->w_curswant); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1097 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1098 dict_add_number(dict, "topline", (long)curwin->w_topline); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1099 #ifdef FEAT_DIFF |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1100 dict_add_number(dict, "topfill", (long)curwin->w_topfill); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1101 #endif |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1102 dict_add_number(dict, "leftcol", (long)curwin->w_leftcol); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1103 dict_add_number(dict, "skipcol", (long)curwin->w_skipcol); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1104 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1105 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1106 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1107 * "winwidth(nr)" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1108 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1109 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1110 f_winwidth(typval_T *argvars, typval_T *rettv) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1111 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1112 win_T *wp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1113 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1114 wp = find_win_by_nr_or_id(&argvars[0]); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1115 if (wp == NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1116 rettv->vval.v_number = -1; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1117 else |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1118 rettv->vval.v_number = wp->w_width; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1119 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1120 #endif // FEAT_EVAL |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1121 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1122 #if defined(FEAT_EVAL) || defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) \ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1123 || defined(PROTO) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1124 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1125 * Set "win" to be the curwin and "tp" to be the current tab page. |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1126 * restore_win() MUST be called to undo, also when FAIL is returned. |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1127 * No autocommands will be executed until restore_win() is called. |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1128 * When "no_display" is TRUE the display won't be affected, no redraw is |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1129 * triggered, another tabpage access is limited. |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1130 * Returns FAIL if switching to "win" failed. |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1131 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1132 int |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1133 switch_win( |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1134 win_T **save_curwin, |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1135 tabpage_T **save_curtab, |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1136 win_T *win, |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1137 tabpage_T *tp, |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1138 int no_display) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1139 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1140 block_autocmds(); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1141 return switch_win_noblock(save_curwin, save_curtab, win, tp, no_display); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1142 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1143 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1144 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1145 * As switch_win() but without blocking autocommands. |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1146 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1147 int |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1148 switch_win_noblock( |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1149 win_T **save_curwin, |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1150 tabpage_T **save_curtab, |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1151 win_T *win, |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1152 tabpage_T *tp, |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1153 int no_display) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1154 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1155 *save_curwin = curwin; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1156 if (tp != NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1157 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1158 *save_curtab = curtab; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1159 if (no_display) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1160 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1161 curtab->tp_firstwin = firstwin; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1162 curtab->tp_lastwin = lastwin; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1163 curtab = tp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1164 firstwin = curtab->tp_firstwin; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1165 lastwin = curtab->tp_lastwin; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1166 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1167 else |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1168 goto_tabpage_tp(tp, FALSE, FALSE); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1169 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1170 if (!win_valid(win)) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1171 return FAIL; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1172 curwin = win; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1173 curbuf = curwin->w_buffer; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1174 return OK; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1175 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1176 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1177 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1178 * Restore current tabpage and window saved by switch_win(), if still valid. |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1179 * When "no_display" is TRUE the display won't be affected, no redraw is |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1180 * triggered. |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1181 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1182 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1183 restore_win( |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1184 win_T *save_curwin, |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1185 tabpage_T *save_curtab, |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1186 int no_display) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1187 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1188 restore_win_noblock(save_curwin, save_curtab, no_display); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1189 unblock_autocmds(); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1190 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1191 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1192 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1193 * As restore_win() but without unblocking autocommands. |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1194 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1195 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1196 restore_win_noblock( |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1197 win_T *save_curwin, |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1198 tabpage_T *save_curtab, |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1199 int no_display) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1200 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1201 if (save_curtab != NULL && valid_tabpage(save_curtab)) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1202 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1203 if (no_display) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1204 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1205 curtab->tp_firstwin = firstwin; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1206 curtab->tp_lastwin = lastwin; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1207 curtab = save_curtab; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1208 firstwin = curtab->tp_firstwin; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1209 lastwin = curtab->tp_lastwin; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1210 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1211 else |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1212 goto_tabpage_tp(save_curtab, FALSE, FALSE); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1213 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1214 if (win_valid(save_curwin)) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1215 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1216 curwin = save_curwin; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1217 curbuf = curwin->w_buffer; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1218 } |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18259
diff
changeset
|
1219 # ifdef FEAT_PROP_POPUP |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1220 else if (WIN_IS_POPUP(curwin)) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1221 // original window was closed and now we're in a popup window: Go |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1222 // to the first valid window. |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1223 win_goto(firstwin); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1224 # endif |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1225 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1226 #endif |