MCPcopy Index your code
hub / github.com/csev/py4e / findColumn

Function findColumn

tools/pythonauto/static/codemirrorepl/codemirror.js:6929–6941  ·  view source on GitHub ↗
(string, goal, tabSize)

Source from the content-addressed store, hash-verified

6927 // The inverse of countColumn -- find the offset that corresponds to
6928 // a particular column.
6929 function findColumn(string, goal, tabSize) {
6930 for (var pos = 0, col = 0;;) {
6931 var nextTab = string.indexOf("\t", pos);
6932 if (nextTab == -1) nextTab = string.length;
6933 var skipped = nextTab - pos;
6934 if (nextTab == string.length || col + skipped >= goal)
6935 return pos + Math.min(skipped, goal - col);
6936 col += nextTab - pos;
6937 col += tabSize - (col % tabSize);
6938 pos = nextTab + 1;
6939 if (col >= goal) return pos;
6940 }
6941 }
6942
6943 var spaceStrs = [""];
6944 function spaceStr(n) {

Callers 1

extendToFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected