| 7071 | // Work around nonsense dimensions being reported for stretches of |
| 7072 | // right-to-left text. |
| 7073 | function buildTokenBadBidi(inner, order) { |
| 7074 | return function(builder, text, style, startStyle, endStyle, title, css) { |
| 7075 | style = style ? style + " cm-force-border" : "cm-force-border"; |
| 7076 | var start = builder.pos, end = start + text.length; |
| 7077 | for (;;) { |
| 7078 | // Find the part that overlaps with the start of this text |
| 7079 | for (var i = 0; i < order.length; i++) { |
| 7080 | var part = order[i]; |
| 7081 | if (part.to > start && part.from <= start) break; |
| 7082 | } |
| 7083 | if (part.to >= end) return inner(builder, text, style, startStyle, endStyle, title, css); |
| 7084 | inner(builder, text.slice(0, part.to - start), style, startStyle, null, title, css); |
| 7085 | startStyle = null; |
| 7086 | text = text.slice(part.to - start); |
| 7087 | start = part.to; |
| 7088 | } |
| 7089 | }; |
| 7090 | } |
| 7091 | |
| 7092 | function buildCollapsedSpan(builder, size, marker, ignoreWidget) { |
| 7093 | var widget = !ignoreWidget && marker.widgetNode; |