c4spar / deno-cliffy

Command line framework for deno 🦕 Including Commandline-Interfaces, Prompts, CLI-Table, Arguments Parser and more...

Home Page:https://cliffy.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ANSI codes overflow multi-line table cells

lionel-rowe opened this issue · comments

Due to TTY output not having any concept of soft line breaks, multi-line table cells with content wrapped in formatting ANSI codes cause their styles to overflow into adjacent borders and cells.

For example:

Table.from([[colors.yellow(`These ${colors.red("colors don’t")} run`), "Cell 2"]])
    .border(true)
    .columns([{ maxWidth: 12 }])
    .render()

Expected display:
image

Actual display:
image

It would be helpful if this was handled automatically within the cell line wrapping logic.