source dump of claude code
at main 19 lines 434 B view raw
1import { lineWidth } from './line-width-cache.js' 2 3export function widestLine(string: string): number { 4 let maxWidth = 0 5 let start = 0 6 7 while (start <= string.length) { 8 const end = string.indexOf('\n', start) 9 const line = 10 end === -1 ? string.substring(start) : string.substring(start, end) 11 12 maxWidth = Math.max(maxWidth, lineWidth(line)) 13 14 if (end === -1) break 15 start = end + 1 16 } 17 18 return maxWidth 19}