truncate(text: string,width: number): string
Cuts a line to width columns, counting what the terminal counts.
The reset goes back on the end, so a value cut off mid-colour cannot leak its palette into whatever the terminal draws next.
import { truncate } from './terminal.ts'; truncate('abcdef', 4); // 'abc…' truncate('abc', 10); // 'abc' — what already fits is left alone