mirror of
https://github.com/neovim/neovim.git
synced 2026-01-04 10:26:42 +10:00
fix(treesitter): no injection highlighting on last line #36951
Problem:
If the last visible line in a window is not fully displayed, this line
may not get injection highlighting. This happens because line('w$')
actually means the last *completely displayed* line.
Solution:
Use line('w$') + 1 for the botline.
This reverts 4244a96774
"test: fix failing lsp/utils_spec #36609",
which changed the test based on the wrong behavior.
This commit is contained in:
@@ -561,7 +561,10 @@ function TSHighlighter._on_start()
|
||||
if not buf_ranges[buf] then
|
||||
buf_ranges[buf] = {}
|
||||
end
|
||||
local topline, botline = vim.fn.line('w0', win) - 1, vim.fn.line('w$', win)
|
||||
local topline = vim.fn.line('w0', win) - 1
|
||||
-- +1 because w$ is the last completely displayed line (w_botline - 1), which may be -1 of the
|
||||
-- last line that is at least partially visible.
|
||||
local botline = vim.fn.line('w$', win) + 1
|
||||
table.insert(buf_ranges[buf], { topline, botline })
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user