(lineObj)
| 327 | |
| 328 | // Find the height above the given line. |
| 329 | export function heightAtLine(lineObj) { |
| 330 | lineObj = visualLine(lineObj) |
| 331 | |
| 332 | let h = 0, chunk = lineObj.parent |
| 333 | for (let i = 0; i < chunk.lines.length; ++i) { |
| 334 | let line = chunk.lines[i] |
| 335 | if (line == lineObj) break |
| 336 | else h += line.height |
| 337 | } |
| 338 | for (let p = chunk.parent; p; chunk = p, p = chunk.parent) { |
| 339 | for (let i = 0; i < p.children.length; ++i) { |
| 340 | let cur = p.children[i] |
| 341 | if (cur == chunk) break |
| 342 | else h += cur.height |
| 343 | } |
| 344 | } |
| 345 | return h |
| 346 | } |
| 347 | |
| 348 | // Compute the character length of a line, taking into account |
| 349 | // collapsed ranges (see markText) that might hide parts, and join |
no test coverage detected