Skip to content

Function: wrapText() ​

ts
function wrapText(
   text, 
   maxWidth, 
   maxLines, 
   measure
): string[];

Defined in: core/cursor.ts:249

Cut text into lines no wider than maxWidth (measure gives the width of a string): at the spaces, and inside a word that is too long on its own. At most maxLines lines; the last one ends with an ellipsis when something was left out.

Parameters ​

text ​

string

maxWidth ​

number

maxLines ​

number

measure ​

(s) => number

Returns ​

string[]