Skip to content

Fix: replace ANSI string buffers with terminal cell surfaces#53

Merged
phranck merged 17 commits into
mainfrom
issue/11-terminal-cell-surface
Jul 20, 2026
Merged

Fix: replace ANSI string buffers with terminal cell surfaces#53
phranck merged 17 commits into
mainfrom
issue/11-terminal-cell-surface

Conversation

@phranck

@phranck phranck commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • add normalized terminal cells, styles, wide-cell continuations, and explicit transparency
  • move FrameBuffer stacking, clipping, compositing, backgrounds, ZStack alignment, and diff preparation onto cell surfaces
  • harden CSI/OSC/DCS/control parsing and make text, notifications, and text fields cell-width aware
  • preserve the public FrameBuffer.lines compatibility adapter and update rendering documentation

Verification

  • 185 focused rendering, layout, input, and ANSI tests passed
  • macOS Xcode 16.2: build, lint, API contracts, 1256-test discovery, and DocC passed; the only initial suite failure was an obsolete ANSI-fragment assertion, now replaced by a green semantic cell-style check
  • Linux Swift 6.0.3: full suite reached the same assertion; focused recovery, strict lint, test discovery, and DocC passed in the pinned --rm container

Closes #11

phranck added 16 commits July 20, 2026 02:24
- measure complete grapheme clusters in terminal cells
- neutralize unsupported CSI, OSC, DCS, and control input
- cover Unicode width and injection boundaries
- normalize SGR style state per grapheme-owned cell
- track wide-cell continuations and explicit transparency
- add cell-safe clipping and compositing primitives
- preserve the public lines adapter with sanitized cached encoding
- make vertical stacking append-only over surface rows
- composite transparency and wide graphemes without reparsing strings
- keep foreground-only spaces transparent during overlays
- treat backgrounds and line decorations as explicit cell paint
- size the shared surface from every rendered child
- position children on both alignment axes
- preserve transparent cells while layering later children
- wrap and measure sanitized Text graphemes by display width
- clip and pad text-field content without splitting wide cells
- scroll focused fields on grapheme boundaries while preserving cursor indices
- prepare terminal-sized surfaces before ANSI encoding
- keep complete wide graphemes only when their full span fits
- normalize redundant input resets at the surface boundary
- apply view backgrounds without reparsing ANSI strings
- preserve child colors while filling opaque padding cells
- cover nested style resets during compositing
- sanitize notification text before wrapping
- use display-cell widths for East Asian content
- clarify text wrapping width documentation
- document terminal surfaces and cell-safe compositing
- update the custom modifier example to use public APIs
- align the architecture pipeline with boundary ANSI encoding
- consume control payloads before splitting logical lines
- reject CRLF control clusters from single-line content
- preserve legitimate line feeds for Text layout
- handle common single-scalar text without line-break allocation
- retain CRLF cluster safety for multiline parsing
- replace repeated String indexing with direct grapheme mapping
- preserve TextField and SecureField display behavior
- cover every cell occupied by the underlying grapheme
- keep cursor visibility changes width-stable
- prevent cursor rendering from splitting wide content
- describe compatibility lines as derived cell-surface output
- inspect semantic bold and dim state instead of ANSI substrings
- keep the assertion stable across normalized SGR encoding
- Integrate async runtime and stable identity changes
- Preserve retry-aware terminal write documentation
@phranck
phranck merged commit c514d83 into main Jul 20, 2026
6 checks passed
@phranck
phranck deleted the issue/11-terminal-cell-surface branch July 20, 2026 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[P0-06] Replace ANSI string buffers with a terminal cell, style, and surface model

1 participant