aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui
diff options
context:
space:
mode:
authorJaehwang Jung <tomtomjhj@gmail.com>2023-12-25 02:31:47 +0900
committerLewis Russell <me@lewisr.dev>2024-01-04 11:37:00 +0000
commitdc48a98f9ac614dc94739637c967aa29e064807e (patch)
treeb53348803c82a132b51077eca3200f3aa36cc513 /test/functional/ui
parent9b90657376754a492d19f1daaffb257bf87d09cf (diff)
downloadrneovim-dc48a98f9ac614dc94739637c967aa29e064807e.tar.gz
rneovim-dc48a98f9ac614dc94739637c967aa29e064807e.tar.bz2
rneovim-dc48a98f9ac614dc94739637c967aa29e064807e.zip
fix(decorations): validate botline for on_win
Problem: Many decoration providers (treesitter injection highlighting, semantic token highlighting, inlay hint) rely on the correctness of the `botline` argument of `on_win` callback. However, `botline` can be smaller than the actual line number of the last displayed line if some lines are folded. In such cases, some decorations will be missing in the lines not covered by `botline`. Solution: Validate `botline` when invoking `on_win`. NOTE: It seems that the old code was deliberately avoiding this presumably due to performance reasons. However, I haven't experienced noticeable lag after this change, and I believe the cost of botline computation would be much smaller than the cost of decoration providers.
Diffstat (limited to 'test/functional/ui')
-rw-r--r--test/functional/ui/decorations_spec.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua
index d78d7d06cc..48df6b3295 100644
--- a/test/functional/ui/decorations_spec.lua
+++ b/test/functional/ui/decorations_spec.lua
@@ -615,9 +615,9 @@ describe('decorations providers', function()
vim.api.nvim_buf_set_lines(0, 0, -1, false, lines)
]])
setup_provider([[
- local function on_do(kind, winid, bufnr, topline, botline_guess)
+ local function on_do(kind, winid, bufnr, topline, botline)
if kind == 'win' then
- if topline < 100 and botline_guess > 100 then
+ if topline < 100 and botline > 100 then
api.nvim_buf_set_extmark(bufnr, ns1, 99, -1, { sign_text = 'X' })
else
api.nvim_buf_clear_namespace(bufnr, ns1, 0, -1)
@@ -655,7 +655,7 @@ describe('decorations providers', function()
eok = true
]])
setup_provider([[
- local function on_do(kind, winid, bufnr, topline, botline_guess)
+ local function on_do(kind, winid, bufnr, topline, botline)
if kind == 'line' then
api.nvim_buf_set_extmark(bufnr, ns1, 1, -1, { sign_text = 'X' })
eok = pcall(api.nvim_buf_clear_namespace, bufnr, ns1, 0, -1)