Mercurial > vim
annotate src/evalwindow.c @ 32164:673dcbaded32 v9.0.1413
patch 9.0.1413: compiler warning for unused variable
Commit: https://github.com/vim/vim/commit/2a003177eb3cee535bb8a384b4b87db13f0486ae
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Mar 17 18:50:48 2023 +0000
patch 9.0.1413: compiler warning for unused variable
Problem: Compiler warning for unused variable.
Solution: Move variable declaration. (John Marriott)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 17 Mar 2023 20:00:06 +0100 |
parents | b89cfd86e18e |
children | a522c6c0127b |
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]); |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31600
diff
changeset
|
27 if (winnr <= 0) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31600
diff
changeset
|
28 return 0; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31600
diff
changeset
|
29 |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31600
diff
changeset
|
30 if (argvars[1].v_type == VAR_UNKNOWN) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31600
diff
changeset
|
31 wp = firstwin; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31600
diff
changeset
|
32 else |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
33 { |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31600
diff
changeset
|
34 tabpage_T *tp; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31600
diff
changeset
|
35 int tabnr = tv_get_number(&argvars[1]); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31600
diff
changeset
|
36 |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31600
diff
changeset
|
37 FOR_ALL_TABPAGES(tp) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31600
diff
changeset
|
38 if (--tabnr == 0) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31600
diff
changeset
|
39 break; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31600
diff
changeset
|
40 if (tp == NULL) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31600
diff
changeset
|
41 return -1; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31600
diff
changeset
|
42 if (tp == curtab) |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
43 wp = firstwin; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
44 else |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31600
diff
changeset
|
45 wp = tp->tp_firstwin; |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
46 } |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31600
diff
changeset
|
47 for ( ; wp != NULL; wp = wp->w_next) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31600
diff
changeset
|
48 if (--winnr == 0) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31600
diff
changeset
|
49 return wp->w_id; |
18010
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". |
31140
a52697bcffa6
patch 9.0.0904: various comment and indent flaws
Bram Moolenaar <Bram@vim.org>
parents:
30978
diff
changeset
|
92 * 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
|
93 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
94 win_T * |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
95 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
|
96 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
97 win_T *wp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
98 tabpage_T *tp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
99 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
100 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
|
101 if (wp->w_id == id) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
102 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
103 if (tpp != NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
104 *tpp = tp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
105 return wp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
106 } |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18259
diff
changeset
|
107 #ifdef FEAT_PROP_POPUP |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
108 // 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
|
109 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
|
110 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
|
111 if (wp->w_id == id) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
112 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
113 if (tpp != NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
114 *tpp = tp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
115 return wp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
116 } |
19888
435726a03481
patch 8.2.0500: using the same loop in many places
Bram Moolenaar <Bram@vim.org>
parents:
19732
diff
changeset
|
117 FOR_ALL_POPUPWINS(wp) |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
118 if (wp->w_id == id) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
119 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
120 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
|
121 *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
|
122 return wp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
123 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
124 #endif |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
125 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
126 return NULL; |
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 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
129 static int |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
130 win_id2win(typval_T *argvars) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
131 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
132 win_T *wp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
133 int nr = 1; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
134 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
|
135 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
136 FOR_ALL_WINDOWS(wp) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
137 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
138 if (wp->w_id == id) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
139 return nr; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
140 ++nr; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
141 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
142 return 0; |
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 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
145 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
146 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
|
147 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
148 win_T *wp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
149 tabpage_T *tp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
150 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
|
151 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
152 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
|
153 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
|
154 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
|
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 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
158 * Find window specified by "vp" in tabpage "tp". |
28809
d0241e74bfdb
patch 8.2.4928: various white space and cosmetic mistakes
Bram Moolenaar <Bram@vim.org>
parents:
28580
diff
changeset
|
159 * Returns current window if "vp" is number zero. |
d0241e74bfdb
patch 8.2.4928: various white space and cosmetic mistakes
Bram Moolenaar <Bram@vim.org>
parents:
28580
diff
changeset
|
160 * Returns NULL if not found. |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
161 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
162 win_T * |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
163 find_win_by_nr( |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
164 typval_T *vp, |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
165 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
|
166 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
167 win_T *wp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
168 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
|
169 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
170 if (nr < 0) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
171 return NULL; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
172 if (nr == 0) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
173 return curwin; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
174 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
175 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
|
176 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
177 if (nr >= LOWEST_WIN_ID) |
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 if (wp->w_id == nr) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
180 return wp; |
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 else if (--nr <= 0) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
183 break; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
184 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
185 if (nr >= LOWEST_WIN_ID) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
186 { |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18259
diff
changeset
|
187 #ifdef FEAT_PROP_POPUP |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
188 // 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
|
189 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
|
190 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
|
191 if (wp->w_id == nr) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
192 return wp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
193 // 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
|
194 FOR_ALL_POPUPWINS(wp) |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
195 if (wp->w_id == nr) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
196 return wp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
197 #endif |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
198 return NULL; |
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 return wp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
201 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
202 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
203 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
204 * 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
|
205 * 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
|
206 * 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
|
207 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
208 win_T * |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
209 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
|
210 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
211 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
|
212 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
213 if (nr >= LOWEST_WIN_ID) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
214 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
|
215 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
|
216 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
217 |
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 * 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
|
220 * 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
|
221 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
222 win_T * |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
223 find_tabwin( |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
224 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
|
225 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
|
226 tabpage_T **ptp) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
227 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
228 win_T *wp = NULL; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
229 tabpage_T *tp = NULL; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
230 long n; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
231 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
232 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
|
233 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
234 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
|
235 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
236 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
|
237 if (n >= 0) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
238 tp = find_tabpage(n); |
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 else |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
241 tp = curtab; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
242 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
243 if (tp != NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
244 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
245 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
|
246 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
|
247 && wvp->vval.v_number != -1) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
248 // 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
|
249 tp = NULL; |
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 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
252 else |
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 wp = curwin; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
255 tp = curtab; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
256 } |
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 if (ptp != NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
259 *ptp = tp; |
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 return wp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
262 } |
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 /* |
30001
6c1a9d7a931f
patch 9.0.0338: return value of list_append_list() not always checked
Bram Moolenaar <Bram@vim.org>
parents:
29994
diff
changeset
|
265 * Get the layout of the given tab page for winlayout() and add it to "l". |
18010
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 static void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
268 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
|
269 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
270 frame_T *child; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
271 list_T *fr_list; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
272 list_T *win_list; |
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 (fr == NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
275 return; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
276 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
277 if (outer) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
278 // outermost call from f_winlayout() |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
279 fr_list = l; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
280 else |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
281 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
282 fr_list = list_alloc(); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
283 if (fr_list == NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
284 return; |
30001
6c1a9d7a931f
patch 9.0.0338: return value of list_append_list() not always checked
Bram Moolenaar <Bram@vim.org>
parents:
29994
diff
changeset
|
285 if (list_append_list(l, fr_list) == FAIL) |
6c1a9d7a931f
patch 9.0.0338: return value of list_append_list() not always checked
Bram Moolenaar <Bram@vim.org>
parents:
29994
diff
changeset
|
286 { |
6c1a9d7a931f
patch 9.0.0338: return value of list_append_list() not always checked
Bram Moolenaar <Bram@vim.org>
parents:
29994
diff
changeset
|
287 vim_free(fr_list); |
6c1a9d7a931f
patch 9.0.0338: return value of list_append_list() not always checked
Bram Moolenaar <Bram@vim.org>
parents:
29994
diff
changeset
|
288 return; |
6c1a9d7a931f
patch 9.0.0338: return value of list_append_list() not always checked
Bram Moolenaar <Bram@vim.org>
parents:
29994
diff
changeset
|
289 } |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
290 } |
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 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
|
293 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
294 if (fr->fr_win != NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
295 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
296 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
|
297 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
|
298 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
299 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
300 else |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
301 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
302 list_append_string(fr_list, |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
303 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
|
304 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
305 win_list = list_alloc(); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
306 if (win_list == NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
307 return; |
30001
6c1a9d7a931f
patch 9.0.0338: return value of list_append_list() not always checked
Bram Moolenaar <Bram@vim.org>
parents:
29994
diff
changeset
|
308 if (list_append_list(fr_list, win_list) == FAIL) |
6c1a9d7a931f
patch 9.0.0338: return value of list_append_list() not always checked
Bram Moolenaar <Bram@vim.org>
parents:
29994
diff
changeset
|
309 { |
6c1a9d7a931f
patch 9.0.0338: return value of list_append_list() not always checked
Bram Moolenaar <Bram@vim.org>
parents:
29994
diff
changeset
|
310 vim_free(win_list); |
6c1a9d7a931f
patch 9.0.0338: return value of list_append_list() not always checked
Bram Moolenaar <Bram@vim.org>
parents:
29994
diff
changeset
|
311 return; |
6c1a9d7a931f
patch 9.0.0338: return value of list_append_list() not always checked
Bram Moolenaar <Bram@vim.org>
parents:
29994
diff
changeset
|
312 } |
6c1a9d7a931f
patch 9.0.0338: return value of list_append_list() not always checked
Bram Moolenaar <Bram@vim.org>
parents:
29994
diff
changeset
|
313 |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
314 child = fr->fr_child; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
315 while (child != NULL) |
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 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
|
318 child = child->fr_next; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
319 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
320 } |
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 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
323 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
324 * 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
|
325 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
326 static int |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
327 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
|
328 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
329 win_T *twin; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
330 int nr = 1; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
331 win_T *wp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
332 char_u *arg; |
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) ? curwin : tp->tp_curwin; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
335 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
|
336 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
337 int invalid_arg = FALSE; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
338 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
339 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
|
340 if (arg == NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
341 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
|
342 else if (STRCMP(arg, "$") == 0) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
343 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
|
344 else if (STRCMP(arg, "#") == 0) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
345 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
346 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
|
347 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
348 else |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
349 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
350 long count; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
351 char_u *endp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
352 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
353 // 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
|
354 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
|
355 if (count <= 0) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
356 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
|
357 if (endp != NULL && *endp != '\0') |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
358 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
359 if (STRCMP(endp, "j") == 0) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
360 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
|
361 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
|
362 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
|
363 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
|
364 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
|
365 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
|
366 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
|
367 else |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
368 invalid_arg = TRUE; |
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 else |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
371 invalid_arg = TRUE; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
372 } |
19291
1d6bc6b31c2e
patch 8.2.0204: crash when using winnr('j') in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19114
diff
changeset
|
373 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
|
374 nr = 0; |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
375 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
376 if (invalid_arg) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
377 { |
25064
8f2262c72178
patch 8.2.3069: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
24180
diff
changeset
|
378 semsg(_(e_invalid_expression_str), arg); |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
379 nr = 0; |
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 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
382 |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31600
diff
changeset
|
383 if (nr <= 0) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31600
diff
changeset
|
384 return 0; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31600
diff
changeset
|
385 |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31600
diff
changeset
|
386 for (wp = (tp == curtab) ? firstwin : tp->tp_firstwin; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31600
diff
changeset
|
387 wp != twin; wp = wp->w_next) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31600
diff
changeset
|
388 { |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31600
diff
changeset
|
389 if (wp == NULL) |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
390 { |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31600
diff
changeset
|
391 // didn't find it in this tabpage |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31600
diff
changeset
|
392 nr = 0; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31600
diff
changeset
|
393 break; |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
394 } |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31600
diff
changeset
|
395 ++nr; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31600
diff
changeset
|
396 } |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
397 return nr; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
398 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
399 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
400 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
401 * 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
|
402 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
403 static dict_T * |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
404 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
|
405 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
406 dict_T *dict; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
407 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
408 dict = dict_alloc(); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
409 if (dict == NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
410 return NULL; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
411 |
28546
65ff2409cba4
patch 8.2.4797: getwininfo() may get oudated values
Bram Moolenaar <Bram@vim.org>
parents:
28522
diff
changeset
|
412 // make sure w_botline is valid |
65ff2409cba4
patch 8.2.4797: getwininfo() may get oudated values
Bram Moolenaar <Bram@vim.org>
parents:
28522
diff
changeset
|
413 validate_botline_win(wp); |
65ff2409cba4
patch 8.2.4797: getwininfo() may get oudated values
Bram Moolenaar <Bram@vim.org>
parents:
28522
diff
changeset
|
414 |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
415 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
|
416 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
|
417 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
|
418 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
|
419 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
|
420 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
|
421 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
|
422 #ifdef FEAT_MENU |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
423 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
|
424 #endif |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
425 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
|
426 dict_add_number(dict, "wincol", wp->w_wincol + 1); |
26191
72c394673e00
patch 8.2.3627: difficult to know where the text starts in a window
Bram Moolenaar <Bram@vim.org>
parents:
26121
diff
changeset
|
427 dict_add_number(dict, "textoff", win_col_off(wp)); |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
428 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
|
429 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
430 #ifdef FEAT_TERMINAL |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
431 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
|
432 #endif |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
433 #ifdef FEAT_QUICKFIX |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
434 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
|
435 dict_add_number(dict, "loclist", |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
436 (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
|
437 #endif |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
438 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
439 // 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
|
440 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
|
441 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
442 return dict; |
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 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
445 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
446 * 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
|
447 * as a dictionary. |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
448 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
449 static dict_T * |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
450 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
|
451 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
452 win_T *wp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
453 dict_T *dict; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
454 list_T *l; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
455 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
456 dict = dict_alloc(); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
457 if (dict == NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
458 return NULL; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
459 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
460 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
|
461 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
462 l = list_alloc(); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
463 if (l != NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
464 { |
19934
3ff714d765ba
patch 8.2.0523: loops are repeated
Bram Moolenaar <Bram@vim.org>
parents:
19888
diff
changeset
|
465 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
|
466 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
|
467 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
|
468 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
469 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
470 // 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
|
471 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
|
472 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
473 return dict; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
474 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
475 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
476 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
477 * "gettabinfo()" function |
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 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
480 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
|
481 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
482 tabpage_T *tp, *tparg = NULL; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
483 dict_T *d; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
484 int tpnr = 0; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
485 |
29175
755ab148288b
patch 8.2.5107: some callers of rettv_list_alloc() check for not OK
Bram Moolenaar <Bram@vim.org>
parents:
28809
diff
changeset
|
486 if (rettv_list_alloc(rettv) == FAIL) |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
487 return; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
488 |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
489 if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL) |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
490 return; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
491 |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
492 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
|
493 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
494 // Information about one tab page |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
495 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
|
496 if (tparg == NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
497 return; |
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 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
500 // 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
|
501 FOR_ALL_TABPAGES(tp) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
502 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
503 tpnr++; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
504 if (tparg != NULL && tp != tparg) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
505 continue; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
506 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
|
507 if (d != NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
508 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
|
509 if (tparg != NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
510 return; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
511 } |
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 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
515 * "getwininfo()" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
516 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
517 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
518 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
|
519 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
520 tabpage_T *tp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
521 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
|
522 dict_T *d; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
523 short tabnr = 0, winnr; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
524 |
29175
755ab148288b
patch 8.2.5107: some callers of rettv_list_alloc() check for not OK
Bram Moolenaar <Bram@vim.org>
parents:
28809
diff
changeset
|
525 if (rettv_list_alloc(rettv) == FAIL) |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
526 return; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
527 |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
528 if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL) |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
529 return; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
530 |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
531 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
|
532 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
533 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
|
534 if (wparg == NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
535 return; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
536 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
537 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
538 // 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
|
539 // pages or one particular window. |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
540 FOR_ALL_TABPAGES(tp) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
541 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
542 tabnr++; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
543 winnr = 0; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
544 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
|
545 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
546 winnr++; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
547 if (wparg != NULL && wp != wparg) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
548 continue; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
549 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
|
550 if (d != NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
551 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
|
552 if (wparg != NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
553 // 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
|
554 return; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
555 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
556 } |
22357
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22135
diff
changeset
|
557 #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
|
558 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
|
559 { |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22135
diff
changeset
|
560 tabnr = 0; |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22135
diff
changeset
|
561 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
|
562 { |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22135
diff
changeset
|
563 tabnr++; |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22135
diff
changeset
|
564 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
|
565 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
|
566 break; |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22135
diff
changeset
|
567 } |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22135
diff
changeset
|
568 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
|
569 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
|
570 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
|
571 } |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22135
diff
changeset
|
572 #endif |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
573 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
574 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
575 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
576 * "getwinpos({timeout})" function |
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 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
579 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
|
580 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
581 int x = -1; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
582 int y = -1; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
583 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
584 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
|
585 return; |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
586 |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
587 if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL) |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
588 return; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
589 |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
590 #if defined(FEAT_GUI) \ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
591 || (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
|
592 || defined(MSWIN) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
593 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
594 varnumber_T timeout = 100; |
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 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
|
597 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
|
598 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
599 (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
|
600 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
601 #endif |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
602 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
|
603 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
|
604 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
605 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
606 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
607 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
608 * "getwinposx()" function |
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 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
611 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
|
612 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
613 rettv->vval.v_number = -1; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
614 #if defined(FEAT_GUI) \ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
615 || (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
|
616 || defined(MSWIN) |
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 int x, y; |
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 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
|
622 rettv->vval.v_number = x; |
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 #endif |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
625 } |
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 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
628 * "getwinposy()" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
629 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
630 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
631 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
|
632 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
633 rettv->vval.v_number = -1; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
634 #if defined(FEAT_GUI) \ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
635 || (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
|
636 || defined(MSWIN) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
637 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
638 int x, y; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
639 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
640 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
|
641 rettv->vval.v_number = y; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
642 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
643 #endif |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
644 } |
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 * "tabpagenr()" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
648 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
649 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
650 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
|
651 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
652 int nr = 1; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
653 char_u *arg; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
654 |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
655 if (in_vim9script() && check_for_opt_string_arg(argvars, 0) == FAIL) |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
656 return; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
657 |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
658 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
|
659 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
660 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
|
661 nr = 0; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
662 if (arg != NULL) |
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 if (STRCMP(arg, "$") == 0) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
665 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
|
666 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
|
667 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
|
668 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
|
669 else |
25064
8f2262c72178
patch 8.2.3069: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
24180
diff
changeset
|
670 semsg(_(e_invalid_expression_str), arg); |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
671 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
672 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
673 else |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
674 nr = tabpage_index(curtab); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
675 rettv->vval.v_number = nr; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
676 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
677 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
678 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
679 * "tabpagewinnr()" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
680 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
681 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
682 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
|
683 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
684 int nr = 1; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
685 tabpage_T *tp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
686 |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
687 if (in_vim9script() |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
688 && (check_for_number_arg(argvars, 0) == FAIL |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25252
diff
changeset
|
689 || check_for_opt_string_arg(argvars, 1) == FAIL)) |
25252
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
690 return; |
acda780ffc3e
patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25064
diff
changeset
|
691 |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
692 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
|
693 if (tp == NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
694 nr = 0; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
695 else |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
696 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
|
697 rettv->vval.v_number = nr; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
698 } |
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 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
701 * "win_execute()" function |
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 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
704 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
|
705 { |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
706 int id; |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
707 tabpage_T *tp; |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
708 win_T *wp; |
26978
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26887
diff
changeset
|
709 switchwin_T switchwin; |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
710 |
23596
9fa72351c18f
patch 8.2.2340: win_execute() unexpectedly returns number zero when failing
Bram Moolenaar <Bram@vim.org>
parents:
23404
diff
changeset
|
711 // 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
|
712 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
|
713 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
|
714 |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
715 if (in_vim9script() |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
716 && (check_for_number_arg(argvars, 0) == FAIL |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
717 || check_for_string_or_list_arg(argvars, 1) == FAIL |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
718 || check_for_opt_string_arg(argvars, 2) == FAIL)) |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
719 return; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
720 |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
721 id = (int)tv_get_number(argvars); |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
722 wp = win_id2wp_tp(id, &tp); |
31600
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
723 if (wp == NULL || tp == NULL) |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
724 return; |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
725 |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
726 pos_T curpos = wp->w_cursor; |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
727 char_u cwd[MAXPATHL]; |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
728 int cwd_status = FAIL; |
26796
63be149f733c
patch 8.2.3926: build failure without the 'autochdir' option
Bram Moolenaar <Bram@vim.org>
parents:
26784
diff
changeset
|
729 #ifdef FEAT_AUTOCHDIR |
31600
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
730 char_u autocwd[MAXPATHL]; |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
731 int apply_acd = FALSE; |
26796
63be149f733c
patch 8.2.3926: build failure without the 'autochdir' option
Bram Moolenaar <Bram@vim.org>
parents:
26784
diff
changeset
|
732 #endif |
26784
c95a3f25b6b1
patch 8.2.3920: restoring directory after using another window is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
26666
diff
changeset
|
733 |
31600
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
734 // Getting and setting directory can be slow on some systems, only do |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
735 // this when the current or target window/tab have a local directory or |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
736 // 'acd' is set. |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
737 if (curwin != wp |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
738 && (curwin->w_localdir != NULL |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
739 || wp->w_localdir != NULL |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
740 || (curtab != tp |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
741 && (curtab->tp_localdir != NULL |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
742 || tp->tp_localdir != NULL)) |
27063
3bad1cf600ed
patch 8.2.4060: win_execute() slow on systems where getcwd()/chdir() is slow
Bram Moolenaar <Bram@vim.org>
parents:
27047
diff
changeset
|
743 #ifdef FEAT_AUTOCHDIR |
31600
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
744 || p_acd |
27063
3bad1cf600ed
patch 8.2.4060: win_execute() slow on systems where getcwd()/chdir() is slow
Bram Moolenaar <Bram@vim.org>
parents:
27047
diff
changeset
|
745 #endif |
31600
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
746 )) |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
747 cwd_status = mch_dirname(cwd, MAXPATHL); |
26784
c95a3f25b6b1
patch 8.2.3920: restoring directory after using another window is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
26666
diff
changeset
|
748 |
26796
63be149f733c
patch 8.2.3926: build failure without the 'autochdir' option
Bram Moolenaar <Bram@vim.org>
parents:
26784
diff
changeset
|
749 #ifdef FEAT_AUTOCHDIR |
31600
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
750 // If 'acd' is set, check we are using that directory. If yes, then |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
751 // apply 'acd' afterwards, otherwise restore the current directory. |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
752 if (cwd_status == OK && p_acd) |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
753 { |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
754 do_autochdir(); |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
755 apply_acd = mch_dirname(autocwd, MAXPATHL) == OK |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
756 && STRCMP(cwd, autocwd) == 0; |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
757 } |
26796
63be149f733c
patch 8.2.3926: build failure without the 'autochdir' option
Bram Moolenaar <Bram@vim.org>
parents:
26784
diff
changeset
|
758 #endif |
18259
f254dd2bc107
patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents:
18084
diff
changeset
|
759 |
31600
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
760 if (switch_win_noblock(&switchwin, wp, tp, TRUE) == OK) |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
761 { |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
762 check_cursor(); |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
763 execute_common(argvars, rettv, 1); |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
764 } |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
765 restore_win_noblock(&switchwin, TRUE); |
26796
63be149f733c
patch 8.2.3926: build failure without the 'autochdir' option
Bram Moolenaar <Bram@vim.org>
parents:
26784
diff
changeset
|
766 #ifdef FEAT_AUTOCHDIR |
31600
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
767 if (apply_acd) |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
768 do_autochdir(); |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
769 else |
26796
63be149f733c
patch 8.2.3926: build failure without the 'autochdir' option
Bram Moolenaar <Bram@vim.org>
parents:
26784
diff
changeset
|
770 #endif |
31600
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
771 if (cwd_status == OK) |
26784
c95a3f25b6b1
patch 8.2.3920: restoring directory after using another window is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
26666
diff
changeset
|
772 mch_chdir((char *)cwd); |
18259
f254dd2bc107
patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents:
18084
diff
changeset
|
773 |
31600
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
774 // Update the status line if the cursor moved. |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
775 if (win_valid(wp) && !EQUAL_POS(curpos, wp->w_cursor)) |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
776 wp->w_redr_status = TRUE; |
26994
8d9506f3542e
patch 8.2.4026: ml_get error with specific win_execute() command
Bram Moolenaar <Bram@vim.org>
parents:
26978
diff
changeset
|
777 |
31600
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
778 // In case the command moved the cursor or changed the Visual area, |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
779 // check it is valid. |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
780 check_cursor(); |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
781 if (VIsual_active) |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
782 check_pos(curbuf, &VIsual); |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
783 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
784 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
785 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
786 * "win_findbuf()" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
787 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
788 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
789 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
|
790 { |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
791 if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL) |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
792 return; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
793 |
29175
755ab148288b
patch 8.2.5107: some callers of rettv_list_alloc() check for not OK
Bram Moolenaar <Bram@vim.org>
parents:
28809
diff
changeset
|
794 if (rettv_list_alloc(rettv) == OK) |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
795 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
|
796 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
797 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
798 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
799 * "win_getid()" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
800 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
801 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
802 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
|
803 { |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
804 if (in_vim9script() |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
805 && (check_for_opt_number_arg(argvars, 0) == FAIL |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
806 || (argvars[0].v_type != VAR_UNKNOWN |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
807 && check_for_opt_number_arg(argvars, 1) == FAIL))) |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
808 return; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
809 |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
810 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
|
811 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
812 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
813 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
814 * "win_gotoid()" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
815 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
816 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
817 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
|
818 { |
18084
f4b51934d4f8
patch 8.1.2037: can call win_gotoid() in cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
18049
diff
changeset
|
819 win_T *wp; |
f4b51934d4f8
patch 8.1.2037: can call win_gotoid() in cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
18049
diff
changeset
|
820 tabpage_T *tp; |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
821 int id; |
18084
f4b51934d4f8
patch 8.1.2037: can call win_gotoid() in cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
18049
diff
changeset
|
822 |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
823 if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL) |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
824 return; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
825 |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
826 id = tv_get_number(&argvars[0]); |
18084
f4b51934d4f8
patch 8.1.2037: can call win_gotoid() in cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
18049
diff
changeset
|
827 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
|
828 { |
25064
8f2262c72178
patch 8.2.3069: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
24180
diff
changeset
|
829 emsg(_(e_invalid_in_cmdline_window)); |
18084
f4b51934d4f8
patch 8.1.2037: can call win_gotoid() in cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
18049
diff
changeset
|
830 return; |
f4b51934d4f8
patch 8.1.2037: can call win_gotoid() in cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
18049
diff
changeset
|
831 } |
28580
39df510f97c3
patch 8.2.4814: possible to leave a popup window with win_gotoid()
Bram Moolenaar <Bram@vim.org>
parents:
28546
diff
changeset
|
832 #if defined(FEAT_PROP_POPUP) && defined(FEAT_TERMINAL) |
39df510f97c3
patch 8.2.4814: possible to leave a popup window with win_gotoid()
Bram Moolenaar <Bram@vim.org>
parents:
28546
diff
changeset
|
833 if (popup_is_popup(curwin) && curbuf->b_term != NULL) |
39df510f97c3
patch 8.2.4814: possible to leave a popup window with win_gotoid()
Bram Moolenaar <Bram@vim.org>
parents:
28546
diff
changeset
|
834 { |
39df510f97c3
patch 8.2.4814: possible to leave a popup window with win_gotoid()
Bram Moolenaar <Bram@vim.org>
parents:
28546
diff
changeset
|
835 emsg(_(e_not_allowed_for_terminal_in_popup_window)); |
39df510f97c3
patch 8.2.4814: possible to leave a popup window with win_gotoid()
Bram Moolenaar <Bram@vim.org>
parents:
28546
diff
changeset
|
836 return; |
39df510f97c3
patch 8.2.4814: possible to leave a popup window with win_gotoid()
Bram Moolenaar <Bram@vim.org>
parents:
28546
diff
changeset
|
837 } |
39df510f97c3
patch 8.2.4814: possible to leave a popup window with win_gotoid()
Bram Moolenaar <Bram@vim.org>
parents:
28546
diff
changeset
|
838 #endif |
18084
f4b51934d4f8
patch 8.1.2037: can call win_gotoid() in cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
18049
diff
changeset
|
839 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
|
840 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
|
841 { |
28522
da28696e5340
patch 8.2.4785: Visual mode not stopped if win_gotoid() goes to other buffer
Bram Moolenaar <Bram@vim.org>
parents:
28315
diff
changeset
|
842 // When jumping to another buffer stop Visual mode. |
da28696e5340
patch 8.2.4785: Visual mode not stopped if win_gotoid() goes to other buffer
Bram Moolenaar <Bram@vim.org>
parents:
28315
diff
changeset
|
843 if (VIsual_active && wp->w_buffer != curbuf) |
da28696e5340
patch 8.2.4785: Visual mode not stopped if win_gotoid() goes to other buffer
Bram Moolenaar <Bram@vim.org>
parents:
28315
diff
changeset
|
844 end_visual_mode(); |
18084
f4b51934d4f8
patch 8.1.2037: can call win_gotoid() in cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
18049
diff
changeset
|
845 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
|
846 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
|
847 return; |
f4b51934d4f8
patch 8.1.2037: can call win_gotoid() in cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
18049
diff
changeset
|
848 } |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
849 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
850 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
851 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
852 * "win_id2tabwin()" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
853 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
854 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
855 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
|
856 { |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
857 if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL) |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
858 return; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
859 |
29175
755ab148288b
patch 8.2.5107: some callers of rettv_list_alloc() check for not OK
Bram Moolenaar <Bram@vim.org>
parents:
28809
diff
changeset
|
860 if (rettv_list_alloc(rettv) == OK) |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
861 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
|
862 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
863 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
864 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
865 * "win_id2win()" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
866 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
867 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
868 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
|
869 { |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
870 if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL) |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
871 return; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
872 |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
873 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
|
874 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
875 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
876 /* |
27047
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
877 * "win_move_separator()" function |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
878 */ |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
879 void |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
880 f_win_move_separator(typval_T *argvars, typval_T *rettv) |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
881 { |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
882 win_T *wp; |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
883 int offset; |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
884 |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
885 rettv->vval.v_number = FALSE; |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
886 |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
887 if (in_vim9script() |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
888 && (check_for_number_arg(argvars, 0) == FAIL |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
889 || check_for_number_arg(argvars, 1) == FAIL)) |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
890 return; |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
891 |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
892 wp = find_win_by_nr_or_id(&argvars[0]); |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
893 if (wp == NULL || win_valid_popup(wp)) |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
894 return; |
30978
1b194361b71a
patch 9.0.0824: crash when using win_move_separator() in other tab page
Bram Moolenaar <Bram@vim.org>
parents:
30972
diff
changeset
|
895 if (!win_valid(wp)) |
1b194361b71a
patch 9.0.0824: crash when using win_move_separator() in other tab page
Bram Moolenaar <Bram@vim.org>
parents:
30972
diff
changeset
|
896 { |
1b194361b71a
patch 9.0.0824: crash when using win_move_separator() in other tab page
Bram Moolenaar <Bram@vim.org>
parents:
30972
diff
changeset
|
897 emsg(_(e_cannot_resize_window_in_another_tab_page)); |
1b194361b71a
patch 9.0.0824: crash when using win_move_separator() in other tab page
Bram Moolenaar <Bram@vim.org>
parents:
30972
diff
changeset
|
898 return; |
1b194361b71a
patch 9.0.0824: crash when using win_move_separator() in other tab page
Bram Moolenaar <Bram@vim.org>
parents:
30972
diff
changeset
|
899 } |
27047
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
900 |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
901 offset = (int)tv_get_number(&argvars[1]); |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
902 win_drag_vsep_line(wp, offset); |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
903 rettv->vval.v_number = TRUE; |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
904 } |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
905 |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
906 /* |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
907 * "win_move_statusline()" function |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
908 */ |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
909 void |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
910 f_win_move_statusline(typval_T *argvars, typval_T *rettv) |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
911 { |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
912 win_T *wp; |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
913 int offset; |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
914 |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
915 rettv->vval.v_number = FALSE; |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
916 |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
917 if (in_vim9script() |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
918 && (check_for_number_arg(argvars, 0) == FAIL |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
919 || check_for_number_arg(argvars, 1) == FAIL)) |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
920 return; |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
921 |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
922 wp = find_win_by_nr_or_id(&argvars[0]); |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
923 if (wp == NULL || win_valid_popup(wp)) |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
924 return; |
30972
62a42d860d87
patch 9.0.0820: memory leak with empty shell command
Bram Moolenaar <Bram@vim.org>
parents:
30645
diff
changeset
|
925 if (!win_valid(wp)) |
62a42d860d87
patch 9.0.0820: memory leak with empty shell command
Bram Moolenaar <Bram@vim.org>
parents:
30645
diff
changeset
|
926 { |
62a42d860d87
patch 9.0.0820: memory leak with empty shell command
Bram Moolenaar <Bram@vim.org>
parents:
30645
diff
changeset
|
927 emsg(_(e_cannot_resize_window_in_another_tab_page)); |
62a42d860d87
patch 9.0.0820: memory leak with empty shell command
Bram Moolenaar <Bram@vim.org>
parents:
30645
diff
changeset
|
928 return; |
62a42d860d87
patch 9.0.0820: memory leak with empty shell command
Bram Moolenaar <Bram@vim.org>
parents:
30645
diff
changeset
|
929 } |
27047
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
930 |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
931 offset = (int)tv_get_number(&argvars[1]); |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
932 win_drag_status_line(wp, offset); |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
933 rettv->vval.v_number = TRUE; |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
934 } |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
935 |
b94cdb5ef20e
patch 8.2.4052: not easy to resize a window from a plugin
Bram Moolenaar <Bram@vim.org>
parents:
27028
diff
changeset
|
936 /* |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
937 * "win_screenpos()" function |
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 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
940 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
|
941 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
942 win_T *wp; |
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 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
|
945 return; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
946 |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
947 if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL) |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
948 return; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
949 |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
950 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
|
951 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
|
952 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
|
953 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
954 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
955 /* |
18049
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
956 * 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
|
957 */ |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
958 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
|
959 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
|
960 { |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
961 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
|
962 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
|
963 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
|
964 |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
965 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
|
966 return; |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
967 |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
968 // 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
|
969 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
|
970 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
|
971 |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
972 // 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
|
973 (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
|
974 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
|
975 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
|
976 (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
|
977 |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
978 // 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
|
979 (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
|
980 |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
981 // 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
|
982 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
|
983 { |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
984 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
|
985 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
|
986 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
|
987 } |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
988 |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
989 #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
|
990 // 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
|
991 // 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
|
992 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
|
993 #endif |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
994 |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
995 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
|
996 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
|
997 } |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
998 |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
999 /* |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
1000 * "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
|
1001 */ |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
1002 void |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
1003 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
|
1004 { |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
1005 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
|
1006 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
|
1007 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
|
1008 |
25302
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25252
diff
changeset
|
1009 if (in_vim9script() |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25252
diff
changeset
|
1010 && (check_for_number_arg(argvars, 0) == FAIL |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25252
diff
changeset
|
1011 || check_for_number_arg(argvars, 1) == FAIL |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25252
diff
changeset
|
1012 || check_for_opt_dict_arg(argvars, 2) == FAIL)) |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25252
diff
changeset
|
1013 return; |
4d3c68196d05
patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25252
diff
changeset
|
1014 |
18049
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
1015 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
|
1016 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
|
1017 |
19065
ef3633932b0c
patch 8.2.0093: win_splitmove() can make Vim hang
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1018 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
|
1019 || !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
|
1020 || 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
|
1021 { |
28809
d0241e74bfdb
patch 8.2.4928: various white space and cosmetic mistakes
Bram Moolenaar <Bram@vim.org>
parents:
28580
diff
changeset
|
1022 emsg(_(e_invalid_window_number)); |
18049
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
1023 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
|
1024 return; |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
1025 } |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
1026 |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
1027 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
|
1028 { |
28809
d0241e74bfdb
patch 8.2.4928: various white space and cosmetic mistakes
Bram Moolenaar <Bram@vim.org>
parents:
28580
diff
changeset
|
1029 dict_T *d; |
d0241e74bfdb
patch 8.2.4928: various white space and cosmetic mistakes
Bram Moolenaar <Bram@vim.org>
parents:
28580
diff
changeset
|
1030 dictitem_T *di; |
18049
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
1031 |
29994
86eb4aba16c3
patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents:
29442
diff
changeset
|
1032 if (check_for_nonnull_dict_arg(argvars, 2) == FAIL) |
28809
d0241e74bfdb
patch 8.2.4928: various white space and cosmetic mistakes
Bram Moolenaar <Bram@vim.org>
parents:
28580
diff
changeset
|
1033 return; |
18049
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
1034 |
28809
d0241e74bfdb
patch 8.2.4928: various white space and cosmetic mistakes
Bram Moolenaar <Bram@vim.org>
parents:
28580
diff
changeset
|
1035 d = argvars[2].vval.v_dict; |
29442
827d9f2b7a71
patch 9.0.0063: too many type casts for dict_get functions
Bram Moolenaar <Bram@vim.org>
parents:
29175
diff
changeset
|
1036 if (dict_get_bool(d, "vertical", FALSE)) |
28809
d0241e74bfdb
patch 8.2.4928: various white space and cosmetic mistakes
Bram Moolenaar <Bram@vim.org>
parents:
28580
diff
changeset
|
1037 flags |= WSP_VERT; |
d0241e74bfdb
patch 8.2.4928: various white space and cosmetic mistakes
Bram Moolenaar <Bram@vim.org>
parents:
28580
diff
changeset
|
1038 if ((di = dict_find(d, (char_u *)"rightbelow", -1)) != NULL) |
d0241e74bfdb
patch 8.2.4928: various white space and cosmetic mistakes
Bram Moolenaar <Bram@vim.org>
parents:
28580
diff
changeset
|
1039 flags |= tv_get_bool(&di->di_tv) ? WSP_BELOW : WSP_ABOVE; |
29442
827d9f2b7a71
patch 9.0.0063: too many type casts for dict_get functions
Bram Moolenaar <Bram@vim.org>
parents:
29175
diff
changeset
|
1040 size = (int)dict_get_number(d, "size"); |
18049
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
1041 } |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
1042 |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
1043 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
|
1044 } |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
1045 |
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
1046 /* |
19398
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
1047 * "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
|
1048 */ |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
1049 void |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
1050 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
|
1051 { |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
1052 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
|
1053 |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
1054 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
|
1055 rettv->vval.v_string = NULL; |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
1056 |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
1057 if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL) |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
1058 return; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
1059 |
19398
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
1060 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
|
1061 { |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
1062 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
|
1063 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
|
1064 { |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
1065 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
|
1066 return; |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
1067 } |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
1068 } |
31263
d8e7d725a666
patch 9.0.0965: using one window for executing autocommands is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
31140
diff
changeset
|
1069 if (is_aucmd_win(wp)) |
20889
27401f09fe9b
patch 8.2.0996: using "aucmdwin" in win_gettype() is not ideal
Bram Moolenaar <Bram@vim.org>
parents:
20879
diff
changeset
|
1070 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
|
1071 #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
|
1072 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
|
1073 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
|
1074 #endif |
19398
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
1075 #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
|
1076 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
|
1077 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
|
1078 #endif |
20879
0ab45b558621
patch 8.2.0991: cannot get window type for autocmd and preview window
Bram Moolenaar <Bram@vim.org>
parents:
19934
diff
changeset
|
1079 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
|
1080 rettv->vval.v_string = vim_strsave((char_u *)"command"); |
25435
6ad76124ddda
patch 8.2.3254: win_gettype() does not recognize a quickfix window
Bram Moolenaar <Bram@vim.org>
parents:
25384
diff
changeset
|
1081 #ifdef FEAT_QUICKFIX |
6ad76124ddda
patch 8.2.3254: win_gettype() does not recognize a quickfix window
Bram Moolenaar <Bram@vim.org>
parents:
25384
diff
changeset
|
1082 else if (bt_quickfix(wp->w_buffer)) |
6ad76124ddda
patch 8.2.3254: win_gettype() does not recognize a quickfix window
Bram Moolenaar <Bram@vim.org>
parents:
25384
diff
changeset
|
1083 rettv->vval.v_string = vim_strsave((char_u *) |
6ad76124ddda
patch 8.2.3254: win_gettype() does not recognize a quickfix window
Bram Moolenaar <Bram@vim.org>
parents:
25384
diff
changeset
|
1084 (wp->w_llist_ref != NULL ? "loclist" : "quickfix")); |
6ad76124ddda
patch 8.2.3254: win_gettype() does not recognize a quickfix window
Bram Moolenaar <Bram@vim.org>
parents:
25384
diff
changeset
|
1085 #endif |
6ad76124ddda
patch 8.2.3254: win_gettype() does not recognize a quickfix window
Bram Moolenaar <Bram@vim.org>
parents:
25384
diff
changeset
|
1086 |
19398
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
1087 } |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
1088 |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
1089 /* |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
1090 * "getcmdwintype()" function |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
1091 */ |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
1092 void |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
1093 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
|
1094 { |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
1095 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
|
1096 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
|
1097 rettv->vval.v_string = alloc(2); |
31600
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
1098 if (rettv->vval.v_string == NULL) |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
1099 return; |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
1100 |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
1101 rettv->vval.v_string[0] = cmdwin_type; |
f1d5ad2b978e
patch 9.0.1132: code is indented more than needed
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
1102 rettv->vval.v_string[1] = NUL; |
19398
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
1103 } |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
1104 |
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
1105 /* |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1106 * "winbufnr(nr)" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1107 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1108 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1109 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
|
1110 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1111 win_T *wp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1112 |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
1113 if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL) |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
1114 return; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
1115 |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1116 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
|
1117 if (wp == NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1118 rettv->vval.v_number = -1; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1119 else |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1120 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
|
1121 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1122 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1123 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1124 * "wincol()" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1125 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1126 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1127 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
|
1128 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1129 validate_cursor(); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1130 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
|
1131 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1132 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1133 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1134 * "winheight(nr)" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1135 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1136 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1137 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
|
1138 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1139 win_T *wp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1140 |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
1141 if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL) |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
1142 return; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
1143 |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1144 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
|
1145 if (wp == NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1146 rettv->vval.v_number = -1; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1147 else |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1148 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
|
1149 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1150 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1151 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1152 * "winlayout()" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1153 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1154 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1155 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
|
1156 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1157 tabpage_T *tp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1158 |
29175
755ab148288b
patch 8.2.5107: some callers of rettv_list_alloc() check for not OK
Bram Moolenaar <Bram@vim.org>
parents:
28809
diff
changeset
|
1159 if (rettv_list_alloc(rettv) == FAIL) |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1160 return; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1161 |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
1162 if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL) |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
1163 return; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
1164 |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1165 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
|
1166 tp = curtab; |
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 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1169 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
|
1170 if (tp == NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1171 return; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1172 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1173 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1174 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
|
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 * "winline()" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1179 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1180 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1181 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
|
1182 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1183 validate_cursor(); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1184 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
|
1185 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1186 |
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 * "winnr()" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1189 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1190 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1191 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
|
1192 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1193 int nr = 1; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1194 |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
1195 if (in_vim9script() && check_for_opt_string_arg(argvars, 0) == FAIL) |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
1196 return; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
1197 |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1198 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
|
1199 rettv->vval.v_number = nr; |
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 |
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 * "winrestcmd()" function |
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 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1206 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
|
1207 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1208 win_T *wp; |
24180
3c165c7432ff
patch 8.2.2631: commands from winrestcmd() do not always work properly
Bram Moolenaar <Bram@vim.org>
parents:
23596
diff
changeset
|
1209 int i; |
3c165c7432ff
patch 8.2.2631: commands from winrestcmd() do not always work properly
Bram Moolenaar <Bram@vim.org>
parents:
23596
diff
changeset
|
1210 int winnr; |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1211 garray_T ga; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1212 char_u buf[50]; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1213 |
27028
c9474ae175f4
patch 8.2.4043: using int for second argument of ga_init2()
Bram Moolenaar <Bram@vim.org>
parents:
26994
diff
changeset
|
1214 ga_init2(&ga, sizeof(char), 70); |
24180
3c165c7432ff
patch 8.2.2631: commands from winrestcmd() do not always work properly
Bram Moolenaar <Bram@vim.org>
parents:
23596
diff
changeset
|
1215 |
3c165c7432ff
patch 8.2.2631: commands from winrestcmd() do not always work properly
Bram Moolenaar <Bram@vim.org>
parents:
23596
diff
changeset
|
1216 // Do this twice to handle some window layouts properly. |
3c165c7432ff
patch 8.2.2631: commands from winrestcmd() do not always work properly
Bram Moolenaar <Bram@vim.org>
parents:
23596
diff
changeset
|
1217 for (i = 0; i < 2; ++i) |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1218 { |
24180
3c165c7432ff
patch 8.2.2631: commands from winrestcmd() do not always work properly
Bram Moolenaar <Bram@vim.org>
parents:
23596
diff
changeset
|
1219 winnr = 1; |
3c165c7432ff
patch 8.2.2631: commands from winrestcmd() do not always work properly
Bram Moolenaar <Bram@vim.org>
parents:
23596
diff
changeset
|
1220 FOR_ALL_WINDOWS(wp) |
3c165c7432ff
patch 8.2.2631: commands from winrestcmd() do not always work properly
Bram Moolenaar <Bram@vim.org>
parents:
23596
diff
changeset
|
1221 { |
3c165c7432ff
patch 8.2.2631: commands from winrestcmd() do not always work properly
Bram Moolenaar <Bram@vim.org>
parents:
23596
diff
changeset
|
1222 sprintf((char *)buf, ":%dresize %d|", winnr, wp->w_height); |
3c165c7432ff
patch 8.2.2631: commands from winrestcmd() do not always work properly
Bram Moolenaar <Bram@vim.org>
parents:
23596
diff
changeset
|
1223 ga_concat(&ga, buf); |
3c165c7432ff
patch 8.2.2631: commands from winrestcmd() do not always work properly
Bram Moolenaar <Bram@vim.org>
parents:
23596
diff
changeset
|
1224 sprintf((char *)buf, "vert :%dresize %d|", winnr, wp->w_width); |
3c165c7432ff
patch 8.2.2631: commands from winrestcmd() do not always work properly
Bram Moolenaar <Bram@vim.org>
parents:
23596
diff
changeset
|
1225 ga_concat(&ga, buf); |
3c165c7432ff
patch 8.2.2631: commands from winrestcmd() do not always work properly
Bram Moolenaar <Bram@vim.org>
parents:
23596
diff
changeset
|
1226 ++winnr; |
3c165c7432ff
patch 8.2.2631: commands from winrestcmd() do not always work properly
Bram Moolenaar <Bram@vim.org>
parents:
23596
diff
changeset
|
1227 } |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1228 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1229 ga_append(&ga, NUL); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1230 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1231 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
|
1232 rettv->v_type = VAR_STRING; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1233 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1234 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1235 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1236 * "winrestview()" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1237 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1238 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1239 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
|
1240 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1241 dict_T *dict; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1242 |
29994
86eb4aba16c3
patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents:
29442
diff
changeset
|
1243 if (check_for_nonnull_dict_arg(argvars, 0) == FAIL) |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
1244 return; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
1245 |
29994
86eb4aba16c3
patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents:
29442
diff
changeset
|
1246 dict = argvars[0].vval.v_dict; |
86eb4aba16c3
patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents:
29442
diff
changeset
|
1247 if (dict_has_key(dict, "lnum")) |
86eb4aba16c3
patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents:
29442
diff
changeset
|
1248 curwin->w_cursor.lnum = (linenr_T)dict_get_number(dict, "lnum"); |
86eb4aba16c3
patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents:
29442
diff
changeset
|
1249 if (dict_has_key(dict, "col")) |
86eb4aba16c3
patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents:
29442
diff
changeset
|
1250 curwin->w_cursor.col = (colnr_T)dict_get_number(dict, "col"); |
86eb4aba16c3
patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents:
29442
diff
changeset
|
1251 if (dict_has_key(dict, "coladd")) |
86eb4aba16c3
patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents:
29442
diff
changeset
|
1252 curwin->w_cursor.coladd = (colnr_T)dict_get_number(dict, "coladd"); |
86eb4aba16c3
patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents:
29442
diff
changeset
|
1253 if (dict_has_key(dict, "curswant")) |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1254 { |
29994
86eb4aba16c3
patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents:
29442
diff
changeset
|
1255 curwin->w_curswant = (colnr_T)dict_get_number(dict, "curswant"); |
86eb4aba16c3
patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents:
29442
diff
changeset
|
1256 curwin->w_set_curswant = FALSE; |
86eb4aba16c3
patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents:
29442
diff
changeset
|
1257 } |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1258 |
29994
86eb4aba16c3
patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents:
29442
diff
changeset
|
1259 if (dict_has_key(dict, "topline")) |
86eb4aba16c3
patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents:
29442
diff
changeset
|
1260 set_topline(curwin, (linenr_T)dict_get_number(dict, "topline")); |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1261 #ifdef FEAT_DIFF |
29994
86eb4aba16c3
patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents:
29442
diff
changeset
|
1262 if (dict_has_key(dict, "topfill")) |
86eb4aba16c3
patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents:
29442
diff
changeset
|
1263 curwin->w_topfill = (int)dict_get_number(dict, "topfill"); |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1264 #endif |
29994
86eb4aba16c3
patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents:
29442
diff
changeset
|
1265 if (dict_has_key(dict, "leftcol")) |
86eb4aba16c3
patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents:
29442
diff
changeset
|
1266 curwin->w_leftcol = (colnr_T)dict_get_number(dict, "leftcol"); |
86eb4aba16c3
patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents:
29442
diff
changeset
|
1267 if (dict_has_key(dict, "skipcol")) |
86eb4aba16c3
patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents:
29442
diff
changeset
|
1268 curwin->w_skipcol = (colnr_T)dict_get_number(dict, "skipcol"); |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1269 |
29994
86eb4aba16c3
patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents:
29442
diff
changeset
|
1270 check_cursor(); |
86eb4aba16c3
patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents:
29442
diff
changeset
|
1271 win_new_height(curwin, curwin->w_height); |
86eb4aba16c3
patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents:
29442
diff
changeset
|
1272 win_new_width(curwin, curwin->w_width); |
86eb4aba16c3
patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents:
29442
diff
changeset
|
1273 changed_window_setting(); |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1274 |
29994
86eb4aba16c3
patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents:
29442
diff
changeset
|
1275 if (curwin->w_topline <= 0) |
86eb4aba16c3
patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents:
29442
diff
changeset
|
1276 curwin->w_topline = 1; |
86eb4aba16c3
patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents:
29442
diff
changeset
|
1277 if (curwin->w_topline > curbuf->b_ml.ml_line_count) |
86eb4aba16c3
patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents:
29442
diff
changeset
|
1278 curwin->w_topline = curbuf->b_ml.ml_line_count; |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1279 #ifdef FEAT_DIFF |
29994
86eb4aba16c3
patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents:
29442
diff
changeset
|
1280 check_topfill(curwin, TRUE); |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1281 #endif |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1282 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1283 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1284 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1285 * "winsaveview()" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1286 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1287 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1288 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
|
1289 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1290 dict_T *dict; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1291 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1292 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
|
1293 return; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1294 dict = rettv->vval.v_dict; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1295 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1296 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
|
1297 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
|
1298 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
|
1299 update_curswant(); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1300 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
|
1301 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1302 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
|
1303 #ifdef FEAT_DIFF |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1304 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
|
1305 #endif |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1306 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
|
1307 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
|
1308 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1309 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1310 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1311 * "winwidth(nr)" function |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1312 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1313 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1314 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
|
1315 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1316 win_T *wp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1317 |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
1318 if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL) |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
1319 return; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25302
diff
changeset
|
1320 |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1321 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
|
1322 if (wp == NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1323 rettv->vval.v_number = -1; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1324 else |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1325 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
|
1326 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1327 #endif // FEAT_EVAL |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1328 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1329 #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
|
1330 || defined(PROTO) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1331 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1332 * 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
|
1333 * 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
|
1334 * 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
|
1335 * 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
|
1336 * 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
|
1337 * 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
|
1338 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1339 int |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1340 switch_win( |
26978
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26887
diff
changeset
|
1341 switchwin_T *switchwin, |
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26887
diff
changeset
|
1342 win_T *win, |
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26887
diff
changeset
|
1343 tabpage_T *tp, |
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26887
diff
changeset
|
1344 int no_display) |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1345 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1346 block_autocmds(); |
26978
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26887
diff
changeset
|
1347 return switch_win_noblock(switchwin, win, tp, no_display); |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1348 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1349 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1350 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1351 * 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
|
1352 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1353 int |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1354 switch_win_noblock( |
26978
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26887
diff
changeset
|
1355 switchwin_T *switchwin, |
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26887
diff
changeset
|
1356 win_T *win, |
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26887
diff
changeset
|
1357 tabpage_T *tp, |
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26887
diff
changeset
|
1358 int no_display) |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1359 { |
26978
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26887
diff
changeset
|
1360 CLEAR_POINTER(switchwin); |
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26887
diff
changeset
|
1361 switchwin->sw_curwin = curwin; |
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26887
diff
changeset
|
1362 if (win == curwin) |
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26887
diff
changeset
|
1363 switchwin->sw_same_win = TRUE; |
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26887
diff
changeset
|
1364 else |
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26887
diff
changeset
|
1365 { |
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26887
diff
changeset
|
1366 // Disable Visual selection, because redrawing may fail. |
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26887
diff
changeset
|
1367 switchwin->sw_visual_active = VIsual_active; |
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26887
diff
changeset
|
1368 VIsual_active = FALSE; |
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26887
diff
changeset
|
1369 } |
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26887
diff
changeset
|
1370 |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1371 if (tp != NULL) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1372 { |
26978
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26887
diff
changeset
|
1373 switchwin->sw_curtab = curtab; |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1374 if (no_display) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1375 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1376 curtab->tp_firstwin = firstwin; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1377 curtab->tp_lastwin = lastwin; |
26666
bbcbb3c13fba
patch 8.2.3862: crash on exit with EXITFREE and using win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
26191
diff
changeset
|
1378 curtab->tp_topframe = topframe; |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1379 curtab = tp; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1380 firstwin = curtab->tp_firstwin; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1381 lastwin = curtab->tp_lastwin; |
26666
bbcbb3c13fba
patch 8.2.3862: crash on exit with EXITFREE and using win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
26191
diff
changeset
|
1382 topframe = curtab->tp_topframe; |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1383 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1384 else |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1385 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
|
1386 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1387 if (!win_valid(win)) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1388 return FAIL; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1389 curwin = win; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1390 curbuf = curwin->w_buffer; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1391 return OK; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1392 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1393 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1394 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1395 * 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
|
1396 * 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
|
1397 * triggered. |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1398 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1399 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1400 restore_win( |
26978
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26887
diff
changeset
|
1401 switchwin_T *switchwin, |
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26887
diff
changeset
|
1402 int no_display) |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1403 { |
26978
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26887
diff
changeset
|
1404 restore_win_noblock(switchwin, no_display); |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1405 unblock_autocmds(); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1406 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1407 |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1408 /* |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1409 * 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
|
1410 */ |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1411 void |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1412 restore_win_noblock( |
26978
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26887
diff
changeset
|
1413 switchwin_T *switchwin, |
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26887
diff
changeset
|
1414 int no_display) |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1415 { |
26978
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26887
diff
changeset
|
1416 if (switchwin->sw_curtab != NULL && valid_tabpage(switchwin->sw_curtab)) |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1417 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1418 if (no_display) |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1419 { |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1420 curtab->tp_firstwin = firstwin; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1421 curtab->tp_lastwin = lastwin; |
26666
bbcbb3c13fba
patch 8.2.3862: crash on exit with EXITFREE and using win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
26191
diff
changeset
|
1422 curtab->tp_topframe = topframe; |
26978
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26887
diff
changeset
|
1423 curtab = switchwin->sw_curtab; |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1424 firstwin = curtab->tp_firstwin; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1425 lastwin = curtab->tp_lastwin; |
26666
bbcbb3c13fba
patch 8.2.3862: crash on exit with EXITFREE and using win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
26191
diff
changeset
|
1426 topframe = curtab->tp_topframe; |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1427 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1428 else |
26978
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26887
diff
changeset
|
1429 goto_tabpage_tp(switchwin->sw_curtab, FALSE, FALSE); |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1430 } |
26978
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26887
diff
changeset
|
1431 |
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26887
diff
changeset
|
1432 if (!switchwin->sw_same_win) |
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26887
diff
changeset
|
1433 VIsual_active = switchwin->sw_visual_active; |
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26887
diff
changeset
|
1434 |
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26887
diff
changeset
|
1435 if (win_valid(switchwin->sw_curwin)) |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1436 { |
26978
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26887
diff
changeset
|
1437 curwin = switchwin->sw_curwin; |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1438 curbuf = curwin->w_buffer; |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1439 } |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18259
diff
changeset
|
1440 # ifdef FEAT_PROP_POPUP |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1441 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
|
1442 // 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
|
1443 // to the first valid window. |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1444 win_goto(firstwin); |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1445 # endif |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1446 } |
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1447 #endif |