forked from
oppi.li/claude-code
source dump of claude code
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}