feat(renderer): account for inline virtual text when positioning images#364
Open
charlesg3 wants to merge 1 commit into
Open
feat(renderer): account for inline virtual text when positioning images#364charlesg3 wants to merge 1 commit into
charlesg3 wants to merge 1 commit into
Conversation
When a plugin like render-markdown.nvim injects inline virtual text at the start of an image row (e.g. heading indent), image.nvim renders the image flush at column 0, sitting under the virt_text instead of under the displayed position of the link. Detect inline virt_text extmarks at the image row and offset absolute_x by their summed display width. The adjustment is guarded by original_x == 0: when the link sits at a non-zero buffer column, treesitter's node:range already reports the indented column and no further shift is needed. Includes: - tests/renderer/inline_virt_text_offset_spec.lua — 5 cases covering the shift, the non-affected paths (no virt_text / x>0 / eol virt_text), and multi-chunk virt_text width summation. - tests/checklists/inline_virt_text_offset.md — manual checklist for visual verification with render-markdown.nvim.
charlesg3
added a commit
to charlesg3/nvim
that referenced
this pull request
May 12, 2026
PRs #348 (BufEnter on document integration) and #350 (overlap option + negative render_offset_top support) were merged upstream, so the previous render-fixes.patch is no longer needed — it's superseded by the upstream 'overlap' option (same math as the local 'existing_lines' field). - Point bundle/image.nvim submodule at 3rd/image.nvim (master), bump to faccd45. - Drop patches/image.nvim/render-fixes.patch (fully merged upstream). - Add patches/image.nvim/inline-virt-text-offset.patch for the one outstanding hunk (render-markdown indent offset), proposed upstream in 3rd/image.nvim#364.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a plugin like render-markdown.nvim injects inline virtual text at the start of an image row (e.g. heading indent), image.nvim currently renders the image flush at column 0, sitting under the virt_text rather than under the displayed
![of the link.This change detects inline virt_text extmarks at the image row and offsets
absolute_xby their summed display width. The adjustment is guarded byoriginal_x == 0: when the link sits at a non-zero buffer column, treesitter'snode:rangealready reports the indented column, so no further shift is needed.What's included
lua/image/renderer.lua— the fixtests/renderer/inline_virt_text_offset_spec.lua— 5 cases (the shift; no-virt-text passthrough; x>0 passthrough; eol virt_text ignored; multi-chunk width summation)tests/checklists/inline_virt_text_offset.md— manual checklist for visual verification under render-markdown