+53
-2
lines changedFilter options
+53
-2
lines changed Original file line number Diff line number Diff line change
@@ -1011,7 +1011,7 @@ void textpos2screenpos(win_T *wp, pos_T *pos, int *rowp, int *scolp, int *ccolp,
1011
1011
col -= wp->w_leftcol;
1012
1012
1013
1013
if (col >= 0 && col < wp->w_width) {
1014
-
coloff = col - scol + (local ? 0 : wp->w_wincol) + 1;
1014
+
coloff = col - scol + (local ? 0 : wp->w_wincol + wp->w_border_adj[3]) + 1;
1015
1015
} else {
1016
1016
scol = ccol = ecol = 0;
1017
1017
// character is left or right of the window
@@ -1022,7 +1022,7 @@ void textpos2screenpos(win_T *wp, pos_T *pos, int *rowp, int *scolp, int *ccolp,
1022
1022
}
1023
1023
}
1024
1024
}
1025
-
*rowp = (local ? 0 : wp->w_winrow) + row + rowoff;
1025
+
*rowp = (local ? 0 : wp->w_winrow + wp->w_border_adj[0]) + row + rowoff;
1026
1026
*scolp = scol + coloff;
1027
1027
*ccolp = ccol + coloff;
1028
1028
*ecolp = ecol + coloff;
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
1
+
local helpers = require('test.functional.helpers')(after_each)
2
+
local clear, eq, meths = helpers.clear, helpers.eq, helpers.meths
3
+
local command, funcs = helpers.command, helpers.funcs
4
+
5
+
before_each(clear)
6
+
7
+
describe('screenpos() function', function()
8
+
it('works in floating window with border', function()
9
+
local bufnr = meths.create_buf(false, true)
10
+
local opts = {
11
+
relative='editor',
12
+
height=8,
13
+
width=12,
14
+
row=6,
15
+
col=8,
16
+
anchor='NW',
17
+
style='minimal',
18
+
border='none',
19
+
focusable=1
20
+
}
21
+
local float = meths.open_win(bufnr, false, opts)
22
+
command('redraw')
23
+
local pos = funcs.screenpos(bufnr, 1, 1)
24
+
eq(7, pos.row)
25
+
eq(9, pos.col)
26
+
27
+
-- only left border
28
+
opts.border = {'', '', '', '', '', '', '', '|'}
29
+
meths.win_set_config(float, opts)
30
+
command('redraw')
31
+
pos = funcs.screenpos(bufnr, 1, 1)
32
+
eq(7, pos.row)
33
+
eq(10, pos.col)
34
+
35
+
-- only top border
36
+
opts.border = {'', '_', '', '', '', '', '', ''}
37
+
meths.win_set_config(float, opts)
38
+
command('redraw')
39
+
pos = funcs.screenpos(bufnr, 1, 1)
40
+
eq(8, pos.row)
41
+
eq(9, pos.col)
42
+
43
+
-- both left and top border
44
+
opts.border = 'single'
45
+
meths.win_set_config(float, opts)
46
+
command('redraw')
47
+
pos = funcs.screenpos(bufnr, 1, 1)
48
+
eq(8, pos.row)
49
+
eq(10, pos.col)
50
+
end)
51
+
end)
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4