tessl install tessl/npm-wrap-ansi@9.0.0Wordwrap a string with ANSI escape codes
Agent Success
Agent success rate when using this tile
100%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.04x
Baseline
Agent success rate without this tile
96%
Build a terminal text formatting utility that wraps styled text while preserving various types of terminal control codes.
Your utility should wrap text to a specified column width while correctly handling different types of terminal escape sequences. The function should:
\u001B[31m for red color, \u001B[39m to reset)\u001B]8;;URL\u0007text\u001B]8;;\u0007)Escape sequences should not count toward the column width - only visible characters should be measured. When text wraps to multiple lines, active styling should continue correctly across line breaks.
"\u001B[31mred text here\u001B[39m" at width 8 preserves red color codes across wrapped lines @test"\u001B]8;;https://example.com\u0007click here\u001B]8;;\u0007" at width 6 maintains clickable link across "click" and "here" on separate lines @test@generates
/**
* Wraps text to specified column width while preserving terminal escape sequences.
*
* @param {string} text - The text to wrap, may contain ANSI escape codes
* @param {number} columns - Maximum column width for wrapping
* @returns {string} Wrapped text with preserved escape sequences
*/
function formatText(text, columns) {
// Implementation here
}
module.exports = { formatText };Provides text wrapping with ANSI escape code support.
@satisfied-by