vim-patch:8.1.1967: line() only works for the current window

Problem:    Line() only works for the current window.
Solution:   Add an optional argument for the window to use.
8e0a8e7eb7
This commit is contained in:
Jan Edmund Lazo
2021-05-10 22:40:08 -04:00
parent 89e29e8774
commit dad725d5e5
5 changed files with 31 additions and 9 deletions

View File

@@ -64,10 +64,13 @@ describe('float window', function()
it('win_execute() should work' , function()
local buf = meths.create_buf(false, false)
meths.buf_set_lines(buf, 0, -1, true, {'the floatwin'})
meths.buf_set_lines(buf, 0, -1, true, {'the floatwin', 'abc', 'def'})
local win = meths.open_win(buf, false, {relative='win', width=16, height=1, row=0, col=10})
local line = funcs.win_execute(win, 'echo getline(1)')
eq('\nthe floatwin', line)
eq('\n1', funcs.win_execute(win, 'echo line(".",'..win.id..')'))
eq('\n3', funcs.win_execute(win, 'echo line("$",'..win.id..')'))
eq('\n0', funcs.win_execute(win, 'echo line("$", 123456)'))
funcs.win_execute(win, 'bwipe!')
end)