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

Function buildTokenBadBidi

lib/web/CodeMirror/src/line/line_data.js:212–230  ·  view source on GitHub ↗
(inner, order)

Source from the content-addressed store, hash-verified

210// Work around nonsense dimensions being reported for stretches of
211// right-to-left text.
212function buildTokenBadBidi(inner, order) {
213 return (builder, text, style, startStyle, endStyle, css, attributes) => {
214 style = style ? style + " cm-force-border" : "cm-force-border"
215 let start = builder.pos, end = start + text.length
216 for (;;) {
217 // Find the part that overlaps with the start of this text
218 let part
219 for (let i = 0; i < order.length; i++) {
220 part = order[i]
221 if (part.to > start && part.from <= start) break
222 }
223 if (part.to >= end) return inner(builder, text, style, startStyle, endStyle, css, attributes)
224 inner(builder, text.slice(0, part.to - start), style, startStyle, null, css, attributes)
225 startStyle = null
226 text = text.slice(part.to - start)
227 start = part.to
228 }
229 }
230}
231
232function buildCollapsedSpan(builder, size, marker, ignoreWidget) {
233 let widget = !ignoreWidget && marker.widgetNode

Callers 1

buildLineContentFunction · 0.70

Calls 1

innerFunction · 0.85

Tested by

no test coverage detected