diff options
author | luukvbaal <luukvbaal@gmail.com> | 2024-05-03 04:35:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-03 10:35:32 +0800 |
commit | cf9f002f31c8b4d9d42912a3f45f5d3db4462fd9 (patch) | |
tree | b5c8f0bf55026ff91e709497a534830d26fd659d /test/functional/api/vim_spec.lua | |
parent | 01e4a70d668d54a7cefa3ff53ec97e39df516265 (diff) | |
download | rneovim-cf9f002f31c8b4d9d42912a3f45f5d3db4462fd9.tar.gz rneovim-cf9f002f31c8b4d9d42912a3f45f5d3db4462fd9.tar.bz2 rneovim-cf9f002f31c8b4d9d42912a3f45f5d3db4462fd9.zip |
fix(api): use correct buffer for "range" in nvim__redraw (#28614)
Diffstat (limited to 'test/functional/api/vim_spec.lua')
-rw-r--r-- | test/functional/api/vim_spec.lua | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index fbb6d42633..c56c8263d6 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -5195,28 +5195,27 @@ describe('API', function() }) -- valid = true does not draw any lines on its own exec_lua([[ - lines = 0 + _G.lines = 0 ns = vim.api.nvim_create_namespace('') - on_win = function() - if do_win then - vim.api.nvim_buf_set_extmark(0, ns, 0, 0, { hl_group = 'IncSearch', end_col = 6 }) - end - end vim.api.nvim_set_decoration_provider(ns, { - on_win = on_win, + on_win = function() + if _G.do_win then + vim.api.nvim_buf_set_extmark(0, ns, 0, 0, { hl_group = 'IncSearch', end_col = 6 }) + end + end, on_line = function() - lines = lines + 1 + _G.lines = _G.lines + 1 end, }) ]]) local lines = exec_lua('return lines') api.nvim__redraw({ buf = 0, valid = true, flush = true }) - eq(lines, exec_lua('return lines')) + eq(lines, exec_lua('return _G.lines')) -- valid = false does api.nvim__redraw({ buf = 0, valid = false, flush = true }) - neq(lines, exec_lua('return lines')) + neq(lines, exec_lua('return _G.lines')) -- valid = true does redraw lines if affected by on_win callback - exec_lua('do_win = true') + exec_lua('_G.do_win = true') api.nvim__redraw({ buf = 0, valid = true, flush = true }) screen:expect({ grid = [[ @@ -5227,5 +5226,8 @@ describe('API', function() 13 | ]], }) + -- takes buffer line count from correct buffer with "win" and {0, -1} "range" + api.nvim__redraw({ win = 0, range = { 0, -1 } }) + n.assert_alive() end) end) |