MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / countColumn

Function countColumn

lib/web/CodeMirror/src/util/misc.js:16–29  ·  view source on GitHub ↗
(string, end, tabSize, startIndex, startValue)

Source from the content-addressed store, hash-verified

14// Counts the column offset in a string, taking tabs into account.
15// Used mostly to find indentation.
16export function countColumn(string, end, tabSize, startIndex, startValue) {
17 if (end == null) {
18 end = string.search(/[^\s\u00a0]/)
19 if (end == -1) end = string.length
20 }
21 for (let i = startIndex || 0, n = startValue || 0;;) {
22 let nextTab = string.indexOf("\t", i)
23 if (nextTab < 0 || nextTab >= end)
24 return n + (end - i)
25 n += nextTab - i
26 n += tabSize - (n % tabSize)
27 i = nextTab + 1
28 }
29}
30
31export class Delayed {
32 constructor() {

Callers 7

posFromMouseFunction · 0.90
indentLineFunction · 0.90
columnMethod · 0.90
indentationMethod · 0.90
findStartLineFunction · 0.90
extendToFunction · 0.90
commands.jsFile · 0.90

Calls 2

indexOfMethod · 0.80
searchMethod · 0.45

Tested by

no test coverage detected