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

Function buildTokenBadBidi

external/.scrollLibs.js:3017–3040  ·  view source on GitHub ↗
(inner, order)

Source from the content-addressed store, hash-verified

3015 // Work around nonsense dimensions being reported for stretches of
3016 // right-to-left text.
3017 function buildTokenBadBidi(inner, order) {
3018 return function (builder, text, style, startStyle, endStyle, css, attributes) {
3019 style = style ? style + " cm-force-border" : "cm-force-border"
3020 var start = builder.pos,
3021 end = start + text.length
3022 for (;;) {
3023 // Find the part that overlaps with the start of this text
3024 var part = void 0
3025 for (var i = 0; i < order.length; i++) {
3026 part = order[i]
3027 if (part.to > start && part.from <= start) {
3028 break
3029 }
3030 }
3031 if (part.to >= end) {
3032 return inner(builder, text, style, startStyle, endStyle, css, attributes)
3033 }
3034 inner(builder, text.slice(0, part.to - start), style, startStyle, null, css, attributes)
3035 startStyle = null
3036 text = text.slice(part.to - start)
3037 start = part.to
3038 }
3039 }
3040 }
3041
3042 function buildCollapsedSpan(builder, size, marker, ignoreWidget) {
3043 var widget = !ignoreWidget && marker.widgetNode

Callers 1

buildLineContentFunction · 0.85

Calls 1

sliceMethod · 0.80

Tested by

no test coverage detected