MCPcopy
hub / github.com/csev/py4e / findStartLine

Function findStartLine

tools/pythonauto/static/codemirrorepl/codemirrorepl.js:1975–1988  ·  view source on GitHub ↗
(n)

Source from the content-addressed store, hash-verified

1973 // smallest indentation, which tends to need the least context to
1974 // parse correctly.
1975 function findStartLine(n) {
1976 var minindent, minline;
1977 for (var search = n, lim = n - 40; search > lim; --search) {
1978 if (search == 0) return 0;
1979 var line = getLine(search-1);
1980 if (line.stateAfter) return search;
1981 var indented = line.indentation(options.tabSize);
1982 if (minline == null || minindent > indented) {
1983 minline = search - 1;
1984 minindent = indented;
1985 }
1986 }
1987 return minline;
1988 }
1989 function getStateBefore(n) {
1990 var start = findStartLine(n), state = start && getLine(start-1).stateAfter;
1991 if (!state) state = startState(mode);

Callers 2

getStateBeforeFunction · 0.70
highlightWorkerFunction · 0.70

Calls 1

getLineFunction · 0.70

Tested by

no test coverage detected