Skip to content

Commit

Permalink
Merge pull request #11 from antonk52/f/blinking-lines
Browse files Browse the repository at this point in the history
Fix blinking lines when cursor line is enabled
  • Loading branch information
glepnir authored Apr 7, 2024
2 parents b18d716 + 49596e9 commit ef72727
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions lua/indentmini/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,20 @@ local function indent_step(bufnr)
end
end

local function indentline()
local function indentline(group)
local function on_win(_, _, bufnr, _)
if bufnr ~= vim.api.nvim_get_current_buf() then
return false
end
end

local ctx = {}
vim.api.nvim_create_autocmd('BufDelete', {
group = group,
callback = function()
ctx = {}
end,
})
local function on_line(_, _, bufnr, row)
local indent = vim.fn.indent(row + 1)
local ok, lines = pcall(api.nvim_buf_get_text, bufnr, row, 0, row, -1, {})
Expand Down Expand Up @@ -93,10 +99,6 @@ local function indentline()
end
end

local function on_end()
ctx = {}
end

local function on_start(_, _)
local bufnr = api.nvim_get_current_buf()
local exclude_buftype = { 'nofile', 'terminal' }
Expand All @@ -113,7 +115,6 @@ local function indentline()
on_win = on_win,
on_start = on_start,
on_line = on_line,
on_end = on_end,
})
end

Expand All @@ -131,7 +132,7 @@ local function setup(opt)
nvim_create_autocmd('BufEnter', {
group = group,
callback = function()
indentline()
indentline(group)
end,
})
end
Expand Down

0 comments on commit ef72727

Please sign in to comment.