Skip to content

[Feature]: Auto-detect :split/:vsplit and place into every window showing a buffer #54

Description

@hisanari-dev

Motivation

show() binds one handle to one specific window (handle.win, recorded once at creation time). If the same buffer is also open in another window (:split/:vsplit), compute_placement only ever computes visibility/position against the original window — the second window renders the reserved blank virt_lines rows with no image in them, for as long as it stays open. This was originally reported as #17 and closed via docs-only (#22, "note ... as a known v0.x limitation") rather than a fix.

Issue #10 ("Multi-location placement fan-out for a single transmitted image", closed via #51) added the underlying primitive this needs — a distinct p= per placement, so one transmitted image id can carry a second, independent placement without re-transmitting pixel data — but it does not by itself detect a split and create that second placement automatically. M.show() still only ever creates one handle bound to one win per call. Today a caller has to work around this manually: call show() again with the second window's win and the same path (documented in README's Known Issues and doc/blit.txt as of #53).

Proposed Solution

Have show()/the renderer detect when its buffer is opened in an additional window (e.g. via WinNew/BufWinEnter, or by scanning vim.fn.win_findbuf(buf) on relevant autocmds) and automatically create a fanned-out placement (issue #10's primitive) for that window too, without the caller needing to call show() a second time. Needs design for:

  • Which single "logical" handle/return value represents an image now potentially placed in several windows — does M.show() still return one handle, with fan-out siblings tracked internally? Or does it return a group?
  • Teardown semantics: does closing one auto-fanned-out window's placement also clear() the others, or only its own (mirroring today's manual-fan-out clear() behavior — per-handle, not per-id)?
  • Whether this should be opt-in (a show() flag) or the new default behavior, given it changes what happens today (blank space) without any API change.

Alternatives Considered

Additional Context

Related: #17 (original bug report, closed docs-only), #10 (underlying fan-out primitive, implemented), #51 (implementation PR), #53 (documents the current manual workaround).

Checklist

  • I have searched existing issues to make sure this is not a duplicate.
  • I have described the problem and the proposed solution clearly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions