(line, builder, styles)
| 1911 | // Outputs a number of spans to make up a line, taking highlighting |
| 1912 | // and marked text into account. |
| 1913 | function insertLineContent(line, builder, styles) { |
| 1914 | var spans = line.markedSpans, allText = line.text, at = 0; |
| 1915 | if (!spans) { |
| 1916 | for (var i$1 = 1; i$1 < styles.length; i$1+=2) |
| 1917 | { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); } |
| 1918 | return |
| 1919 | } |
| 1920 | |
| 1921 | var len = allText.length, pos = 0, i = 1, text = "", style, css; |
| 1922 | var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, collapsed, attributes; |
| 1923 | for (;;) { |
| 1924 | if (nextChange == pos) { // Update current marker set |
| 1925 | spanStyle = spanEndStyle = spanStartStyle = css = ""; |
| 1926 | attributes = null; |
| 1927 | collapsed = null; nextChange = Infinity; |
| 1928 | var foundBookmarks = [], endStyles = (void 0); |
| 1929 | for (var j = 0; j < spans.length; ++j) { |
| 1930 | var sp = spans[j], m = sp.marker; |
| 1931 | if (m.type == "bookmark" && sp.from == pos && m.widgetNode) { |
| 1932 | foundBookmarks.push(m); |
| 1933 | } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) { |
| 1934 | if (sp.to != null && sp.to != pos && nextChange > sp.to) { |
| 1935 | nextChange = sp.to; |
| 1936 | spanEndStyle = ""; |
| 1937 | } |
| 1938 | if (m.className) { spanStyle += " " + m.className; } |
| 1939 | if (m.css) { css = (css ? css + ";" : "") + m.css; } |
| 1940 | if (m.startStyle && sp.from == pos) { spanStartStyle += " " + m.startStyle; } |
| 1941 | if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); } |
| 1942 | // support for the old title property |
| 1943 | // https://github.com/codemirror/CodeMirror/pull/5673 |
| 1944 | if (m.title) { (attributes || (attributes = {})).title = m.title; } |
| 1945 | if (m.attributes) { |
| 1946 | for (var attr in m.attributes) |
| 1947 | { (attributes || (attributes = {}))[attr] = m.attributes[attr]; } |
| 1948 | } |
| 1949 | if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0)) |
| 1950 | { collapsed = sp; } |
| 1951 | } else if (sp.from > pos && nextChange > sp.from) { |
| 1952 | nextChange = sp.from; |
| 1953 | } |
| 1954 | } |
| 1955 | if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2) |
| 1956 | { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += " " + endStyles[j$1]; } } } |
| 1957 | |
| 1958 | if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2) |
| 1959 | { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } } |
| 1960 | if (collapsed && (collapsed.from || 0) == pos) { |
| 1961 | buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos, |
| 1962 | collapsed.marker, collapsed.from == null); |
| 1963 | if (collapsed.to == null) { return } |
| 1964 | if (collapsed.to == pos) { collapsed = false; } |
| 1965 | } |
| 1966 | } |
| 1967 | if (pos >= len) { break } |
| 1968 | |
| 1969 | var upto = Math.min(len, nextChange); |
| 1970 | while (true) { |
no test coverage detected