417
418
public getPositionAt(offset: number): Position {
420
>
offset = Math.max(0, offset);
421
>
422
>
let x = this.root;
423
>
let lfCnt = 0;
424
>
const originalOffset = offset;
425
>
426
>
while (x !== SENTINEL) {
427
>
if (x.size_left !== 0 && x.size_left >= offset) {
428
x = x.left;
430
>
const out = this.getIndexOf(x, offset - x.size_left);
431
>
432
>
lfCnt += x.lf_left + out.index;
433
>
434
>
if (out.index === 0) {
435
const lineStartOffset = this.getOffsetAt(lfCnt + 1, 1);
436
const column = originalOffset - lineStartOffset;