MCPcopy Create free account
hub / github.com/breck7/scroll / countColumn

Function countColumn

external/.scrollLibs.js:673–689  ·  view source on GitHub ↗
(string, end, tabSize, startIndex, startValue)

Source from the content-addressed store, hash-verified

671 // Counts the column offset in a string, taking tabs into account.
672 // Used mostly to find indentation.
673 function countColumn(string, end, tabSize, startIndex, startValue) {
674 if (end == null) {
675 end = string.search(/[^\s\u00a0]/)
676 if (end == -1) {
677 end = string.length
678 }
679 }
680 for (var i = startIndex || 0, n = startValue || 0; ; ) {
681 var nextTab = string.indexOf("\t", i)
682 if (nextTab < 0 || nextTab >= end) {
683 return n + (end - i)
684 }
685 n += nextTab - i
686 n += tabSize - (n % tabSize)
687 i = nextTab + 1
688 }
689 }
690
691 var Delayed = function () {
692 this.id = null

Callers 5

.scrollLibs.jsFile · 0.85
findStartLineFunction · 0.85
posFromMouseFunction · 0.85
extendToFunction · 0.85
indentLineFunction · 0.85

Calls 1

indexOfMethod · 0.80

Tested by

no test coverage detected