Skip to main content

Module ansi

Module ansi 

Source
Expand description

Just enough ANSI to render a captured pane.

The preview shows a live agent session, which is nothing but colour, so capture-pane -e is what has to be drawn. fzf gets this for free by being handed the bytes and parsing them itself; a native picker has to do it.

Deliberately not a terminal emulator, and deliberately not a dependency. capture-pane -e emits SGR (ESC [ ... m) and nothing else: the cursor movement, scrolling and mode changes a real stream carries have already been applied to the screen it hands back. So this understands SGR, skips any other escape sequence whole, and never has to be right about anything else.

Functionsยง

to_lines
Text into styled lines, carrying the style across line breaks the way a terminal does: a capture can open a colour on one row and close it on the next.