MCPcopy Create free account
hub / github.com/breck7/scroll / find

Function find

external/.scrollLibs.js:12628–12643  ·  view source on GitHub ↗
(textNode, topNode, offset)

Source from the content-addressed store, hash-verified

12626 maps = measure.maps
12627
12628 function find(textNode, topNode, offset) {
12629 for (var i = -1; i < (maps ? maps.length : 0); i++) {
12630 var map$$1 = i < 0 ? measure.map : maps[i]
12631 for (var j = 0; j < map$$1.length; j += 3) {
12632 var curNode = map$$1[j + 2]
12633 if (curNode == textNode || curNode == topNode) {
12634 var line = lineNo(i < 0 ? lineView.line : lineView.rest[i])
12635 var ch = map$$1[j] + offset
12636 if (offset < 0 || curNode != textNode) {
12637 ch = map$$1[j + (offset ? 1 : 0)]
12638 }
12639 return Pos(line, ch)
12640 }
12641 }
12642 }
12643 }
12644 var found = find(textNode, topNode, offset)
12645 if (found) {
12646 return badPos(found, bad)

Callers 1

locateNodeInLineViewFunction · 0.70

Calls 2

lineNoFunction · 0.85
PosFunction · 0.85

Tested by

no test coverage detected