Repository navigation
feat!: position placements horizontally via a col cell offset - #55
Merged
Merged
Conversation
show()'s opts.col was accepted but silently ignored: virt_lines always render at the window's text-area left edge, so the image always landed there too. The image is drawn out of band at an absolute screen position, so it can be shifted without touching the extmark: compute_placement now adds geometry.col to the text-area left edge's screen column, in both the normal path and the scrolled-off-anchor (topfill) branch. Existing column clipping handles an offset that overhangs or passes the right edge. Closes #9 BREAKING CHANGE: opts.col is now a 0-indexed display-cell offset from the window's text-area left edge, not an anchor byte column, and is validated as a non-negative integer. A negative or fractional col that was previously accepted (and ignored) now raises an argument error.
There was a problem hiding this comment.
This is a well-implemented feature that adds horizontal positioning support for image placements. The implementation correctly handles column offsets as display-cell measurements (not byte columns), includes proper validation, comprehensive test coverage, and thorough documentation. The breaking change is appropriately marked and documented. The code is ready to merge.
You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.
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.
📦 Pull Request
Description
Makes
show()'sopts.colactually position the image horizontally. It was accepted but silently ignored:virt_linesalways render at the window's text-area left edge, so the image always landed there too.The
virt_linesblock only reserves blank rows — the image itself is drawn out of band at an absolute screen position — so no change to the extmark strategy is needed.compute_placementnow addsgeometry.colto the text-area left edge's screen column, in both the normal path and the scrolled-off-anchor (topfill) branch. The existingcompute_clip/pixel_cropcolumn handling covers an offset that overhangs the window's right edge (column-cropped slice) or passes it entirely (hidden).Design decision (discussed before implementing, per the issue):
colis a 0-indexed display-cell offset from the text-area left edge, not a buffer byte column. A cell offset depends on nothing but the window, whereas a byte column would need converting through the anchor line's text (tabs, wide characters, a column past end of line), is ambiguous under'wrap', and cannot be resolved viascreenpos()in thetopfillbranch where the anchor line is not rendered. A caller wanting character alignment can passvim.fn.strdisplaywidth(line:sub(1, byte_col)). The offset does not follow'nowrap'horizontal scrolling, matching the reservedvirt_linesrows. Rationale is recorded indocs/spec/renderer-placement.md's new "Horizontal positioning" subsection.Breaking (v0.x):
opts.colchanges meaning from "anchor byte column" (documented, but unused) to a cell offset, and is now validated as a non-negative integer — a negative or fractionalcolthat was previously accepted and ignored now raises an argument error. Called out in the commit body and README changelog.Pixel-level behavior is terminal-dependent and has not been verified on a real terminal; a step was added to
docs/manual-testing.md.Related Issue
Closes #9
Type of Change
Checklist
makelocally (stylua --check,selene, tests) and it passes.docs/spec/memo if protocol or terminal-detection behavior changed.doc/blit.txtand/or README if this changes the public API.feat:,fix:, etc.).