MCPcopy
hub / github.com/csev/py4e / buildTokenBadBidi

Function buildTokenBadBidi

tools/pythonauto/static/codemirrorepl/codemirror.js:5777–5794  ·  view source on GitHub ↗
(inner, order)

Source from the content-addressed store, hash-verified

5775 // Work around nonsense dimensions being reported for stretches of
5776 // right-to-left text.
5777 function buildTokenBadBidi(inner, order) {
5778 return function(builder, text, style, startStyle, endStyle, title) {
5779 style = style ? style + " cm-force-border" : "cm-force-border";
5780 var start = builder.pos, end = start + text.length;
5781 for (;;) {
5782 // Find the part that overlaps with the start of this text
5783 for (var i = 0; i < order.length; i++) {
5784 var part = order[i];
5785 if (part.to > start && part.from <= start) break;
5786 }
5787 if (part.to >= end) return inner(builder, text, style, startStyle, endStyle, title);
5788 inner(builder, text.slice(0, part.to - start), style, startStyle, null, title);
5789 startStyle = null;
5790 text = text.slice(part.to - start);
5791 start = part.to;
5792 }
5793 };
5794 }
5795
5796 function buildCollapsedSpan(builder, size, marker, ignoreWidget) {
5797 var widget = !ignoreWidget && marker.widgetNode;

Callers 1

buildLineContentFunction · 0.85

Calls 1

sliceMethod · 0.80

Tested by

no test coverage detected