[v0.1/Protocol] Implement DECCARA / DECRARA rectangular attribute ops #188

Closed
opened 2026-09-07 16:33:18 +09:00 by natsukium · 0 comments
Owner

What

Implement DECCARA (CSI Pt;Pl;Pb;Pr;Ps... $ r) and DECRARA (CSI Pt;Pl;Pb;Pr;Ps... $ t): change and reverse
character attributes inside a rectangle. They are the last ❌ not yet row of the rectangular-editing family in
docs/reference/protocols/support-matrix.md; every neighbor (DECCRA, DECFRA, DECERA, DECSERA, DECRQCRA) is .

#181 recorded the stance: adopt. The Pt;Pl;Pb;Pr bounds model is already specified
(docs/reference/protocols/vt-compliance.md "Rectangular editing"), the SGR pen exists, and DECSACE (CSI Ps * x),
which selects rectangle vs stream extent for these two operations, is already parsed and stored (dec_sace in
crates/felis-grid/src/sink.rs). What is missing is the two dispatch arms and the attribute-merge pass.

Where

  • crates/felis-grid/src/sink.rs: two arms beside the existing (&[b'$'], b'v' | b'x' | b'z' | b'{') rectangle
    dispatch, for (&[b'$'], b'r') and (&[b'$'], b't').
  • crates/felis-grid/src/editing.rs: the operations themselves, reusing the shared rectangle-bounds normalization the
    other four use (origin mode, margins, clamping, degenerate rectangles) and honoring dec_sace.
  • Attribute semantics: DECCARA sets/clears the listed SGR attributes on every cell in the extent and leaves the rest
    untouched (it is a merge, not a pen replacement); DECRARA toggles them. Only the attribute subset xterm accepts here
    (bold, faint, italic, blink, reverse, underline variants, invisible, strike) participates; colors are not part of
    either operation.

Tests

  • crates/felis-grid/tests/snapshot_csi.rs / snapshot_csi_handlers.rs: one snapshot per operation, plus one for the
    DECSACE stream-extent variant and one for a rectangle clipped by margins under origin mode.
  • Extend crates/felis-grid/tests/proptest_rect_ops.rs with the two new operations: bounds normalization must match
    the family (no panic, no out-of-grid write, degenerate rectangles are no-ops).
  • Ratchet the esctest baseline for the DECCARA/DECRARA cases that start passing.

Cascade

docs/reference/protocols/support-matrix.md (row flips to ),
docs/reference/protocols/vt-compliance.md "Rectangular editing", and the landscape stance line from #181.

Split from #181.

## What Implement DECCARA (`CSI Pt;Pl;Pb;Pr;Ps... $ r`) and DECRARA (`CSI Pt;Pl;Pb;Pr;Ps... $ t`): change and reverse character attributes inside a rectangle. They are the last `❌ not yet` row of the rectangular-editing family in `docs/reference/protocols/support-matrix.md`; every neighbor (DECCRA, DECFRA, DECERA, DECSERA, DECRQCRA) is `✅`. #181 recorded the stance: **adopt**. The `Pt;Pl;Pb;Pr` bounds model is already specified (`docs/reference/protocols/vt-compliance.md` "Rectangular editing"), the SGR pen exists, and DECSACE (`CSI Ps * x`), which selects rectangle vs stream extent for these two operations, is already parsed and stored (`dec_sace` in `crates/felis-grid/src/sink.rs`). What is missing is the two dispatch arms and the attribute-merge pass. ## Where - `crates/felis-grid/src/sink.rs`: two arms beside the existing `(&[b'$'], b'v' | b'x' | b'z' | b'{')` rectangle dispatch, for `(&[b'$'], b'r')` and `(&[b'$'], b't')`. - `crates/felis-grid/src/editing.rs`: the operations themselves, reusing the shared rectangle-bounds normalization the other four use (origin mode, margins, clamping, degenerate rectangles) and honoring `dec_sace`. - Attribute semantics: DECCARA sets/clears the listed SGR attributes on every cell in the extent and leaves the rest untouched (it is a merge, not a pen replacement); DECRARA toggles them. Only the attribute subset xterm accepts here (bold, faint, italic, blink, reverse, underline variants, invisible, strike) participates; colors are not part of either operation. ## Tests - `crates/felis-grid/tests/snapshot_csi.rs` / `snapshot_csi_handlers.rs`: one snapshot per operation, plus one for the DECSACE stream-extent variant and one for a rectangle clipped by margins under origin mode. - Extend `crates/felis-grid/tests/proptest_rect_ops.rs` with the two new operations: bounds normalization must match the family (no panic, no out-of-grid write, degenerate rectangles are no-ops). - Ratchet the esctest baseline for the DECCARA/DECRARA cases that start passing. ## Cascade `docs/reference/protocols/support-matrix.md` (row flips to `✅`), `docs/reference/protocols/vt-compliance.md` "Rectangular editing", and the landscape stance line from #181. Split from #181.
Sign in to join this conversation.
No description provided.