MCPcopy Create free account
hub / github.com/sql-js/sql.js / findColumn

Function findColumn

GUI/codemirror/lib/codemirror.js:6987–6999  ·  view source on GitHub ↗
(string, goal, tabSize)

Source from the content-addressed store, hash-verified

6985 // The inverse of countColumn -- find the offset that corresponds to
6986 // a particular column.
6987 function findColumn(string, goal, tabSize) {
6988 for (var pos = 0, col = 0;;) {
6989 var nextTab = string.indexOf("\t", pos);
6990 if (nextTab == -1) nextTab = string.length;
6991 var skipped = nextTab - pos;
6992 if (nextTab == string.length || col + skipped >= goal)
6993 return pos + Math.min(skipped, goal - col);
6994 col += nextTab - pos;
6995 col += tabSize - (col % tabSize);
6996 pos = nextTab + 1;
6997 if (col >= goal) return pos;
6998 }
6999 }
7000
7001 var spaceStrs = [""];
7002 function spaceStr(n) {

Callers 1

extendToFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…