1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
|
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0184
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 8.1.0187 (after 8.1.0184)
Problem: getwininfo() and win_screenpos() return different numbers.
Solution: Add one to "wincol" and "winrow" from getwininfo().
Files: src/evalfunc.c, src/testdir/test_bufwintabinfo.vim,
runtime/doc/eval.txt
*** ../vim-8.1.0186/src/evalfunc.c Sat Jul 14 21:41:38 2018
--- src/evalfunc.c Sun Jul 15 16:51:34 2018
***************
*** 5648,5659 ****
dict_add_number(dict, "winnr", winnr);
dict_add_number(dict, "winid", wp->w_id);
dict_add_number(dict, "height", wp->w_height);
! dict_add_number(dict, "winrow", wp->w_winrow);
#ifdef FEAT_MENU
dict_add_number(dict, "winbar", wp->w_winbar_height);
#endif
dict_add_number(dict, "width", wp->w_width);
! dict_add_number(dict, "wincol", wp->w_wincol);
dict_add_number(dict, "bufnr", wp->w_buffer->b_fnum);
#ifdef FEAT_TERMINAL
--- 5648,5659 ----
dict_add_number(dict, "winnr", winnr);
dict_add_number(dict, "winid", wp->w_id);
dict_add_number(dict, "height", wp->w_height);
! dict_add_number(dict, "winrow", wp->w_winrow + 1);
#ifdef FEAT_MENU
dict_add_number(dict, "winbar", wp->w_winbar_height);
#endif
dict_add_number(dict, "width", wp->w_width);
! dict_add_number(dict, "wincol", wp->w_wincol + 1);
dict_add_number(dict, "bufnr", wp->w_buffer->b_fnum);
#ifdef FEAT_TERMINAL
*** ../vim-8.1.0186/src/testdir/test_bufwintabinfo.vim Sat Jul 14 22:23:44 2018
--- src/testdir/test_bufwintabinfo.vim Sun Jul 15 16:57:49 2018
***************
*** 52,72 ****
let winlist = getwininfo()
call assert_equal(5, len(winlist))
call assert_equal(winwidth(1), winlist[0].width)
! call assert_equal(0, winlist[0].wincol)
! let tablineheight = winlist[0].winrow == 1 ? 1 : 0
! call assert_equal(tablineheight, winlist[0].winrow) " tabline adds one
call assert_equal(winbufnr(2), winlist[1].bufnr)
call assert_equal(winheight(2), winlist[1].height)
! call assert_equal(0, winlist[1].wincol)
! call assert_equal(tablineheight + winheight(1) + 1, winlist[1].winrow)
call assert_equal(1, winlist[2].winnr)
! call assert_equal(tablineheight, winlist[2].winrow)
! call assert_equal(0, winlist[2].wincol)
! call assert_equal(winlist[2].width + 1, winlist[3].wincol)
! call assert_equal(0, winlist[4].wincol)
call assert_equal(1, winlist[0].tabnr)
call assert_equal(1, winlist[1].tabnr)
--- 52,73 ----
let winlist = getwininfo()
call assert_equal(5, len(winlist))
call assert_equal(winwidth(1), winlist[0].width)
! call assert_equal(1, winlist[0].wincol)
! " tabline adds one row in terminal, not in GUI
! let tablineheight = winlist[0].winrow == 2 ? 1 : 0
! call assert_equal(tablineheight + 1, winlist[0].winrow)
call assert_equal(winbufnr(2), winlist[1].bufnr)
call assert_equal(winheight(2), winlist[1].height)
! call assert_equal(1, winlist[1].wincol)
! call assert_equal(tablineheight + winheight(1) + 2, winlist[1].winrow)
call assert_equal(1, winlist[2].winnr)
! call assert_equal(tablineheight + 1, winlist[2].winrow)
! call assert_equal(1, winlist[2].wincol)
! call assert_equal(winlist[2].width + 2, winlist[3].wincol)
! call assert_equal(1, winlist[4].wincol)
call assert_equal(1, winlist[0].tabnr)
call assert_equal(1, winlist[1].tabnr)
*** ../vim-8.1.0186/runtime/doc/eval.txt Sat Jul 14 21:41:38 2018
--- runtime/doc/eval.txt Sun Jul 15 16:54:29 2018
***************
*** 2196,2202 ****
any variable {varname} in tab {nr} or {def}
gettabwinvar({tabnr}, {winnr}, {name} [, {def}])
any {name} in {winnr} in tab page {tabnr}
! getwininfo([{winid}]) List list of windows
getwinpos([{timeout}]) List X and Y coord in pixels of the Vim window
getwinposx() Number X coord in pixels of the Vim window
getwinposy() Number Y coord in pixels of the Vim window
--- 2196,2202 ----
any variable {varname} in tab {nr} or {def}
gettabwinvar({tabnr}, {winnr}, {name} [, {def}])
any {name} in {winnr} in tab page {tabnr}
! getwininfo([{winid}]) List list of info about each window
getwinpos([{timeout}]) List X and Y coord in pixels of the Vim window
getwinposx() Number X coord in pixels of the Vim window
getwinposy() Number Y coord in pixels of the Vim window
***************
*** 4935,4940 ****
--- 4936,4976 ----
:let list_is_on = gettabwinvar(1, 2, '&list')
:echo "myvar = " . gettabwinvar(3, 1, 'myvar')
<
+ getwininfo([{winid}]) *getwininfo()*
+ Returns information about windows as a List with Dictionaries.
+
+ If {winid} is given Information about the window with that ID
+ is returned. If the window does not exist the result is an
+ empty list.
+
+ Without {winid} information about all the windows in all the
+ tab pages is returned.
+
+ Each List item is a Dictionary with the following entries:
+ bufnr number of buffer in the window
+ height window height (excluding winbar)
+ winbar 1 if the window has a toolbar, 0
+ otherwise
+ loclist 1 if showing a location list
+ {only with the +quickfix feature}
+ quickfix 1 if quickfix or location list window
+ {only with the +quickfix feature}
+ terminal 1 if a terminal window
+ {only with the +terminal feature}
+ tabnr tab page number
+ variables a reference to the dictionary with
+ window-local variables
+ width window width
+ wincol leftmost screen column of the window,
+ col from |win_screenpos()|
+ winid |window-ID|
+ winnr window number
+ winrow topmost screen column of the window,
+ row from |win_screenpos()|
+
+ To obtain all window-local variables use: >
+ gettabwinvar({tabnr}, {winnr}, '&')
+
getwinpos([{timeout}]) *getwinpos()*
The result is a list with two numbers, the result of
getwinposx() and getwinposy() combined:
***************
*** 4968,5006 ****
The result will be -1 if the information is not available.
The value can be used with `:winpos`.
- getwininfo([{winid}]) *getwininfo()*
- Returns information about windows as a List with Dictionaries.
-
- If {winid} is given Information about the window with that ID
- is returned. If the window does not exist the result is an
- empty list.
-
- Without {winid} information about all the windows in all the
- tab pages is returned.
-
- Each List item is a Dictionary with the following entries:
- bufnr number of buffer in the window
- height window height (excluding winbar)
- winbar 1 if the window has a toolbar, 0
- otherwise
- loclist 1 if showing a location list
- {only with the +quickfix feature}
- quickfix 1 if quickfix or location list window
- {only with the +quickfix feature}
- terminal 1 if a terminal window
- {only with the +terminal feature}
- tabnr tab page number
- variables a reference to the dictionary with
- window-local variables
- width window width
- wincol leftmost screen column of the window
- winid |window-ID|
- winnr window number
- winrow topmost screen column of the window
-
- To obtain all window-local variables use: >
- gettabwinvar({tabnr}, {winnr}, '&')
-
getwinvar({winnr}, {varname} [, {def}]) *getwinvar()*
Like |gettabwinvar()| for the current tabpage.
Examples: >
--- 5004,5009 ----
***************
*** 9047,9053 ****
win_screenpos({nr}) *win_screenpos()*
Return the screen position of window {nr} as a list with two
numbers: [row, col]. The first window always has position
! [1, 1].
{nr} can be the window number or the |window-ID|.
Return [0, 0] if the window cannot be found in the current
tabpage.
--- 9051,9057 ----
win_screenpos({nr}) *win_screenpos()*
Return the screen position of window {nr} as a list with two
numbers: [row, col]. The first window always has position
! [1, 1], unless there is a tabline, then it is [2, 1].
{nr} can be the window number or the |window-ID|.
Return [0, 0] if the window cannot be found in the current
tabpage.
*** ../vim-8.1.0186/src/version.c Sat Jul 14 22:23:44 2018
--- src/version.c Sun Jul 15 17:00:11 2018
***************
*** 791,792 ****
--- 791,794 ----
{ /* Add new patch number below this line */
+ /**/
+ 187,
/**/
--
hundred-and-one symptoms of being an internet addict:
251. You've never seen your closest friends who usually live WAY too far away.
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|