aboutsummaryrefslogtreecommitdiff
path: root/test/functional/testnvim.lua
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2024-07-17 12:23:15 +0100
committerLewis Russell <me@lewisr.dev>2024-07-31 11:33:32 +0100
commit573a71469d37cc35f72bfc929f4ce1156833df9f (patch)
treea00230976aa453aabb2c9de073e08ccde343e400 /test/functional/testnvim.lua
parentc9b129a02ab46fc80c81f3f9cabed4040a7462c0 (diff)
downloadrneovim-573a71469d37cc35f72bfc929f4ce1156833df9f.tar.gz
rneovim-573a71469d37cc35f72bfc929f4ce1156833df9f.tar.bz2
rneovim-573a71469d37cc35f72bfc929f4ce1156833df9f.zip
fix(scrollbind): properly take filler/virtual lines into account
Problem: `'scrollbind'` does not work properly if the window being scrolled automatically contains any filler/virtual lines (except for diff filler lines). This is because when the scrollbind check is done, the logic only considers changes to topline which are represented as line numbers. Solution: Write the logic for determine the scroll amount to take into account filler/virtual lines. Fixes #29751
Diffstat (limited to 'test/functional/testnvim.lua')
-rw-r--r--test/functional/testnvim.lua11
1 files changed, 10 insertions, 1 deletions
diff --git a/test/functional/testnvim.lua b/test/functional/testnvim.lua
index 5a9e7f8c29..66ce6daacb 100644
--- a/test/functional/testnvim.lua
+++ b/test/functional/testnvim.lua
@@ -835,9 +835,18 @@ function M.exec_capture(code)
return M.api.nvim_exec2(code, { output = true }).output
end
---- @param code string
+--- @param code string|function
--- @return any
function M.exec_lua(code, ...)
+ if type(code) == 'function' then
+ return M.api.nvim_exec_lua(
+ [[
+ local code = ...
+ return loadstring(code)(select(2, ...))
+ ]],
+ { string.dump(code), ... }
+ )
+ end
return M.api.nvim_exec_lua(code, { ... })
end