MCPcopy Index your code
hub / github.com/DHTMLX/gantt / findColumn

Function findColumn

samples/common/codehighlight/codemirror.js:218–230  ·  view source on GitHub ↗
(string, goal, tabSize)

Source from the content-addressed store, hash-verified

216 // The inverse of countColumn -- find the offset that corresponds to
217 // a particular column.
218 function findColumn(string, goal, tabSize) {
219 for (var pos = 0, col = 0;;) {
220 var nextTab = string.indexOf("\t", pos);
221 if (nextTab == -1) { nextTab = string.length; }
222 var skipped = nextTab - pos;
223 if (nextTab == string.length || col + skipped >= goal)
224 { return pos + Math.min(skipped, goal - col) }
225 col += nextTab - pos;
226 col += tabSize - (col % tabSize);
227 pos = nextTab + 1;
228 if (col >= goal) { return pos }
229 }
230 }
231
232 var spaceStrs = [""];
233 function spaceStr(n) {

Callers 1

extendToFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected