Skip to content

fix(ink-compat): parse ANSI SGR emitted by Transform#35

Closed
RtlZeroMemory wants to merge 4 commits into
mainfrom
fix/ink-compat-transform-ansi-sgr
Closed

fix(ink-compat): parse ANSI SGR emitted by Transform#35
RtlZeroMemory wants to merge 4 commits into
mainfrom
fix/ink-compat-transform-ansi-sgr

Conversation

@RtlZeroMemory

Copy link
Copy Markdown
Owner

Summary

  • parse ANSI CSI/SGR sequences after output is applied
  • avoid leaking literal color fragments like in rendered text
  • add regression test for returning ANSI-encoded string

Why

and similar components can emit ANSI from . Previously only plain text node paths parsed ANSI; transform output could bypass parsing and render raw bracket fragments.

Local validation

  • TAP version 13

Subtest:

# Subtest: applies transform to flattened text (best-effort)
ok 1 - applies transform to flattened text (best-effort)
  ---
  duration_ms: 3.708994
  ...
# Subtest: transform sees per-line index
ok 2 - transform sees per-line index
  ---
  duration_ms: 0.648031
  ...
# Subtest: transform ANSI SGR output is parsed into styled text
ok 3 - transform ANSI SGR output is parsed into styled text
  ---
  duration_ms: 0.755791
  ...
1..3

ok 1 -

duration_ms: 5.715668
type: 'suite'
...
1..1

tests 3

suites 1

pass 3

fail 0

cancelled 0

skipped 0

todo 0

duration_ms 138.176205

  • TAP version 13

Subtest: reconciler: host tree -> Rezi VNode

# Subtest: <Text> renders ui.text with style
ok 1 - <Text> renders ui.text with style
  ---
  duration_ms: 3.924426
  ...
# Subtest: nested <Text> produces richText spans
ok 2 - nested <Text> produces richText spans
  ---
  duration_ms: 0.585781
  ...
# Subtest: <Text> parses ANSI SGR color sequences into richText spans
ok 3 - <Text> parses ANSI SGR color sequences into richText spans
  ---
  duration_ms: 0.423741
  ...
# Subtest: <Text> supports ANSI 256-color foreground (38;5;n)
ok 4 - <Text> supports ANSI 256-color foreground (38;5;n)
  ---
  duration_ms: 0.25309
  ...
# Subtest: <Box flexDirection> maps to ui.row/ui.column
ok 5 - <Box flexDirection> maps to ui.row/ui.column
  ---
  duration_ms: 0.690211
  ...
# Subtest: <Box borderStyle> wraps stack in ui.box
ok 6 - <Box borderStyle> wraps stack in ui.box
  ---
  duration_ms: 0.291441
  ...
# Subtest: <Spacer> maps to ui.spacer({flex:1})
ok 7 - <Spacer> maps to ui.spacer({flex:1})
  ---
  duration_ms: 0.43037
  ...
1..7

ok 1 - reconciler: host tree -> Rezi VNode

duration_ms: 7.242401
type: 'suite'
...
1..1

tests 7

suites 1

pass 7

fail 0

cancelled 0

skipped 0

todo 0

duration_ms 148.918177

  • Manual Gemini smoke using local patched dist overlay: startup rendered proper ANSI-colored banner (no literal artifacts)

@RtlZeroMemory
RtlZeroMemory deleted the fix/ink-compat-transform-ansi-sgr branch February 12, 2026 09:53
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.

2 participants