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

Function buildTokenMeasure

tools/pythonauto/static/codemirror/codemirror.js:4617–4640  ·  view source on GitHub ↗
(builder, text, style, startStyle, endStyle)

Source from the content-addressed store, hash-verified

4615 }
4616
4617 function buildTokenMeasure(builder, text, style, startStyle, endStyle) {
4618 var wrapping = builder.cm.options.lineWrapping;
4619 for (var i = 0; i < text.length; ++i) {
4620 var start = i == 0, to = i + 1;
4621 while (to < text.length && isExtendingChar(text.charAt(to))) ++to;
4622 var ch = text.slice(i, to);
4623 i = to - 1;
4624 if (i && wrapping && spanAffectsWrapping(text, i))
4625 builder.pre.appendChild(elt("wbr"));
4626 var old = builder.measure[builder.pos];
4627 var span = builder.measure[builder.pos] =
4628 buildToken(builder, ch, style,
4629 start && startStyle, i == text.length - 1 && endStyle);
4630 if (old) span.leftSide = old.leftSide || old;
4631 // In IE single-space nodes wrap differently than spaces
4632 // embedded in larger text nodes, except when set to
4633 // white-space: normal (issue #1268).
4634 if (old_ie && wrapping && ch == " " && i && !/\s/.test(text.charAt(i - 1)) &&
4635 i < text.length - 1 && !/\s/.test(text.charAt(i + 1)))
4636 span.style.whiteSpace = "normal";
4637 builder.pos += ch.length;
4638 }
4639 if (text.length) builder.measuredSomething = true;
4640 }
4641
4642 function buildTokenSplitSpaces(inner) {
4643 function split(old) {

Callers

nothing calls this directly

Calls 6

spanAffectsWrappingFunction · 0.85
sliceMethod · 0.80
isExtendingCharFunction · 0.70
eltFunction · 0.70
buildTokenFunction · 0.70
appendChildMethod · 0.45

Tested by

no test coverage detected