Skip to content

Commit

Permalink
only render visible part of screen
Browse files Browse the repository at this point in the history
  • Loading branch information
glepnir committed May 6, 2024
1 parent deb3a2b commit b09ef87
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lua/indentmini/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ local function on_line(_, _, bufnr, row)
if erow < 1 then
return
end
-- only render visible part of screen
local toprow = vim.fn.line('w0') - 2
local botrow = vim.fn.line('w$') - 1
srow = math.max(math.max(toprow, srow), 0)
erow = math.max(math.min(botrow, erow), api.nvim_buf_line_count(data.buf) - 1)
local level = math.floor(curindent / shiftw)
for i = srow + 1, erow, 1 do
api.nvim_set_hl(
Expand Down

0 comments on commit b09ef87

Please sign in to comment.