(map$$1, ch, bias)
| 3708 | var nullRect = { left: 0, right: 0, top: 0, bottom: 0 } |
| 3709 | |
| 3710 | function nodeAndOffsetInLineMap(map$$1, ch, bias) { |
| 3711 | var node, start, end, collapse, mStart, mEnd |
| 3712 | // First, search the line map for the text node corresponding to, |
| 3713 | // or closest to, the target character. |
| 3714 | for (var i = 0; i < map$$1.length; i += 3) { |
| 3715 | mStart = map$$1[i] |
| 3716 | mEnd = map$$1[i + 1] |
| 3717 | if (ch < mStart) { |
| 3718 | start = 0 |
| 3719 | end = 1 |
| 3720 | collapse = "left" |
| 3721 | } else if (ch < mEnd) { |
| 3722 | start = ch - mStart |
| 3723 | end = start + 1 |
| 3724 | } else if (i == map$$1.length - 3 || (ch == mEnd && map$$1[i + 3] > ch)) { |
| 3725 | end = mEnd - mStart |
| 3726 | start = end - 1 |
| 3727 | if (ch >= mEnd) { |
| 3728 | collapse = "right" |
| 3729 | } |
| 3730 | } |
| 3731 | if (start != null) { |
| 3732 | node = map$$1[i + 2] |
| 3733 | if (mStart == mEnd && bias == (node.insertLeft ? "left" : "right")) { |
| 3734 | collapse = bias |
| 3735 | } |
| 3736 | if (bias == "left" && start == 0) { |
| 3737 | while (i && map$$1[i - 2] == map$$1[i - 3] && map$$1[i - 1].insertLeft) { |
| 3738 | node = map$$1[(i -= 3) + 2] |
| 3739 | collapse = "left" |
| 3740 | } |
| 3741 | } |
| 3742 | if (bias == "right" && start == mEnd - mStart) { |
| 3743 | while (i < map$$1.length - 3 && map$$1[i + 3] == map$$1[i + 4] && !map$$1[i + 5].insertLeft) { |
| 3744 | node = map$$1[(i += 3) + 2] |
| 3745 | collapse = "right" |
| 3746 | } |
| 3747 | } |
| 3748 | break |
| 3749 | } |
| 3750 | } |
| 3751 | return { node: node, start: start, end: end, collapse: collapse, coverStart: mStart, coverEnd: mEnd } |
| 3752 | } |
| 3753 | |
| 3754 | function getUsefulRect(rects, bias) { |
| 3755 | var rect = nullRect |
no outgoing calls
no test coverage detected