Repository navigation
Conversation
Adds product and tech specs for warpdotdev#13914: the inline code chip's background/border is painted using per-glyph advance width (which includes right-side bearing) rather than ink width, producing a visually larger gap on the right edge than the left.
…ompensation (GH13914) Oz flagged that the existing paint math (visible_left - 2*block_padding, width (visible_right - visible_left) + 2*block_padding) is asymmetric: block_padding algebraically cancels out of the right edge and only ever shifts the left edge. The prior spec wording claimed this was applied "symmetrically to both edges", which was wrong. Traced through the impl (fb/13914-code-chip-ink-width-impl, crates/warpui_core/src/text_layout.rs:1362-1405): the ink-derived edges are substituted as local visible_left/visible_right values immediately before this unchanged block_padding math runs, so the fix composes with the legacy left-only offset rather than replacing or bypassing it. The right edge ends up pure ink-geometry (block_padding cancels), but the left edge picks up an extra 2*block_padding beyond the intended ink padding — a font_size/5 (~1px at 13px) residual left/right imbalance that survives the fix, unrelated to the advance-vs-ink bug this issue targets. Documents this precisely in tech.md (new "Interaction with the legacy block_padding offset" section + Follow-up), and softens product.md's Success Criterion 1 / adds Open Question warpdotdev#4 so the spec doesn't overclaim full left/right padding equality.
… (GH13914) Round-2 review resolutions on PR warpdotdev#14026: - Bring the block_padding correction in scope for chips: compensate out the legacy left-only 2*block_padding shift so chip edges are equal ink padding on both sides, literally. Non-chip runs keep the legacy math. The composes-section becomes replaced-for-chips; the algebra stays as evidence. - Rewrite the success criterion honestly: equal ink padding is the promise; the left edge tightens ~1px as an intended consequence, not preservation. The font_size/12 padding is a design value for air, no longer doing left-edge duty. - Make the scope explicit and intentional: the ink-edge geometry applies to the chip family (inline-code chips today, kbd keycaps per PR warpdotdev#13916 once landed) via a named TextStyle::is_chip predicate. All other border/background consumers are unchanged.
…g (GH13914)
Round-3 review findings:
- tech.md:132 understated 2*block_padding as ~1.08px; it is font_size/5,
~2.6px at a 13px font (a clearly visible shift, not sub-pixel). Propagate
the corrected magnitude everywhere it's cited: tech.md's block_padding
interaction section, testing/manual-verification criteria, and
product.md's goals/success-criteria/open-questions.
- product.md:55's zero-ink fallback description dropped the padding term
("advance-based edge" only), conflicting with tech.md's own fallback-rules
section and the actual implementation, both of which apply
advance-edge ± pad. Align product.md to state the same rule.
…a claims (GH13914) tech.md's fallback-rules section still specified raw visible_left/visible_right for zero-ink edge glyphs, contradicting product.md's advance-edge ± pad rule (already correct) and the implementation (pinned by test_run_background_falls_back_to_advance_for_zero_ink_glyph). Align tech.md to advance-edge ± pad. Separately, every "left edge tightens by 2 × block_padding (≈2.6px)" claim framed as a verification criterion or precise new-vs-old delta ignored that the left edge also switches from advance-anchored to ink-anchored, making the true delta glyph/font-dependent. Reframe these as: the typical magnitude of the removed block_padding residual (still exact in isolation), not a fixed verification target. product.md Success Criterion 2 now asserts the literally-pinned properties (zero block_padding residual, ink-edge-minus-pad formula) instead of an exact pixel figure.
|
I'm starting a first review of this spec-only pull request. You can view the conversation on Warp. I reviewed this pull request and requested human review from: Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This PR adds product and technical specs for correcting inline-code chip background geometry by anchoring chip edges to glyph ink extents plus equal design padding, while keeping glyph layout, caret placement, selection, copy/paste, and non-chip rendering behavior unchanged.
Concerns
- No blocking completeness, clarity, feasibility, issue-alignment, internal-consistency, or high-level security concerns found in the changed specs.
spec_context.mdreports no approved or repository spec context for this PR, so there is no implementation/spec drift to flag.
Verdict
Found: 0 critical, 0 important, 0 suggestions
Approve
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
|
(Just commenting as this is waiting for review). |
|
@vorporeal This PR is still waiting for review. (Just trying to avoid the stale-bot) |
Closes #13914
Adds a product spec and tech spec for the inline-code chip background asymmetry: the chip's background/border is currently painted using each glyph's advance width (which bakes in right-side bearing/spacing), so the gap between the last character's ink and the chip's right edge is consistently larger than the equivalent left-side gap — and varies with whichever glyph ends the span.
The spec's proposed design draws the chip's edges from glyph ink extents plus a font-relative design padding:
[first_ink_left − pad, last_ink_right + pad]wherepadis computed per run at paint time asfont_size × ratio— it scales automatically with the current font size, with interior glyph positions remaining advance-based. Per-glyph ink is available cross-platform through the existingplatform::FontDB::glyph_raster_bounds(already cached; macOS font-kit raster bounds and Linux swash placement have matching true-ink semantics), so the correction is exact rather than a tuned constant — this also incidentally fixes the current right edge clipping ink overshoot from italic/overhang glyphs. The tech spec documentsglyph_typographic_boundsas an examined dead end (its two backends measure different things), the device→paint scale conversion, a ~1px macOS AA-fudge residual, and a zero-ink (e.g. trailing space) advance-edge fallback; it confirms the TUI Markdown renderer does not reach this paint path and is unaffected.Remaining open questions are design-taste rather than correctness: the dimensionless padding ratio (currently
1/12of the font size — chosen to approximate a typical monospace left-side bearing so the chip's left edge stays where today's advance-based edge sits) and visual sign-off on the macOS AA residual.Review-feedback accounting (continuation of #14026 — all 8 findings across 4 review rounds)
This PR replaces #14026, which is closed after exhausting its review-trigger budget. All eight
oz-for-ossfindings raised across four review rounds on #14026 are addressed as of this branch's spec tip; the table below is the full accounting.block_paddinginteraction — legacy left-only shift undocumented against the new ink-edge designtech.md:2774a882847tech.md's unchanged (left-only)block_paddingresidualproduct.md:220fcebacbdfont_size/12paddingproduct.md:630fcebacbdbackground_color/borderconsumer, not just chipsproduct.md:730fcebacbd2 × block_paddingmagnitude cited as ~1.08px, actuallyfont_size/5≈ 2.6px at 13pxtech.md:13296620e117advance-edge ± pad) and tech.md's testing sectiontech.md:38796620e117visible_left/visible_rightfor zero-ink glyphs, contradicting product.md and the implementationtech.md:254bc345c70a2 × block_paddingfigure, ignoring the first glyph's ink bearing and the newpad(glyph/font-dependent in reality)product.md:66bc345c70aAll eight threads on #14026 have reply comments pointing at their resolving commit; the round-1–3 threads are marked resolved on GitHub. The round-4 threads (
tech.md:254,product.md:66) are fixed bybc345c70aon this branch but not yet marked resolved on #14026, since #14026 is being closed in favor of this PR rather than receiving further replies.A validation implementation exists locally (three commits, rebased onto this spec tip; not pushed, so no stable SHAs to cite — it will arrive as its own PR once this spec is approved, per the spec→implementation flow):
is_chippredicate,block_paddingcompensation)block_paddingmagnitude in ink-padding doc commentGates:
cargo nextest run -p warpui_core -p warp_editor(794 passed),cargo clippy --all-targets --all-features --tests -- -D warnings(clean),cargo fmt -- --check(clean).