Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wide/multiple char string and nerd font support for chunk #139

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

itepechi
Copy link
Contributor

This PR should fix

  • The rendering glitch that occurs when a non-single cell wide string is passed to the chars option.
  • 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

2024-09-29.19.52.13.mp4

This PR

2024-09-29.19.55.16.mp4

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

@itepechi itepechi force-pushed the chunk-multi-cell-full-support branch from c9262a9 to 4dce8d6 Compare September 30, 2024 18:35
@shellRaining
Copy link
Owner

Great! thank you very much, however the amount of code involved is indeed quite large, I will take some time to review it further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multiple chars for chunk.chars.right_arrow
2 participants