hlchunk.nvim
hlchunk.nvim copied to clipboard
Add wide/multiple char string and nerd font support for chunk
This PR should fix
- The rendering glitch that occurs when a non-single cell wide string is passed to the
charsoption. - The rendering glitch that occurs when the virtual text encounters a non-single cell wide character such as control characters, CJK characters, emoji, or nerd font icons.
- The rendering glitch that occurs when the space is too small to draw both the line and the arrow of the chunk.
- The rendering glitch caused by
"%s"matching non-blank characters and not matching actually blank characters. - The rendering glitch caused by
vim.api.nvim_strwidth()reporting incorrect string widths.
resolves #134
Demo
main
https://github.com/user-attachments/assets/a7700670-c74e-4650-b536-8c4d826a3b03
This PR
https://github.com/user-attachments/assets/6c5d6314-5678-4339-9baa-aca7b4772120
Real world performance
Performance is better for small to medium files thanks to reduced calls to slow APIs, but worse for large files due to strict checking.
Performance on average
| filename | main |
this PR |
|---|---|---|
lua/hlchunk/mods/base_mod/init.lua (199 lines) |
0.620 ms |
0.522 ms |
src/nvim/buffer.c (4254 lines) |
1.054 ms |
1.265 ms |
Great! thank you very much, however the amount of code involved is indeed quite large, I will take some time to review it further.