MCPcopy Create free account
hub / github.com/ronreiter/interactive-tutorials / buildTokenMeasure

Function buildTokenMeasure

static/js/codemirror/codemirror.js:4034–4050  ·  view source on GitHub ↗
(builder, text, style, startStyle, endStyle)

Source from the content-addressed store, hash-verified

4032 }
4033
4034 function buildTokenMeasure(builder, text, style, startStyle, endStyle) {
4035 for (var i = 0; i < text.length; ++i) {
4036 var ch = text.charAt(i), start = i == 0;
4037 if (ch >= "\ud800" && ch < "\udbff" && i < text.length - 1) {
4038 ch = text.slice(i, i + 2);
4039 ++i;
4040 } else if (i && builder.cm.options.lineWrapping &&
4041 spanAffectsWrapping.test(text.slice(i - 1, i + 1))) {
4042 builder.pre.appendChild(elt("wbr"));
4043 }
4044 builder.measure[builder.pos] =
4045 buildToken(builder, ch, style,
4046 start && startStyle, i == text.length - 1 && endStyle);
4047 builder.pos += ch.length;
4048 }
4049 if (text.length) builder.addedOne = true;
4050 }
4051
4052 function buildCollapsedSpan(builder, size, widget) {
4053 if (widget) {

Callers

nothing calls this directly

Calls 3

eltFunction · 0.85
buildTokenFunction · 0.85
testMethod · 0.45

Tested by

no test coverage detected