lukas-reineke / headlines.nvim

This plugin adds horizontal highlights for text filetypes, like markdown, orgmode, and neorg.
MIT License
698 stars 28 forks source link

Issue with clearing background highlights #21

Closed TerseTears closed 2 years ago

TerseTears commented 2 years ago

Hello.

This may be two separate issues, but both seem to be related to how background highlights that aren't (completely) in view are cleared. The first issue is with a red line that shows when a headline goes out of view (seems it only happens if it's at a lower level). The second issue is with the code blocks and how the background highlight is removed midway. Below is an illustration:

https://user-images.githubusercontent.com/36173945/167283917-f87c435b-794c-49f4-9f9e-68b5a65987a4.mp4

lukas-reineke commented 2 years ago

The codeblock background highlight happens because the plugin currently only looks at the current view. I can add a bit of buffer to that :+1:

The red line though I can't reproduce.

gerritvreeman commented 2 years ago

Would there be a significant influence on performance if it just looked at the entire buffer (by changing local offset = 0 and local range = vim.api.nvim_buf_line_count(bufnr))?

lukas-reineke commented 2 years ago

Depends on the size of the file. Couple hundred lines, probably no. Couple hundred thousand lines, yes.

Now that markdown has a supported treesitter grammar as well, it might be nicer to switch to that. I'll think about this

lukas-reineke commented 2 years ago

I refactored everything to use treesitter. This should no longer happen.