Skip to content

Fix pixel seams in complementary splits and thirds #23

Description

@martinbha

Goal

Make complementary tiled layouts meet exactly: no uncovered pixel seams and no missed screen edges.

Context

The split helpers in crates/panes-core/src/layout.rs floor each side independently. LeftHalf takes floor(w * split) from the left and RightHalf takes floor(w * (1 - split)) anchored to the right, so on a 1001px-wide work area both floor to 500 and a 1px column at x=500 is covered by neither. The same happens for top/bottom halves and corners on odd heights, and for non-0.5 ratios on many widths. Thirds are worse: third() uses unit = floor(extent / 3), so LastThird ends at 3 * unit, up to 2px short of the screen edge (on portrait screens the gap is at the bottom). Rectangle computes the trailing segment as the remainder (maxX - x) so tiles always meet the edge and each other.

This is core geometry, so Windows inherits the seams as soon as #6 lands.

Scope

  • Compute the trailing side of complementary splits as the remainder of the leading side: right width = max_x - left_width, bottom height analogously, corners combining both.
  • Make thirds span edge to edge: middle segments keep the floored unit, the last segment extends to max_x/min_y as appropriate for orientation.
  • Apply the same remainder rule to two-thirds bands where applicable.
  • Add tests on odd-dimension screens (e.g. 1001x801) and non-0.5 ratios asserting adjacent tiles share edges exactly and the last tile reaches the screen edge.

Implementation Notes

  • Follow-up interaction with Fix doubled gap between adjacent tiled windows #12 (gap seams): fix seams first with gap = 0, then the gap logic divides clean shared edges.
  • Keep rounding deterministic; the executor validation matrix in crates/panes-runtime/tests/command_flow.rs pins expected rects and will need updating for thirds on non-divisible widths.
  • Reference: Rectangle's LeftRightHalfCalculation.swift and third calculations compute complements from maxX rather than re-flooring.

Acceptance Criteria

  • Left + right halves cover the full work-area width with no gap or overlap for any width and ratio.
  • Top + bottom halves and the four corners tile exactly on odd dimensions.
  • First/center/last thirds cover the full extent with the last third flush against the far edge.
  • Tests cover odd dimensions, non-0.5 ratios, and portrait orientation.

Validation

  • cargo fmt --all -- --check
  • cargo check --workspace
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test --workspace

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcorePlatform-neutral logic in panes-core or panes-runtime

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions