Skip to content

Markdown ANSI escape sequences rendered as literal text in TUI (wrapped numbered lists) #1143

Open

Description

@noveanando

Summary

In the interactive TUI, parts of the markdown styling (bold, truecolor codespans) leak to the screen as LITERAL text. Users see raw sequences like: 1. [1mPasien ini...[22m and [38;2;67;56;202m1147958[39m. This makes assistant responses unreadable and pollutes anything copied from the terminal.

Expected Behavior

Markdown should render as styled text (bold/colored) in the TUI. ANSI escape sequences should be applied as styling or stripped entirely — never printed as visible literal text like [1m or [38;2;R;G;Bm.

Actual Behavior

Bold/codespan styling inside LONG numbered-list items that WRAP across physical lines shows literal [1m, [22m, [38;2;R;G;Bm, [39m sequences (the ESC byte is missing; the rest prints as text). Tables, short lines, and codespans that fit on one line render correctly. Verified on BOTH themes: light leaks rgb(67,56,202)=#4338CA (theme CODE color), dark leaks rgb(177,186,249)=#B1BAF9.

Steps to reproduce the issue

  1. Run cmd interactive TUI in foot 1.21 inside tmux 3.8 (TERM=tmux-256color, COLORTERM=truecolor).
  2. Ask the model for a response containing long numbered-list items with bold and inline codespans (text long enough to wrap across multiple physical lines).
  3. Observe: wrapped list items show literal [1m / [38;2;...m text; tables and short lines are fine.
  4. Compare: cmd -p "same prompt" (headless) prints CLEAN output with 0 ESC bytes; the session .jsonl file also stores clean markdown — the corruption happens only in the interactive TUI render path.
  5. Also reproduces with a plain launcher (no user patches: node dist/index.mjs directly).

Command Code Version

1.88.5

Operating System

Linux

Terminal/IDE

foot 1.21.0 (foot --server) inside tmux 3.8, COLORTERM=truecolor

Shell

bash

Session file (optional)

No response

Fix prompt (optional)

No response

Additional context

Suspected component: the TUI markdown render path — marked-terminal + chalk (truecolor) feeding ink 7.1.0. ink/build/ink.js line 392 wraps output with wrapAnsi(output, width, {trim:false, hard:true}), and ink 7.1's new build/ansi-tokenizer.js slices/reassembles styled text. hard-wrapping inside a styled run and/or token re-assembly appears to drop the leading ESC byte or split a CSI sequence so the remainder prints literally.
Evidence: model output in session .jsonl is clean markdown; headless cmd -p is clean (0 ESC bytes); bug persists with all user patches removed and on both themes.

Activity

  1. added theissue type on Nov 13, 2026
  2. magicprinc commented on Nov 13, 2026

    @magicprinc

    see also #1138

  3. naymurdev commented on Nov 13, 2026

    @naymurdev

    Thanks for creating the issue!! @vipulgupta2048 can u have look at it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions