nvimdev / indentmini.nvim

A minimal and blazing fast indentline plugin
MIT License
171 stars 12 forks source link

Fix blinking lines when cursor line is enabled #11

Closed antonk52 closed 5 months ago

antonk52 commented 5 months ago

Hi and thanks for the plugin. I noticed that there is a blinking effect when passing empty lines while smaming "j". However, this only reproduces when cursorline is set

Steps to repro

Before demo https://github.com/nvimdev/indentmini.nvim/assets/5817809/a4b1921a-6c4d-464a-b945-ddd88783041b

The way I understood it, this happens because ctx is emptied after every tick in the on_end function. Which in turn defaults previous line to 0 inside on_line

https://github.com/nvimdev/indentmini.nvim/blob/b18d7168e59dbe8700649e2d58022432d8fde2e2/lua/indentmini/init.lua#L40

I have tried looking up the indent level of a previous line by recursively walking up the lines until the first non empty line but that did not

A simple workaround would be to not empty the context. This of course can come at some memory consumption price. To ease it I added an autocommand that would empty the context once a buffer is closed.

After demo https://github.com/nvimdev/indentmini.nvim/assets/5817809/82bb6333-44c1-4e39-be23-3a391697d9e9

Hope this helps