You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the great work! This plugin benefits me a lot.
I noticed that you implemented the unicode placeholder method, but I'm not sure the implement here fully utilized the power of the unicode placeholder.
Instead of writing the unicode diacritics into tty (this creates flickering on my pc...), simply write them into neovim's buffer and then color their foreground with the hexcode of the image id.
localfunctionrender_image(image_id, x, y, width, height)
localvirt_lines= {}
localhl_group="image-nvim-image-id-" ..tostring(image_id)
-- encode image_id into the foreground colorvim.api.nvim_set_hl(0, hl_group, { fg=string.format("#%06X", image_id) })
fori=0, height-1dolocalline=""forj=0, width-1doline=line..codes.placeholder..codes.diacritics[i+1] ..codes.diacritics[j+1]
endtable.insert(virt_lines, { { line, hl_group } })
end-- I put these diacritics into an extmark, you can try other ways too vim.api.nvim_buf_set_extmark(0, ns_id, y, x, {
virt_lines=virt_lines,
virt_lines_above=false,
})
end
With this slight change, we get a much better rendering.
Since unicode diacritics are just text, neovim can handle it well. This saves us tons of times
no need to crop the images when scrolling
no need to resize the images (kitty will fit the image into the rectangular diacritics)
no need to offset the images to avoid overlapping and other stuff
no need to clear and re-render images when switching windows/buffers (kitty handles this for us)
The only drawback is that other backends don't support unicode placeholders (yet).
unicode_placeholders.mp4
I wanted to create a PR for you, but it seems your code is structured for a more general use case (with support of other backends, love your efforts!) Maybe I will leave this headache to you.
Thanks for the great work! This plugin benefits me a lot.
I noticed that you implemented the unicode placeholder method, but I'm not sure the implement here fully utilized the power of the unicode placeholder.
Instead of writing the unicode diacritics into tty (this creates flickering on my pc...), simply write them into neovim's buffer and then color their foreground with the hexcode of the image id.
With this slight change, we get a much better rendering.
Since unicode diacritics are just text, neovim can handle it well. This saves us tons of times
The only drawback is that other backends don't support unicode placeholders (yet).
unicode_placeholders.mp4
I wanted to create a PR for you, but it seems your code is structured for a more general use case (with support of other backends, love your efforts!) Maybe I will leave this headache to you.
Related issues:
#103
#123
#132
#116
#174
#245
The text was updated successfully, but these errors were encountered: