Skip to content

feat!: position placements horizontally via a col cell offset - #55

Merged
hisanari-dev merged 1 commit into
mainfrom
feat/horizontal-col-positioning
Oct 4, 2026
Merged

hisanari-dev merged 1 commit into
mainfrom
feat/horizontal-col-positioning

Conversation

@hisanari-dev

Copy link
Copy Markdown
Contributor

📦 Pull Request

Description

Makes show()'s opts.col actually position the image horizontally. It 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 virt_lines block 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_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. The existing compute_clip/pixel_crop column 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): col is 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 via screenpos() in the topfill branch where the anchor line is not rendered. A caller wanting character alignment can pass vim.fn.strdisplaywidth(line:sub(1, byte_col)). The offset does not follow 'nowrap' horizontal scrolling, matching the reserved virt_lines rows. Rationale is recorded in docs/spec/renderer-placement.md's new "Horizontal positioning" subsection.

Breaking (v0.x): opts.col changes meaning from "anchor byte column" (documented, but unused) to a cell offset, and is now validated as a non-negative integer — a negative or fractional col that 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

  • Bug fix
  • New feature
  • Refactoring
  • Documentation
  • CI / Infrastructure

Checklist

  • I have run make locally (stylua --check, selene, tests) and it passes.
  • I have added unit tests for new pure logic (escape sequences, chunking, geometry, detection).
  • I have updated the relevant docs/spec/ memo if protocol or terminal-detection behavior changed.
  • I have updated doc/blit.txt and/or README if this changes the public API.
  • I have followed Conventional Commits (feat:, fix:, etc.).

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.

@amazon-q-developer amazon-q-developer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@hisanari-dev
hisanari-dev merged commit b048f17 into main Oct 4, 2026
3 checks passed
@hisanari-dev
hisanari-dev deleted the feat/horizontal-col-positioning branch October 4, 2026 13:38
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.

[Feature]: Support horizontal column positioning for placements

1 participant