Authors need portable cursor stacking without SCO-specific CSI variants in typed builders.
Verification and traceability
Platform spec article
Verification and traceability
Spec standingStandard
-
Normative cursor save/restore uses DEC sequences, not SCO.
Context
Decision
Rule Detail Save/restore DEC ESC 7/ESC 8is the normative pairSCO CSI s/CSI uare not required in v1 typed buildersConsequences
Typed
Ansi.Cursorhelpers emit DEC only; rawCsimay still be used in tests.Verification anchors
AnsiEscapeTests.bd;ANSI.mdtables. -
Styled emission must respect ShouldEmitAnsi and non-TTY hosts.
Context
Programs must not leak escapes to pipes, log files, or NO_COLOR environments.
Decision
Rule Detail Gating User-visible styled output must pass Ansi.Escape.WhenEnabledTests Ungated Csiremains for golden testsConsequences
When
ShouldEmitAnsi()is false, gated builders return empty strings.Verification anchors
AnsiEscapeTests.bd; console capability integration. -
Truecolor sequences downgrade via EffectiveColorModel.
Context
Terminals differ in color depth; emitting unsupported
38;2breaks dumb hosts.Decision
Rule Detail Ladder truecolor → 256 → basic per EffectiveColorModelPolicy Callers do not pick per-sequence models manually Consequences
SGR builders consult capability probes before emitting RGB CSI.
Verification anchors
AnsiSgrGoldenTests.bd;CapabilitiesTests.bd. -
OSC payloads terminate with BEL, not ST.
Context
OSC framing varies across terminals; v1 picks one terminator for golden tests.
Decision
Rule Detail Terminator BEL ( 0x07) in v1ST ESCtermination is not requiredConsequences
OSC helpers emit BEL-terminated sequences only until a future ADR extends ST.
Verification anchors
AnsiEscapeTests.bd;Ansi.Oscsources.
- Contracts and edge cases MUST/SHOULD rules for escape emission and supported sequence subsets.
- Design model ESC/CSI/OSC taxonomy and normative control-character tables for terminal output.
- Examples Representative escape composition and gated emission patterns.
- Flow and algorithm How escape bytes are composed, gated, and written to stdout.
- Verification and traceability Golden tests and source anchors for ANSI escape framing.
0 revisions (git unavailable at build; counts may be empty)
No commits recorded for this path.
| Section id | Required | Found |
|---|---|---|
what-this-feature-specifies | yes | yes |
implementation-anchors | yes | yes |
Full tree: run pnpm verify:platform-spec-layout (writes src/generated/platform-spec-layout-report.json).
Purpose
Section titled “Purpose”Document verification and traceability for the Ansi Escape Model feature: role-specific normative detail beyond the feature hub.
Canonical references
Section titled “Canonical references”- Feature hub: Ansi Escape Model
- Sibling articles in this bundle (design model, contracts, flow, examples, verification)
Detailed behavior
Section titled “Detailed behavior”Source anchors
Section titled “Source anchors”| Path | Coverage |
|---|---|
compiler/corelib/packages/console/src/Ansi/Escape.bd | ESC, CSI, private mode, DEC, OSC, gating |
compiler/corelib/packages/console/src/Ansi/Cursor.bd | Movement CSI |
compiler/corelib/packages/console/src/Ansi/Erase.bd | Display/line erase |
compiler/corelib/packages/console/src/Ansi/Sgr.bd | SGR builder and downgrade |
compiler/corelib/packages/console/src/Ansi/Screen.bd | Scroll region / alt screen |
Repository ANSI.md | Informative full sequence catalog |
Corelib tests
Section titled “Corelib tests”| Test file | Asserts |
|---|---|
AnsiEscapeTests.bd | CSI bold red, reset, ?1049h, DEC save, cursor home, erase display |
AnsiSgrGoldenTests.bd | SGR chains and reset suffix |
AnsiStyleChainTests.bd | Markup attribute chain → escapes |
AnsiBuildersTests.bd | Screen scroll region framing |
CapabilitiesTests.bd | Gated vs empty output when ANSI disabled |
Tests live under compiler/corelib/beskid_corelib/tests/corelib_tests/src/console/ and run as part of the corelib_tests project.
Traceability rule
Section titled “Traceability rule”Any change to ANSI-001 through ANSI-008 in contracts and edge cases must update or add a golden test in the same change. Informative ANSI.md updates are recommended but not CI-gated.
Verification
Section titled “Verification”See the verification and traceability article in this bundle and compiler/corelib/beskid_corelib/tests/corelib_tests/src/console/.
Related topics
Section titled “Related topics”- Parent feature hub and Terminal and console area