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

feat(latex): async image rendering #1397

Merged
merged 17 commits into from May 18, 2024

Conversation

benlubas
Copy link
Contributor

@benlubas benlubas commented Apr 19, 2024

screen_cap.mp4

Brings many many improvements to the latex renderer:

  • Images are created and show asynchronously using nvim-nio
    • Creating images never blocks nvim, even with excessive amounts of images
  • Images correctly position themselves in line (accounting for other virtual text, folds, etc.)
  • Enable/Disable commands
  • minimum length requirement to render. This allows you to type $x$ and not have it render a massive disproportionate letter x for no good reason
  • Better documentation
  • Image caching
  • Persistent images with auto update--before images would just disappear when you started typing
  • Foreground color controlled by a highlight group
    • this updates and rerenders on colorscheme change
    • Default links to Normal
  • Debounced rendering so it waits for you to finish typing, this is just to avoid an (even more) excessive amount of temp images being created.
    • Debouncing can make things look bad, it's completely configurable, default is 200ms, setting it to 10ms makes it near impossible to notice (I don't recommend setting it to less than this in case you're running a macro or something).

Unfortunately this clobbers all of the changes in #1372, but it improves on most of what's happening there I think. I started this work before that PR went up, and then I got stalled with school and other things.


TODO:

@benlubas benlubas marked this pull request as ready for review April 25, 2024 15:57
@vhyrro
Copy link
Member

vhyrro commented May 17, 2024

Code generally looks great! I've managed to find another bug that may or may not be known: other virtual text seems to break positioning within the buffer (e.g. images generated by .image). I assume this is a bug that needs fixing on image.nvim's side, right?

@benlubas
Copy link
Contributor Author

I don't see that behavior, and we definitely account for that in image nvim. Is your image nvim on latest from GitHub?

@vhyrro
Copy link
Member

vhyrro commented May 17, 2024

I'm on the latest stable luarocks release which I realized happens to be from 144 days ago 😂, perhaps that's due for an update 😅

@benlubas
Copy link
Contributor Author

I asked 3rd to cut a release, I think that triggers a luarocks build too, so you can try the rocks version again

@vhyrro
Copy link
Member

vhyrro commented May 17, 2024

Thanks for getting that release out, that's fixed now at least :)

@vhyrro vhyrro merged commit f05bce2 into nvim-neorg:main May 18, 2024
1 of 2 checks passed
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.

None yet

2 participants