MCPcopy Index your code
hub / github.com/ronreiter/interactive-tutorials / findStartLine

Function findStartLine

static/js/codemirror/codemirror.js:901–914  ·  view source on GitHub ↗
(cm, n)

Source from the content-addressed store, hash-verified

899 // smallest indentation, which tends to need the least context to
900 // parse correctly.
901 function findStartLine(cm, n) {
902 var minindent, minline, doc = cm.doc;
903 for (var search = n, lim = n - 100; search > lim; --search) {
904 if (search <= doc.first) return doc.first;
905 var line = getLine(doc, search - 1);
906 if (line.stateAfter) return search;
907 var indented = countColumn(line.text, null, cm.options.tabSize);
908 if (minline == null || minindent > indented) {
909 minline = search - 1;
910 minindent = indented;
911 }
912 }
913 return minline;
914 }
915
916 function getStateBefore(cm, n) {
917 var doc = cm.doc, display = cm.display;

Callers 1

getStateBeforeFunction · 0.85

Calls 2

getLineFunction · 0.85
countColumnFunction · 0.85

Tested by

no test coverage detected