MCPcopy Create free account
hub / github.com/TruthHun/BookStack / find

Function find

static/mergely/lib/codemirror.js:1929–1942  ·  view source on GitHub ↗
(textNode, topNode, offset)

Source from the content-addressed store, hash-verified

1927 var measure = lineView.measure, maps = measure.maps;
1928
1929 function find(textNode, topNode, offset) {
1930 for (var i = -1; i < (maps ? maps.length : 0); i++) {
1931 var map = i < 0 ? measure.map : maps[i];
1932 for (var j = 0; j < map.length; j += 3) {
1933 var curNode = map[j + 2];
1934 if (curNode == textNode || curNode == topNode) {
1935 var line = lineNo(i < 0 ? lineView.line : lineView.rest[i]);
1936 var ch = map[j] + offset;
1937 if (offset < 0 || curNode != textNode) ch = map[j + (offset ? 1 : 0)];
1938 return Pos(line, ch);
1939 }
1940 }
1941 }
1942 }
1943 var found = find(textNode, topNode, offset);
1944 if (found) return badPos(found, bad);
1945

Callers 3

locateNodeInLineViewFunction · 0.70
jquery-2.2.1.jsFile · 0.50
jquery.jsFile · 0.50

Calls 1

lineNoFunction · 0.70

Tested by

no test coverage detected