Search is not available for this dataset
query
stringlengths
7
355k
document
stringlengths
9
341k
metadata
dict
negatives
sequencelengths
0
101
negative_scores
sequencelengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Compute the character length of a line, taking into account collapsed ranges (see markText) that might hide parts, and join other lines onto it.
function lineLength(line) { if (line.height == 0) { return 0 } var len = line.text.length, merged, cur = line; while (merged = collapsedSpanAtStart(cur)) { var found = merged.find(0, true); cur = found.from.line; len += found.from.ch - found.to.ch; } cur = line; while (merged = collapsedSpanAtEnd(cur)) { var found$1 = merged.find(0, true); len -= cur.text.length - found$1.from.ch; cur = found$1.to.line; len += cur.text.length - found$1.to.ch; } return len }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function lineLength(line) {\n if (line.height == 0) return 0;\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found = merged.find(0, true);\n len -= cur.text.length - found.from.ch;\n cur = found.to.line;\n len += cur.text.length - found.to.ch;\n }\n return len;\n }", "function lineLength(line) {\n if (line.height == 0) return 0;\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found = merged.find(0, true);\n len -= cur.text.length - found.from.ch;\n cur = found.to.line;\n len += cur.text.length - found.to.ch;\n }\n return len;\n }", "function lineLength(line) {\n if (line.height == 0) return 0;\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found = merged.find(0, true);\n len -= cur.text.length - found.from.ch;\n cur = found.to.line;\n len += cur.text.length - found.to.ch;\n }\n return len;\n }", "function lineLength(line) {\n if (line.height == 0) return 0;\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found = merged.find(0, true);\n len -= cur.text.length - found.from.ch;\n cur = found.to.line;\n len += cur.text.length - found.to.ch;\n }\n return len;\n }", "function lineLength(line) {\n if (line.height == 0) return 0;\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found = merged.find(0, true);\n len -= cur.text.length - found.from.ch;\n cur = found.to.line;\n len += cur.text.length - found.to.ch;\n }\n return len;\n }", "function lineLength(line) {\n if (line.height == 0) return 0;\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found = merged.find(0, true);\n len -= cur.text.length - found.from.ch;\n cur = found.to.line;\n len += cur.text.length - found.to.ch;\n }\n return len;\n }", "function lineLength(line) {\n if (line.height == 0) return 0;\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found = merged.find(0, true);\n len -= cur.text.length - found.from.ch;\n cur = found.to.line;\n len += cur.text.length - found.to.ch;\n }\n return len;\n }", "function lineLength(line) {\n if (line.height == 0) return 0;\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found = merged.find(0, true);\n len -= cur.text.length - found.from.ch;\n cur = found.to.line;\n len += cur.text.length - found.to.ch;\n }\n return len;\n }", "function lineLength(line) {\r\n if (line.height == 0) return 0;\r\n var len = line.text.length, merged, cur = line;\r\n while (merged = collapsedSpanAtStart(cur)) {\r\n var found = merged.find(0, true);\r\n cur = found.from.line;\r\n len += found.from.ch - found.to.ch;\r\n }\r\n cur = line;\r\n while (merged = collapsedSpanAtEnd(cur)) {\r\n var found = merged.find(0, true);\r\n len -= cur.text.length - found.from.ch;\r\n cur = found.to.line;\r\n len += cur.text.length - found.to.ch;\r\n }\r\n return len;\r\n }", "function lineLength(line) {\n\t\t if (line.height == 0) { return 0 }\n\t\t var len = line.text.length, merged, cur = line;\n\t\t while (merged = collapsedSpanAtStart(cur)) {\n\t\t var found = merged.find(0, true);\n\t\t cur = found.from.line;\n\t\t len += found.from.ch - found.to.ch;\n\t\t }\n\t\t cur = line;\n\t\t while (merged = collapsedSpanAtEnd(cur)) {\n\t\t var found$1 = merged.find(0, true);\n\t\t len -= cur.text.length - found$1.from.ch;\n\t\t cur = found$1.to.line;\n\t\t len += cur.text.length - found$1.to.ch;\n\t\t }\n\t\t return len\n\t\t }", "function lineLength(line) {\r\n if (line.height == 0) { return 0 }\r\n var len = line.text.length, merged, cur = line;\r\n while (merged = collapsedSpanAtStart(cur)) {\r\n var found = merged.find(0, true);\r\n cur = found.from.line;\r\n len += found.from.ch - found.to.ch;\r\n }\r\n cur = line;\r\n while (merged = collapsedSpanAtEnd(cur)) {\r\n var found$1 = merged.find(0, true);\r\n len -= cur.text.length - found$1.from.ch;\r\n cur = found$1.to.line;\r\n len += cur.text.length - found$1.to.ch;\r\n }\r\n return len\r\n}", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true)\n cur = found.from.line\n len += found.from.ch - found.to.ch\n }\n cur = line\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true)\n len -= cur.text.length - found$1.from.ch\n cur = found$1.to.line\n len += cur.text.length - found$1.to.ch\n }\n return len\n}", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true)\n cur = found.from.line\n len += found.from.ch - found.to.ch\n }\n cur = line\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true)\n len -= cur.text.length - found$1.from.ch\n cur = found$1.to.line\n len += cur.text.length - found$1.to.ch\n }\n return len\n}", "function lineLength(line) {\n\t\t if (line.height == 0) return 0;\n\t\t var len = line.text.length, merged, cur = line;\n\t\t while (merged = collapsedSpanAtStart(cur)) {\n\t\t var found = merged.find(0, true);\n\t\t cur = found.from.line;\n\t\t len += found.from.ch - found.to.ch;\n\t\t }\n\t\t cur = line;\n\t\t while (merged = collapsedSpanAtEnd(cur)) {\n\t\t var found = merged.find(0, true);\n\t\t len -= cur.text.length - found.from.ch;\n\t\t cur = found.to.line;\n\t\t len += cur.text.length - found.to.ch;\n\t\t }\n\t\t return len;\n\t\t }", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n}", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n}", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n}", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n}", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n}", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n}", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n}", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n}", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n}", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n}", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n}", "function lineLength(line) {\n\t if (line.height == 0) return 0;\n\t var len = line.text.length, merged, cur = line;\n\t while (merged = collapsedSpanAtStart(cur)) {\n\t var found = merged.find(0, true);\n\t cur = found.from.line;\n\t len += found.from.ch - found.to.ch;\n\t }\n\t cur = line;\n\t while (merged = collapsedSpanAtEnd(cur)) {\n\t var found = merged.find(0, true);\n\t len -= cur.text.length - found.from.ch;\n\t cur = found.to.line;\n\t len += cur.text.length - found.to.ch;\n\t }\n\t return len;\n\t }", "function lineLength(line) {\n\t if (line.height == 0) return 0;\n\t var len = line.text.length, merged, cur = line;\n\t while (merged = collapsedSpanAtStart(cur)) {\n\t var found = merged.find(0, true);\n\t cur = found.from.line;\n\t len += found.from.ch - found.to.ch;\n\t }\n\t cur = line;\n\t while (merged = collapsedSpanAtEnd(cur)) {\n\t var found = merged.find(0, true);\n\t len -= cur.text.length - found.from.ch;\n\t cur = found.to.line;\n\t len += cur.text.length - found.to.ch;\n\t }\n\t return len;\n\t }", "function lineLength(line) {\n\t if (line.height == 0) return 0;\n\t var len = line.text.length, merged, cur = line;\n\t while (merged = collapsedSpanAtStart(cur)) {\n\t var found = merged.find(0, true);\n\t cur = found.from.line;\n\t len += found.from.ch - found.to.ch;\n\t }\n\t cur = line;\n\t while (merged = collapsedSpanAtEnd(cur)) {\n\t var found = merged.find(0, true);\n\t len -= cur.text.length - found.from.ch;\n\t cur = found.to.line;\n\t len += cur.text.length - found.to.ch;\n\t }\n\t return len;\n\t }", "function lineLength(line) {\n if (line.height == 0) {\n return 0;\n }\n\n var len = line.text.length,\n merged,\n cur = line;\n\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n\n cur = line;\n\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n\n return len;\n } // Find the longest line in the document.", "get length() {\n // Assume that every newline is a keystroke, and that whitespace is stripped.\n const lines = this.code.split('\\n');\n const total_characters = lines.map(line => line.trim().length).reduce((a, b) => a + b);\n return total_characters + lines.length - 1;\n }", "function lineLength(line){\n return Math.sqrt(Math.pow(line[1][0] - line[0][0], 2) + Math.pow(line[1][1] - line[0][1], 2));\n }", "function getCharsOnLine(editor, line) {\n return getLine(editor, line).length;\n }", "function realLength(value) {\n var length = value.indexOf('\\n')\n return width(length === -1 ? value : value.slice(0, length))\n}", "function _lineLength(str) {\n // The number of actual characters counted.\n var ct = 0;\n // Whether we are inside a color sequence.\n var inSeq = false;\n\n for (var i = 0; i < str.length; i++) {\n if (str[i] === '\\x1B') {\n inSeq = true;\n } else if (inSeq) {\n if (str[i] === 'm') {\n inSeq = false;\n }\n } else {\n ct++;\n }\n }\n\n return ct;\n}", "function foldLine(line, width) {\n\t if (line === '' || line[0] === ' ') return line;\n\n\t // Since a more-indented line adds a \\n, breaks can't be followed by a space.\n\t var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.\n\t var match;\n\t // start is an inclusive index. end, curr, and next are exclusive.\n\t var start = 0, end, curr = 0, next = 0;\n\t var result = '';\n\n\t // Invariants: 0 <= start <= length-1.\n\t // 0 <= curr <= next <= max(0, length-2). curr - start <= width.\n\t // Inside the loop:\n\t // A match implies length >= 2, so curr and next are <= length-2.\n\t while ((match = breakRe.exec(line))) {\n\t next = match.index;\n\t // maintain invariant: curr - start <= width\n\t if (next - start > width) {\n\t end = (curr > start) ? curr : next; // derive end <= length-2\n\t result += '\\n' + line.slice(start, end);\n\t // skip the space that was output as \\n\n\t start = end + 1; // derive start <= length-1\n\t }\n\t curr = next;\n\t }\n\n\t // By the invariants, start <= length-1, so there is something left over.\n\t // It is either the whole string or a part starting from non-whitespace.\n\t result += '\\n';\n\t // Insert a break if the remainder is too long and there is a break available.\n\t if (line.length - start > width && curr > start) {\n\t result += line.slice(start, curr) + '\\n' + line.slice(curr + 1);\n\t } else {\n\t result += line.slice(start);\n\t }\n\n\t return result.slice(1); // drop extra \\n joiner\n\t}", "function foldLine(line, width) {\n\t if (line === '' || line[0] === ' ') return line;\n\n\t // Since a more-indented line adds a \\n, breaks can't be followed by a space.\n\t var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.\n\t var match;\n\t // start is an inclusive index. end, curr, and next are exclusive.\n\t var start = 0, end, curr = 0, next = 0;\n\t var result = '';\n\n\t // Invariants: 0 <= start <= length-1.\n\t // 0 <= curr <= next <= max(0, length-2). curr - start <= width.\n\t // Inside the loop:\n\t // A match implies length >= 2, so curr and next are <= length-2.\n\t while ((match = breakRe.exec(line))) {\n\t next = match.index;\n\t // maintain invariant: curr - start <= width\n\t if (next - start > width) {\n\t end = (curr > start) ? curr : next; // derive end <= length-2\n\t result += '\\n' + line.slice(start, end);\n\t // skip the space that was output as \\n\n\t start = end + 1; // derive start <= length-1\n\t }\n\t curr = next;\n\t }\n\n\t // By the invariants, start <= length-1, so there is something left over.\n\t // It is either the whole string or a part starting from non-whitespace.\n\t result += '\\n';\n\t // Insert a break if the remainder is too long and there is a break available.\n\t if (line.length - start > width && curr > start) {\n\t result += line.slice(start, curr) + '\\n' + line.slice(curr + 1);\n\t } else {\n\t result += line.slice(start);\n\t }\n\n\t return result.slice(1); // drop extra \\n joiner\n\t}", "function foldLine(line, width) {\n\t if (line === '' || line[0] === ' ') return line;\n\n\t // Since a more-indented line adds a \\n, breaks can't be followed by a space.\n\t var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.\n\t var match;\n\t // start is an inclusive index. end, curr, and next are exclusive.\n\t var start = 0, end, curr = 0, next = 0;\n\t var result = '';\n\n\t // Invariants: 0 <= start <= length-1.\n\t // 0 <= curr <= next <= max(0, length-2). curr - start <= width.\n\t // Inside the loop:\n\t // A match implies length >= 2, so curr and next are <= length-2.\n\t while ((match = breakRe.exec(line))) {\n\t next = match.index;\n\t // maintain invariant: curr - start <= width\n\t if (next - start > width) {\n\t end = (curr > start) ? curr : next; // derive end <= length-2\n\t result += '\\n' + line.slice(start, end);\n\t // skip the space that was output as \\n\n\t start = end + 1; // derive start <= length-1\n\t }\n\t curr = next;\n\t }\n\n\t // By the invariants, start <= length-1, so there is something left over.\n\t // It is either the whole string or a part starting from non-whitespace.\n\t result += '\\n';\n\t // Insert a break if the remainder is too long and there is a break available.\n\t if (line.length - start > width && curr > start) {\n\t result += line.slice(start, curr) + '\\n' + line.slice(curr + 1);\n\t } else {\n\t result += line.slice(start);\n\t }\n\n\t return result.slice(1); // drop extra \\n joiner\n\t}", "function foldLine(line, width) {\n if (line === '' || line[0] === ' ') return line;\n\n // Since a more-indented line adds a \\n, breaks can't be followed by a space.\n var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.\n var match;\n // start is an inclusive index. end, curr, and next are exclusive.\n var start = 0, end, curr = 0, next = 0;\n var result = '';\n\n // Invariants: 0 <= start <= length-1.\n // 0 <= curr <= next <= max(0, length-2). curr - start <= width.\n // Inside the loop:\n // A match implies length >= 2, so curr and next are <= length-2.\n while ((match = breakRe.exec(line))) {\n next = match.index;\n // maintain invariant: curr - start <= width\n if (next - start > width) {\n end = (curr > start) ? curr : next; // derive end <= length-2\n result += '\\n' + line.slice(start, end);\n // skip the space that was output as \\n\n start = end + 1; // derive start <= length-1\n }\n curr = next;\n }\n\n // By the invariants, start <= length-1, so there is something left over.\n // It is either the whole string or a part starting from non-whitespace.\n result += '\\n';\n // Insert a break if the remainder is too long and there is a break available.\n if (line.length - start > width && curr > start) {\n result += line.slice(start, curr) + '\\n' + line.slice(curr + 1);\n } else {\n result += line.slice(start);\n }\n\n return result.slice(1); // drop extra \\n joiner\n}", "function foldLine(line, width) {\n if (line === '' || line[0] === ' ') return line;\n\n // Since a more-indented line adds a \\n, breaks can't be followed by a space.\n var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.\n var match;\n // start is an inclusive index. end, curr, and next are exclusive.\n var start = 0, end, curr = 0, next = 0;\n var result = '';\n\n // Invariants: 0 <= start <= length-1.\n // 0 <= curr <= next <= max(0, length-2). curr - start <= width.\n // Inside the loop:\n // A match implies length >= 2, so curr and next are <= length-2.\n while ((match = breakRe.exec(line))) {\n next = match.index;\n // maintain invariant: curr - start <= width\n if (next - start > width) {\n end = (curr > start) ? curr : next; // derive end <= length-2\n result += '\\n' + line.slice(start, end);\n // skip the space that was output as \\n\n start = end + 1; // derive start <= length-1\n }\n curr = next;\n }\n\n // By the invariants, start <= length-1, so there is something left over.\n // It is either the whole string or a part starting from non-whitespace.\n result += '\\n';\n // Insert a break if the remainder is too long and there is a break available.\n if (line.length - start > width && curr > start) {\n result += line.slice(start, curr) + '\\n' + line.slice(curr + 1);\n } else {\n result += line.slice(start);\n }\n\n return result.slice(1); // drop extra \\n joiner\n}", "function foldLine(line, width) {\n if (line === '' || line[0] === ' ') return line;\n\n // Since a more-indented line adds a \\n, breaks can't be followed by a space.\n var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.\n var match;\n // start is an inclusive index. end, curr, and next are exclusive.\n var start = 0, end, curr = 0, next = 0;\n var result = '';\n\n // Invariants: 0 <= start <= length-1.\n // 0 <= curr <= next <= max(0, length-2). curr - start <= width.\n // Inside the loop:\n // A match implies length >= 2, so curr and next are <= length-2.\n while ((match = breakRe.exec(line))) {\n next = match.index;\n // maintain invariant: curr - start <= width\n if (next - start > width) {\n end = (curr > start) ? curr : next; // derive end <= length-2\n result += '\\n' + line.slice(start, end);\n // skip the space that was output as \\n\n start = end + 1; // derive start <= length-1\n }\n curr = next;\n }\n\n // By the invariants, start <= length-1, so there is something left over.\n // It is either the whole string or a part starting from non-whitespace.\n result += '\\n';\n // Insert a break if the remainder is too long and there is a break available.\n if (line.length - start > width && curr > start) {\n result += line.slice(start, curr) + '\\n' + line.slice(curr + 1);\n } else {\n result += line.slice(start);\n }\n\n return result.slice(1); // drop extra \\n joiner\n}", "function foldLine(line, width) {\n if (line === '' || line[0] === ' ') return line;\n\n // Since a more-indented line adds a \\n, breaks can't be followed by a space.\n var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.\n var match;\n // start is an inclusive index. end, curr, and next are exclusive.\n var start = 0, end, curr = 0, next = 0;\n var result = '';\n\n // Invariants: 0 <= start <= length-1.\n // 0 <= curr <= next <= max(0, length-2). curr - start <= width.\n // Inside the loop:\n // A match implies length >= 2, so curr and next are <= length-2.\n while ((match = breakRe.exec(line))) {\n next = match.index;\n // maintain invariant: curr - start <= width\n if (next - start > width) {\n end = (curr > start) ? curr : next; // derive end <= length-2\n result += '\\n' + line.slice(start, end);\n // skip the space that was output as \\n\n start = end + 1; // derive start <= length-1\n }\n curr = next;\n }\n\n // By the invariants, start <= length-1, so there is something left over.\n // It is either the whole string or a part starting from non-whitespace.\n result += '\\n';\n // Insert a break if the remainder is too long and there is a break available.\n if (line.length - start > width && curr > start) {\n result += line.slice(start, curr) + '\\n' + line.slice(curr + 1);\n } else {\n result += line.slice(start);\n }\n\n return result.slice(1); // drop extra \\n joiner\n}", "function foldLine(line, width) {\n if (line === '' || line[0] === ' ') return line;\n\n // Since a more-indented line adds a \\n, breaks can't be followed by a space.\n var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.\n var match;\n // start is an inclusive index. end, curr, and next are exclusive.\n var start = 0, end, curr = 0, next = 0;\n var result = '';\n\n // Invariants: 0 <= start <= length-1.\n // 0 <= curr <= next <= max(0, length-2). curr - start <= width.\n // Inside the loop:\n // A match implies length >= 2, so curr and next are <= length-2.\n while ((match = breakRe.exec(line))) {\n next = match.index;\n // maintain invariant: curr - start <= width\n if (next - start > width) {\n end = (curr > start) ? curr : next; // derive end <= length-2\n result += '\\n' + line.slice(start, end);\n // skip the space that was output as \\n\n start = end + 1; // derive start <= length-1\n }\n curr = next;\n }\n\n // By the invariants, start <= length-1, so there is something left over.\n // It is either the whole string or a part starting from non-whitespace.\n result += '\\n';\n // Insert a break if the remainder is too long and there is a break available.\n if (line.length - start > width && curr > start) {\n result += line.slice(start, curr) + '\\n' + line.slice(curr + 1);\n } else {\n result += line.slice(start);\n }\n\n return result.slice(1); // drop extra \\n joiner\n}", "function foldLine(line, width) {\n if (line === '' || line[0] === ' ') return line;\n\n // Since a more-indented line adds a \\n, breaks can't be followed by a space.\n var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.\n var match;\n // start is an inclusive index. end, curr, and next are exclusive.\n var start = 0, end, curr = 0, next = 0;\n var result = '';\n\n // Invariants: 0 <= start <= length-1.\n // 0 <= curr <= next <= max(0, length-2). curr - start <= width.\n // Inside the loop:\n // A match implies length >= 2, so curr and next are <= length-2.\n while ((match = breakRe.exec(line))) {\n next = match.index;\n // maintain invariant: curr - start <= width\n if (next - start > width) {\n end = (curr > start) ? curr : next; // derive end <= length-2\n result += '\\n' + line.slice(start, end);\n // skip the space that was output as \\n\n start = end + 1; // derive start <= length-1\n }\n curr = next;\n }\n\n // By the invariants, start <= length-1, so there is something left over.\n // It is either the whole string or a part starting from non-whitespace.\n result += '\\n';\n // Insert a break if the remainder is too long and there is a break available.\n if (line.length - start > width && curr > start) {\n result += line.slice(start, curr) + '\\n' + line.slice(curr + 1);\n } else {\n result += line.slice(start);\n }\n\n return result.slice(1); // drop extra \\n joiner\n}", "function foldLine(line, width) {\n if (line === '' || line[0] === ' ') return line;\n\n // Since a more-indented line adds a \\n, breaks can't be followed by a space.\n var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.\n var match;\n // start is an inclusive index. end, curr, and next are exclusive.\n var start = 0, end, curr = 0, next = 0;\n var result = '';\n\n // Invariants: 0 <= start <= length-1.\n // 0 <= curr <= next <= max(0, length-2). curr - start <= width.\n // Inside the loop:\n // A match implies length >= 2, so curr and next are <= length-2.\n while ((match = breakRe.exec(line))) {\n next = match.index;\n // maintain invariant: curr - start <= width\n if (next - start > width) {\n end = (curr > start) ? curr : next; // derive end <= length-2\n result += '\\n' + line.slice(start, end);\n // skip the space that was output as \\n\n start = end + 1; // derive start <= length-1\n }\n curr = next;\n }\n\n // By the invariants, start <= length-1, so there is something left over.\n // It is either the whole string or a part starting from non-whitespace.\n result += '\\n';\n // Insert a break if the remainder is too long and there is a break available.\n if (line.length - start > width && curr > start) {\n result += line.slice(start, curr) + '\\n' + line.slice(curr + 1);\n } else {\n result += line.slice(start);\n }\n\n return result.slice(1); // drop extra \\n joiner\n}", "function foldLine(line, width) {\n if (line === '' || line[0] === ' ') return line;\n\n // Since a more-indented line adds a \\n, breaks can't be followed by a space.\n var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.\n var match;\n // start is an inclusive index. end, curr, and next are exclusive.\n var start = 0, end, curr = 0, next = 0;\n var result = '';\n\n // Invariants: 0 <= start <= length-1.\n // 0 <= curr <= next <= max(0, length-2). curr - start <= width.\n // Inside the loop:\n // A match implies length >= 2, so curr and next are <= length-2.\n while ((match = breakRe.exec(line))) {\n next = match.index;\n // maintain invariant: curr - start <= width\n if (next - start > width) {\n end = (curr > start) ? curr : next; // derive end <= length-2\n result += '\\n' + line.slice(start, end);\n // skip the space that was output as \\n\n start = end + 1; // derive start <= length-1\n }\n curr = next;\n }\n\n // By the invariants, start <= length-1, so there is something left over.\n // It is either the whole string or a part starting from non-whitespace.\n result += '\\n';\n // Insert a break if the remainder is too long and there is a break available.\n if (line.length - start > width && curr > start) {\n result += line.slice(start, curr) + '\\n' + line.slice(curr + 1);\n } else {\n result += line.slice(start);\n }\n\n return result.slice(1); // drop extra \\n joiner\n}", "function foldLine(line, width) {\n if (line === '' || line[0] === ' ') return line;\n\n // Since a more-indented line adds a \\n, breaks can't be followed by a space.\n var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.\n var match;\n // start is an inclusive index. end, curr, and next are exclusive.\n var start = 0, end, curr = 0, next = 0;\n var result = '';\n\n // Invariants: 0 <= start <= length-1.\n // 0 <= curr <= next <= max(0, length-2). curr - start <= width.\n // Inside the loop:\n // A match implies length >= 2, so curr and next are <= length-2.\n while ((match = breakRe.exec(line))) {\n next = match.index;\n // maintain invariant: curr - start <= width\n if (next - start > width) {\n end = (curr > start) ? curr : next; // derive end <= length-2\n result += '\\n' + line.slice(start, end);\n // skip the space that was output as \\n\n start = end + 1; // derive start <= length-1\n }\n curr = next;\n }\n\n // By the invariants, start <= length-1, so there is something left over.\n // It is either the whole string or a part starting from non-whitespace.\n result += '\\n';\n // Insert a break if the remainder is too long and there is a break available.\n if (line.length - start > width && curr > start) {\n result += line.slice(start, curr) + '\\n' + line.slice(curr + 1);\n } else {\n result += line.slice(start);\n }\n\n return result.slice(1); // drop extra \\n joiner\n}", "function foldLine(line, width) {\n if (line === '' || line[0] === ' ') return line;\n\n // Since a more-indented line adds a \\n, breaks can't be followed by a space.\n var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.\n var match;\n // start is an inclusive index. end, curr, and next are exclusive.\n var start = 0, end, curr = 0, next = 0;\n var result = '';\n\n // Invariants: 0 <= start <= length-1.\n // 0 <= curr <= next <= max(0, length-2). curr - start <= width.\n // Inside the loop:\n // A match implies length >= 2, so curr and next are <= length-2.\n while ((match = breakRe.exec(line))) {\n next = match.index;\n // maintain invariant: curr - start <= width\n if (next - start > width) {\n end = (curr > start) ? curr : next; // derive end <= length-2\n result += '\\n' + line.slice(start, end);\n // skip the space that was output as \\n\n start = end + 1; // derive start <= length-1\n }\n curr = next;\n }\n\n // By the invariants, start <= length-1, so there is something left over.\n // It is either the whole string or a part starting from non-whitespace.\n result += '\\n';\n // Insert a break if the remainder is too long and there is a break available.\n if (line.length - start > width && curr > start) {\n result += line.slice(start, curr) + '\\n' + line.slice(curr + 1);\n } else {\n result += line.slice(start);\n }\n\n return result.slice(1); // drop extra \\n joiner\n}", "function foldLine(line, width) {\n if (line === '' || line[0] === ' ') return line;\n\n // Since a more-indented line adds a \\n, breaks can't be followed by a space.\n var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.\n var match;\n // start is an inclusive index. end, curr, and next are exclusive.\n var start = 0, end, curr = 0, next = 0;\n var result = '';\n\n // Invariants: 0 <= start <= length-1.\n // 0 <= curr <= next <= max(0, length-2). curr - start <= width.\n // Inside the loop:\n // A match implies length >= 2, so curr and next are <= length-2.\n while ((match = breakRe.exec(line))) {\n next = match.index;\n // maintain invariant: curr - start <= width\n if (next - start > width) {\n end = (curr > start) ? curr : next; // derive end <= length-2\n result += '\\n' + line.slice(start, end);\n // skip the space that was output as \\n\n start = end + 1; // derive start <= length-1\n }\n curr = next;\n }\n\n // By the invariants, start <= length-1, so there is something left over.\n // It is either the whole string or a part starting from non-whitespace.\n result += '\\n';\n // Insert a break if the remainder is too long and there is a break available.\n if (line.length - start > width && curr > start) {\n result += line.slice(start, curr) + '\\n' + line.slice(curr + 1);\n } else {\n result += line.slice(start);\n }\n\n return result.slice(1); // drop extra \\n joiner\n}", "function foldLine(line, width) {\n if (line === '' || line[0] === ' ') return line;\n\n // Since a more-indented line adds a \\n, breaks can't be followed by a space.\n var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.\n var match;\n // start is an inclusive index. end, curr, and next are exclusive.\n var start = 0, end, curr = 0, next = 0;\n var result = '';\n\n // Invariants: 0 <= start <= length-1.\n // 0 <= curr <= next <= max(0, length-2). curr - start <= width.\n // Inside the loop:\n // A match implies length >= 2, so curr and next are <= length-2.\n while ((match = breakRe.exec(line))) {\n next = match.index;\n // maintain invariant: curr - start <= width\n if (next - start > width) {\n end = (curr > start) ? curr : next; // derive end <= length-2\n result += '\\n' + line.slice(start, end);\n // skip the space that was output as \\n\n start = end + 1; // derive start <= length-1\n }\n curr = next;\n }\n\n // By the invariants, start <= length-1, so there is something left over.\n // It is either the whole string or a part starting from non-whitespace.\n result += '\\n';\n // Insert a break if the remainder is too long and there is a break available.\n if (line.length - start > width && curr > start) {\n result += line.slice(start, curr) + '\\n' + line.slice(curr + 1);\n } else {\n result += line.slice(start);\n }\n\n return result.slice(1); // drop extra \\n joiner\n}", "function foldLine(line, width) {\n if (line === '' || line[0] === ' ') return line;\n\n // Since a more-indented line adds a \\n, breaks can't be followed by a space.\n var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.\n var match;\n // start is an inclusive index. end, curr, and next are exclusive.\n var start = 0, end, curr = 0, next = 0;\n var result = '';\n\n // Invariants: 0 <= start <= length-1.\n // 0 <= curr <= next <= max(0, length-2). curr - start <= width.\n // Inside the loop:\n // A match implies length >= 2, so curr and next are <= length-2.\n while ((match = breakRe.exec(line))) {\n next = match.index;\n // maintain invariant: curr - start <= width\n if (next - start > width) {\n end = (curr > start) ? curr : next; // derive end <= length-2\n result += '\\n' + line.slice(start, end);\n // skip the space that was output as \\n\n start = end + 1; // derive start <= length-1\n }\n curr = next;\n }\n\n // By the invariants, start <= length-1, so there is something left over.\n // It is either the whole string or a part starting from non-whitespace.\n result += '\\n';\n // Insert a break if the remainder is too long and there is a break available.\n if (line.length - start > width && curr > start) {\n result += line.slice(start, curr) + '\\n' + line.slice(curr + 1);\n } else {\n result += line.slice(start);\n }\n\n return result.slice(1); // drop extra \\n joiner\n}", "function foldLine(line, width) {\n if (line === '' || line[0] === ' ') return line;\n\n // Since a more-indented line adds a \\n, breaks can't be followed by a space.\n var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.\n var match;\n // start is an inclusive index. end, curr, and next are exclusive.\n var start = 0, end, curr = 0, next = 0;\n var result = '';\n\n // Invariants: 0 <= start <= length-1.\n // 0 <= curr <= next <= max(0, length-2). curr - start <= width.\n // Inside the loop:\n // A match implies length >= 2, so curr and next are <= length-2.\n while ((match = breakRe.exec(line))) {\n next = match.index;\n // maintain invariant: curr - start <= width\n if (next - start > width) {\n end = (curr > start) ? curr : next; // derive end <= length-2\n result += '\\n' + line.slice(start, end);\n // skip the space that was output as \\n\n start = end + 1; // derive start <= length-1\n }\n curr = next;\n }\n\n // By the invariants, start <= length-1, so there is something left over.\n // It is either the whole string or a part starting from non-whitespace.\n result += '\\n';\n // Insert a break if the remainder is too long and there is a break available.\n if (line.length - start > width && curr > start) {\n result += line.slice(start, curr) + '\\n' + line.slice(curr + 1);\n } else {\n result += line.slice(start);\n }\n\n return result.slice(1); // drop extra \\n joiner\n}", "function foldLine(line, width) {\n if (line === '' || line[0] === ' ') return line;\n\n // Since a more-indented line adds a \\n, breaks can't be followed by a space.\n var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.\n var match;\n // start is an inclusive index. end, curr, and next are exclusive.\n var start = 0, end, curr = 0, next = 0;\n var result = '';\n\n // Invariants: 0 <= start <= length-1.\n // 0 <= curr <= next <= max(0, length-2). curr - start <= width.\n // Inside the loop:\n // A match implies length >= 2, so curr and next are <= length-2.\n while ((match = breakRe.exec(line))) {\n next = match.index;\n // maintain invariant: curr - start <= width\n if (next - start > width) {\n end = (curr > start) ? curr : next; // derive end <= length-2\n result += '\\n' + line.slice(start, end);\n // skip the space that was output as \\n\n start = end + 1; // derive start <= length-1\n }\n curr = next;\n }\n\n // By the invariants, start <= length-1, so there is something left over.\n // It is either the whole string or a part starting from non-whitespace.\n result += '\\n';\n // Insert a break if the remainder is too long and there is a break available.\n if (line.length - start > width && curr > start) {\n result += line.slice(start, curr) + '\\n' + line.slice(curr + 1);\n } else {\n result += line.slice(start);\n }\n\n return result.slice(1); // drop extra \\n joiner\n}", "function foldLine(line, width) {\n if (line === '' || line[0] === ' ') return line;\n\n // Since a more-indented line adds a \\n, breaks can't be followed by a space.\n var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.\n var match;\n // start is an inclusive index. end, curr, and next are exclusive.\n var start = 0, end, curr = 0, next = 0;\n var result = '';\n\n // Invariants: 0 <= start <= length-1.\n // 0 <= curr <= next <= max(0, length-2). curr - start <= width.\n // Inside the loop:\n // A match implies length >= 2, so curr and next are <= length-2.\n while ((match = breakRe.exec(line))) {\n next = match.index;\n // maintain invariant: curr - start <= width\n if (next - start > width) {\n end = (curr > start) ? curr : next; // derive end <= length-2\n result += '\\n' + line.slice(start, end);\n // skip the space that was output as \\n\n start = end + 1; // derive start <= length-1\n }\n curr = next;\n }\n\n // By the invariants, start <= length-1, so there is something left over.\n // It is either the whole string or a part starting from non-whitespace.\n result += '\\n';\n // Insert a break if the remainder is too long and there is a break available.\n if (line.length - start > width && curr > start) {\n result += line.slice(start, curr) + '\\n' + line.slice(curr + 1);\n } else {\n result += line.slice(start);\n }\n\n return result.slice(1); // drop extra \\n joiner\n}", "function foldLine(line, width) {\n if (line === '' || line[0] === ' ') return line;\n\n // Since a more-indented line adds a \\n, breaks can't be followed by a space.\n var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.\n var match;\n // start is an inclusive index. end, curr, and next are exclusive.\n var start = 0, end, curr = 0, next = 0;\n var result = '';\n\n // Invariants: 0 <= start <= length-1.\n // 0 <= curr <= next <= max(0, length-2). curr - start <= width.\n // Inside the loop:\n // A match implies length >= 2, so curr and next are <= length-2.\n while ((match = breakRe.exec(line))) {\n next = match.index;\n // maintain invariant: curr - start <= width\n if (next - start > width) {\n end = (curr > start) ? curr : next; // derive end <= length-2\n result += '\\n' + line.slice(start, end);\n // skip the space that was output as \\n\n start = end + 1; // derive start <= length-1\n }\n curr = next;\n }\n\n // By the invariants, start <= length-1, so there is something left over.\n // It is either the whole string or a part starting from non-whitespace.\n result += '\\n';\n // Insert a break if the remainder is too long and there is a break available.\n if (line.length - start > width && curr > start) {\n result += line.slice(start, curr) + '\\n' + line.slice(curr + 1);\n } else {\n result += line.slice(start);\n }\n\n return result.slice(1); // drop extra \\n joiner\n}", "function foldLine(line, width) {\n if (line === '' || line[0] === ' ') return line;\n\n // Since a more-indented line adds a \\n, breaks can't be followed by a space.\n var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.\n var match;\n // start is an inclusive index. end, curr, and next are exclusive.\n var start = 0, end, curr = 0, next = 0;\n var result = '';\n\n // Invariants: 0 <= start <= length-1.\n // 0 <= curr <= next <= max(0, length-2). curr - start <= width.\n // Inside the loop:\n // A match implies length >= 2, so curr and next are <= length-2.\n while ((match = breakRe.exec(line))) {\n next = match.index;\n // maintain invariant: curr - start <= width\n if (next - start > width) {\n end = (curr > start) ? curr : next; // derive end <= length-2\n result += '\\n' + line.slice(start, end);\n // skip the space that was output as \\n\n start = end + 1; // derive start <= length-1\n }\n curr = next;\n }\n\n // By the invariants, start <= length-1, so there is something left over.\n // It is either the whole string or a part starting from non-whitespace.\n result += '\\n';\n // Insert a break if the remainder is too long and there is a break available.\n if (line.length - start > width && curr > start) {\n result += line.slice(start, curr) + '\\n' + line.slice(curr + 1);\n } else {\n result += line.slice(start);\n }\n\n return result.slice(1); // drop extra \\n joiner\n}", "function foldLine(line, width) {\n if (line === '' || line[0] === ' ') return line;\n\n // Since a more-indented line adds a \\n, breaks can't be followed by a space.\n var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.\n var match;\n // start is an inclusive index. end, curr, and next are exclusive.\n var start = 0, end, curr = 0, next = 0;\n var result = '';\n\n // Invariants: 0 <= start <= length-1.\n // 0 <= curr <= next <= max(0, length-2). curr - start <= width.\n // Inside the loop:\n // A match implies length >= 2, so curr and next are <= length-2.\n while ((match = breakRe.exec(line))) {\n next = match.index;\n // maintain invariant: curr - start <= width\n if (next - start > width) {\n end = (curr > start) ? curr : next; // derive end <= length-2\n result += '\\n' + line.slice(start, end);\n // skip the space that was output as \\n\n start = end + 1; // derive start <= length-1\n }\n curr = next;\n }\n\n // By the invariants, start <= length-1, so there is something left over.\n // It is either the whole string or a part starting from non-whitespace.\n result += '\\n';\n // Insert a break if the remainder is too long and there is a break available.\n if (line.length - start > width && curr > start) {\n result += line.slice(start, curr) + '\\n' + line.slice(curr + 1);\n } else {\n result += line.slice(start);\n }\n\n return result.slice(1); // drop extra \\n joiner\n}", "function foldLine(line, width) {\n if (line === '' || line[0] === ' ') return line;\n\n // Since a more-indented line adds a \\n, breaks can't be followed by a space.\n var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.\n var match;\n // start is an inclusive index. end, curr, and next are exclusive.\n var start = 0, end, curr = 0, next = 0;\n var result = '';\n\n // Invariants: 0 <= start <= length-1.\n // 0 <= curr <= next <= max(0, length-2). curr - start <= width.\n // Inside the loop:\n // A match implies length >= 2, so curr and next are <= length-2.\n while ((match = breakRe.exec(line))) {\n next = match.index;\n // maintain invariant: curr - start <= width\n if (next - start > width) {\n end = (curr > start) ? curr : next; // derive end <= length-2\n result += '\\n' + line.slice(start, end);\n // skip the space that was output as \\n\n start = end + 1; // derive start <= length-1\n }\n curr = next;\n }\n\n // By the invariants, start <= length-1, so there is something left over.\n // It is either the whole string or a part starting from non-whitespace.\n result += '\\n';\n // Insert a break if the remainder is too long and there is a break available.\n if (line.length - start > width && curr > start) {\n result += line.slice(start, curr) + '\\n' + line.slice(curr + 1);\n } else {\n result += line.slice(start);\n }\n\n return result.slice(1); // drop extra \\n joiner\n}", "function foldLine(line, width) {\n if (line === '' || line[0] === ' ') return line;\n\n // Since a more-indented line adds a \\n, breaks can't be followed by a space.\n var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.\n var match;\n // start is an inclusive index. end, curr, and next are exclusive.\n var start = 0, end, curr = 0, next = 0;\n var result = '';\n\n // Invariants: 0 <= start <= length-1.\n // 0 <= curr <= next <= max(0, length-2). curr - start <= width.\n // Inside the loop:\n // A match implies length >= 2, so curr and next are <= length-2.\n while ((match = breakRe.exec(line))) {\n next = match.index;\n // maintain invariant: curr - start <= width\n if (next - start > width) {\n end = (curr > start) ? curr : next; // derive end <= length-2\n result += '\\n' + line.slice(start, end);\n // skip the space that was output as \\n\n start = end + 1; // derive start <= length-1\n }\n curr = next;\n }\n\n // By the invariants, start <= length-1, so there is something left over.\n // It is either the whole string or a part starting from non-whitespace.\n result += '\\n';\n // Insert a break if the remainder is too long and there is a break available.\n if (line.length - start > width && curr > start) {\n result += line.slice(start, curr) + '\\n' + line.slice(curr + 1);\n } else {\n result += line.slice(start);\n }\n\n return result.slice(1); // drop extra \\n joiner\n}", "function foldLine(line, width) {\n if (line === '' || line[0] === ' ') return line;\n\n // Since a more-indented line adds a \\n, breaks can't be followed by a space.\n var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.\n var match;\n // start is an inclusive index. end, curr, and next are exclusive.\n var start = 0, end, curr = 0, next = 0;\n var result = '';\n\n // Invariants: 0 <= start <= length-1.\n // 0 <= curr <= next <= max(0, length-2). curr - start <= width.\n // Inside the loop:\n // A match implies length >= 2, so curr and next are <= length-2.\n while ((match = breakRe.exec(line))) {\n next = match.index;\n // maintain invariant: curr - start <= width\n if (next - start > width) {\n end = (curr > start) ? curr : next; // derive end <= length-2\n result += '\\n' + line.slice(start, end);\n // skip the space that was output as \\n\n start = end + 1; // derive start <= length-1\n }\n curr = next;\n }\n\n // By the invariants, start <= length-1, so there is something left over.\n // It is either the whole string or a part starting from non-whitespace.\n result += '\\n';\n // Insert a break if the remainder is too long and there is a break available.\n if (line.length - start > width && curr > start) {\n result += line.slice(start, curr) + '\\n' + line.slice(curr + 1);\n } else {\n result += line.slice(start);\n }\n\n return result.slice(1); // drop extra \\n joiner\n}", "function foldLine(line, width) {\n if (line === '' || line[0] === ' ') return line;\n\n // Since a more-indented line adds a \\n, breaks can't be followed by a space.\n var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.\n var match;\n // start is an inclusive index. end, curr, and next are exclusive.\n var start = 0, end, curr = 0, next = 0;\n var result = '';\n\n // Invariants: 0 <= start <= length-1.\n // 0 <= curr <= next <= max(0, length-2). curr - start <= width.\n // Inside the loop:\n // A match implies length >= 2, so curr and next are <= length-2.\n while ((match = breakRe.exec(line))) {\n next = match.index;\n // maintain invariant: curr - start <= width\n if (next - start > width) {\n end = (curr > start) ? curr : next; // derive end <= length-2\n result += '\\n' + line.slice(start, end);\n // skip the space that was output as \\n\n start = end + 1; // derive start <= length-1\n }\n curr = next;\n }\n\n // By the invariants, start <= length-1, so there is something left over.\n // It is either the whole string or a part starting from non-whitespace.\n result += '\\n';\n // Insert a break if the remainder is too long and there is a break available.\n if (line.length - start > width && curr > start) {\n result += line.slice(start, curr) + '\\n' + line.slice(curr + 1);\n } else {\n result += line.slice(start);\n }\n\n return result.slice(1); // drop extra \\n joiner\n}", "function foldLine(line, width) {\n if (line === '' || line[0] === ' ') { return line; }\n\n // Since a more-indented line adds a \\n, breaks can't be followed by a space.\n var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.\n var match;\n // start is an inclusive index. end, curr, and next are exclusive.\n var start = 0, end, curr = 0, next = 0;\n var result = '';\n\n // Invariants: 0 <= start <= length-1.\n // 0 <= curr <= next <= max(0, length-2). curr - start <= width.\n // Inside the loop:\n // A match implies length >= 2, so curr and next are <= length-2.\n while ((match = breakRe.exec(line))) {\n next = match.index;\n // maintain invariant: curr - start <= width\n if (next - start > width) {\n end = (curr > start) ? curr : next; // derive end <= length-2\n result += '\\n' + line.slice(start, end);\n // skip the space that was output as \\n\n start = end + 1; // derive start <= length-1\n }\n curr = next;\n }\n\n // By the invariants, start <= length-1, so there is something left over.\n // It is either the whole string or a part starting from non-whitespace.\n result += '\\n';\n // Insert a break if the remainder is too long and there is a break available.\n if (line.length - start > width && curr > start) {\n result += line.slice(start, curr) + '\\n' + line.slice(curr + 1);\n } else {\n result += line.slice(start);\n }\n\n return result.slice(1); // drop extra \\n joiner\n}", "function foldLine$1(line, width) {\n if (line === '' || line[0] === ' ') return line;\n\n // Since a more-indented line adds a \\n, breaks can't be followed by a space.\n var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.\n var match;\n // start is an inclusive index. end, curr, and next are exclusive.\n var start = 0, end, curr = 0, next = 0;\n var result = '';\n\n // Invariants: 0 <= start <= length-1.\n // 0 <= curr <= next <= max(0, length-2). curr - start <= width.\n // Inside the loop:\n // A match implies length >= 2, so curr and next are <= length-2.\n while ((match = breakRe.exec(line))) {\n next = match.index;\n // maintain invariant: curr - start <= width\n if (next - start > width) {\n end = (curr > start) ? curr : next; // derive end <= length-2\n result += '\\n' + line.slice(start, end);\n // skip the space that was output as \\n\n start = end + 1; // derive start <= length-1\n }\n curr = next;\n }\n\n // By the invariants, start <= length-1, so there is something left over.\n // It is either the whole string or a part starting from non-whitespace.\n result += '\\n';\n // Insert a break if the remainder is too long and there is a break available.\n if (line.length - start > width && curr > start) {\n result += line.slice(start, curr) + '\\n' + line.slice(curr + 1);\n } else {\n result += line.slice(start);\n }\n\n return result.slice(1); // drop extra \\n joiner\n}", "function charWidth(display) {\n if (display.cachedCharWidth != null) { return display.cachedCharWidth }\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor], \"CodeMirror-line-like\");\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) { display.cachedCharWidth = width; }\n return width || 10\n }", "function charWidth(display) {\n if (display.cachedCharWidth != null) { return display.cachedCharWidth }\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor], \"CodeMirror-line-like\");\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) { display.cachedCharWidth = width; }\n return width || 10\n }", "function charWidth(display) {\n if (display.cachedCharWidth != null) { return display.cachedCharWidth }\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor], \"CodeMirror-line-like\");\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) { display.cachedCharWidth = width; }\n return width || 10\n }", "function charWidth(display) {\n if (display.cachedCharWidth != null) { return display.cachedCharWidth }\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor], \"CodeMirror-line-like\");\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) { display.cachedCharWidth = width; }\n return width || 10\n }", "function charWidth(display) {\n if (display.cachedCharWidth != null) { return display.cachedCharWidth }\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor], \"CodeMirror-line-like\");\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) { display.cachedCharWidth = width; }\n return width || 10\n }", "function charWidth(display) {\n if (display.cachedCharWidth != null) { return display.cachedCharWidth }\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor], \"CodeMirror-line-like\");\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) { display.cachedCharWidth = width; }\n return width || 10\n }", "function charWidth(display) {\n if (display.cachedCharWidth != null) { return display.cachedCharWidth }\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor], \"CodeMirror-line-like\");\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) { display.cachedCharWidth = width; }\n return width || 10\n }", "function charWidth(display) {\n if (display.cachedCharWidth != null) { return display.cachedCharWidth }\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor], \"CodeMirror-line-like\");\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) { display.cachedCharWidth = width; }\n return width || 10\n }", "function charWidth(display) {\n if (display.cachedCharWidth != null) { return display.cachedCharWidth }\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor], \"CodeMirror-line-like\");\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) { display.cachedCharWidth = width; }\n return width || 10\n }", "function charWidth(display) {\n if (display.cachedCharWidth != null) { return display.cachedCharWidth }\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor], \"CodeMirror-line-like\");\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) { display.cachedCharWidth = width; }\n return width || 10\n }", "function charWidth(display) {\n if (display.cachedCharWidth != null) { return display.cachedCharWidth }\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor], \"CodeMirror-line-like\");\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) { display.cachedCharWidth = width; }\n return width || 10\n }", "function charWidth(display) {\n if (display.cachedCharWidth != null) { return display.cachedCharWidth }\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor], \"CodeMirror-line-like\");\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) { display.cachedCharWidth = width; }\n return width || 10\n }", "function charWidth(display) {\n\t\t if (display.cachedCharWidth != null) { return display.cachedCharWidth }\n\t\t var anchor = elt(\"span\", \"xxxxxxxxxx\");\n\t\t var pre = elt(\"pre\", [anchor], \"CodeMirror-line-like\");\n\t\t removeChildrenAndAdd(display.measure, pre);\n\t\t var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n\t\t if (width > 2) { display.cachedCharWidth = width; }\n\t\t return width || 10\n\t\t }", "function checkNumOfLines (text, font, lineWidth,limit) {\n\t\ttext=text.split(' ')\n\t\tlet sumLine=1\n\t\tlet j=0\n\t\tfor (let i=0; i<text.length; i++) {\n\t\t\tfragment=text.slice(j,i+1).join(' ')\n\t\t\tif(getTextWidth(fragment,font)>lineWidth) {\n\t\t\t\tsumLine++\n\t\t\t\tif (sumLine===limit) {break}\n\t\t\t\tj=i\n\t\t\t\ti--\n\t\t\t}\n\t\t}\n\t\treturn sumLine\n\t}", "function formatLength (geom, sourceProj) {\n const getLineStringLength = function (line) {\n let length = 0\n if ($('#geodesic').is(':checked')) {\n const coordinates = line.clone().transform(sourceProj, 'EPSG:4326').getCoordinates()\n const nCoords = coordinates.length\n for (let i = 0; i < nCoords - 1; i++) {\n length += wgs84Sphere.haversineDistance(coordinates[i], coordinates[i + 1])\n }\n } else {\n length = line.getLength()\n }\n return length\n }\n let length = 0\n if (geom.getType() === 'MultiLineString') {\n geom.getLineStrings().forEach(function (line) {\n length += getLineStringLength(line)\n })\n } else {\n length = getLineStringLength(geom)\n }\n let output\n if (length > 1000) {\n output = (Math.round(length / 1000 * 100) / 100) + ' km'\n } else {\n output = (Math.round(length * 100) / 100) + ' m'\n }\n $('#measure').html(output)\n // return output\n }", "function visualLength(text)\n\t{\n\t\tvar ruler = document.getElementById(\"ruler\");\n\t\truler.innerHTML = text;\n\t\treturn ruler.offsetWidth;\n\t}", "_maxLineHack() {\n var display = this.cm.display, curOp = this.cm.curOp;\n const CLEARANCE = 3; /* space added to the right, in characters */\n display.maxLineChanged = false;\n if (curOp) {\n curOp.updateMaxLine = false;\n curOp.adjustWidthTo = (display.maxLine.text.length + CLEARANCE) *\n this.cm.defaultCharWidth();\n // Force the size using the actual character count.\n // May result in too much horizontal scrolling, but that is\n // better than the alternative.\n }\n }", "function va(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=n(\"span\",\"xxxxxxxxxx\"),r=n(\"pre\",[t]);a(e.measure,r);var f=t.getBoundingClientRect(),o=(f.right-f.left)/10;return o>2&&(e.cachedCharWidth=o),o||10}", "function reflowSmallerGetNewLineLengths(wrappedLines, oldCols, newCols) {\n const newLineLengths = [];\n const cellsNeeded = wrappedLines.map((l, i) => getWrappedLineTrimmedLength(wrappedLines, i, oldCols)).reduce((p, c) => p + c);\n // Use srcCol and srcLine to find the new wrapping point, use that to get the cellsAvailable and\n // linesNeeded\n let srcCol = 0;\n let srcLine = 0;\n let cellsAvailable = 0;\n while (cellsAvailable < cellsNeeded) {\n if (cellsNeeded - cellsAvailable < newCols) {\n // Add the final line and exit the loop\n newLineLengths.push(cellsNeeded - cellsAvailable);\n break;\n }\n srcCol += newCols;\n const oldTrimmedLength = getWrappedLineTrimmedLength(wrappedLines, srcLine, oldCols);\n if (srcCol > oldTrimmedLength) {\n srcCol -= oldTrimmedLength;\n srcLine++;\n }\n const endsWithWide = wrappedLines[srcLine].getWidth(srcCol - 1) === 2;\n if (endsWithWide) {\n srcCol--;\n }\n const lineLength = endsWithWide ? newCols - 1 : newCols;\n newLineLengths.push(lineLength);\n cellsAvailable += lineLength;\n }\n return newLineLengths;\n}", "@computed\n get maxAnnotationLength() {\n if (this.rawAnnotations.length == 0) {\n return 0;\n }\n let maxLen = 0;\n this.rawAnnotations.forEach(d => {\n maxLen = Math.max(maxLen, d.endOffset - d.startOffset + 1);\n });\n return maxLen;\n }", "function textHeight(display) {\n if (display.cachedTextHeight != null) {\n return display.cachedTextHeight;\n }\n\n if (measureText == null) {\n measureText = elt(\"pre\", null, \"CodeMirror-line-like\"); // Measure a bunch of lines, for browsers that compute\n // fractional heights.\n\n for (var i = 0; i < 49; ++i) {\n measureText.appendChild(document.createTextNode(\"x\"));\n measureText.appendChild(elt(\"br\"));\n }\n\n measureText.appendChild(document.createTextNode(\"x\"));\n }\n\n removeChildrenAndAdd(display.measure, measureText);\n var height = measureText.offsetHeight / 50;\n\n if (height > 3) {\n display.cachedTextHeight = height;\n }\n\n removeChildren(display.measure);\n return height || 1;\n } // Compute the default character width.", "function findMaxLineLength(txt) {\n \n // Isolate lines\n let lines = txt.split(\"\\n\");\n let result = lines[0].length;\n\n // Find maximum line length\n for (let i = 1; i < lines.length; i++) {\n \tif (lines[i].length > result) {\n \t\tresult = lines[i].length;\n \t}\n }\n return result;\n}" ]
[ "0.76744145", "0.76744145", "0.76744145", "0.76744145", "0.76744145", "0.76744145", "0.76744145", "0.76744145", "0.7654427", "0.76487726", "0.7636767", "0.7626715", "0.7626715", "0.7623724", "0.76186347", "0.76186347", "0.76186347", "0.76186347", "0.76186347", "0.76186347", "0.76186347", "0.76186347", "0.76186347", "0.76186347", "0.76186347", "0.759522", "0.759522", "0.759522", "0.73382515", "0.6651068", "0.6336474", "0.63253886", "0.6256251", "0.59415954", "0.5904063", "0.5904063", "0.5904063", "0.5865918", "0.5865918", "0.5865918", "0.5865918", "0.5865918", "0.5865918", "0.5865918", "0.5865918", "0.5865918", "0.5865918", "0.5865918", "0.5865918", "0.5865918", "0.5865918", "0.5865918", "0.5865918", "0.5865918", "0.5865918", "0.5865918", "0.5865918", "0.5865918", "0.5865918", "0.5865918", "0.58568966", "0.58287764", "0.5793913", "0.5793913", "0.5793913", "0.5793913", "0.5793913", "0.5793913", "0.5793913", "0.5793913", "0.5793913", "0.5793913", "0.5793913", "0.5793913", "0.5791913", "0.5682425", "0.5566313", "0.5546818", "0.55170095", "0.5340049", "0.53239894", "0.53153986", "0.5282209", "0.5282101" ]
0.76794684
16
Find the longest line in the document.
function findMaxLine(cm) { var d = cm.display, doc = cm.doc; d.maxLine = getLine(doc, doc.first); d.maxLineLength = lineLength(d.maxLine); d.maxLineChanged = true; doc.iter(function (line) { var len = lineLength(line); if (len > d.maxLineLength) { d.maxLineLength = len; d.maxLine = line; } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findMaxLine(cm) {\n var d = cm.display, doc = cm.doc;\n d.maxLine = getLine(doc, doc.first);\n d.maxLineLength = lineLength(d.maxLine);\n d.maxLineChanged = true;\n doc.iter(function(line) {\n var len = lineLength(line);\n if (len > d.maxLineLength) {\n d.maxLineLength = len;\n d.maxLine = line;\n }\n });\n }", "function findMaxLine(cm) {\n var d = cm.display, doc = cm.doc;\n d.maxLine = getLine(doc, doc.first);\n d.maxLineLength = lineLength(d.maxLine);\n d.maxLineChanged = true;\n doc.iter(function(line) {\n var len = lineLength(line);\n if (len > d.maxLineLength) {\n d.maxLineLength = len;\n d.maxLine = line;\n }\n });\n }", "function findMaxLine(cm) {\n var d = cm.display, doc = cm.doc;\n d.maxLine = getLine(doc, doc.first);\n d.maxLineLength = lineLength(d.maxLine);\n d.maxLineChanged = true;\n doc.iter(function(line) {\n var len = lineLength(line);\n if (len > d.maxLineLength) {\n d.maxLineLength = len;\n d.maxLine = line;\n }\n });\n }", "function findMaxLine(cm) {\n var d = cm.display, doc = cm.doc;\n d.maxLine = getLine(doc, doc.first);\n d.maxLineLength = lineLength(d.maxLine);\n d.maxLineChanged = true;\n doc.iter(function(line) {\n var len = lineLength(line);\n if (len > d.maxLineLength) {\n d.maxLineLength = len;\n d.maxLine = line;\n }\n });\n }", "function findMaxLine(cm) {\n var d = cm.display, doc = cm.doc;\n d.maxLine = getLine(doc, doc.first);\n d.maxLineLength = lineLength(d.maxLine);\n d.maxLineChanged = true;\n doc.iter(function(line) {\n var len = lineLength(line);\n if (len > d.maxLineLength) {\n d.maxLineLength = len;\n d.maxLine = line;\n }\n });\n }", "function findMaxLine(cm) {\n var d = cm.display, doc = cm.doc;\n d.maxLine = getLine(doc, doc.first);\n d.maxLineLength = lineLength(d.maxLine);\n d.maxLineChanged = true;\n doc.iter(function(line) {\n var len = lineLength(line);\n if (len > d.maxLineLength) {\n d.maxLineLength = len;\n d.maxLine = line;\n }\n });\n }", "function findMaxLine(cm) {\n var d = cm.display, doc = cm.doc;\n d.maxLine = getLine(doc, doc.first);\n d.maxLineLength = lineLength(d.maxLine);\n d.maxLineChanged = true;\n doc.iter(function(line) {\n var len = lineLength(line);\n if (len > d.maxLineLength) {\n d.maxLineLength = len;\n d.maxLine = line;\n }\n });\n }", "function findMaxLine(cm) {\n var d = cm.display, doc = cm.doc;\n d.maxLine = getLine(doc, doc.first);\n d.maxLineLength = lineLength(d.maxLine);\n d.maxLineChanged = true;\n doc.iter(function(line) {\n var len = lineLength(line);\n if (len > d.maxLineLength) {\n d.maxLineLength = len;\n d.maxLine = line;\n }\n });\n }", "function findMaxLine(cm) {\n var d = cm.display, doc = cm.doc\n d.maxLine = getLine(doc, doc.first)\n d.maxLineLength = lineLength(d.maxLine)\n d.maxLineChanged = true\n doc.iter(function (line) {\n var len = lineLength(line)\n if (len > d.maxLineLength) {\n d.maxLineLength = len\n d.maxLine = line\n }\n })\n}", "function findMaxLine(cm) {\n var d = cm.display, doc = cm.doc\n d.maxLine = getLine(doc, doc.first)\n d.maxLineLength = lineLength(d.maxLine)\n d.maxLineChanged = true\n doc.iter(function (line) {\n var len = lineLength(line)\n if (len > d.maxLineLength) {\n d.maxLineLength = len\n d.maxLine = line\n }\n })\n}", "function findMaxLine(cm) {\r\n var d = cm.display, doc = cm.doc;\r\n d.maxLine = getLine(doc, doc.first);\r\n d.maxLineLength = lineLength(d.maxLine);\r\n d.maxLineChanged = true;\r\n doc.iter(function(line) {\r\n var len = lineLength(line);\r\n if (len > d.maxLineLength) {\r\n d.maxLineLength = len;\r\n d.maxLine = line;\r\n }\r\n });\r\n }", "function findMaxLine(cm) {\n var d = cm.display, doc = cm.doc;\n d.maxLine = getLine(doc, doc.first);\n d.maxLineLength = lineLength(d.maxLine);\n d.maxLineChanged = true;\n doc.iter(function (line) {\n var len = lineLength(line);\n if (len > d.maxLineLength) {\n d.maxLineLength = len;\n d.maxLine = line;\n }\n });\n}", "function findMaxLine(cm) {\n var d = cm.display, doc = cm.doc;\n d.maxLine = getLine(doc, doc.first);\n d.maxLineLength = lineLength(d.maxLine);\n d.maxLineChanged = true;\n doc.iter(function (line) {\n var len = lineLength(line);\n if (len > d.maxLineLength) {\n d.maxLineLength = len;\n d.maxLine = line;\n }\n });\n}", "function findMaxLine(cm) {\n var d = cm.display, doc = cm.doc;\n d.maxLine = getLine(doc, doc.first);\n d.maxLineLength = lineLength(d.maxLine);\n d.maxLineChanged = true;\n doc.iter(function (line) {\n var len = lineLength(line);\n if (len > d.maxLineLength) {\n d.maxLineLength = len;\n d.maxLine = line;\n }\n });\n}", "function findMaxLine(cm) {\n var d = cm.display, doc = cm.doc;\n d.maxLine = getLine(doc, doc.first);\n d.maxLineLength = lineLength(d.maxLine);\n d.maxLineChanged = true;\n doc.iter(function (line) {\n var len = lineLength(line);\n if (len > d.maxLineLength) {\n d.maxLineLength = len;\n d.maxLine = line;\n }\n });\n}", "function findMaxLine(cm) {\n var d = cm.display, doc = cm.doc;\n d.maxLine = getLine(doc, doc.first);\n d.maxLineLength = lineLength(d.maxLine);\n d.maxLineChanged = true;\n doc.iter(function (line) {\n var len = lineLength(line);\n if (len > d.maxLineLength) {\n d.maxLineLength = len;\n d.maxLine = line;\n }\n });\n}", "function findMaxLine(cm) {\n var d = cm.display, doc = cm.doc;\n d.maxLine = getLine(doc, doc.first);\n d.maxLineLength = lineLength(d.maxLine);\n d.maxLineChanged = true;\n doc.iter(function (line) {\n var len = lineLength(line);\n if (len > d.maxLineLength) {\n d.maxLineLength = len;\n d.maxLine = line;\n }\n });\n}", "function findMaxLine(cm) {\n var d = cm.display, doc = cm.doc;\n d.maxLine = getLine(doc, doc.first);\n d.maxLineLength = lineLength(d.maxLine);\n d.maxLineChanged = true;\n doc.iter(function (line) {\n var len = lineLength(line);\n if (len > d.maxLineLength) {\n d.maxLineLength = len;\n d.maxLine = line;\n }\n });\n}", "function findMaxLine(cm) {\n var d = cm.display, doc = cm.doc;\n d.maxLine = getLine(doc, doc.first);\n d.maxLineLength = lineLength(d.maxLine);\n d.maxLineChanged = true;\n doc.iter(function (line) {\n var len = lineLength(line);\n if (len > d.maxLineLength) {\n d.maxLineLength = len;\n d.maxLine = line;\n }\n });\n}", "function findMaxLine(cm) {\n var d = cm.display, doc = cm.doc;\n d.maxLine = getLine(doc, doc.first);\n d.maxLineLength = lineLength(d.maxLine);\n d.maxLineChanged = true;\n doc.iter(function (line) {\n var len = lineLength(line);\n if (len > d.maxLineLength) {\n d.maxLineLength = len;\n d.maxLine = line;\n }\n });\n}", "function findMaxLine(cm) {\n var d = cm.display, doc = cm.doc;\n d.maxLine = getLine(doc, doc.first);\n d.maxLineLength = lineLength(d.maxLine);\n d.maxLineChanged = true;\n doc.iter(function (line) {\n var len = lineLength(line);\n if (len > d.maxLineLength) {\n d.maxLineLength = len;\n d.maxLine = line;\n }\n });\n}", "function findMaxLine(cm) {\n var d = cm.display, doc = cm.doc;\n d.maxLine = getLine(doc, doc.first);\n d.maxLineLength = lineLength(d.maxLine);\n d.maxLineChanged = true;\n doc.iter(function (line) {\n var len = lineLength(line);\n if (len > d.maxLineLength) {\n d.maxLineLength = len;\n d.maxLine = line;\n }\n });\n}", "function findMaxLine(cm) {\n\t var d = cm.display, doc = cm.doc;\n\t d.maxLine = getLine(doc, doc.first);\n\t d.maxLineLength = lineLength(d.maxLine);\n\t d.maxLineChanged = true;\n\t doc.iter(function(line) {\n\t var len = lineLength(line);\n\t if (len > d.maxLineLength) {\n\t d.maxLineLength = len;\n\t d.maxLine = line;\n\t }\n\t });\n\t }", "function findMaxLine(cm) {\n\t var d = cm.display, doc = cm.doc;\n\t d.maxLine = getLine(doc, doc.first);\n\t d.maxLineLength = lineLength(d.maxLine);\n\t d.maxLineChanged = true;\n\t doc.iter(function(line) {\n\t var len = lineLength(line);\n\t if (len > d.maxLineLength) {\n\t d.maxLineLength = len;\n\t d.maxLine = line;\n\t }\n\t });\n\t }", "function findMaxLine(cm) {\n\t var d = cm.display, doc = cm.doc;\n\t d.maxLine = getLine(doc, doc.first);\n\t d.maxLineLength = lineLength(d.maxLine);\n\t d.maxLineChanged = true;\n\t doc.iter(function(line) {\n\t var len = lineLength(line);\n\t if (len > d.maxLineLength) {\n\t d.maxLineLength = len;\n\t d.maxLine = line;\n\t }\n\t });\n\t }", "function findMaxLine(cm) {\r\n var d = cm.display, doc = cm.doc;\r\n d.maxLine = getLine(doc, doc.first);\r\n d.maxLineLength = lineLength(d.maxLine);\r\n d.maxLineChanged = true;\r\n doc.iter(function (line) {\r\n var len = lineLength(line);\r\n if (len > d.maxLineLength) {\r\n d.maxLineLength = len;\r\n d.maxLine = line;\r\n }\r\n });\r\n}", "function findMaxLine(cm) {\n\t\t var d = cm.display, doc = cm.doc;\n\t\t d.maxLine = getLine(doc, doc.first);\n\t\t d.maxLineLength = lineLength(d.maxLine);\n\t\t d.maxLineChanged = true;\n\t\t doc.iter(function(line) {\n\t\t var len = lineLength(line);\n\t\t if (len > d.maxLineLength) {\n\t\t d.maxLineLength = len;\n\t\t d.maxLine = line;\n\t\t }\n\t\t });\n\t\t }", "function findMaxLine(cm) {\n\t\t var d = cm.display, doc = cm.doc;\n\t\t d.maxLine = getLine(doc, doc.first);\n\t\t d.maxLineLength = lineLength(d.maxLine);\n\t\t d.maxLineChanged = true;\n\t\t doc.iter(function (line) {\n\t\t var len = lineLength(line);\n\t\t if (len > d.maxLineLength) {\n\t\t d.maxLineLength = len;\n\t\t d.maxLine = line;\n\t\t }\n\t\t });\n\t\t }", "function lineLength(line) {\n if (line.height == 0) {\n return 0;\n }\n\n var len = line.text.length,\n merged,\n cur = line;\n\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n\n cur = line;\n\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n\n return len;\n } // Find the longest line in the document.", "function findMaxLineLength(txt) {\n \n // Isolate lines\n let lines = txt.split(\"\\n\");\n let result = lines[0].length;\n\n // Find maximum line length\n for (let i = 1; i < lines.length; i++) {\n \tif (lines[i].length > result) {\n \t\tresult = lines[i].length;\n \t}\n }\n return result;\n}", "function longestWord(sen) {}", "function longest (l) { // {{{\n\tvar maxlen = 0;\n\tl.shift().forEach( function (s) { if (s && s.length > maxlen) { maxlen = s.length } } );\n\treturn maxlen;\n} // }}}", "function lineLength(line) {\n\t\t if (line.height == 0) return 0;\n\t\t var len = line.text.length, merged, cur = line;\n\t\t while (merged = collapsedSpanAtStart(cur)) {\n\t\t var found = merged.find(0, true);\n\t\t cur = found.from.line;\n\t\t len += found.from.ch - found.to.ch;\n\t\t }\n\t\t cur = line;\n\t\t while (merged = collapsedSpanAtEnd(cur)) {\n\t\t var found = merged.find(0, true);\n\t\t len -= cur.text.length - found.from.ch;\n\t\t cur = found.to.line;\n\t\t len += cur.text.length - found.to.ch;\n\t\t }\n\t\t return len;\n\t\t }", "function lineLength(line) {\n\t\t if (line.height == 0) { return 0 }\n\t\t var len = line.text.length, merged, cur = line;\n\t\t while (merged = collapsedSpanAtStart(cur)) {\n\t\t var found = merged.find(0, true);\n\t\t cur = found.from.line;\n\t\t len += found.from.ch - found.to.ch;\n\t\t }\n\t\t cur = line;\n\t\t while (merged = collapsedSpanAtEnd(cur)) {\n\t\t var found$1 = merged.find(0, true);\n\t\t len -= cur.text.length - found$1.from.ch;\n\t\t cur = found$1.to.line;\n\t\t len += cur.text.length - found$1.to.ch;\n\t\t }\n\t\t return len\n\t\t }", "function lineLength(line) {\n\t if (line.height == 0) return 0;\n\t var len = line.text.length, merged, cur = line;\n\t while (merged = collapsedSpanAtStart(cur)) {\n\t var found = merged.find(0, true);\n\t cur = found.from.line;\n\t len += found.from.ch - found.to.ch;\n\t }\n\t cur = line;\n\t while (merged = collapsedSpanAtEnd(cur)) {\n\t var found = merged.find(0, true);\n\t len -= cur.text.length - found.from.ch;\n\t cur = found.to.line;\n\t len += cur.text.length - found.to.ch;\n\t }\n\t return len;\n\t }", "function lineLength(line) {\n\t if (line.height == 0) return 0;\n\t var len = line.text.length, merged, cur = line;\n\t while (merged = collapsedSpanAtStart(cur)) {\n\t var found = merged.find(0, true);\n\t cur = found.from.line;\n\t len += found.from.ch - found.to.ch;\n\t }\n\t cur = line;\n\t while (merged = collapsedSpanAtEnd(cur)) {\n\t var found = merged.find(0, true);\n\t len -= cur.text.length - found.from.ch;\n\t cur = found.to.line;\n\t len += cur.text.length - found.to.ch;\n\t }\n\t return len;\n\t }", "function lineLength(line) {\n\t if (line.height == 0) return 0;\n\t var len = line.text.length, merged, cur = line;\n\t while (merged = collapsedSpanAtStart(cur)) {\n\t var found = merged.find(0, true);\n\t cur = found.from.line;\n\t len += found.from.ch - found.to.ch;\n\t }\n\t cur = line;\n\t while (merged = collapsedSpanAtEnd(cur)) {\n\t var found = merged.find(0, true);\n\t len -= cur.text.length - found.from.ch;\n\t cur = found.to.line;\n\t len += cur.text.length - found.to.ch;\n\t }\n\t return len;\n\t }", "function lineLength(line) {\r\n if (line.height == 0) return 0;\r\n var len = line.text.length, merged, cur = line;\r\n while (merged = collapsedSpanAtStart(cur)) {\r\n var found = merged.find(0, true);\r\n cur = found.from.line;\r\n len += found.from.ch - found.to.ch;\r\n }\r\n cur = line;\r\n while (merged = collapsedSpanAtEnd(cur)) {\r\n var found = merged.find(0, true);\r\n len -= cur.text.length - found.from.ch;\r\n cur = found.to.line;\r\n len += cur.text.length - found.to.ch;\r\n }\r\n return len;\r\n }", "function lineLength(line) {\n if (line.height == 0) return 0;\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found = merged.find(0, true);\n len -= cur.text.length - found.from.ch;\n cur = found.to.line;\n len += cur.text.length - found.to.ch;\n }\n return len;\n }", "function lineLength(line) {\n if (line.height == 0) return 0;\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found = merged.find(0, true);\n len -= cur.text.length - found.from.ch;\n cur = found.to.line;\n len += cur.text.length - found.to.ch;\n }\n return len;\n }", "function lineLength(line) {\n if (line.height == 0) return 0;\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found = merged.find(0, true);\n len -= cur.text.length - found.from.ch;\n cur = found.to.line;\n len += cur.text.length - found.to.ch;\n }\n return len;\n }", "function lineLength(line) {\n if (line.height == 0) return 0;\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found = merged.find(0, true);\n len -= cur.text.length - found.from.ch;\n cur = found.to.line;\n len += cur.text.length - found.to.ch;\n }\n return len;\n }", "function lineLength(line) {\n if (line.height == 0) return 0;\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found = merged.find(0, true);\n len -= cur.text.length - found.from.ch;\n cur = found.to.line;\n len += cur.text.length - found.to.ch;\n }\n return len;\n }", "function lineLength(line) {\n if (line.height == 0) return 0;\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found = merged.find(0, true);\n len -= cur.text.length - found.from.ch;\n cur = found.to.line;\n len += cur.text.length - found.to.ch;\n }\n return len;\n }", "function lineLength(line) {\n if (line.height == 0) return 0;\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found = merged.find(0, true);\n len -= cur.text.length - found.from.ch;\n cur = found.to.line;\n len += cur.text.length - found.to.ch;\n }\n return len;\n }", "function lineLength(line) {\n if (line.height == 0) return 0;\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found = merged.find(0, true);\n len -= cur.text.length - found.from.ch;\n cur = found.to.line;\n len += cur.text.length - found.to.ch;\n }\n return len;\n }", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n }", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n }", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n }", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n }", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n }", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n }", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n }", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n }", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n }", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n }", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n }", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n }", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n }", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n }", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n }", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n }", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n }", "findOldestLine() {\r\n let minimum = Number.MAX_VALUE\r\n let lineNumWithMin = null\r\n for(let lineNum = 0; lineNum < this.numberOfCacheLines; lineNum++) {\r\n let line = this.cacheLines[lineNum]\r\n if((line.timeUsed < minimum) && (line.state != States.INVALID)) {\r\n minimum = line.timeUsed\r\n lineNumWithMin = lineNum\r\n }\r\n }\r\n return lineNumWithMin;\r\n }", "function longest(words) {\n\n}", "function lineLength(line) {\r\n if (line.height == 0) { return 0 }\r\n var len = line.text.length, merged, cur = line;\r\n while (merged = collapsedSpanAtStart(cur)) {\r\n var found = merged.find(0, true);\r\n cur = found.from.line;\r\n len += found.from.ch - found.to.ch;\r\n }\r\n cur = line;\r\n while (merged = collapsedSpanAtEnd(cur)) {\r\n var found$1 = merged.find(0, true);\r\n len -= cur.text.length - found$1.from.ch;\r\n cur = found$1.to.line;\r\n len += cur.text.length - found$1.to.ch;\r\n }\r\n return len\r\n}", "function longestRun (string) {\n\n\n\n\n\n}", "function lineWordEnd(area) {\n area.pos = area.pos || pos(area);\n return linePos(area) + wordDist(area);\n }", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true)\n cur = found.from.line\n len += found.from.ch - found.to.ch\n }\n cur = line\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true)\n len -= cur.text.length - found$1.from.ch\n cur = found$1.to.line\n len += cur.text.length - found$1.to.ch\n }\n return len\n}", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true)\n cur = found.from.line\n len += found.from.ch - found.to.ch\n }\n cur = line\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true)\n len -= cur.text.length - found$1.from.ch\n cur = found$1.to.line\n len += cur.text.length - found$1.to.ch\n }\n return len\n}", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n}", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n}", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n}", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n}", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n}", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n}", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n}", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n}", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n}", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n}", "function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n}", "function getLongest () {\n var longest = '';\n for (var i = 0; i < strings.length; i++) {\n if (strings[i].length > longest.length) {\n longest = strings[i];\n }\n }return longest;\n}", "function longestString(longStr){\n var mostAmntOfCharacters = longStr.reduce((x,y) => x.length >= y.length ? x : y);\n return mostAmntOfCharacters\n}", "function findLongestWord(sentence){\n // YOUR CODE HERE\n}" ]
[ "0.7557767", "0.7557767", "0.7557767", "0.7557767", "0.7557767", "0.7557767", "0.7557767", "0.7557767", "0.75130606", "0.75130606", "0.75036013", "0.7496651", "0.7496651", "0.7496651", "0.7496651", "0.7496651", "0.7496651", "0.7496651", "0.7496651", "0.7496651", "0.7496651", "0.7496651", "0.7485004", "0.7485004", "0.7485004", "0.74727786", "0.7453769", "0.7452739", "0.7177752", "0.6854581", "0.6580037", "0.6405701", "0.63757133", "0.6321788", "0.63079756", "0.63079756", "0.63079756", "0.62958354", "0.62886566", "0.62886566", "0.62886566", "0.62886566", "0.62886566", "0.62886566", "0.62886566", "0.62886566", "0.62612575", "0.62612575", "0.62612575", "0.62612575", "0.62612575", "0.62612575", "0.62612575", "0.62612575", "0.62612575", "0.62612575", "0.62612575", "0.62612575", "0.62612575", "0.62612575", "0.62612575", "0.62612575", "0.62612575", "0.623942", "0.62073886", "0.6202309", "0.62003326", "0.6177437", "0.6168492", "0.6168492", "0.61665565", "0.61665565", "0.61665565", "0.61665565", "0.61665565", "0.61665565", "0.61665565", "0.61665565", "0.61665565", "0.61665565", "0.61665565", "0.6133513", "0.6122608", "0.6099657" ]
0.75558054
23
Change the content (text, markers) of a line. Automatically invalidates cached information and tries to reestimate the line's height.
function updateLine(line, text, markedSpans, estimateHeight) { line.text = text; if (line.stateAfter) { line.stateAfter = null; } if (line.styles) { line.styles = null; } if (line.order != null) { line.order = null; } detachMarkedSpans(line); attachMarkedSpans(line, markedSpans); var estHeight = estimateHeight ? estimateHeight(line) : 1; if (estHeight != line.height) { updateLineHeight(line, estHeight); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateLine(line, text, markedSpans, estimateHeight) {\n line.text = text;\n\n if (line.stateAfter) {\n line.stateAfter = null;\n }\n\n if (line.styles) {\n line.styles = null;\n }\n\n if (line.order != null) {\n line.order = null;\n }\n\n detachMarkedSpans(line);\n attachMarkedSpans(line, markedSpans);\n var estHeight = estimateHeight ? estimateHeight(line) : 1;\n\n if (estHeight != line.height) {\n updateLineHeight(line, estHeight);\n }\n } // Detach a line from the document tree and its markers.", "function updateLine(line, text, markedSpans, estimateHeight) {\n\t\t line.text = text;\n\t\t if (line.stateAfter) { line.stateAfter = null; }\n\t\t if (line.styles) { line.styles = null; }\n\t\t if (line.order != null) { line.order = null; }\n\t\t detachMarkedSpans(line);\n\t\t attachMarkedSpans(line, markedSpans);\n\t\t var estHeight = estimateHeight ? estimateHeight(line) : 1;\n\t\t if (estHeight != line.height) { updateLineHeight(line, estHeight); }\n\t\t }", "function updateLine(line, text, markedSpans, estimateHeight) {\n line.text = text;\n if (line.stateAfter) line.stateAfter = null;\n if (line.styles) line.styles = null;\n if (line.order != null) line.order = null;\n detachMarkedSpans(line);\n attachMarkedSpans(line, markedSpans);\n var estHeight = estimateHeight ? estimateHeight(line) : 1;\n if (estHeight != line.height) updateLineHeight(line, estHeight);\n }", "function updateLine(line, text, markedSpans, estimateHeight) {\n line.text = text;\n if (line.stateAfter) line.stateAfter = null;\n if (line.styles) line.styles = null;\n if (line.order != null) line.order = null;\n detachMarkedSpans(line);\n attachMarkedSpans(line, markedSpans);\n var estHeight = estimateHeight ? estimateHeight(line) : 1;\n if (estHeight != line.height) updateLineHeight(line, estHeight);\n }", "function updateLine(line, text, markedSpans, estimateHeight) {\n line.text = text;\n if (line.stateAfter) line.stateAfter = null;\n if (line.styles) line.styles = null;\n if (line.order != null) line.order = null;\n detachMarkedSpans(line);\n attachMarkedSpans(line, markedSpans);\n var estHeight = estimateHeight ? estimateHeight(line) : 1;\n if (estHeight != line.height) updateLineHeight(line, estHeight);\n }", "function updateLine(line, text, markedSpans, estimateHeight) {\n line.text = text;\n if (line.stateAfter) line.stateAfter = null;\n if (line.styles) line.styles = null;\n if (line.order != null) line.order = null;\n detachMarkedSpans(line);\n attachMarkedSpans(line, markedSpans);\n var estHeight = estimateHeight ? estimateHeight(line) : 1;\n if (estHeight != line.height) updateLineHeight(line, estHeight);\n }", "function updateLine(line, text, markedSpans, estimateHeight) {\n line.text = text;\n if (line.stateAfter) line.stateAfter = null;\n if (line.styles) line.styles = null;\n if (line.order != null) line.order = null;\n detachMarkedSpans(line);\n attachMarkedSpans(line, markedSpans);\n var estHeight = estimateHeight ? estimateHeight(line) : 1;\n if (estHeight != line.height) updateLineHeight(line, estHeight);\n }", "function updateLine(line, text, markedSpans, estimateHeight) {\n line.text = text;\n if (line.stateAfter) line.stateAfter = null;\n if (line.styles) line.styles = null;\n if (line.order != null) line.order = null;\n detachMarkedSpans(line);\n attachMarkedSpans(line, markedSpans);\n var estHeight = estimateHeight ? estimateHeight(line) : 1;\n if (estHeight != line.height) updateLineHeight(line, estHeight);\n }", "function updateLine(line, text, markedSpans, estimateHeight) {\n line.text = text;\n if (line.stateAfter) line.stateAfter = null;\n if (line.styles) line.styles = null;\n if (line.order != null) line.order = null;\n detachMarkedSpans(line);\n attachMarkedSpans(line, markedSpans);\n var estHeight = estimateHeight ? estimateHeight(line) : 1;\n if (estHeight != line.height) updateLineHeight(line, estHeight);\n }", "function updateLine(line, text, markedSpans, estimateHeight) {\n\t\t line.text = text;\n\t\t if (line.stateAfter) line.stateAfter = null;\n\t\t if (line.styles) line.styles = null;\n\t\t if (line.order != null) line.order = null;\n\t\t detachMarkedSpans(line);\n\t\t attachMarkedSpans(line, markedSpans);\n\t\t var estHeight = estimateHeight ? estimateHeight(line) : 1;\n\t\t if (estHeight != line.height) updateLineHeight(line, estHeight);\n\t\t }", "function updateLine(line, text, markedSpans, estimateHeight) {\n\t line.text = text;\n\t if (line.stateAfter) line.stateAfter = null;\n\t if (line.styles) line.styles = null;\n\t if (line.order != null) line.order = null;\n\t detachMarkedSpans(line);\n\t attachMarkedSpans(line, markedSpans);\n\t var estHeight = estimateHeight ? estimateHeight(line) : 1;\n\t if (estHeight != line.height) updateLineHeight(line, estHeight);\n\t }", "function updateLine(line, text, markedSpans, estimateHeight) {\n\t line.text = text;\n\t if (line.stateAfter) line.stateAfter = null;\n\t if (line.styles) line.styles = null;\n\t if (line.order != null) line.order = null;\n\t detachMarkedSpans(line);\n\t attachMarkedSpans(line, markedSpans);\n\t var estHeight = estimateHeight ? estimateHeight(line) : 1;\n\t if (estHeight != line.height) updateLineHeight(line, estHeight);\n\t }", "function updateLine(line, text, markedSpans, estimateHeight) {\n\t line.text = text;\n\t if (line.stateAfter) line.stateAfter = null;\n\t if (line.styles) line.styles = null;\n\t if (line.order != null) line.order = null;\n\t detachMarkedSpans(line);\n\t attachMarkedSpans(line, markedSpans);\n\t var estHeight = estimateHeight ? estimateHeight(line) : 1;\n\t if (estHeight != line.height) updateLineHeight(line, estHeight);\n\t }", "function updateLine(line, text, markedSpans, estimateHeight) {\n line.text = text\n if (line.stateAfter) { line.stateAfter = null }\n if (line.styles) { line.styles = null }\n if (line.order != null) { line.order = null }\n detachMarkedSpans(line)\n attachMarkedSpans(line, markedSpans)\n var estHeight = estimateHeight ? estimateHeight(line) : 1\n if (estHeight != line.height) { updateLineHeight(line, estHeight) }\n}", "function updateLine(line, text, markedSpans, estimateHeight) {\n line.text = text\n if (line.stateAfter) { line.stateAfter = null }\n if (line.styles) { line.styles = null }\n if (line.order != null) { line.order = null }\n detachMarkedSpans(line)\n attachMarkedSpans(line, markedSpans)\n var estHeight = estimateHeight ? estimateHeight(line) : 1\n if (estHeight != line.height) { updateLineHeight(line, estHeight) }\n}", "function updateLine(line, text, markedSpans, estimateHeight) {\r\n line.text = text;\r\n if (line.stateAfter) line.stateAfter = null;\r\n if (line.styles) line.styles = null;\r\n if (line.order != null) line.order = null;\r\n detachMarkedSpans(line);\r\n attachMarkedSpans(line, markedSpans);\r\n var estHeight = estimateHeight ? estimateHeight(line) : 1;\r\n if (estHeight != line.height) updateLineHeight(line, estHeight);\r\n }", "function updateLine(line, text, markedSpans, estimateHeight) {\r\n line.text = text;\r\n if (line.stateAfter) { line.stateAfter = null; }\r\n if (line.styles) { line.styles = null; }\r\n if (line.order != null) { line.order = null; }\r\n detachMarkedSpans(line);\r\n attachMarkedSpans(line, markedSpans);\r\n var estHeight = estimateHeight ? estimateHeight(line) : 1;\r\n if (estHeight != line.height) { updateLineHeight(line, estHeight); }\r\n}", "function updateLine(line, text, markedSpans, estimateHeight) {\n line.text = text;\n if (line.stateAfter) { line.stateAfter = null; }\n if (line.styles) { line.styles = null; }\n if (line.order != null) { line.order = null; }\n detachMarkedSpans(line);\n attachMarkedSpans(line, markedSpans);\n var estHeight = estimateHeight ? estimateHeight(line) : 1;\n if (estHeight != line.height) { updateLineHeight(line, estHeight); }\n}", "function updateLine(line, text, markedSpans, estimateHeight) {\n line.text = text;\n if (line.stateAfter) { line.stateAfter = null; }\n if (line.styles) { line.styles = null; }\n if (line.order != null) { line.order = null; }\n detachMarkedSpans(line);\n attachMarkedSpans(line, markedSpans);\n var estHeight = estimateHeight ? estimateHeight(line) : 1;\n if (estHeight != line.height) { updateLineHeight(line, estHeight); }\n}", "function updateLine(line, text, markedSpans, estimateHeight) {\n line.text = text;\n if (line.stateAfter) { line.stateAfter = null; }\n if (line.styles) { line.styles = null; }\n if (line.order != null) { line.order = null; }\n detachMarkedSpans(line);\n attachMarkedSpans(line, markedSpans);\n var estHeight = estimateHeight ? estimateHeight(line) : 1;\n if (estHeight != line.height) { updateLineHeight(line, estHeight); }\n}", "function updateLine(line, text, markedSpans, estimateHeight) {\n line.text = text;\n if (line.stateAfter) { line.stateAfter = null; }\n if (line.styles) { line.styles = null; }\n if (line.order != null) { line.order = null; }\n detachMarkedSpans(line);\n attachMarkedSpans(line, markedSpans);\n var estHeight = estimateHeight ? estimateHeight(line) : 1;\n if (estHeight != line.height) { updateLineHeight(line, estHeight); }\n}", "function updateLine(line, text, markedSpans, estimateHeight) {\n line.text = text;\n if (line.stateAfter) { line.stateAfter = null; }\n if (line.styles) { line.styles = null; }\n if (line.order != null) { line.order = null; }\n detachMarkedSpans(line);\n attachMarkedSpans(line, markedSpans);\n var estHeight = estimateHeight ? estimateHeight(line) : 1;\n if (estHeight != line.height) { updateLineHeight(line, estHeight); }\n}", "function updateLine(line, text, markedSpans, estimateHeight) {\n line.text = text;\n if (line.stateAfter) { line.stateAfter = null; }\n if (line.styles) { line.styles = null; }\n if (line.order != null) { line.order = null; }\n detachMarkedSpans(line);\n attachMarkedSpans(line, markedSpans);\n var estHeight = estimateHeight ? estimateHeight(line) : 1;\n if (estHeight != line.height) { updateLineHeight(line, estHeight); }\n}", "function updateLine(line, text, markedSpans, estimateHeight) {\n line.text = text;\n if (line.stateAfter) { line.stateAfter = null; }\n if (line.styles) { line.styles = null; }\n if (line.order != null) { line.order = null; }\n detachMarkedSpans(line);\n attachMarkedSpans(line, markedSpans);\n var estHeight = estimateHeight ? estimateHeight(line) : 1;\n if (estHeight != line.height) { updateLineHeight(line, estHeight); }\n}", "function updateLine(line, text, markedSpans, estimateHeight) {\n line.text = text;\n if (line.stateAfter) { line.stateAfter = null; }\n if (line.styles) { line.styles = null; }\n if (line.order != null) { line.order = null; }\n detachMarkedSpans(line);\n attachMarkedSpans(line, markedSpans);\n var estHeight = estimateHeight ? estimateHeight(line) : 1;\n if (estHeight != line.height) { updateLineHeight(line, estHeight); }\n}", "function updateLine(line, text, markedSpans, estimateHeight) {\n line.text = text;\n if (line.stateAfter) { line.stateAfter = null; }\n if (line.styles) { line.styles = null; }\n if (line.order != null) { line.order = null; }\n detachMarkedSpans(line);\n attachMarkedSpans(line, markedSpans);\n var estHeight = estimateHeight ? estimateHeight(line) : 1;\n if (estHeight != line.height) { updateLineHeight(line, estHeight); }\n}", "function updateLine(line, text, markedSpans, estimateHeight) {\n line.text = text;\n if (line.stateAfter) { line.stateAfter = null; }\n if (line.styles) { line.styles = null; }\n if (line.order != null) { line.order = null; }\n detachMarkedSpans(line);\n attachMarkedSpans(line, markedSpans);\n var estHeight = estimateHeight ? estimateHeight(line) : 1;\n if (estHeight != line.height) { updateLineHeight(line, estHeight); }\n}", "function updateLine(line, text, markedSpans, estimateHeight) {\n line.text = text;\n if (line.stateAfter) { line.stateAfter = null; }\n if (line.styles) { line.styles = null; }\n if (line.order != null) { line.order = null; }\n detachMarkedSpans(line);\n attachMarkedSpans(line, markedSpans);\n var estHeight = estimateHeight ? estimateHeight(line) : 1;\n if (estHeight != line.height) { updateLineHeight(line, estHeight); }\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n\n if (lineView.text == lineView.node) {\n lineView.node = built.pre;\n }\n\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) lineView.node = built.pre;\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) lineView.node = built.pre;\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) lineView.node = built.pre;\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) lineView.node = built.pre;\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) lineView.node = built.pre;\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) lineView.node = built.pre;\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) lineView.node = built.pre;\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) lineView.node = built.pre;\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\r\n var cls = lineView.text.className;\r\n var built = getLineContent(cm, lineView);\r\n if (lineView.text == lineView.node) lineView.node = built.pre;\r\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\r\n lineView.text = built.pre;\r\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\r\n lineView.bgClass = built.bgClass;\r\n lineView.textClass = built.textClass;\r\n updateLineClasses(lineView);\r\n } else if (cls) {\r\n lineView.text.className = cls;\r\n }\r\n }", "function updateLineText(cm, lineView) {\n\t var cls = lineView.text.className;\n\t var built = getLineContent(cm, lineView);\n\t if (lineView.text == lineView.node) lineView.node = built.pre;\n\t lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n\t lineView.text = built.pre;\n\t if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n\t lineView.bgClass = built.bgClass;\n\t lineView.textClass = built.textClass;\n\t updateLineClasses(lineView);\n\t } else if (cls) {\n\t lineView.text.className = cls;\n\t }\n\t }", "function updateLineText(cm, lineView) {\n\t var cls = lineView.text.className;\n\t var built = getLineContent(cm, lineView);\n\t if (lineView.text == lineView.node) lineView.node = built.pre;\n\t lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n\t lineView.text = built.pre;\n\t if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n\t lineView.bgClass = built.bgClass;\n\t lineView.textClass = built.textClass;\n\t updateLineClasses(lineView);\n\t } else if (cls) {\n\t lineView.text.className = cls;\n\t }\n\t }", "function updateLineText(cm, lineView) {\n\t var cls = lineView.text.className;\n\t var built = getLineContent(cm, lineView);\n\t if (lineView.text == lineView.node) lineView.node = built.pre;\n\t lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n\t lineView.text = built.pre;\n\t if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n\t lineView.bgClass = built.bgClass;\n\t lineView.textClass = built.textClass;\n\t updateLineClasses(lineView);\n\t } else if (cls) {\n\t lineView.text.className = cls;\n\t }\n\t }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n}", "function updateLineText(cm, lineView) {\r\n var cls = lineView.text.className;\r\n var built = getLineContent(cm, lineView);\r\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\r\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\r\n lineView.text = built.pre;\r\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\r\n lineView.bgClass = built.bgClass;\r\n lineView.textClass = built.textClass;\r\n updateLineClasses(cm, lineView);\r\n } else if (cls) {\r\n lineView.text.className = cls;\r\n }\r\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className\n var built = getLineContent(cm, lineView)\n if (lineView.text == lineView.node) { lineView.node = built.pre }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text)\n lineView.text = built.pre\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass\n lineView.textClass = built.textClass\n updateLineClasses(lineView)\n } else if (cls) {\n lineView.text.className = cls\n }\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className\n var built = getLineContent(cm, lineView)\n if (lineView.text == lineView.node) { lineView.node = built.pre }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text)\n lineView.text = built.pre\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass\n lineView.textClass = built.textClass\n updateLineClasses(cm, lineView)\n } else if (cls) {\n lineView.text.className = cls\n }\n}", "function updateLineText(cm, lineView) {\n\t\t var cls = lineView.text.className;\n\t\t var built = getLineContent(cm, lineView);\n\t\t if (lineView.text == lineView.node) { lineView.node = built.pre; }\n\t\t lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n\t\t lineView.text = built.pre;\n\t\t if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n\t\t lineView.bgClass = built.bgClass;\n\t\t lineView.textClass = built.textClass;\n\t\t updateLineClasses(cm, lineView);\n\t\t } else if (cls) {\n\t\t lineView.text.className = cls;\n\t\t }\n\t\t }", "function updateLineText(cm, lineView) {\n\t\t var cls = lineView.text.className;\n\t\t var built = getLineContent(cm, lineView);\n\t\t if (lineView.text == lineView.node) lineView.node = built.pre;\n\t\t lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n\t\t lineView.text = built.pre;\n\t\t if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n\t\t lineView.bgClass = built.bgClass;\n\t\t lineView.textClass = built.textClass;\n\t\t updateLineClasses(lineView);\n\t\t } else if (cls) {\n\t\t lineView.text.className = cls;\n\t\t }\n\t\t }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built;\n }\n\n return buildLineContent(cm, lineView);\n } // Redraw the line's text. Interacts with the background and text", "function updateLineHeight(line, height) {\n\t\t var diff = height - line.height;\n\t\t if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n\t\t }", "function Line(text, markedSpans, estimateHeight) {\n this.text = text\n attachMarkedSpans(this, markedSpans)\n this.height = estimateHeight ? estimateHeight(this) : 1\n}", "function updateLineHeight(line, height) {\n\t\t var diff = height - line.height;\n\t\t if (diff) for (var n = line; n; n = n.parent) n.height += diff;\n\t\t }", "function updateLineHeight(line, height) {\r\n var diff = height - line.height;\r\n if (diff) for (var n = line; n; n = n.parent) n.height += diff;\r\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }" ]
[ "0.7491608", "0.7394629", "0.73894763", "0.73894763", "0.73894763", "0.73894763", "0.73894763", "0.73894763", "0.73894763", "0.7387523", "0.7345274", "0.7345274", "0.7345274", "0.7339563", "0.7339563", "0.7328437", "0.73019385", "0.72927153", "0.72927153", "0.72927153", "0.72927153", "0.72927153", "0.72927153", "0.72927153", "0.72927153", "0.72927153", "0.72927153", "0.72927153", "0.69593084", "0.69347167", "0.69347167", "0.69347167", "0.69347167", "0.69347167", "0.69347167", "0.69347167", "0.69347167", "0.69313", "0.69313", "0.69313", "0.69313", "0.69313", "0.69313", "0.69313", "0.69313", "0.69313", "0.69313", "0.69313", "0.69313", "0.69313", "0.69313", "0.69313", "0.69313", "0.69313", "0.6922399", "0.6899397", "0.6899397", "0.6899397", "0.6894371", "0.6894371", "0.6894371", "0.6894371", "0.6894371", "0.6894371", "0.6894371", "0.6894371", "0.6894371", "0.6894371", "0.6894371", "0.68898416", "0.68843085", "0.68834054", "0.6880693", "0.6874148", "0.6564566", "0.6502249", "0.64724445", "0.6461441", "0.64478856", "0.6447537", "0.6447537", "0.6447537", "0.6447537", "0.6447537" ]
0.7390273
17
Detach a line from the document tree and its markers.
function cleanUpLine(line) { line.parent = null; detachMarkedSpans(line); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function detachMarkedSpans(line) {\n var spans = line.markedSpans\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line) }\n line.markedSpans = null\n}", "function detachMarkedSpans(line) {\n var spans = line.markedSpans\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line) }\n line.markedSpans = null\n}", "function detachMarkedSpans(line) {\n\t\t var spans = line.markedSpans;\n\t\t if (!spans) return;\n\t\t for (var i = 0; i < spans.length; ++i)\n\t\t spans[i].marker.detachLine(line);\n\t\t line.markedSpans = null;\n\t\t }", "function cleanUpLine(line) {\n line.parent = null\n detachMarkedSpans(line)\n}", "function cleanUpLine(line) {\n line.parent = null\n detachMarkedSpans(line)\n}", "function detachMarkedSpans(line) {\n\t\t var spans = line.markedSpans;\n\t\t if (!spans) { return }\n\t\t for (var i = 0; i < spans.length; ++i)\n\t\t { spans[i].marker.detachLine(line); }\n\t\t line.markedSpans = null;\n\t\t }", "function detachMarkedSpans(line) {\r\n var spans = line.markedSpans;\r\n if (!spans) { return }\r\n for (var i = 0; i < spans.length; ++i)\r\n { spans[i].marker.detachLine(line); }\r\n line.markedSpans = null;\r\n}", "function detachMarkedSpans(line) {\r\n var spans = line.markedSpans;\r\n if (!spans) return;\r\n for (var i = 0; i < spans.length; ++i)\r\n spans[i].marker.detachLine(line);\r\n line.markedSpans = null;\r\n }", "function cleanUpLine(line) {\r\n line.parent = null;\r\n detachMarkedSpans(line);\r\n}", "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n }", "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n }", "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n }", "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n }", "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n }", "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n }", "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n }", "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n }", "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n }", "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n }", "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n }", "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n }", "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n }", "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n }", "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n }", "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n }", "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n }", "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n}", "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n}", "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n}", "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n}", "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n}", "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n}", "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n}", "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n}", "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n}", "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n}", "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n}", "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) return;\n for (var i = 0; i < spans.length; ++i)\n spans[i].marker.detachLine(line);\n line.markedSpans = null;\n }", "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) return;\n for (var i = 0; i < spans.length; ++i)\n spans[i].marker.detachLine(line);\n line.markedSpans = null;\n }", "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) return;\n for (var i = 0; i < spans.length; ++i)\n spans[i].marker.detachLine(line);\n line.markedSpans = null;\n }", "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) return;\n for (var i = 0; i < spans.length; ++i)\n spans[i].marker.detachLine(line);\n line.markedSpans = null;\n }", "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) return;\n for (var i = 0; i < spans.length; ++i)\n spans[i].marker.detachLine(line);\n line.markedSpans = null;\n }", "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) return;\n for (var i = 0; i < spans.length; ++i)\n spans[i].marker.detachLine(line);\n line.markedSpans = null;\n }", "function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) return;\n for (var i = 0; i < spans.length; ++i)\n spans[i].marker.detachLine(line);\n line.markedSpans = null;\n }", "function detachMarkedSpans(line) {\n\t var spans = line.markedSpans;\n\t if (!spans) return;\n\t for (var i = 0; i < spans.length; ++i)\n\t spans[i].marker.detachLine(line);\n\t line.markedSpans = null;\n\t }", "function detachMarkedSpans(line) {\n\t var spans = line.markedSpans;\n\t if (!spans) return;\n\t for (var i = 0; i < spans.length; ++i)\n\t spans[i].marker.detachLine(line);\n\t line.markedSpans = null;\n\t }", "function detachMarkedSpans(line) {\n\t var spans = line.markedSpans;\n\t if (!spans) return;\n\t for (var i = 0; i < spans.length; ++i)\n\t spans[i].marker.detachLine(line);\n\t line.markedSpans = null;\n\t }", "function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n}", "function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n}", "function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n}", "function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n}", "function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n}", "function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n}", "function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n}", "function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n}", "function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n}", "function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n}", "function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n}", "function cleanUpLine(line) {\r\n line.parent = null;\r\n detachMarkedSpans(line);\r\n }", "function cleanUpLine(line) {\n\t\t line.parent = null;\n\t\t detachMarkedSpans(line);\n\t\t }", "function cleanUpLine(line) {\n\t\t line.parent = null;\n\t\t detachMarkedSpans(line);\n\t\t }", "function cleanUpLine(line) {\n\t line.parent = null;\n\t detachMarkedSpans(line);\n\t }", "function cleanUpLine(line) {\n\t line.parent = null;\n\t detachMarkedSpans(line);\n\t }", "function cleanUpLine(line) {\n\t line.parent = null;\n\t detachMarkedSpans(line);\n\t }", "removeLineSegmant(){\n this.linePath.splice(this.linePath.length-1, 1);\n this.circlesInLinePath.splice(this.circlesInLinePath.length-1, 1);\n this.lineGraphics.clear();\n var lineToDelete = this.animLinePath.splice(this.animLinePath.length-1, 1);\n\n lineToDelete[0].destroy();\n }", "function ae(e){var t=e.markedSpans;if(t){for(var a=0;a<t.length;++a)t[a].marker.detachLine(e);e.markedSpans=null}}", "removeToLineStart() {\n if (this.selection.isEmpty())\n this.selection.selectLineStart();\n if (this.selection.isEmpty())\n this.selection.selectLeft();\n this.session.remove(this.getSelectionRange());\n this.clearSelection();\n }", "remove(line) {\n this.grid.remove(line)\n }", "function deleteLine(){\n\t\tul.removeChild(li);\n\t\tli.removeChild(btn);\n\t}", "_eraseInBufferLine(y, start, end, clearWrap = false) {\n const line = this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase + y);\n line.replaceCells(start, end, this._bufferService.buffer.getNullCell(this._eraseAttrData()), this._eraseAttrData());\n if (clearWrap) {\n line.isWrapped = false;\n }\n }", "function removeMapLine(line) {\n mymap.removeLayer(line);\n}", "function updateLine(line, text, markedSpans, estimateHeight) {\n line.text = text;\n\n if (line.stateAfter) {\n line.stateAfter = null;\n }\n\n if (line.styles) {\n line.styles = null;\n }\n\n if (line.order != null) {\n line.order = null;\n }\n\n detachMarkedSpans(line);\n attachMarkedSpans(line, markedSpans);\n var estHeight = estimateHeight ? estimateHeight(line) : 1;\n\n if (estHeight != line.height) {\n updateLineHeight(line, estHeight);\n }\n } // Detach a line from the document tree and its markers.", "function onDeleteLine() {\n changeCurrMeme('delete-row');\n initCanvasAndEditor();\n}", "function deleteLine() {\r\n ctx.clearRect(0, 0, can.width, can.height);\r\n}", "deleteLine(row) {\n if (!this.transaction || !this.editBuilder) {\n return;\n }\n const lastRow = this.getLastRow();\n if (row > lastRow) {\n return;\n }\n const line = this.editor.document.lineAt(row);\n const _range = line.range;\n this.editBuilder.delete(_range);\n }", "function deleteLastLine() {\n $('.line:last').remove();\n }", "removeToLineEnd() {\n if (this.selection.isEmpty())\n this.selection.selectLineEnd();\n\n var range = this.getSelectionRange();\n if (range.start.column == range.end.column && range.start.row == range.end.row) {\n range.end.column = 0;\n range.end.row++;\n }\n\n this.session.remove(range);\n this.clearSelection();\n }" ]
[ "0.7419141", "0.7419141", "0.7408427", "0.7399212", "0.7399212", "0.73966587", "0.7390764", "0.7388641", "0.7385563", "0.738401", "0.738401", "0.738401", "0.738401", "0.738401", "0.738401", "0.738401", "0.738401", "0.738401", "0.738401", "0.738401", "0.738401", "0.738401", "0.738401", "0.738401", "0.738401", "0.738401", "0.7371651", "0.7371651", "0.7371651", "0.7371651", "0.7371651", "0.7371651", "0.7371651", "0.7371651", "0.7371651", "0.7371651", "0.7371651", "0.73693633", "0.73693633", "0.73693633", "0.73693633", "0.73693633", "0.73693633", "0.73693633", "0.73526675", "0.73526675", "0.73526675", "0.7346404", "0.7346404", "0.7346404", "0.7346404", "0.7346404", "0.7346404", "0.7346404", "0.7346404", "0.7346404", "0.7346404", "0.7346404", "0.7267581", "0.71840346", "0.71840346", "0.71441704", "0.71441704", "0.71441704", "0.666879", "0.6614497", "0.6513022", "0.6315747", "0.6306676", "0.62402284", "0.62338567", "0.619329", "0.6092409", "0.60908824", "0.6075638", "0.6050109", "0.60125345" ]
0.7264013
76
Render the DOM representation of the text of a line. Also builds up a 'line map', which points at the DOM nodes that represent specific stretches of text, and is used by the measuring code. The returned object contains the DOM node, this map, and information about linewide styles that were set by the mode.
function buildLineContent(cm, lineView) { // The padding-right forces the element to have a 'border', which // is needed on Webkit to be able to get line-level bounding // rectangles for it (in measureChar). var content = eltP("span", null, null, webkit ? "padding-right: .1px" : null); var builder = {pre: eltP("pre", [content], "CodeMirror-line"), content: content, col: 0, pos: 0, cm: cm, trailingSpace: false, splitSpaces: cm.getOption("lineWrapping")}; lineView.measure = {}; // Iterate over the logical lines that make up this visual line. for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) { var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0); builder.pos = 0; builder.addToken = buildToken; // Optionally wire in some hacks into the token-rendering // algorithm, to deal with browser quirks. if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction))) { builder.addToken = buildTokenBadBidi(builder.addToken, order); } builder.map = []; var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line); insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate)); if (line.styleClasses) { if (line.styleClasses.bgClass) { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || ""); } if (line.styleClasses.textClass) { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || ""); } } // Ensure at least a single node is present, for measuring. if (builder.map.length == 0) { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); } // Store the map and a cache object for the current logical line if (i == 0) { lineView.measure.map = builder.map; lineView.measure.cache = {}; } else { (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map) ;(lineView.measure.caches || (lineView.measure.caches = [])).push({}); } } // See issue #2901 if (webkit) { var last = builder.content.lastChild; if (/\bcm-tab\b/.test(last.className) || (last.querySelector && last.querySelector(".cm-tab"))) { builder.content.className = "cm-tab-wrap-hack"; } } signal(cm, "renderLine", cm, lineView.line, builder.pre); if (builder.pre.className) { builder.textClass = joinClasses(builder.pre.className, builder.textClass || ""); } return builder }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buildLineContent(cm, lineView) {\r\n // The padding-right forces the element to have a 'border', which\r\n // is needed on Webkit to be able to get line-level bounding\r\n // rectangles for it (in measureChar).\r\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\r\n var builder = {pre: elt(\"pre\", [content]), content: content, col: 0, pos: 0, cm: cm};\r\n lineView.measure = {};\r\n\r\n // Iterate over the logical lines that make up this visual line.\r\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\r\n var line = i ? lineView.rest[i - 1] : lineView.line, order;\r\n builder.pos = 0;\r\n builder.addToken = buildToken;\r\n // Optionally wire in some hacks into the token-rendering\r\n // algorithm, to deal with browser quirks.\r\n if ((ie || webkit) && cm.getOption(\"lineWrapping\"))\r\n builder.addToken = buildTokenSplitSpaces(builder.addToken);\r\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\r\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\r\n builder.map = [];\r\n insertLineContent(line, builder, getLineStyles(cm, line));\r\n if (line.styleClasses) {\r\n if (line.styleClasses.bgClass)\r\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\r\n if (line.styleClasses.textClass)\r\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\r\n }\r\n\r\n // Ensure at least a single node is present, for measuring.\r\n if (builder.map.length == 0)\r\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\r\n\r\n // Store the map and a cache object for the current logical line\r\n if (i == 0) {\r\n lineView.measure.map = builder.map;\r\n lineView.measure.cache = {};\r\n } else {\r\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\r\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\r\n }\r\n }\r\n\r\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\r\n if (builder.pre.className)\r\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\r\n return builder;\r\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: elt(\"pre\", [content]), content: content, col: 0, pos: 0, cm: cm};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order;\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if ((ie || webkit) && cm.getOption(\"lineWrapping\"))\n builder.addToken = buildTokenSplitSpaces(builder.addToken);\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\n builder.map = [];\n insertLineContent(line, builder, getLineStyles(cm, line));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n if (line.styleClasses.textClass)\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n return builder;\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: elt(\"pre\", [content]), content: content, col: 0, pos: 0, cm: cm};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order;\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if ((ie || webkit) && cm.getOption(\"lineWrapping\"))\n builder.addToken = buildTokenSplitSpaces(builder.addToken);\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\n builder.map = [];\n insertLineContent(line, builder, getLineStyles(cm, line));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n if (line.styleClasses.textClass)\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n return builder;\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: elt(\"pre\", [content]), content: content, col: 0, pos: 0, cm: cm};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order;\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if ((ie || webkit) && cm.getOption(\"lineWrapping\"))\n builder.addToken = buildTokenSplitSpaces(builder.addToken);\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n if (line.styleClasses.textClass)\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit && /\\bcm-tab\\b/.test(builder.content.lastChild.className))\n builder.content.className = \"cm-tab-wrap-hack\";\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\n return builder;\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: elt(\"pre\", [content]), content: content, col: 0, pos: 0, cm: cm};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order;\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if ((ie || webkit) && cm.getOption(\"lineWrapping\"))\n builder.addToken = buildTokenSplitSpaces(builder.addToken);\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n if (line.styleClasses.textClass)\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit && /\\bcm-tab\\b/.test(builder.content.lastChild.className))\n builder.content.className = \"cm-tab-wrap-hack\";\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\n return builder;\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: elt(\"pre\", [content]), content: content, col: 0, pos: 0, cm: cm};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order;\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if ((ie || webkit) && cm.getOption(\"lineWrapping\"))\n builder.addToken = buildTokenSplitSpaces(builder.addToken);\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n if (line.styleClasses.textClass)\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit && /\\bcm-tab\\b/.test(builder.content.lastChild.className))\n builder.content.className = \"cm-tab-wrap-hack\";\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\n return builder;\n }", "function buildLineContent(cm, lineView) {\n\t // The padding-right forces the element to have a 'border', which\n\t // is needed on Webkit to be able to get line-level bounding\n\t // rectangles for it (in measureChar).\n\t var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n\t var builder = {pre: elt(\"pre\", [content], \"CodeMirror-line\"), content: content,\n\t col: 0, pos: 0, cm: cm,\n\t splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n\t lineView.measure = {};\n\n\t // Iterate over the logical lines that make up this visual line.\n\t for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n\t var line = i ? lineView.rest[i - 1] : lineView.line, order;\n\t builder.pos = 0;\n\t builder.addToken = buildToken;\n\t // Optionally wire in some hacks into the token-rendering\n\t // algorithm, to deal with browser quirks.\n\t if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n\t builder.addToken = buildTokenBadBidi(builder.addToken, order);\n\t builder.map = [];\n\t var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n\t insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n\t if (line.styleClasses) {\n\t if (line.styleClasses.bgClass)\n\t builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n\t if (line.styleClasses.textClass)\n\t builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n\t }\n\n\t // Ensure at least a single node is present, for measuring.\n\t if (builder.map.length == 0)\n\t builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n\t // Store the map and a cache object for the current logical line\n\t if (i == 0) {\n\t lineView.measure.map = builder.map;\n\t lineView.measure.cache = {};\n\t } else {\n\t (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n\t (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n\t }\n\t }\n\n\t // See issue #2901\n\t if (webkit && /\\bcm-tab\\b/.test(builder.content.lastChild.className))\n\t builder.content.className = \"cm-tab-wrap-hack\";\n\n\t signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n\t if (builder.pre.className)\n\t builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\n\t return builder;\n\t }", "function buildLineContent(cm, lineView) {\n\t // The padding-right forces the element to have a 'border', which\n\t // is needed on Webkit to be able to get line-level bounding\n\t // rectangles for it (in measureChar).\n\t var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n\t var builder = {pre: elt(\"pre\", [content], \"CodeMirror-line\"), content: content,\n\t col: 0, pos: 0, cm: cm,\n\t trailingSpace: false,\n\t splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n\t lineView.measure = {};\n\n\t // Iterate over the logical lines that make up this visual line.\n\t for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n\t var line = i ? lineView.rest[i - 1] : lineView.line, order;\n\t builder.pos = 0;\n\t builder.addToken = buildToken;\n\t // Optionally wire in some hacks into the token-rendering\n\t // algorithm, to deal with browser quirks.\n\t if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n\t builder.addToken = buildTokenBadBidi(builder.addToken, order);\n\t builder.map = [];\n\t var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n\t insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n\t if (line.styleClasses) {\n\t if (line.styleClasses.bgClass)\n\t builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n\t if (line.styleClasses.textClass)\n\t builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n\t }\n\n\t // Ensure at least a single node is present, for measuring.\n\t if (builder.map.length == 0)\n\t builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n\t // Store the map and a cache object for the current logical line\n\t if (i == 0) {\n\t lineView.measure.map = builder.map;\n\t lineView.measure.cache = {};\n\t } else {\n\t (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n\t (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n\t }\n\t }\n\n\t // See issue #2901\n\t if (webkit) {\n\t var last = builder.content.lastChild\n\t if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n\t builder.content.className = \"cm-tab-wrap-hack\";\n\t }\n\n\t signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n\t if (builder.pre.className)\n\t builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\n\t return builder;\n\t }", "function buildLineContent(cm, lineView) {\n\t\t // The padding-right forces the element to have a 'border', which\n\t\t // is needed on Webkit to be able to get line-level bounding\n\t\t // rectangles for it (in measureChar).\n\t\t var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n\t\t var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n\t\t col: 0, pos: 0, cm: cm,\n\t\t trailingSpace: false,\n\t\t splitSpaces: cm.getOption(\"lineWrapping\")};\n\t\t lineView.measure = {};\n\n\t\t // Iterate over the logical lines that make up this visual line.\n\t\t for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n\t\t var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n\t\t builder.pos = 0;\n\t\t builder.addToken = buildToken;\n\t\t // Optionally wire in some hacks into the token-rendering\n\t\t // algorithm, to deal with browser quirks.\n\t\t if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n\t\t { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n\t\t builder.map = [];\n\t\t var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n\t\t insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n\t\t if (line.styleClasses) {\n\t\t if (line.styleClasses.bgClass)\n\t\t { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n\t\t if (line.styleClasses.textClass)\n\t\t { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n\t\t }\n\n\t\t // Ensure at least a single node is present, for measuring.\n\t\t if (builder.map.length == 0)\n\t\t { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n\t\t // Store the map and a cache object for the current logical line\n\t\t if (i == 0) {\n\t\t lineView.measure.map = builder.map;\n\t\t lineView.measure.cache = {};\n\t\t } else {\n\t\t (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n\t\t ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n\t\t }\n\t\t }\n\n\t\t // See issue #2901\n\t\t if (webkit) {\n\t\t var last = builder.content.lastChild;\n\t\t if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n\t\t { builder.content.className = \"cm-tab-wrap-hack\"; }\n\t\t }\n\n\t\t signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n\t\t if (builder.pre.className)\n\t\t { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n\t\t return builder\n\t\t }", "function buildLineContent(cm, lineView) {\n\t // The padding-right forces the element to have a 'border', which\n\t // is needed on Webkit to be able to get line-level bounding\n\t // rectangles for it (in measureChar).\n\t var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n\t var builder = {pre: elt(\"pre\", [content], \"CodeMirror-line\"), content: content,\n\t col: 0, pos: 0, cm: cm,\n\t splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n\t lineView.measure = {};\n\t\n\t // Iterate over the logical lines that make up this visual line.\n\t for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n\t var line = i ? lineView.rest[i - 1] : lineView.line, order;\n\t builder.pos = 0;\n\t builder.addToken = buildToken;\n\t // Optionally wire in some hacks into the token-rendering\n\t // algorithm, to deal with browser quirks.\n\t if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n\t builder.addToken = buildTokenBadBidi(builder.addToken, order);\n\t builder.map = [];\n\t var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n\t insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n\t if (line.styleClasses) {\n\t if (line.styleClasses.bgClass)\n\t builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n\t if (line.styleClasses.textClass)\n\t builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n\t }\n\t\n\t // Ensure at least a single node is present, for measuring.\n\t if (builder.map.length == 0)\n\t builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\t\n\t // Store the map and a cache object for the current logical line\n\t if (i == 0) {\n\t lineView.measure.map = builder.map;\n\t lineView.measure.cache = {};\n\t } else {\n\t (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n\t (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n\t }\n\t }\n\t\n\t // See issue #2901\n\t if (webkit && /\\bcm-tab\\b/.test(builder.content.lastChild.className))\n\t builder.content.className = \"cm-tab-wrap-hack\";\n\t\n\t signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n\t if (builder.pre.className)\n\t builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\t\n\t return builder;\n\t }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: elt(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order;\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n if (line.styleClasses.textClass)\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit && /\\bcm-tab\\b/.test(builder.content.lastChild.className))\n builder.content.className = \"cm-tab-wrap-hack\";\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\n return builder;\n }", "function buildLineContent(cm, lineView) {\r\n // The padding-right forces the element to have a 'border', which\r\n // is needed on Webkit to be able to get line-level bounding\r\n // rectangles for it (in measureChar).\r\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\r\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\r\n col: 0, pos: 0, cm: cm,\r\n trailingSpace: false,\r\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\r\n lineView.measure = {};\r\n\r\n // Iterate over the logical lines that make up this visual line.\r\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\r\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\r\n builder.pos = 0;\r\n builder.addToken = buildToken;\r\n // Optionally wire in some hacks into the token-rendering\r\n // algorithm, to deal with browser quirks.\r\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\r\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\r\n builder.map = [];\r\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\r\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\r\n if (line.styleClasses) {\r\n if (line.styleClasses.bgClass)\r\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\r\n if (line.styleClasses.textClass)\r\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\r\n }\r\n\r\n // Ensure at least a single node is present, for measuring.\r\n if (builder.map.length == 0)\r\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\r\n\r\n // Store the map and a cache object for the current logical line\r\n if (i == 0) {\r\n lineView.measure.map = builder.map;\r\n lineView.measure.cache = {};\r\n } else {\r\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\r\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\r\n }\r\n }\r\n\r\n // See issue #2901\r\n if (webkit) {\r\n var last = builder.content.lastChild;\r\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\r\n { builder.content.className = \"cm-tab-wrap-hack\"; }\r\n }\r\n\r\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\r\n if (builder.pre.className)\r\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\r\n\r\n return builder\r\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: elt(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order;\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n if (line.styleClasses.textClass)\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n builder.content.className = \"cm-tab-wrap-hack\";\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\n return builder;\n }", "function buildLineContent(cm, lineView) {\n\t\t // The padding-right forces the element to have a 'border', which\n\t\t // is needed on Webkit to be able to get line-level bounding\n\t\t // rectangles for it (in measureChar).\n\t\t var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n\t\t var builder = {pre: elt(\"pre\", [content], \"CodeMirror-line\"), content: content,\n\t\t col: 0, pos: 0, cm: cm,\n\t\t trailingSpace: false,\n\t\t splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n\t\t lineView.measure = {};\n\t\t\n\t\t // Iterate over the logical lines that make up this visual line.\n\t\t for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n\t\t var line = i ? lineView.rest[i - 1] : lineView.line, order;\n\t\t builder.pos = 0;\n\t\t builder.addToken = buildToken;\n\t\t // Optionally wire in some hacks into the token-rendering\n\t\t // algorithm, to deal with browser quirks.\n\t\t if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n\t\t builder.addToken = buildTokenBadBidi(builder.addToken, order);\n\t\t builder.map = [];\n\t\t var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n\t\t insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n\t\t if (line.styleClasses) {\n\t\t if (line.styleClasses.bgClass)\n\t\t builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n\t\t if (line.styleClasses.textClass)\n\t\t builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n\t\t }\n\t\t\n\t\t // Ensure at least a single node is present, for measuring.\n\t\t if (builder.map.length == 0)\n\t\t builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\t\t\n\t\t // Store the map and a cache object for the current logical line\n\t\t if (i == 0) {\n\t\t lineView.measure.map = builder.map;\n\t\t lineView.measure.cache = {};\n\t\t } else {\n\t\t (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n\t\t (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n\t\t }\n\t\t }\n\t\t\n\t\t // See issue #2901\n\t\t if (webkit) {\n\t\t var last = builder.content.lastChild\n\t\t if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n\t\t builder.content.className = \"cm-tab-wrap-hack\";\n\t\t }\n\t\t\n\t\t signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n\t\t if (builder.pre.className)\n\t\t builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\t\t\n\t\t return builder;\n\t\t }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null)\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")}\n lineView.measure = {}\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0)\n builder.pos = 0\n builder.addToken = buildToken\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order) }\n builder.map = []\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line)\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate))\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\") }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\") }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))) }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map\n lineView.measure.cache = {}\n } else {\n ;(lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({})\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\" }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre)\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\") }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {\n pre: eltP(\"pre\", [content], \"CodeMirror-line\"),\n content: content,\n col: 0,\n pos: 0,\n cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")\n };\n lineView.measure = {}; // Iterate over the logical lines that make up this visual line.\n\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line,\n order = void 0;\n builder.pos = 0;\n builder.addToken = buildToken; // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction))) {\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\n }\n\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n\n if (line.styleClasses) {\n if (line.styleClasses.bgClass) {\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n }\n\n if (line.styleClasses.textClass) {\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n }\n } // Ensure at least a single node is present, for measuring.\n\n\n if (builder.map.length == 0) {\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n } // Store the map and a cache object for the current logical line\n\n\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n } // See issue #2901\n\n\n if (webkit) {\n var last = builder.content.lastChild;\n\n if (/\\bcm-tab\\b/.test(last.className) || last.querySelector && last.querySelector(\".cm-tab\")) {\n builder.content.className = \"cm-tab-wrap-hack\";\n }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n\n if (builder.pre.className) {\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n }\n\n return builder;\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null)\n var builder = {pre: elt(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")}\n // hide from accessibility tree\n content.setAttribute(\"role\", \"presentation\")\n builder.pre.setAttribute(\"role\", \"presentation\")\n lineView.measure = {}\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0)\n builder.pos = 0\n builder.addToken = buildToken\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order) }\n builder.map = []\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line)\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate))\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\") }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\") }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))) }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map\n lineView.measure.cache = {}\n } else {\n ;(lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({})\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\" }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre)\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\") }\n\n return builder\n}", "function RendererTextLine() {\n\n /*\n * The width of the line in pixels.\n * @property width\n * @type number\n * @protected\n */\n this.width = 0;\n\n /*\n * The height of the line in pixels.\n * @property width\n * @type number\n * @protected\n */\n this.height = 0;\n\n /*\n * The descent of the line in pixels.\n * @property descent\n * @type number\n * @protected\n */\n this.descent = 0;\n\n /*\n * The content of the line as token objects.\n * @property content\n * @type Object[]\n * @protected\n */\n this.content = [];\n }", "function buildLineElement(cm, lineView, lineN, dims) {\n\t\t var built = getLineContent(cm, lineView);\n\t\t lineView.text = lineView.node = built.pre;\n\t\t if (built.bgClass) { lineView.bgClass = built.bgClass; }\n\t\t if (built.textClass) { lineView.textClass = built.textClass; }\n\n\t\t updateLineClasses(cm, lineView);\n\t\t updateLineGutter(cm, lineView, lineN, dims);\n\t\t insertLineWidgets(cm, lineView, dims);\n\t\t return lineView.node\n\t\t }", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n }", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n }", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n }", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n }", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n }", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n }", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n }", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n }", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n }", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n }", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n }", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n }", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n }", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n }", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n }", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n }", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n }", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView)\n lineView.text = lineView.node = built.pre\n if (built.bgClass) { lineView.bgClass = built.bgClass }\n if (built.textClass) { lineView.textClass = built.textClass }\n\n updateLineClasses(cm, lineView)\n updateLineGutter(cm, lineView, lineN, dims)\n insertLineWidgets(cm, lineView, dims)\n return lineView.node\n}", "function buildLineElement(cm, lineView, lineN, dims) {\n\t\t var built = getLineContent(cm, lineView);\n\t\t lineView.text = lineView.node = built.pre;\n\t\t if (built.bgClass) lineView.bgClass = built.bgClass;\n\t\t if (built.textClass) lineView.textClass = built.textClass;\n\t\t\n\t\t updateLineClasses(lineView);\n\t\t updateLineGutter(cm, lineView, lineN, dims);\n\t\t insertLineWidgets(cm, lineView, dims);\n\t\t return lineView.node;\n\t\t }", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView)\n lineView.text = lineView.node = built.pre\n if (built.bgClass) { lineView.bgClass = built.bgClass }\n if (built.textClass) { lineView.textClass = built.textClass }\n\n updateLineClasses(lineView)\n updateLineGutter(cm, lineView, lineN, dims)\n insertLineWidgets(cm, lineView, dims)\n return lineView.node\n}", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) lineView.bgClass = built.bgClass;\n if (built.textClass) lineView.textClass = built.textClass;\n\n updateLineClasses(lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(lineView, dims);\n return lineView.node;\n }", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) lineView.bgClass = built.bgClass;\n if (built.textClass) lineView.textClass = built.textClass;\n\n updateLineClasses(lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(lineView, dims);\n return lineView.node;\n }", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) lineView.bgClass = built.bgClass;\n if (built.textClass) lineView.textClass = built.textClass;\n\n updateLineClasses(lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(lineView, dims);\n return lineView.node;\n }", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) lineView.bgClass = built.bgClass;\n if (built.textClass) lineView.textClass = built.textClass;\n\n updateLineClasses(lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(lineView, dims);\n return lineView.node;\n }", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) lineView.bgClass = built.bgClass;\n if (built.textClass) lineView.textClass = built.textClass;\n\n updateLineClasses(lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(lineView, dims);\n return lineView.node;\n }", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) lineView.bgClass = built.bgClass;\n if (built.textClass) lineView.textClass = built.textClass;\n\n updateLineClasses(lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(lineView, dims);\n return lineView.node;\n }", "function _renderLine(input, sb) {\r\n var fontIsMonospace = input.fontIsMonospace;\r\n var canUseHalfwidthRightwardsArrow = input.canUseHalfwidthRightwardsArrow;\r\n var containsForeignElements = input.containsForeignElements;\r\n var lineContent = input.lineContent;\r\n var len = input.len;\r\n var isOverflowing = input.isOverflowing;\r\n var parts = input.parts;\r\n var fauxIndentLength = input.fauxIndentLength;\r\n var tabSize = input.tabSize;\r\n var startVisibleColumn = input.startVisibleColumn;\r\n var containsRTL = input.containsRTL;\r\n var spaceWidth = input.spaceWidth;\r\n var middotWidth = input.middotWidth;\r\n var renderWhitespace = input.renderWhitespace;\r\n var renderControlCharacters = input.renderControlCharacters;\r\n // use U+2E31 - WORD SEPARATOR MIDDLE DOT or U+00B7 - MIDDLE DOT\r\n var spaceRenderWhitespaceCharacter = (middotWidth > spaceWidth ? 0x2E31 : 0xB7);\r\n var characterMapping = new CharacterMapping(len + 1, parts.length);\r\n var charIndex = 0;\r\n var visibleColumn = startVisibleColumn;\r\n var charOffsetInPart = 0;\r\n var prevPartContentCnt = 0;\r\n var partAbsoluteOffset = 0;\r\n sb.appendASCIIString('<span>');\r\n for (var partIndex = 0, tokensLen = parts.length; partIndex < tokensLen; partIndex++) {\r\n partAbsoluteOffset += prevPartContentCnt;\r\n var part = parts[partIndex];\r\n var partEndIndex = part.endIndex;\r\n var partType = part.type;\r\n var partRendersWhitespace = (renderWhitespace !== 0 /* None */ && (partType.indexOf('vs-whitespace') >= 0));\r\n charOffsetInPart = 0;\r\n sb.appendASCIIString('<span class=\"');\r\n sb.appendASCIIString(partType);\r\n sb.appendASCII(34 /* DoubleQuote */);\r\n if (partRendersWhitespace) {\r\n var partContentCnt = 0;\r\n {\r\n var _charIndex = charIndex;\r\n var _visibleColumn = visibleColumn;\r\n for (; _charIndex < partEndIndex; _charIndex++) {\r\n var charCode = lineContent.charCodeAt(_charIndex);\r\n var charWidth = (charCode === 9 /* Tab */ ? (tabSize - (_visibleColumn % tabSize)) : 1) | 0;\r\n partContentCnt += charWidth;\r\n if (_charIndex >= fauxIndentLength) {\r\n _visibleColumn += charWidth;\r\n }\r\n }\r\n }\r\n if (!fontIsMonospace) {\r\n var partIsOnlyWhitespace = (partType === 'vs-whitespace');\r\n if (partIsOnlyWhitespace || !containsForeignElements) {\r\n sb.appendASCIIString(' style=\"display:inline-block;width:');\r\n sb.appendASCIIString(String(spaceWidth * partContentCnt));\r\n sb.appendASCIIString('px\"');\r\n }\r\n }\r\n sb.appendASCII(62 /* GreaterThan */);\r\n for (; charIndex < partEndIndex; charIndex++) {\r\n characterMapping.setPartData(charIndex, partIndex, charOffsetInPart, partAbsoluteOffset);\r\n var charCode = lineContent.charCodeAt(charIndex);\r\n var charWidth = void 0;\r\n if (charCode === 9 /* Tab */) {\r\n charWidth = (tabSize - (visibleColumn % tabSize)) | 0;\r\n if (!canUseHalfwidthRightwardsArrow || charWidth > 1) {\r\n sb.write1(0x2192); // RIGHTWARDS ARROW\r\n }\r\n else {\r\n sb.write1(0xFFEB); // HALFWIDTH RIGHTWARDS ARROW\r\n }\r\n for (var space = 2; space <= charWidth; space++) {\r\n sb.write1(0xA0); // &nbsp;\r\n }\r\n }\r\n else { // must be CharCode.Space\r\n charWidth = 1;\r\n sb.write1(spaceRenderWhitespaceCharacter); // &middot; or word separator middle dot\r\n }\r\n charOffsetInPart += charWidth;\r\n if (charIndex >= fauxIndentLength) {\r\n visibleColumn += charWidth;\r\n }\r\n }\r\n prevPartContentCnt = partContentCnt;\r\n }\r\n else {\r\n var partContentCnt = 0;\r\n if (containsRTL) {\r\n sb.appendASCIIString(' dir=\"ltr\"');\r\n }\r\n sb.appendASCII(62 /* GreaterThan */);\r\n for (; charIndex < partEndIndex; charIndex++) {\r\n characterMapping.setPartData(charIndex, partIndex, charOffsetInPart, partAbsoluteOffset);\r\n var charCode = lineContent.charCodeAt(charIndex);\r\n var producedCharacters = 1;\r\n var charWidth = 1;\r\n switch (charCode) {\r\n case 9 /* Tab */:\r\n producedCharacters = (tabSize - (visibleColumn % tabSize));\r\n charWidth = producedCharacters;\r\n for (var space = 1; space <= producedCharacters; space++) {\r\n sb.write1(0xA0); // &nbsp;\r\n }\r\n break;\r\n case 32 /* Space */:\r\n sb.write1(0xA0); // &nbsp;\r\n break;\r\n case 60 /* LessThan */:\r\n sb.appendASCIIString('&lt;');\r\n break;\r\n case 62 /* GreaterThan */:\r\n sb.appendASCIIString('&gt;');\r\n break;\r\n case 38 /* Ampersand */:\r\n sb.appendASCIIString('&amp;');\r\n break;\r\n case 0 /* Null */:\r\n sb.appendASCIIString('&#00;');\r\n break;\r\n case 65279 /* UTF8_BOM */:\r\n case 8232 /* LINE_SEPARATOR_2028 */:\r\n sb.write1(0xFFFD);\r\n break;\r\n default:\r\n if (strings.isFullWidthCharacter(charCode)) {\r\n charWidth++;\r\n }\r\n if (renderControlCharacters && charCode < 32) {\r\n sb.write1(9216 + charCode);\r\n }\r\n else {\r\n sb.write1(charCode);\r\n }\r\n }\r\n charOffsetInPart += producedCharacters;\r\n partContentCnt += producedCharacters;\r\n if (charIndex >= fauxIndentLength) {\r\n visibleColumn += charWidth;\r\n }\r\n }\r\n prevPartContentCnt = partContentCnt;\r\n }\r\n sb.appendASCIIString('</span>');\r\n }\r\n // When getting client rects for the last character, we will position the\r\n // text range at the end of the span, insteaf of at the beginning of next span\r\n characterMapping.setPartData(len, parts.length - 1, charOffsetInPart, partAbsoluteOffset);\r\n if (isOverflowing) {\r\n sb.appendASCIIString('<span>&hellip;</span>');\r\n }\r\n sb.appendASCIIString('</span>');\r\n return new RenderLineOutput(characterMapping, containsRTL, containsForeignElements);\r\n}", "function buildLineElement(cm, lineView, lineN, dims) {\r\n var built = getLineContent(cm, lineView);\r\n lineView.text = lineView.node = built.pre;\r\n if (built.bgClass) lineView.bgClass = built.bgClass;\r\n if (built.textClass) lineView.textClass = built.textClass;\r\n\r\n updateLineClasses(lineView);\r\n updateLineGutter(cm, lineView, lineN, dims);\r\n insertLineWidgets(lineView, dims);\r\n return lineView.node;\r\n }", "function buildLineElement(cm, lineView, lineN, dims) {\r\n var built = getLineContent(cm, lineView);\r\n lineView.text = lineView.node = built.pre;\r\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\r\n if (built.textClass) { lineView.textClass = built.textClass; }\r\n\r\n updateLineClasses(cm, lineView);\r\n updateLineGutter(cm, lineView, lineN, dims);\r\n insertLineWidgets(cm, lineView, dims);\r\n return lineView.node\r\n}", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) lineView.bgClass = built.bgClass;\n if (built.textClass) lineView.textClass = built.textClass;\n\n updateLineClasses(lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node;\n }", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) lineView.bgClass = built.bgClass;\n if (built.textClass) lineView.textClass = built.textClass;\n\n updateLineClasses(lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node;\n }", "function buildLineElement(cm, lineView, lineN, dims) {\n\t var built = getLineContent(cm, lineView);\n\t lineView.text = lineView.node = built.pre;\n\t if (built.bgClass) lineView.bgClass = built.bgClass;\n\t if (built.textClass) lineView.textClass = built.textClass;\n\n\t updateLineClasses(lineView);\n\t updateLineGutter(cm, lineView, lineN, dims);\n\t insertLineWidgets(cm, lineView, dims);\n\t return lineView.node;\n\t }", "function buildLineElement(cm, lineView, lineN, dims) {\n\t var built = getLineContent(cm, lineView);\n\t lineView.text = lineView.node = built.pre;\n\t if (built.bgClass) lineView.bgClass = built.bgClass;\n\t if (built.textClass) lineView.textClass = built.textClass;\n\n\t updateLineClasses(lineView);\n\t updateLineGutter(cm, lineView, lineN, dims);\n\t insertLineWidgets(cm, lineView, dims);\n\t return lineView.node;\n\t }", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n}", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n}", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n}", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n}", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n}", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n}", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n}", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n}", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n}", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n}", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n}", "function buildLineElement(cm, lineView, lineN, dims) {\n\t var built = getLineContent(cm, lineView);\n\t lineView.text = lineView.node = built.pre;\n\t if (built.bgClass) lineView.bgClass = built.bgClass;\n\t if (built.textClass) lineView.textClass = built.textClass;\n\t\n\t updateLineClasses(lineView);\n\t updateLineGutter(cm, lineView, lineN, dims);\n\t insertLineWidgets(cm, lineView, dims);\n\t return lineView.node;\n\t }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built;\n }\n\n return buildLineContent(cm, lineView);\n } // Redraw the line's text. Interacts with the background and text", "function Line(text, styles) {\n this.styles = styles || [text, null];\n this.text = text;\n this.height = 1;\n this.marked = this.gutterMarker = this.className = this.bgClassName = this.handlers = null;\n this.stateAfter = this.parent = this.hidden = null;\n }", "function Line(text, styles) {\n this.styles = styles || [text, null];\n this.text = text;\n this.height = 1;\n this.marked = this.gutterMarker = this.className = this.bgClassName = this.handlers = null;\n this.stateAfter = this.parent = this.hidden = null;\n }", "function Line(text, styles) {\n this.styles = styles || [text, null];\n this.text = text;\n this.height = 1;\n this.marked = this.gutterMarker = this.className = this.bgClassName = this.handlers = null;\n this.stateAfter = this.parent = this.hidden = null;\n }", "function getLineContent(cm, lineView) {\r\n var ext = cm.display.externalMeasured;\r\n if (ext && ext.line == lineView.line) {\r\n cm.display.externalMeasured = null;\r\n lineView.measure = ext.measure;\r\n return ext.built;\r\n }\r\n return buildLineContent(cm, lineView);\r\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }" ]
[ "0.7296825", "0.7259922", "0.7259922", "0.7194069", "0.7194069", "0.7194069", "0.70309806", "0.7024098", "0.7003542", "0.7000183", "0.69872445", "0.69866264", "0.69771665", "0.69638944", "0.6954674", "0.6933167", "0.6933167", "0.6933167", "0.6933167", "0.6933167", "0.6933167", "0.6933167", "0.6933167", "0.6933167", "0.69225454", "0.69225454", "0.6911464", "0.68385077", "0.6684853", "0.6340827", "0.6314893", "0.6314893", "0.6314893", "0.6314893", "0.6314893", "0.6314893", "0.6314893", "0.6314893", "0.6314893", "0.6314893", "0.6314893", "0.6314893", "0.6314893", "0.6314893", "0.6314893", "0.6314893", "0.6314893", "0.62818456", "0.6272993", "0.6272009", "0.6270989", "0.6270989", "0.6270989", "0.6270989", "0.6270989", "0.6270989", "0.6269162", "0.6268572", "0.62625784", "0.62616825", "0.62616825", "0.625551", "0.625551", "0.62524974", "0.62524974", "0.62524974", "0.62524974", "0.62524974", "0.62524974", "0.62524974", "0.62524974", "0.62524974", "0.62524974", "0.62524974", "0.62425196", "0.6218659", "0.6140881", "0.6140881", "0.6140881", "0.5903464", "0.5894917", "0.5894917", "0.5894917", "0.5894917" ]
0.69485915
26
Build up the DOM representation for a single token, and add it to the line map. Takes care to render special characters separately.
function buildToken(builder, text, style, startStyle, endStyle, css, attributes) { if (!text) { return } var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text; var special = builder.cm.state.specialChars, mustWrap = false; var content; if (!special.test(text)) { builder.col += text.length; content = document.createTextNode(displayText); builder.map.push(builder.pos, builder.pos + text.length, content); if (ie && ie_version < 9) { mustWrap = true; } builder.pos += text.length; } else { content = document.createDocumentFragment(); var pos = 0; while (true) { special.lastIndex = pos; var m = special.exec(text); var skipped = m ? m.index - pos : text.length - pos; if (skipped) { var txt = document.createTextNode(displayText.slice(pos, pos + skipped)); if (ie && ie_version < 9) { content.appendChild(elt("span", [txt])); } else { content.appendChild(txt); } builder.map.push(builder.pos, builder.pos + skipped, txt); builder.col += skipped; builder.pos += skipped; } if (!m) { break } pos += skipped + 1; var txt$1 = (void 0); if (m[0] == "\t") { var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize; txt$1 = content.appendChild(elt("span", spaceStr(tabWidth), "cm-tab")); txt$1.setAttribute("role", "presentation"); txt$1.setAttribute("cm-text", "\t"); builder.col += tabWidth; } else if (m[0] == "\r" || m[0] == "\n") { txt$1 = content.appendChild(elt("span", m[0] == "\r" ? "\u240d" : "\u2424", "cm-invalidchar")); txt$1.setAttribute("cm-text", m[0]); builder.col += 1; } else { txt$1 = builder.cm.options.specialCharPlaceholder(m[0]); txt$1.setAttribute("cm-text", m[0]); if (ie && ie_version < 9) { content.appendChild(elt("span", [txt$1])); } else { content.appendChild(txt$1); } builder.col += 1; } builder.map.push(builder.pos, builder.pos + 1, txt$1); builder.pos++; } } builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32; if (style || startStyle || endStyle || mustWrap || css) { var fullStyle = style || ""; if (startStyle) { fullStyle += startStyle; } if (endStyle) { fullStyle += endStyle; } var token = elt("span", [content], fullStyle, css); if (attributes) { for (var attr in attributes) { if (attributes.hasOwnProperty(attr) && attr != "style" && attr != "class") { token.setAttribute(attr, attributes[attr]); } } } return builder.content.appendChild(token) } builder.content.appendChild(content); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "drawHTMLToken() {\n const tokenContainer = document.createElement('div');\n const gameBoardUnderlay = document.getElementById('game-board-underlay');\n gameBoardUnderlay.appendChild(tokenContainer);\n tokenContainer.setAttribute(\"id\", this.id);\n tokenContainer.setAttribute(\"class\", \"token\");\n tokenContainer.style.backgroundColor = this.owner.colour;\n }", "function buildToken(builder, text, style, startStyle, endStyle, css, attributes) {\n\t\t if (!text) { return }\n\t\t var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n\t\t var special = builder.cm.state.specialChars, mustWrap = false;\n\t\t var content;\n\t\t if (!special.test(text)) {\n\t\t builder.col += text.length;\n\t\t content = document.createTextNode(displayText);\n\t\t builder.map.push(builder.pos, builder.pos + text.length, content);\n\t\t if (ie && ie_version < 9) { mustWrap = true; }\n\t\t builder.pos += text.length;\n\t\t } else {\n\t\t content = document.createDocumentFragment();\n\t\t var pos = 0;\n\t\t while (true) {\n\t\t special.lastIndex = pos;\n\t\t var m = special.exec(text);\n\t\t var skipped = m ? m.index - pos : text.length - pos;\n\t\t if (skipped) {\n\t\t var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n\t\t if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])); }\n\t\t else { content.appendChild(txt); }\n\t\t builder.map.push(builder.pos, builder.pos + skipped, txt);\n\t\t builder.col += skipped;\n\t\t builder.pos += skipped;\n\t\t }\n\t\t if (!m) { break }\n\t\t pos += skipped + 1;\n\t\t var txt$1 = (void 0);\n\t\t if (m[0] == \"\\t\") {\n\t\t var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n\t\t txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n\t\t txt$1.setAttribute(\"role\", \"presentation\");\n\t\t txt$1.setAttribute(\"cm-text\", \"\\t\");\n\t\t builder.col += tabWidth;\n\t\t } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n\t\t txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n\t\t txt$1.setAttribute(\"cm-text\", m[0]);\n\t\t builder.col += 1;\n\t\t } else {\n\t\t txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n\t\t txt$1.setAttribute(\"cm-text\", m[0]);\n\t\t if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])); }\n\t\t else { content.appendChild(txt$1); }\n\t\t builder.col += 1;\n\t\t }\n\t\t builder.map.push(builder.pos, builder.pos + 1, txt$1);\n\t\t builder.pos++;\n\t\t }\n\t\t }\n\t\t builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n\t\t if (style || startStyle || endStyle || mustWrap || css || attributes) {\n\t\t var fullStyle = style || \"\";\n\t\t if (startStyle) { fullStyle += startStyle; }\n\t\t if (endStyle) { fullStyle += endStyle; }\n\t\t var token = elt(\"span\", [content], fullStyle, css);\n\t\t if (attributes) {\n\t\t for (var attr in attributes) { if (attributes.hasOwnProperty(attr) && attr != \"style\" && attr != \"class\")\n\t\t { token.setAttribute(attr, attributes[attr]); } }\n\t\t }\n\t\t return builder.content.appendChild(token)\n\t\t }\n\t\t builder.content.appendChild(content);\n\t\t }", "function buildToken(builder, text, style, startStyle, endStyle, title) {\r\n if (!text) return;\r\n var special = builder.cm.options.specialChars, mustWrap = false;\r\n if (!special.test(text)) {\r\n builder.col += text.length;\r\n var content = document.createTextNode(text);\r\n builder.map.push(builder.pos, builder.pos + text.length, content);\r\n if (ie && ie_version < 9) mustWrap = true;\r\n builder.pos += text.length;\r\n } else {\r\n var content = document.createDocumentFragment(), pos = 0;\r\n while (true) {\r\n special.lastIndex = pos;\r\n var m = special.exec(text);\r\n var skipped = m ? m.index - pos : text.length - pos;\r\n if (skipped) {\r\n var txt = document.createTextNode(text.slice(pos, pos + skipped));\r\n if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\r\n else content.appendChild(txt);\r\n builder.map.push(builder.pos, builder.pos + skipped, txt);\r\n builder.col += skipped;\r\n builder.pos += skipped;\r\n }\r\n if (!m) break;\r\n pos += skipped + 1;\r\n if (m[0] == \"\\t\") {\r\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\r\n var txt = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\r\n builder.col += tabWidth;\r\n } else {\r\n var txt = builder.cm.options.specialCharPlaceholder(m[0]);\r\n if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\r\n else content.appendChild(txt);\r\n builder.col += 1;\r\n }\r\n builder.map.push(builder.pos, builder.pos + 1, txt);\r\n builder.pos++;\r\n }\r\n }\r\n if (style || startStyle || endStyle || mustWrap) {\r\n var fullStyle = style || \"\";\r\n if (startStyle) fullStyle += startStyle;\r\n if (endStyle) fullStyle += endStyle;\r\n var token = elt(\"span\", [content], fullStyle);\r\n if (title) token.title = title;\r\n return builder.content.appendChild(token);\r\n }\r\n builder.content.appendChild(content);\r\n }", "function buildToken(builder, text, style, startStyle, endStyle, title) {\n if (!text) return;\n var special = builder.cm.options.specialChars, mustWrap = false;\n if (!special.test(text)) {\n builder.col += text.length;\n var content = document.createTextNode(text);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) mustWrap = true;\n builder.pos += text.length;\n } else {\n var content = document.createDocumentFragment(), pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(text.slice(pos, pos + skipped));\n if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n else content.appendChild(txt);\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) break;\n pos += skipped + 1;\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n var txt = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n builder.col += tabWidth;\n } else {\n var txt = builder.cm.options.specialCharPlaceholder(m[0]);\n if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n else content.appendChild(txt);\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt);\n builder.pos++;\n }\n }\n if (style || startStyle || endStyle || mustWrap) {\n var fullStyle = style || \"\";\n if (startStyle) fullStyle += startStyle;\n if (endStyle) fullStyle += endStyle;\n var token = elt(\"span\", [content], fullStyle);\n if (title) token.title = title;\n return builder.content.appendChild(token);\n }\n builder.content.appendChild(content);\n }", "function buildToken(builder, text, style, startStyle, endStyle, title) {\n if (!text) return;\n var special = builder.cm.options.specialChars, mustWrap = false;\n if (!special.test(text)) {\n builder.col += text.length;\n var content = document.createTextNode(text);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) mustWrap = true;\n builder.pos += text.length;\n } else {\n var content = document.createDocumentFragment(), pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(text.slice(pos, pos + skipped));\n if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n else content.appendChild(txt);\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) break;\n pos += skipped + 1;\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n var txt = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n builder.col += tabWidth;\n } else {\n var txt = builder.cm.options.specialCharPlaceholder(m[0]);\n if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n else content.appendChild(txt);\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt);\n builder.pos++;\n }\n }\n if (style || startStyle || endStyle || mustWrap) {\n var fullStyle = style || \"\";\n if (startStyle) fullStyle += startStyle;\n if (endStyle) fullStyle += endStyle;\n var token = elt(\"span\", [content], fullStyle);\n if (title) token.title = title;\n return builder.content.appendChild(token);\n }\n builder.content.appendChild(content);\n }", "function buildToken(builder, text, style, startStyle, endStyle, title) {\n if (!text) return;\n var special = builder.cm.options.specialChars, mustWrap = false;\n if (!special.test(text)) {\n builder.col += text.length;\n var content = document.createTextNode(text);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) mustWrap = true;\n builder.pos += text.length;\n } else {\n var content = document.createDocumentFragment(), pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(text.slice(pos, pos + skipped));\n if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n else content.appendChild(txt);\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) break;\n pos += skipped + 1;\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n var txt = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n builder.col += tabWidth;\n } else {\n var txt = builder.cm.options.specialCharPlaceholder(m[0]);\n if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n else content.appendChild(txt);\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt);\n builder.pos++;\n }\n }\n if (style || startStyle || endStyle || mustWrap) {\n var fullStyle = style || \"\";\n if (startStyle) fullStyle += startStyle;\n if (endStyle) fullStyle += endStyle;\n var token = elt(\"span\", [content], fullStyle);\n if (title) token.title = title;\n return builder.content.appendChild(token);\n }\n builder.content.appendChild(content);\n }", "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) return;\n var special = builder.cm.options.specialChars, mustWrap = false;\n if (!special.test(text)) {\n builder.col += text.length;\n var content = document.createTextNode(text);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) mustWrap = true;\n builder.pos += text.length;\n } else {\n var content = document.createDocumentFragment(), pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(text.slice(pos, pos + skipped));\n if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n else content.appendChild(txt);\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) break;\n pos += skipped + 1;\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n var txt = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n builder.col += tabWidth;\n } else {\n var txt = builder.cm.options.specialCharPlaceholder(m[0]);\n if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n else content.appendChild(txt);\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt);\n builder.pos++;\n }\n }\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) fullStyle += startStyle;\n if (endStyle) fullStyle += endStyle;\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) token.title = title;\n return builder.content.appendChild(token);\n }\n builder.content.appendChild(content);\n }", "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n\t\t if (!text) return;\n\t\t var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text\n\t\t var special = builder.cm.state.specialChars, mustWrap = false;\n\t\t if (!special.test(text)) {\n\t\t builder.col += text.length;\n\t\t var content = document.createTextNode(displayText);\n\t\t builder.map.push(builder.pos, builder.pos + text.length, content);\n\t\t if (ie && ie_version < 9) mustWrap = true;\n\t\t builder.pos += text.length;\n\t\t } else {\n\t\t var content = document.createDocumentFragment(), pos = 0;\n\t\t while (true) {\n\t\t special.lastIndex = pos;\n\t\t var m = special.exec(text);\n\t\t var skipped = m ? m.index - pos : text.length - pos;\n\t\t if (skipped) {\n\t\t var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n\t\t if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n\t\t else content.appendChild(txt);\n\t\t builder.map.push(builder.pos, builder.pos + skipped, txt);\n\t\t builder.col += skipped;\n\t\t builder.pos += skipped;\n\t\t }\n\t\t if (!m) break;\n\t\t pos += skipped + 1;\n\t\t if (m[0] == \"\\t\") {\n\t\t var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n\t\t var txt = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n\t\t txt.setAttribute(\"role\", \"presentation\");\n\t\t txt.setAttribute(\"cm-text\", \"\\t\");\n\t\t builder.col += tabWidth;\n\t\t } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n\t\t var txt = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n\t\t txt.setAttribute(\"cm-text\", m[0]);\n\t\t builder.col += 1;\n\t\t } else {\n\t\t var txt = builder.cm.options.specialCharPlaceholder(m[0]);\n\t\t txt.setAttribute(\"cm-text\", m[0]);\n\t\t if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n\t\t else content.appendChild(txt);\n\t\t builder.col += 1;\n\t\t }\n\t\t builder.map.push(builder.pos, builder.pos + 1, txt);\n\t\t builder.pos++;\n\t\t }\n\t\t }\n\t\t builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32\n\t\t if (style || startStyle || endStyle || mustWrap || css) {\n\t\t var fullStyle = style || \"\";\n\t\t if (startStyle) fullStyle += startStyle;\n\t\t if (endStyle) fullStyle += endStyle;\n\t\t var token = elt(\"span\", [content], fullStyle, css);\n\t\t if (title) token.title = title;\n\t\t return builder.content.appendChild(token);\n\t\t }\n\t\t builder.content.appendChild(content);\n\t\t }", "function tokenToNode(token, tokenText) {\n switch (token.tokenType) {\n case \"ident\":\n return createStyledNode(tokenText, identClass);\n case \"symbol\":\n updateIdentClass(tokenText);\n return doc.createTextNode(tokenText);\n case \"whitespace\":\n return doc.createTextNode(tokenText);\n case \"comment\":\n return createStyledNode(tokenText, COMMENT_COLOR);\n default:\n return createStyledNode(tokenText, PROPERTY_VALUE_COLOR);\n }\n }", "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) return;\n var special = builder.cm.options.specialChars, mustWrap = false;\n if (!special.test(text)) {\n builder.col += text.length;\n var content = document.createTextNode(text);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) mustWrap = true;\n builder.pos += text.length;\n } else {\n var content = document.createDocumentFragment(), pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(text.slice(pos, pos + skipped));\n if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n else content.appendChild(txt);\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) break;\n pos += skipped + 1;\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n var txt = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt.setAttribute(\"role\", \"presentation\");\n builder.col += tabWidth;\n } else {\n var txt = builder.cm.options.specialCharPlaceholder(m[0]);\n if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n else content.appendChild(txt);\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt);\n builder.pos++;\n }\n }\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) fullStyle += startStyle;\n if (endStyle) fullStyle += endStyle;\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) token.title = title;\n return builder.content.appendChild(token);\n }\n builder.content.appendChild(content);\n }", "function buildToken(builder, text, style, startStyle, endStyle, css, attributes) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n var content;\n if (!special.test(text)) {\n builder.col += text.length;\n content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) { mustWrap = true; }\n builder.pos += text.length;\n } else {\n content = document.createDocumentFragment();\n var pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])); }\n else { content.appendChild(txt); }\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) { break }\n pos += skipped + 1;\n var txt$1 = (void 0);\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt$1.setAttribute(\"role\", \"presentation\");\n txt$1.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt$1.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n txt$1.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])); }\n else { content.appendChild(txt$1); }\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n if (style || startStyle || endStyle || mustWrap || css || attributes) {\n var fullStyle = style || \"\";\n if (startStyle) { fullStyle += startStyle; }\n if (endStyle) { fullStyle += endStyle; }\n var token = elt(\"span\", [content], fullStyle, css);\n if (attributes) {\n for (var attr in attributes) { if (attributes.hasOwnProperty(attr) && attr != \"style\" && attr != \"class\")\n { token.setAttribute(attr, attributes[attr]); } }\n }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content);\n }", "function buildToken(builder, text, style, startStyle, endStyle, css, attributes) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n var content;\n if (!special.test(text)) {\n builder.col += text.length;\n content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) { mustWrap = true; }\n builder.pos += text.length;\n } else {\n content = document.createDocumentFragment();\n var pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])); }\n else { content.appendChild(txt); }\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) { break }\n pos += skipped + 1;\n var txt$1 = (void 0);\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt$1.setAttribute(\"role\", \"presentation\");\n txt$1.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt$1.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n txt$1.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])); }\n else { content.appendChild(txt$1); }\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n if (style || startStyle || endStyle || mustWrap || css || attributes) {\n var fullStyle = style || \"\";\n if (startStyle) { fullStyle += startStyle; }\n if (endStyle) { fullStyle += endStyle; }\n var token = elt(\"span\", [content], fullStyle, css);\n if (attributes) {\n for (var attr in attributes) { if (attributes.hasOwnProperty(attr) && attr != \"style\" && attr != \"class\")\n { token.setAttribute(attr, attributes[attr]); } }\n }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content);\n }", "function buildToken(builder, text, style, startStyle, endStyle, css, attributes) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n var content;\n if (!special.test(text)) {\n builder.col += text.length;\n content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) { mustWrap = true; }\n builder.pos += text.length;\n } else {\n content = document.createDocumentFragment();\n var pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])); }\n else { content.appendChild(txt); }\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) { break }\n pos += skipped + 1;\n var txt$1 = (void 0);\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt$1.setAttribute(\"role\", \"presentation\");\n txt$1.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt$1.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n txt$1.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])); }\n else { content.appendChild(txt$1); }\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n if (style || startStyle || endStyle || mustWrap || css || attributes) {\n var fullStyle = style || \"\";\n if (startStyle) { fullStyle += startStyle; }\n if (endStyle) { fullStyle += endStyle; }\n var token = elt(\"span\", [content], fullStyle, css);\n if (attributes) {\n for (var attr in attributes) { if (attributes.hasOwnProperty(attr) && attr != \"style\" && attr != \"class\")\n { token.setAttribute(attr, attributes[attr]); } }\n }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content);\n }", "function buildToken(builder, text, style, startStyle, endStyle, css, attributes) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n var content;\n if (!special.test(text)) {\n builder.col += text.length;\n content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) { mustWrap = true; }\n builder.pos += text.length;\n } else {\n content = document.createDocumentFragment();\n var pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])); }\n else { content.appendChild(txt); }\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) { break }\n pos += skipped + 1;\n var txt$1 = (void 0);\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt$1.setAttribute(\"role\", \"presentation\");\n txt$1.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt$1.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n txt$1.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])); }\n else { content.appendChild(txt$1); }\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n if (style || startStyle || endStyle || mustWrap || css || attributes) {\n var fullStyle = style || \"\";\n if (startStyle) { fullStyle += startStyle; }\n if (endStyle) { fullStyle += endStyle; }\n var token = elt(\"span\", [content], fullStyle, css);\n if (attributes) {\n for (var attr in attributes) { if (attributes.hasOwnProperty(attr) && attr != \"style\" && attr != \"class\")\n { token.setAttribute(attr, attributes[attr]); } }\n }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content);\n }", "function buildToken(builder, text, style, startStyle, endStyle, css, attributes) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n var content;\n if (!special.test(text)) {\n builder.col += text.length;\n content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) { mustWrap = true; }\n builder.pos += text.length;\n } else {\n content = document.createDocumentFragment();\n var pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])); }\n else { content.appendChild(txt); }\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) { break }\n pos += skipped + 1;\n var txt$1 = (void 0);\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt$1.setAttribute(\"role\", \"presentation\");\n txt$1.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt$1.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n txt$1.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])); }\n else { content.appendChild(txt$1); }\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n if (style || startStyle || endStyle || mustWrap || css || attributes) {\n var fullStyle = style || \"\";\n if (startStyle) { fullStyle += startStyle; }\n if (endStyle) { fullStyle += endStyle; }\n var token = elt(\"span\", [content], fullStyle, css);\n if (attributes) {\n for (var attr in attributes) { if (attributes.hasOwnProperty(attr) && attr != \"style\" && attr != \"class\")\n { token.setAttribute(attr, attributes[attr]); } }\n }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content);\n }", "function buildToken(builder, text, style, startStyle, endStyle, css, attributes) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n var content;\n if (!special.test(text)) {\n builder.col += text.length;\n content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) { mustWrap = true; }\n builder.pos += text.length;\n } else {\n content = document.createDocumentFragment();\n var pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])); }\n else { content.appendChild(txt); }\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) { break }\n pos += skipped + 1;\n var txt$1 = (void 0);\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt$1.setAttribute(\"role\", \"presentation\");\n txt$1.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt$1.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n txt$1.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])); }\n else { content.appendChild(txt$1); }\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n if (style || startStyle || endStyle || mustWrap || css || attributes) {\n var fullStyle = style || \"\";\n if (startStyle) { fullStyle += startStyle; }\n if (endStyle) { fullStyle += endStyle; }\n var token = elt(\"span\", [content], fullStyle, css);\n if (attributes) {\n for (var attr in attributes) { if (attributes.hasOwnProperty(attr) && attr != \"style\" && attr != \"class\")\n { token.setAttribute(attr, attributes[attr]); } }\n }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content);\n }", "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n\t if (!text) return;\n\t var displayText = builder.splitSpaces ? text.replace(/ {3,}/g, splitSpaces) : text;\n\t var special = builder.cm.state.specialChars, mustWrap = false;\n\t if (!special.test(text)) {\n\t builder.col += text.length;\n\t var content = document.createTextNode(displayText);\n\t builder.map.push(builder.pos, builder.pos + text.length, content);\n\t if (ie && ie_version < 9) mustWrap = true;\n\t builder.pos += text.length;\n\t } else {\n\t var content = document.createDocumentFragment(), pos = 0;\n\t while (true) {\n\t special.lastIndex = pos;\n\t var m = special.exec(text);\n\t var skipped = m ? m.index - pos : text.length - pos;\n\t if (skipped) {\n\t var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n\t if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n\t else content.appendChild(txt);\n\t builder.map.push(builder.pos, builder.pos + skipped, txt);\n\t builder.col += skipped;\n\t builder.pos += skipped;\n\t }\n\t if (!m) break;\n\t pos += skipped + 1;\n\t if (m[0] == \"\\t\") {\n\t var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n\t var txt = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n\t txt.setAttribute(\"role\", \"presentation\");\n\t txt.setAttribute(\"cm-text\", \"\\t\");\n\t builder.col += tabWidth;\n\t } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n\t var txt = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n\t txt.setAttribute(\"cm-text\", m[0]);\n\t builder.col += 1;\n\t } else {\n\t var txt = builder.cm.options.specialCharPlaceholder(m[0]);\n\t txt.setAttribute(\"cm-text\", m[0]);\n\t if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n\t else content.appendChild(txt);\n\t builder.col += 1;\n\t }\n\t builder.map.push(builder.pos, builder.pos + 1, txt);\n\t builder.pos++;\n\t }\n\t }\n\t if (style || startStyle || endStyle || mustWrap || css) {\n\t var fullStyle = style || \"\";\n\t if (startStyle) fullStyle += startStyle;\n\t if (endStyle) fullStyle += endStyle;\n\t var token = elt(\"span\", [content], fullStyle, css);\n\t if (title) token.title = title;\n\t return builder.content.appendChild(token);\n\t }\n\t builder.content.appendChild(content);\n\t }", "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n\t if (!text) return;\n\t var displayText = builder.splitSpaces ? text.replace(/ {3,}/g, splitSpaces) : text;\n\t var special = builder.cm.state.specialChars, mustWrap = false;\n\t if (!special.test(text)) {\n\t builder.col += text.length;\n\t var content = document.createTextNode(displayText);\n\t builder.map.push(builder.pos, builder.pos + text.length, content);\n\t if (ie && ie_version < 9) mustWrap = true;\n\t builder.pos += text.length;\n\t } else {\n\t var content = document.createDocumentFragment(), pos = 0;\n\t while (true) {\n\t special.lastIndex = pos;\n\t var m = special.exec(text);\n\t var skipped = m ? m.index - pos : text.length - pos;\n\t if (skipped) {\n\t var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n\t if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n\t else content.appendChild(txt);\n\t builder.map.push(builder.pos, builder.pos + skipped, txt);\n\t builder.col += skipped;\n\t builder.pos += skipped;\n\t }\n\t if (!m) break;\n\t pos += skipped + 1;\n\t if (m[0] == \"\\t\") {\n\t var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n\t var txt = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n\t txt.setAttribute(\"role\", \"presentation\");\n\t txt.setAttribute(\"cm-text\", \"\\t\");\n\t builder.col += tabWidth;\n\t } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n\t var txt = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n\t txt.setAttribute(\"cm-text\", m[0]);\n\t builder.col += 1;\n\t } else {\n\t var txt = builder.cm.options.specialCharPlaceholder(m[0]);\n\t txt.setAttribute(\"cm-text\", m[0]);\n\t if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n\t else content.appendChild(txt);\n\t builder.col += 1;\n\t }\n\t builder.map.push(builder.pos, builder.pos + 1, txt);\n\t builder.pos++;\n\t }\n\t }\n\t if (style || startStyle || endStyle || mustWrap || css) {\n\t var fullStyle = style || \"\";\n\t if (startStyle) fullStyle += startStyle;\n\t if (endStyle) fullStyle += endStyle;\n\t var token = elt(\"span\", [content], fullStyle, css);\n\t if (title) token.title = title;\n\t return builder.content.appendChild(token);\n\t }\n\t builder.content.appendChild(content);\n\t }", "function buildToken(builder, text, style, startStyle, endStyle, css, attributes) {\n if (!text) {\n return;\n }\n\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n var special = builder.cm.state.specialChars,\n mustWrap = false;\n var content;\n\n if (!special.test(text)) {\n builder.col += text.length;\n content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n\n if (ie && ie_version < 9) {\n mustWrap = true;\n }\n\n builder.pos += text.length;\n } else {\n content = document.createDocumentFragment();\n var pos = 0;\n\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n\n if (ie && ie_version < 9) {\n content.appendChild(elt(\"span\", [txt]));\n } else {\n content.appendChild(txt);\n }\n\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n\n if (!m) {\n break;\n }\n\n pos += skipped + 1;\n var txt$1 = void 0;\n\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize,\n tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt$1.setAttribute(\"role\", \"presentation\");\n txt$1.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240D\" : \"\\u2424\", \"cm-invalidchar\"));\n txt$1.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n txt$1.setAttribute(\"cm-text\", m[0]);\n\n if (ie && ie_version < 9) {\n content.appendChild(elt(\"span\", [txt$1]));\n } else {\n content.appendChild(txt$1);\n }\n\n builder.col += 1;\n }\n\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\n builder.pos++;\n }\n }\n\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n\n if (startStyle) {\n fullStyle += startStyle;\n }\n\n if (endStyle) {\n fullStyle += endStyle;\n }\n\n var token = elt(\"span\", [content], fullStyle, css);\n\n if (attributes) {\n for (var attr in attributes) {\n if (attributes.hasOwnProperty(attr) && attr != \"style\" && attr != \"class\") {\n token.setAttribute(attr, attributes[attr]);\n }\n }\n }\n\n return builder.content.appendChild(token);\n }\n\n builder.content.appendChild(content);\n } // Change some spaces to NBSP to prevent the browser from collapsing", "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n\t if (!text) return;\n\t var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text\n\t var special = builder.cm.state.specialChars, mustWrap = false;\n\t if (!special.test(text)) {\n\t builder.col += text.length;\n\t var content = document.createTextNode(displayText);\n\t builder.map.push(builder.pos, builder.pos + text.length, content);\n\t if (ie && ie_version < 9) mustWrap = true;\n\t builder.pos += text.length;\n\t } else {\n\t var content = document.createDocumentFragment(), pos = 0;\n\t while (true) {\n\t special.lastIndex = pos;\n\t var m = special.exec(text);\n\t var skipped = m ? m.index - pos : text.length - pos;\n\t if (skipped) {\n\t var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n\t if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n\t else content.appendChild(txt);\n\t builder.map.push(builder.pos, builder.pos + skipped, txt);\n\t builder.col += skipped;\n\t builder.pos += skipped;\n\t }\n\t if (!m) break;\n\t pos += skipped + 1;\n\t if (m[0] == \"\\t\") {\n\t var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n\t var txt = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n\t txt.setAttribute(\"role\", \"presentation\");\n\t txt.setAttribute(\"cm-text\", \"\\t\");\n\t builder.col += tabWidth;\n\t } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n\t var txt = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n\t txt.setAttribute(\"cm-text\", m[0]);\n\t builder.col += 1;\n\t } else {\n\t var txt = builder.cm.options.specialCharPlaceholder(m[0]);\n\t txt.setAttribute(\"cm-text\", m[0]);\n\t if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n\t else content.appendChild(txt);\n\t builder.col += 1;\n\t }\n\t builder.map.push(builder.pos, builder.pos + 1, txt);\n\t builder.pos++;\n\t }\n\t }\n\t builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32\n\t if (style || startStyle || endStyle || mustWrap || css) {\n\t var fullStyle = style || \"\";\n\t if (startStyle) fullStyle += startStyle;\n\t if (endStyle) fullStyle += endStyle;\n\t var token = elt(\"span\", [content], fullStyle, css);\n\t if (title) token.title = title;\n\t return builder.content.appendChild(token);\n\t }\n\t builder.content.appendChild(content);\n\t }", "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text\n var special = builder.cm.state.specialChars, mustWrap = false\n var content\n if (!special.test(text)) {\n builder.col += text.length\n content = document.createTextNode(displayText)\n builder.map.push(builder.pos, builder.pos + text.length, content)\n if (ie && ie_version < 9) { mustWrap = true }\n builder.pos += text.length\n } else {\n content = document.createDocumentFragment()\n var pos = 0\n while (true) {\n special.lastIndex = pos\n var m = special.exec(text)\n var skipped = m ? m.index - pos : text.length - pos\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped))\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])) }\n else { content.appendChild(txt) }\n builder.map.push(builder.pos, builder.pos + skipped, txt)\n builder.col += skipped\n builder.pos += skipped\n }\n if (!m) { break }\n pos += skipped + 1\n var txt$1 = (void 0)\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"))\n txt$1.setAttribute(\"role\", \"presentation\")\n txt$1.setAttribute(\"cm-text\", \"\\t\")\n builder.col += tabWidth\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"))\n txt$1.setAttribute(\"cm-text\", m[0])\n builder.col += 1\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0])\n txt$1.setAttribute(\"cm-text\", m[0])\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])) }\n else { content.appendChild(txt$1) }\n builder.col += 1\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1)\n builder.pos++\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\"\n if (startStyle) { fullStyle += startStyle }\n if (endStyle) { fullStyle += endStyle }\n var token = elt(\"span\", [content], fullStyle, css)\n if (title) { token.title = title }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content)\n}", "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text\n var special = builder.cm.state.specialChars, mustWrap = false\n var content\n if (!special.test(text)) {\n builder.col += text.length\n content = document.createTextNode(displayText)\n builder.map.push(builder.pos, builder.pos + text.length, content)\n if (ie && ie_version < 9) { mustWrap = true }\n builder.pos += text.length\n } else {\n content = document.createDocumentFragment()\n var pos = 0\n while (true) {\n special.lastIndex = pos\n var m = special.exec(text)\n var skipped = m ? m.index - pos : text.length - pos\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped))\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])) }\n else { content.appendChild(txt) }\n builder.map.push(builder.pos, builder.pos + skipped, txt)\n builder.col += skipped\n builder.pos += skipped\n }\n if (!m) { break }\n pos += skipped + 1\n var txt$1 = (void 0)\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"))\n txt$1.setAttribute(\"role\", \"presentation\")\n txt$1.setAttribute(\"cm-text\", \"\\t\")\n builder.col += tabWidth\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"))\n txt$1.setAttribute(\"cm-text\", m[0])\n builder.col += 1\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0])\n txt$1.setAttribute(\"cm-text\", m[0])\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])) }\n else { content.appendChild(txt$1) }\n builder.col += 1\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1)\n builder.pos++\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\"\n if (startStyle) { fullStyle += startStyle }\n if (endStyle) { fullStyle += endStyle }\n var token = elt(\"span\", [content], fullStyle, css)\n if (title) { token.title = title }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content)\n}", "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) return;\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text\n var special = builder.cm.state.specialChars, mustWrap = false;\n if (!special.test(text)) {\n builder.col += text.length;\n var content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) mustWrap = true;\n builder.pos += text.length;\n } else {\n var content = document.createDocumentFragment(), pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n else content.appendChild(txt);\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) break;\n pos += skipped + 1;\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n var txt = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt.setAttribute(\"role\", \"presentation\");\n txt.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n var txt = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n var txt = builder.cm.options.specialCharPlaceholder(m[0]);\n txt.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n else content.appendChild(txt);\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) fullStyle += startStyle;\n if (endStyle) fullStyle += endStyle;\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) token.title = title;\n return builder.content.appendChild(token);\n }\n builder.content.appendChild(content);\n }", "function addToken() {\n token.end = {\n line: line,\n col: column\n };\n\n DEBUG && debug('addToken:', JSON.stringify(token, null, 2));\n\n tokens.push(token);\n\n buffer = '';\n token = {};\n }", "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n var content;\n if (!special.test(text)) {\n builder.col += text.length;\n content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) { mustWrap = true; }\n builder.pos += text.length;\n } else {\n content = document.createDocumentFragment();\n var pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])); }\n else { content.appendChild(txt); }\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) { break }\n pos += skipped + 1;\n var txt$1 = (void 0);\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt$1.setAttribute(\"role\", \"presentation\");\n txt$1.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt$1.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n txt$1.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])); }\n else { content.appendChild(txt$1); }\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) { fullStyle += startStyle; }\n if (endStyle) { fullStyle += endStyle; }\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) { token.title = title; }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content);\n }", "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n var content;\n if (!special.test(text)) {\n builder.col += text.length;\n content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) { mustWrap = true; }\n builder.pos += text.length;\n } else {\n content = document.createDocumentFragment();\n var pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])); }\n else { content.appendChild(txt); }\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) { break }\n pos += skipped + 1;\n var txt$1 = (void 0);\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt$1.setAttribute(\"role\", \"presentation\");\n txt$1.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt$1.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n txt$1.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])); }\n else { content.appendChild(txt$1); }\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) { fullStyle += startStyle; }\n if (endStyle) { fullStyle += endStyle; }\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) { token.title = title; }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content);\n }", "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\r\n if (!text) { return }\r\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\r\n var special = builder.cm.state.specialChars, mustWrap = false;\r\n var content;\r\n if (!special.test(text)) {\r\n builder.col += text.length;\r\n content = document.createTextNode(displayText);\r\n builder.map.push(builder.pos, builder.pos + text.length, content);\r\n if (ie && ie_version < 9) { mustWrap = true; }\r\n builder.pos += text.length;\r\n } else {\r\n content = document.createDocumentFragment();\r\n var pos = 0;\r\n while (true) {\r\n special.lastIndex = pos;\r\n var m = special.exec(text);\r\n var skipped = m ? m.index - pos : text.length - pos;\r\n if (skipped) {\r\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\r\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])); }\r\n else { content.appendChild(txt); }\r\n builder.map.push(builder.pos, builder.pos + skipped, txt);\r\n builder.col += skipped;\r\n builder.pos += skipped;\r\n }\r\n if (!m) { break }\r\n pos += skipped + 1;\r\n var txt$1 = (void 0);\r\n if (m[0] == \"\\t\") {\r\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\r\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\r\n txt$1.setAttribute(\"role\", \"presentation\");\r\n txt$1.setAttribute(\"cm-text\", \"\\t\");\r\n builder.col += tabWidth;\r\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\r\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\r\n txt$1.setAttribute(\"cm-text\", m[0]);\r\n builder.col += 1;\r\n } else {\r\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\r\n txt$1.setAttribute(\"cm-text\", m[0]);\r\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])); }\r\n else { content.appendChild(txt$1); }\r\n builder.col += 1;\r\n }\r\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\r\n builder.pos++;\r\n }\r\n }\r\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\r\n if (style || startStyle || endStyle || mustWrap || css) {\r\n var fullStyle = style || \"\";\r\n if (startStyle) { fullStyle += startStyle; }\r\n if (endStyle) { fullStyle += endStyle; }\r\n var token = elt(\"span\", [content], fullStyle, css);\r\n if (title) { token.title = title; }\r\n return builder.content.appendChild(token)\r\n }\r\n builder.content.appendChild(content);\r\n}", "function buildLineContent(cm, lineView) {\r\n // The padding-right forces the element to have a 'border', which\r\n // is needed on Webkit to be able to get line-level bounding\r\n // rectangles for it (in measureChar).\r\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\r\n var builder = {pre: elt(\"pre\", [content]), content: content, col: 0, pos: 0, cm: cm};\r\n lineView.measure = {};\r\n\r\n // Iterate over the logical lines that make up this visual line.\r\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\r\n var line = i ? lineView.rest[i - 1] : lineView.line, order;\r\n builder.pos = 0;\r\n builder.addToken = buildToken;\r\n // Optionally wire in some hacks into the token-rendering\r\n // algorithm, to deal with browser quirks.\r\n if ((ie || webkit) && cm.getOption(\"lineWrapping\"))\r\n builder.addToken = buildTokenSplitSpaces(builder.addToken);\r\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\r\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\r\n builder.map = [];\r\n insertLineContent(line, builder, getLineStyles(cm, line));\r\n if (line.styleClasses) {\r\n if (line.styleClasses.bgClass)\r\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\r\n if (line.styleClasses.textClass)\r\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\r\n }\r\n\r\n // Ensure at least a single node is present, for measuring.\r\n if (builder.map.length == 0)\r\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\r\n\r\n // Store the map and a cache object for the current logical line\r\n if (i == 0) {\r\n lineView.measure.map = builder.map;\r\n lineView.measure.cache = {};\r\n } else {\r\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\r\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\r\n }\r\n }\r\n\r\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\r\n if (builder.pre.className)\r\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\r\n return builder;\r\n }", "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) return;\n var displayText = builder.splitSpaces ? text.replace(/ {3,}/g, splitSpaces) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n if (!special.test(text)) {\n builder.col += text.length;\n var content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) mustWrap = true;\n builder.pos += text.length;\n } else {\n var content = document.createDocumentFragment(), pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n else content.appendChild(txt);\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) break;\n pos += skipped + 1;\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n var txt = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt.setAttribute(\"role\", \"presentation\");\n txt.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else {\n var txt = builder.cm.options.specialCharPlaceholder(m[0]);\n txt.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n else content.appendChild(txt);\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt);\n builder.pos++;\n }\n }\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) fullStyle += startStyle;\n if (endStyle) fullStyle += endStyle;\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) token.title = title;\n return builder.content.appendChild(token);\n }\n builder.content.appendChild(content);\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: elt(\"pre\", [content]), content: content, col: 0, pos: 0, cm: cm};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order;\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if ((ie || webkit) && cm.getOption(\"lineWrapping\"))\n builder.addToken = buildTokenSplitSpaces(builder.addToken);\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\n builder.map = [];\n insertLineContent(line, builder, getLineStyles(cm, line));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n if (line.styleClasses.textClass)\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n return builder;\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: elt(\"pre\", [content]), content: content, col: 0, pos: 0, cm: cm};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order;\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if ((ie || webkit) && cm.getOption(\"lineWrapping\"))\n builder.addToken = buildTokenSplitSpaces(builder.addToken);\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\n builder.map = [];\n insertLineContent(line, builder, getLineStyles(cm, line));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n if (line.styleClasses.textClass)\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n return builder;\n }", "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n var content;\n if (!special.test(text)) {\n builder.col += text.length;\n content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) { mustWrap = true; }\n builder.pos += text.length;\n } else {\n content = document.createDocumentFragment();\n var pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])); }\n else { content.appendChild(txt); }\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) { break }\n pos += skipped + 1;\n var txt$1 = (void 0);\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt$1.setAttribute(\"role\", \"presentation\");\n txt$1.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt$1.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n txt$1.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])); }\n else { content.appendChild(txt$1); }\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) { fullStyle += startStyle; }\n if (endStyle) { fullStyle += endStyle; }\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) { token.title = title; }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content);\n}", "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n var content;\n if (!special.test(text)) {\n builder.col += text.length;\n content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) { mustWrap = true; }\n builder.pos += text.length;\n } else {\n content = document.createDocumentFragment();\n var pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])); }\n else { content.appendChild(txt); }\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) { break }\n pos += skipped + 1;\n var txt$1 = (void 0);\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt$1.setAttribute(\"role\", \"presentation\");\n txt$1.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt$1.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n txt$1.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])); }\n else { content.appendChild(txt$1); }\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) { fullStyle += startStyle; }\n if (endStyle) { fullStyle += endStyle; }\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) { token.title = title; }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content);\n}", "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n var content;\n if (!special.test(text)) {\n builder.col += text.length;\n content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) { mustWrap = true; }\n builder.pos += text.length;\n } else {\n content = document.createDocumentFragment();\n var pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])); }\n else { content.appendChild(txt); }\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) { break }\n pos += skipped + 1;\n var txt$1 = (void 0);\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt$1.setAttribute(\"role\", \"presentation\");\n txt$1.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt$1.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n txt$1.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])); }\n else { content.appendChild(txt$1); }\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) { fullStyle += startStyle; }\n if (endStyle) { fullStyle += endStyle; }\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) { token.title = title; }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content);\n}", "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n var content;\n if (!special.test(text)) {\n builder.col += text.length;\n content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) { mustWrap = true; }\n builder.pos += text.length;\n } else {\n content = document.createDocumentFragment();\n var pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])); }\n else { content.appendChild(txt); }\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) { break }\n pos += skipped + 1;\n var txt$1 = (void 0);\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt$1.setAttribute(\"role\", \"presentation\");\n txt$1.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt$1.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n txt$1.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])); }\n else { content.appendChild(txt$1); }\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) { fullStyle += startStyle; }\n if (endStyle) { fullStyle += endStyle; }\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) { token.title = title; }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content);\n}", "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n var content;\n if (!special.test(text)) {\n builder.col += text.length;\n content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) { mustWrap = true; }\n builder.pos += text.length;\n } else {\n content = document.createDocumentFragment();\n var pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])); }\n else { content.appendChild(txt); }\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) { break }\n pos += skipped + 1;\n var txt$1 = (void 0);\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt$1.setAttribute(\"role\", \"presentation\");\n txt$1.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt$1.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n txt$1.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])); }\n else { content.appendChild(txt$1); }\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) { fullStyle += startStyle; }\n if (endStyle) { fullStyle += endStyle; }\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) { token.title = title; }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content);\n}", "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n var content;\n if (!special.test(text)) {\n builder.col += text.length;\n content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) { mustWrap = true; }\n builder.pos += text.length;\n } else {\n content = document.createDocumentFragment();\n var pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])); }\n else { content.appendChild(txt); }\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) { break }\n pos += skipped + 1;\n var txt$1 = (void 0);\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt$1.setAttribute(\"role\", \"presentation\");\n txt$1.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt$1.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n txt$1.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])); }\n else { content.appendChild(txt$1); }\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) { fullStyle += startStyle; }\n if (endStyle) { fullStyle += endStyle; }\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) { token.title = title; }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content);\n}", "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n var content;\n if (!special.test(text)) {\n builder.col += text.length;\n content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) { mustWrap = true; }\n builder.pos += text.length;\n } else {\n content = document.createDocumentFragment();\n var pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])); }\n else { content.appendChild(txt); }\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) { break }\n pos += skipped + 1;\n var txt$1 = (void 0);\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt$1.setAttribute(\"role\", \"presentation\");\n txt$1.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt$1.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n txt$1.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])); }\n else { content.appendChild(txt$1); }\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) { fullStyle += startStyle; }\n if (endStyle) { fullStyle += endStyle; }\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) { token.title = title; }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content);\n}", "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n var content;\n if (!special.test(text)) {\n builder.col += text.length;\n content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) { mustWrap = true; }\n builder.pos += text.length;\n } else {\n content = document.createDocumentFragment();\n var pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])); }\n else { content.appendChild(txt); }\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) { break }\n pos += skipped + 1;\n var txt$1 = (void 0);\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt$1.setAttribute(\"role\", \"presentation\");\n txt$1.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt$1.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n txt$1.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])); }\n else { content.appendChild(txt$1); }\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) { fullStyle += startStyle; }\n if (endStyle) { fullStyle += endStyle; }\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) { token.title = title; }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content);\n}", "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n var content;\n if (!special.test(text)) {\n builder.col += text.length;\n content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) { mustWrap = true; }\n builder.pos += text.length;\n } else {\n content = document.createDocumentFragment();\n var pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])); }\n else { content.appendChild(txt); }\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) { break }\n pos += skipped + 1;\n var txt$1 = (void 0);\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt$1.setAttribute(\"role\", \"presentation\");\n txt$1.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt$1.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n txt$1.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])); }\n else { content.appendChild(txt$1); }\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) { fullStyle += startStyle; }\n if (endStyle) { fullStyle += endStyle; }\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) { token.title = title; }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content);\n}", "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n var content;\n if (!special.test(text)) {\n builder.col += text.length;\n content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) { mustWrap = true; }\n builder.pos += text.length;\n } else {\n content = document.createDocumentFragment();\n var pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])); }\n else { content.appendChild(txt); }\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) { break }\n pos += skipped + 1;\n var txt$1 = (void 0);\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt$1.setAttribute(\"role\", \"presentation\");\n txt$1.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt$1.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n txt$1.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])); }\n else { content.appendChild(txt$1); }\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) { fullStyle += startStyle; }\n if (endStyle) { fullStyle += endStyle; }\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) { token.title = title; }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content);\n}", "function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n var content;\n if (!special.test(text)) {\n builder.col += text.length;\n content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) { mustWrap = true; }\n builder.pos += text.length;\n } else {\n content = document.createDocumentFragment();\n var pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])); }\n else { content.appendChild(txt); }\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) { break }\n pos += skipped + 1;\n var txt$1 = (void 0);\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt$1.setAttribute(\"role\", \"presentation\");\n txt$1.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt$1.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n txt$1.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])); }\n else { content.appendChild(txt$1); }\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) { fullStyle += startStyle; }\n if (endStyle) { fullStyle += endStyle; }\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) { token.title = title; }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content);\n}", "function addToken(token, write) {\n if (token.type.label == \"string\") {\n write(\"'\" + sanitize(token.value) + \"'\",\n token.loc.start.line,\n token.loc.start.column);\n } else if (token.type.label == \"regexp\") {\n write(String(token.value.value),\n token.loc.start.line,\n token.loc.start.column);\n } else {\n let value;\n if (token.value != null) {\n value = token.value;\n if (token.type.label === \"privateId\") {\n value = `#${value}`;\n }\n } else {\n value = token.type.label;\n }\n write(String(value),\n token.loc.start.line,\n token.loc.start.column);\n }\n }", "function buildLineContent(cm, lineView) {\n\t\t // The padding-right forces the element to have a 'border', which\n\t\t // is needed on Webkit to be able to get line-level bounding\n\t\t // rectangles for it (in measureChar).\n\t\t var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n\t\t var builder = {pre: elt(\"pre\", [content], \"CodeMirror-line\"), content: content,\n\t\t col: 0, pos: 0, cm: cm,\n\t\t trailingSpace: false,\n\t\t splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n\t\t lineView.measure = {};\n\t\t\n\t\t // Iterate over the logical lines that make up this visual line.\n\t\t for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n\t\t var line = i ? lineView.rest[i - 1] : lineView.line, order;\n\t\t builder.pos = 0;\n\t\t builder.addToken = buildToken;\n\t\t // Optionally wire in some hacks into the token-rendering\n\t\t // algorithm, to deal with browser quirks.\n\t\t if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n\t\t builder.addToken = buildTokenBadBidi(builder.addToken, order);\n\t\t builder.map = [];\n\t\t var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n\t\t insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n\t\t if (line.styleClasses) {\n\t\t if (line.styleClasses.bgClass)\n\t\t builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n\t\t if (line.styleClasses.textClass)\n\t\t builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n\t\t }\n\t\t\n\t\t // Ensure at least a single node is present, for measuring.\n\t\t if (builder.map.length == 0)\n\t\t builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\t\t\n\t\t // Store the map and a cache object for the current logical line\n\t\t if (i == 0) {\n\t\t lineView.measure.map = builder.map;\n\t\t lineView.measure.cache = {};\n\t\t } else {\n\t\t (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n\t\t (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n\t\t }\n\t\t }\n\t\t\n\t\t // See issue #2901\n\t\t if (webkit) {\n\t\t var last = builder.content.lastChild\n\t\t if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n\t\t builder.content.className = \"cm-tab-wrap-hack\";\n\t\t }\n\t\t\n\t\t signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n\t\t if (builder.pre.className)\n\t\t builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\t\t\n\t\t return builder;\n\t\t }", "function buildLineContent(cm, lineView) {\n\t // The padding-right forces the element to have a 'border', which\n\t // is needed on Webkit to be able to get line-level bounding\n\t // rectangles for it (in measureChar).\n\t var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n\t var builder = {pre: elt(\"pre\", [content], \"CodeMirror-line\"), content: content,\n\t col: 0, pos: 0, cm: cm,\n\t trailingSpace: false,\n\t splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n\t lineView.measure = {};\n\n\t // Iterate over the logical lines that make up this visual line.\n\t for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n\t var line = i ? lineView.rest[i - 1] : lineView.line, order;\n\t builder.pos = 0;\n\t builder.addToken = buildToken;\n\t // Optionally wire in some hacks into the token-rendering\n\t // algorithm, to deal with browser quirks.\n\t if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n\t builder.addToken = buildTokenBadBidi(builder.addToken, order);\n\t builder.map = [];\n\t var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n\t insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n\t if (line.styleClasses) {\n\t if (line.styleClasses.bgClass)\n\t builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n\t if (line.styleClasses.textClass)\n\t builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n\t }\n\n\t // Ensure at least a single node is present, for measuring.\n\t if (builder.map.length == 0)\n\t builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n\t // Store the map and a cache object for the current logical line\n\t if (i == 0) {\n\t lineView.measure.map = builder.map;\n\t lineView.measure.cache = {};\n\t } else {\n\t (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n\t (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n\t }\n\t }\n\n\t // See issue #2901\n\t if (webkit) {\n\t var last = builder.content.lastChild\n\t if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n\t builder.content.className = \"cm-tab-wrap-hack\";\n\t }\n\n\t signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n\t if (builder.pre.className)\n\t builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\n\t return builder;\n\t }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: elt(\"pre\", [content]), content: content, col: 0, pos: 0, cm: cm};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order;\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if ((ie || webkit) && cm.getOption(\"lineWrapping\"))\n builder.addToken = buildTokenSplitSpaces(builder.addToken);\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n if (line.styleClasses.textClass)\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit && /\\bcm-tab\\b/.test(builder.content.lastChild.className))\n builder.content.className = \"cm-tab-wrap-hack\";\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\n return builder;\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: elt(\"pre\", [content]), content: content, col: 0, pos: 0, cm: cm};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order;\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if ((ie || webkit) && cm.getOption(\"lineWrapping\"))\n builder.addToken = buildTokenSplitSpaces(builder.addToken);\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n if (line.styleClasses.textClass)\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit && /\\bcm-tab\\b/.test(builder.content.lastChild.className))\n builder.content.className = \"cm-tab-wrap-hack\";\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\n return builder;\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: elt(\"pre\", [content]), content: content, col: 0, pos: 0, cm: cm};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order;\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if ((ie || webkit) && cm.getOption(\"lineWrapping\"))\n builder.addToken = buildTokenSplitSpaces(builder.addToken);\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n if (line.styleClasses.textClass)\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit && /\\bcm-tab\\b/.test(builder.content.lastChild.className))\n builder.content.className = \"cm-tab-wrap-hack\";\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\n return builder;\n }", "function buildLineContent(cm, lineView) {\n\t // The padding-right forces the element to have a 'border', which\n\t // is needed on Webkit to be able to get line-level bounding\n\t // rectangles for it (in measureChar).\n\t var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n\t var builder = {pre: elt(\"pre\", [content], \"CodeMirror-line\"), content: content,\n\t col: 0, pos: 0, cm: cm,\n\t splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n\t lineView.measure = {};\n\n\t // Iterate over the logical lines that make up this visual line.\n\t for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n\t var line = i ? lineView.rest[i - 1] : lineView.line, order;\n\t builder.pos = 0;\n\t builder.addToken = buildToken;\n\t // Optionally wire in some hacks into the token-rendering\n\t // algorithm, to deal with browser quirks.\n\t if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n\t builder.addToken = buildTokenBadBidi(builder.addToken, order);\n\t builder.map = [];\n\t var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n\t insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n\t if (line.styleClasses) {\n\t if (line.styleClasses.bgClass)\n\t builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n\t if (line.styleClasses.textClass)\n\t builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n\t }\n\n\t // Ensure at least a single node is present, for measuring.\n\t if (builder.map.length == 0)\n\t builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n\t // Store the map and a cache object for the current logical line\n\t if (i == 0) {\n\t lineView.measure.map = builder.map;\n\t lineView.measure.cache = {};\n\t } else {\n\t (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n\t (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n\t }\n\t }\n\n\t // See issue #2901\n\t if (webkit && /\\bcm-tab\\b/.test(builder.content.lastChild.className))\n\t builder.content.className = \"cm-tab-wrap-hack\";\n\n\t signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n\t if (builder.pre.className)\n\t builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\n\t return builder;\n\t }", "function buildLineContent(cm, lineView) {\n\t // The padding-right forces the element to have a 'border', which\n\t // is needed on Webkit to be able to get line-level bounding\n\t // rectangles for it (in measureChar).\n\t var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n\t var builder = {pre: elt(\"pre\", [content], \"CodeMirror-line\"), content: content,\n\t col: 0, pos: 0, cm: cm,\n\t splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n\t lineView.measure = {};\n\t\n\t // Iterate over the logical lines that make up this visual line.\n\t for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n\t var line = i ? lineView.rest[i - 1] : lineView.line, order;\n\t builder.pos = 0;\n\t builder.addToken = buildToken;\n\t // Optionally wire in some hacks into the token-rendering\n\t // algorithm, to deal with browser quirks.\n\t if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n\t builder.addToken = buildTokenBadBidi(builder.addToken, order);\n\t builder.map = [];\n\t var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n\t insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n\t if (line.styleClasses) {\n\t if (line.styleClasses.bgClass)\n\t builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n\t if (line.styleClasses.textClass)\n\t builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n\t }\n\t\n\t // Ensure at least a single node is present, for measuring.\n\t if (builder.map.length == 0)\n\t builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\t\n\t // Store the map and a cache object for the current logical line\n\t if (i == 0) {\n\t lineView.measure.map = builder.map;\n\t lineView.measure.cache = {};\n\t } else {\n\t (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n\t (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n\t }\n\t }\n\t\n\t // See issue #2901\n\t if (webkit && /\\bcm-tab\\b/.test(builder.content.lastChild.className))\n\t builder.content.className = \"cm-tab-wrap-hack\";\n\t\n\t signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n\t if (builder.pre.className)\n\t builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\t\n\t return builder;\n\t }", "function buildLineContent(cm, lineView) {\n\t\t // The padding-right forces the element to have a 'border', which\n\t\t // is needed on Webkit to be able to get line-level bounding\n\t\t // rectangles for it (in measureChar).\n\t\t var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n\t\t var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n\t\t col: 0, pos: 0, cm: cm,\n\t\t trailingSpace: false,\n\t\t splitSpaces: cm.getOption(\"lineWrapping\")};\n\t\t lineView.measure = {};\n\n\t\t // Iterate over the logical lines that make up this visual line.\n\t\t for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n\t\t var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n\t\t builder.pos = 0;\n\t\t builder.addToken = buildToken;\n\t\t // Optionally wire in some hacks into the token-rendering\n\t\t // algorithm, to deal with browser quirks.\n\t\t if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n\t\t { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n\t\t builder.map = [];\n\t\t var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n\t\t insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n\t\t if (line.styleClasses) {\n\t\t if (line.styleClasses.bgClass)\n\t\t { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n\t\t if (line.styleClasses.textClass)\n\t\t { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n\t\t }\n\n\t\t // Ensure at least a single node is present, for measuring.\n\t\t if (builder.map.length == 0)\n\t\t { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n\t\t // Store the map and a cache object for the current logical line\n\t\t if (i == 0) {\n\t\t lineView.measure.map = builder.map;\n\t\t lineView.measure.cache = {};\n\t\t } else {\n\t\t (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n\t\t ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n\t\t }\n\t\t }\n\n\t\t // See issue #2901\n\t\t if (webkit) {\n\t\t var last = builder.content.lastChild;\n\t\t if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n\t\t { builder.content.className = \"cm-tab-wrap-hack\"; }\n\t\t }\n\n\t\t signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n\t\t if (builder.pre.className)\n\t\t { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n\t\t return builder\n\t\t }", "function tokenPart(token){\n var part = makePartSpan(token.value, self.doc); \n part.className = token.style;\n return part;\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: elt(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order;\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n if (line.styleClasses.textClass)\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n builder.content.className = \"cm-tab-wrap-hack\";\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\n return builder;\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: elt(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order;\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n if (line.styleClasses.textClass)\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit && /\\bcm-tab\\b/.test(builder.content.lastChild.className))\n builder.content.className = \"cm-tab-wrap-hack\";\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\n return builder;\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null)\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")}\n lineView.measure = {}\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0)\n builder.pos = 0\n builder.addToken = buildToken\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order) }\n builder.map = []\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line)\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate))\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\") }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\") }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))) }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map\n lineView.measure.cache = {}\n } else {\n ;(lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({})\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\" }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre)\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\") }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null)\n var builder = {pre: elt(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")}\n // hide from accessibility tree\n content.setAttribute(\"role\", \"presentation\")\n builder.pre.setAttribute(\"role\", \"presentation\")\n lineView.measure = {}\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0)\n builder.pos = 0\n builder.addToken = buildToken\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order) }\n builder.map = []\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line)\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate))\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\") }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\") }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))) }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map\n lineView.measure.cache = {}\n } else {\n ;(lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({})\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\" }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre)\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\") }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\r\n // The padding-right forces the element to have a 'border', which\r\n // is needed on Webkit to be able to get line-level bounding\r\n // rectangles for it (in measureChar).\r\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\r\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\r\n col: 0, pos: 0, cm: cm,\r\n trailingSpace: false,\r\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\r\n lineView.measure = {};\r\n\r\n // Iterate over the logical lines that make up this visual line.\r\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\r\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\r\n builder.pos = 0;\r\n builder.addToken = buildToken;\r\n // Optionally wire in some hacks into the token-rendering\r\n // algorithm, to deal with browser quirks.\r\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\r\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\r\n builder.map = [];\r\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\r\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\r\n if (line.styleClasses) {\r\n if (line.styleClasses.bgClass)\r\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\r\n if (line.styleClasses.textClass)\r\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\r\n }\r\n\r\n // Ensure at least a single node is present, for measuring.\r\n if (builder.map.length == 0)\r\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\r\n\r\n // Store the map and a cache object for the current logical line\r\n if (i == 0) {\r\n lineView.measure.map = builder.map;\r\n lineView.measure.cache = {};\r\n } else {\r\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\r\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\r\n }\r\n }\r\n\r\n // See issue #2901\r\n if (webkit) {\r\n var last = builder.content.lastChild;\r\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\r\n { builder.content.className = \"cm-tab-wrap-hack\"; }\r\n }\r\n\r\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\r\n if (builder.pre.className)\r\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\r\n\r\n return builder\r\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {\n pre: eltP(\"pre\", [content], \"CodeMirror-line\"),\n content: content,\n col: 0,\n pos: 0,\n cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")\n };\n lineView.measure = {}; // Iterate over the logical lines that make up this visual line.\n\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line,\n order = void 0;\n builder.pos = 0;\n builder.addToken = buildToken; // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction))) {\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\n }\n\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n\n if (line.styleClasses) {\n if (line.styleClasses.bgClass) {\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n }\n\n if (line.styleClasses.textClass) {\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n }\n } // Ensure at least a single node is present, for measuring.\n\n\n if (builder.map.length == 0) {\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n } // Store the map and a cache object for the current logical line\n\n\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n } // See issue #2901\n\n\n if (webkit) {\n var last = builder.content.lastChild;\n\n if (/\\bcm-tab\\b/.test(last.className) || last.querySelector && last.querySelector(\".cm-tab\")) {\n builder.content.className = \"cm-tab-wrap-hack\";\n }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n\n if (builder.pre.className) {\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n }\n\n return builder;\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function injectLineNumbers(tokens, idx, options, env, slf) {\n var line;\n if (tokens[idx].map && tokens[idx].level === 0) {\n line = tokens[idx].map[0];\n tokens[idx].attrJoin('class', 'line');\n tokens[idx].attrSet('data-line', String(line));\n }\n return slf.renderToken(tokens, idx, options, env, slf);\n }", "function injectLineNumbers(tokens, idx, options, env, slf) {\n var line;\n if (tokens[idx].map && tokens[idx].level === 0) {\n line = tokens[idx].map[0];\n tokens[idx].attrJoin('class', 'line');\n tokens[idx].attrSet('data-line', String(line));\n }\n return slf.renderToken(tokens, idx, options, env, slf);\n }", "function _renderLine(input, sb) {\r\n var fontIsMonospace = input.fontIsMonospace;\r\n var canUseHalfwidthRightwardsArrow = input.canUseHalfwidthRightwardsArrow;\r\n var containsForeignElements = input.containsForeignElements;\r\n var lineContent = input.lineContent;\r\n var len = input.len;\r\n var isOverflowing = input.isOverflowing;\r\n var parts = input.parts;\r\n var fauxIndentLength = input.fauxIndentLength;\r\n var tabSize = input.tabSize;\r\n var startVisibleColumn = input.startVisibleColumn;\r\n var containsRTL = input.containsRTL;\r\n var spaceWidth = input.spaceWidth;\r\n var middotWidth = input.middotWidth;\r\n var renderWhitespace = input.renderWhitespace;\r\n var renderControlCharacters = input.renderControlCharacters;\r\n // use U+2E31 - WORD SEPARATOR MIDDLE DOT or U+00B7 - MIDDLE DOT\r\n var spaceRenderWhitespaceCharacter = (middotWidth > spaceWidth ? 0x2E31 : 0xB7);\r\n var characterMapping = new CharacterMapping(len + 1, parts.length);\r\n var charIndex = 0;\r\n var visibleColumn = startVisibleColumn;\r\n var charOffsetInPart = 0;\r\n var prevPartContentCnt = 0;\r\n var partAbsoluteOffset = 0;\r\n sb.appendASCIIString('<span>');\r\n for (var partIndex = 0, tokensLen = parts.length; partIndex < tokensLen; partIndex++) {\r\n partAbsoluteOffset += prevPartContentCnt;\r\n var part = parts[partIndex];\r\n var partEndIndex = part.endIndex;\r\n var partType = part.type;\r\n var partRendersWhitespace = (renderWhitespace !== 0 /* None */ && (partType.indexOf('vs-whitespace') >= 0));\r\n charOffsetInPart = 0;\r\n sb.appendASCIIString('<span class=\"');\r\n sb.appendASCIIString(partType);\r\n sb.appendASCII(34 /* DoubleQuote */);\r\n if (partRendersWhitespace) {\r\n var partContentCnt = 0;\r\n {\r\n var _charIndex = charIndex;\r\n var _visibleColumn = visibleColumn;\r\n for (; _charIndex < partEndIndex; _charIndex++) {\r\n var charCode = lineContent.charCodeAt(_charIndex);\r\n var charWidth = (charCode === 9 /* Tab */ ? (tabSize - (_visibleColumn % tabSize)) : 1) | 0;\r\n partContentCnt += charWidth;\r\n if (_charIndex >= fauxIndentLength) {\r\n _visibleColumn += charWidth;\r\n }\r\n }\r\n }\r\n if (!fontIsMonospace) {\r\n var partIsOnlyWhitespace = (partType === 'vs-whitespace');\r\n if (partIsOnlyWhitespace || !containsForeignElements) {\r\n sb.appendASCIIString(' style=\"display:inline-block;width:');\r\n sb.appendASCIIString(String(spaceWidth * partContentCnt));\r\n sb.appendASCIIString('px\"');\r\n }\r\n }\r\n sb.appendASCII(62 /* GreaterThan */);\r\n for (; charIndex < partEndIndex; charIndex++) {\r\n characterMapping.setPartData(charIndex, partIndex, charOffsetInPart, partAbsoluteOffset);\r\n var charCode = lineContent.charCodeAt(charIndex);\r\n var charWidth = void 0;\r\n if (charCode === 9 /* Tab */) {\r\n charWidth = (tabSize - (visibleColumn % tabSize)) | 0;\r\n if (!canUseHalfwidthRightwardsArrow || charWidth > 1) {\r\n sb.write1(0x2192); // RIGHTWARDS ARROW\r\n }\r\n else {\r\n sb.write1(0xFFEB); // HALFWIDTH RIGHTWARDS ARROW\r\n }\r\n for (var space = 2; space <= charWidth; space++) {\r\n sb.write1(0xA0); // &nbsp;\r\n }\r\n }\r\n else { // must be CharCode.Space\r\n charWidth = 1;\r\n sb.write1(spaceRenderWhitespaceCharacter); // &middot; or word separator middle dot\r\n }\r\n charOffsetInPart += charWidth;\r\n if (charIndex >= fauxIndentLength) {\r\n visibleColumn += charWidth;\r\n }\r\n }\r\n prevPartContentCnt = partContentCnt;\r\n }\r\n else {\r\n var partContentCnt = 0;\r\n if (containsRTL) {\r\n sb.appendASCIIString(' dir=\"ltr\"');\r\n }\r\n sb.appendASCII(62 /* GreaterThan */);\r\n for (; charIndex < partEndIndex; charIndex++) {\r\n characterMapping.setPartData(charIndex, partIndex, charOffsetInPart, partAbsoluteOffset);\r\n var charCode = lineContent.charCodeAt(charIndex);\r\n var producedCharacters = 1;\r\n var charWidth = 1;\r\n switch (charCode) {\r\n case 9 /* Tab */:\r\n producedCharacters = (tabSize - (visibleColumn % tabSize));\r\n charWidth = producedCharacters;\r\n for (var space = 1; space <= producedCharacters; space++) {\r\n sb.write1(0xA0); // &nbsp;\r\n }\r\n break;\r\n case 32 /* Space */:\r\n sb.write1(0xA0); // &nbsp;\r\n break;\r\n case 60 /* LessThan */:\r\n sb.appendASCIIString('&lt;');\r\n break;\r\n case 62 /* GreaterThan */:\r\n sb.appendASCIIString('&gt;');\r\n break;\r\n case 38 /* Ampersand */:\r\n sb.appendASCIIString('&amp;');\r\n break;\r\n case 0 /* Null */:\r\n sb.appendASCIIString('&#00;');\r\n break;\r\n case 65279 /* UTF8_BOM */:\r\n case 8232 /* LINE_SEPARATOR_2028 */:\r\n sb.write1(0xFFFD);\r\n break;\r\n default:\r\n if (strings.isFullWidthCharacter(charCode)) {\r\n charWidth++;\r\n }\r\n if (renderControlCharacters && charCode < 32) {\r\n sb.write1(9216 + charCode);\r\n }\r\n else {\r\n sb.write1(charCode);\r\n }\r\n }\r\n charOffsetInPart += producedCharacters;\r\n partContentCnt += producedCharacters;\r\n if (charIndex >= fauxIndentLength) {\r\n visibleColumn += charWidth;\r\n }\r\n }\r\n prevPartContentCnt = partContentCnt;\r\n }\r\n sb.appendASCIIString('</span>');\r\n }\r\n // When getting client rects for the last character, we will position the\r\n // text range at the end of the span, insteaf of at the beginning of next span\r\n characterMapping.setPartData(len, parts.length - 1, charOffsetInPart, partAbsoluteOffset);\r\n if (isOverflowing) {\r\n sb.appendASCIIString('<span>&hellip;</span>');\r\n }\r\n sb.appendASCIIString('</span>');\r\n return new RenderLineOutput(characterMapping, containsRTL, containsForeignElements);\r\n}", "function appendTokenList(item){ //because lexeme is dynamically updated in a list\n var temp = item;\n lineTokens.push(temp);\n}", "function tokensToNodes(tokens, opts, doc) {\n\t\t\tvar result = [];\n\n\t\t\tfor (var _iterator = tokens, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n\t\t\t\tvar _ref;\n\n\t\t\t\tif (_isArray) {\n\t\t\t\t\tif (_i >= _iterator.length) break;\n\t\t\t\t\t_ref = _iterator[_i++];\n\t\t\t\t} else {\n\t\t\t\t\t_i = _iterator.next();\n\t\t\t\t\tif (_i.done) break;\n\t\t\t\t\t_ref = _i.value;\n\t\t\t\t}\n\n\t\t\t\tvar token = _ref;\n\n\t\t\t\tif (token.type === 'nl' && opts.nl2br) {\n\t\t\t\t\tresult.push(doc.createElement('br'));\n\t\t\t\t\tcontinue;\n\t\t\t\t} else if (!token.isLink || !opts.check(token)) {\n\t\t\t\t\tresult.push(doc.createTextNode(token.toString()));\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tvar _opts$resolve = opts.resolve(token),\n\t\t\t\t formatted = _opts$resolve.formatted,\n\t\t\t\t formattedHref = _opts$resolve.formattedHref,\n\t\t\t\t tagName = _opts$resolve.tagName,\n\t\t\t\t className = _opts$resolve.className,\n\t\t\t\t target = _opts$resolve.target,\n\t\t\t\t events = _opts$resolve.events,\n\t\t\t\t attributes = _opts$resolve.attributes;\n\n\t\t\t\t// Build the link\n\n\n\t\t\t\tvar link = doc.createElement(tagName);\n\t\t\t\tlink.setAttribute('href', formattedHref);\n\n\t\t\t\tif (className) {\n\t\t\t\t\tlink.setAttribute('class', className);\n\t\t\t\t}\n\n\t\t\t\tif (target) {\n\t\t\t\t\tlink.setAttribute('target', target);\n\t\t\t\t}\n\n\t\t\t\t// Build up additional attributes\n\t\t\t\tif (attributes) {\n\t\t\t\t\tfor (var attr in attributes) {\n\t\t\t\t\t\tlink.setAttribute(attr, attributes[attr]);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (events) {\n\t\t\t\t\tfor (var event in events) {\n\t\t\t\t\t\tif (link.addEventListener) {\n\t\t\t\t\t\t\tlink.addEventListener(event, events[event]);\n\t\t\t\t\t\t} else if (link.attachEvent) {\n\t\t\t\t\t\t\tlink.attachEvent('on' + event, events[event]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tlink.appendChild(doc.createTextNode(formatted));\n\t\t\t\tresult.push(link);\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}", "function tokensToNodes(tokens, opts, doc) {\n\t\t\tvar result = [];\n\n\t\t\tfor (var _iterator = tokens, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n\t\t\t\tvar _ref;\n\n\t\t\t\tif (_isArray) {\n\t\t\t\t\tif (_i >= _iterator.length) break;\n\t\t\t\t\t_ref = _iterator[_i++];\n\t\t\t\t} else {\n\t\t\t\t\t_i = _iterator.next();\n\t\t\t\t\tif (_i.done) break;\n\t\t\t\t\t_ref = _i.value;\n\t\t\t\t}\n\n\t\t\t\tvar token = _ref;\n\n\t\t\t\tif (token.type === 'nl' && opts.nl2br) {\n\t\t\t\t\tresult.push(doc.createElement('br'));\n\t\t\t\t\tcontinue;\n\t\t\t\t} else if (!token.isLink || !opts.check(token)) {\n\t\t\t\t\tresult.push(doc.createTextNode(token.toString()));\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tvar _opts$resolve = opts.resolve(token),\n\t\t\t\t formatted = _opts$resolve.formatted,\n\t\t\t\t formattedHref = _opts$resolve.formattedHref,\n\t\t\t\t tagName = _opts$resolve.tagName,\n\t\t\t\t className = _opts$resolve.className,\n\t\t\t\t target = _opts$resolve.target,\n\t\t\t\t events = _opts$resolve.events,\n\t\t\t\t attributes = _opts$resolve.attributes;\n\n\t\t\t\t// Build the link\n\n\n\t\t\t\tvar link = doc.createElement(tagName);\n\t\t\t\tlink.setAttribute('href', formattedHref);\n\n\t\t\t\tif (className) {\n\t\t\t\t\tlink.setAttribute('class', className);\n\t\t\t\t}\n\n\t\t\t\tif (target) {\n\t\t\t\t\tlink.setAttribute('target', target);\n\t\t\t\t}\n\n\t\t\t\t// Build up additional attributes\n\t\t\t\tif (attributes) {\n\t\t\t\t\tfor (var attr in attributes) {\n\t\t\t\t\t\tlink.setAttribute(attr, attributes[attr]);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (events) {\n\t\t\t\t\tfor (var event in events) {\n\t\t\t\t\t\tif (link.addEventListener) {\n\t\t\t\t\t\t\tlink.addEventListener(event, events[event]);\n\t\t\t\t\t\t} else if (link.attachEvent) {\n\t\t\t\t\t\t\tlink.attachEvent('on' + event, events[event]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tlink.appendChild(doc.createTextNode(formatted));\n\t\t\t\tresult.push(link);\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}" ]
[ "0.63364595", "0.6152449", "0.611563", "0.6113837", "0.6113837", "0.6113837", "0.6104204", "0.60897434", "0.604226", "0.60420346", "0.6017149", "0.6017149", "0.6017149", "0.6017149", "0.6017149", "0.6017149", "0.6008158", "0.6008158", "0.5997036", "0.5991892", "0.59615743", "0.59615743", "0.5940242", "0.5899565", "0.5888658", "0.5888658", "0.5873962", "0.58598846", "0.58452207", "0.5834418", "0.5834418", "0.5834012", "0.5834012", "0.5834012", "0.5834012", "0.5834012", "0.5834012", "0.5834012", "0.5834012", "0.5834012", "0.5834012", "0.5834012", "0.581021", "0.57920176", "0.5787162", "0.5783481", "0.5783481", "0.5783481", "0.57719934", "0.5756238", "0.57527673", "0.57408065", "0.5692829", "0.5677649", "0.5677649", "0.5677649", "0.5677649", "0.5677649", "0.5677649", "0.5677649", "0.5677649", "0.5677649", "0.5677649", "0.5677649", "0.5677649", "0.5677649", "0.5677649", "0.5677649", "0.5677649", "0.5677649", "0.5673696", "0.5657372", "0.5648976", "0.56304425", "0.5618493", "0.5606738", "0.5606738", "0.558939", "0.558939", "0.558939", "0.558939", "0.558939", "0.558939", "0.558939", "0.558939", "0.558939", "0.547953", "0.547953", "0.5337952", "0.53348583", "0.52984107", "0.52984107" ]
0.6017149
20
Change some spaces to NBSP to prevent the browser from collapsing trailing spaces at the end of a line when rendering text (issue 1362).
function splitSpaces(text, trailingBefore) { if (text.length > 1 && !/ /.test(text)) { return text } var spaceBefore = trailingBefore, result = ""; for (var i = 0; i < text.length; i++) { var ch = text.charAt(i); if (ch == " " && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32)) { ch = "\u00a0"; } result += ch; spaceBefore = ch == " "; } return result }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function String_SpaceToNonBreakingSpace()\n{\n\t//replace them\n\treturn this.replace(/\\b {2}/g, \" &nbsp;\").replace(/ {2}\\b/g, \"&nbsp; \").replace(/ {2}/g, \"&nbsp;&nbsp;\");\n}", "function normalizeSpaces(text)\n{\n // IE has already done this conversion, so doing it again will remove multiple nbsp\n if (browserVersion.isIE)\n {\n return text;\n }\n\n // Replace multiple spaces with a single space\n // TODO - this shouldn't occur inside PRE elements\n text = text.replace(/\\ +/g, \" \");\n\n // Replace &nbsp; with a space\n var nbspPattern = new RegExp(String.fromCharCode(160), \"g\");\n if (browserVersion.isSafari) {\n return replaceAll(text, String.fromCharCode(160), \" \");\n } else {\n return text.replace(nbspPattern, \" \");\n }\n}", "function nbspCleanup() {\r\n\tif (o3_wrap) {\r\n\t\to3_text = o3_text.replace(/\\&nbsp;/g, ' ');\r\n\t\to3_cap = o3_cap.replace(/\\&nbsp;/g, ' ');\r\n\t}\r\n}", "function nonBreakingSpaces(str) {\n return str.replace(/ /g, \"&nbsp;\");\n}", "function fixSpaces(string) {\n if (string.charAt(0) == \" \") string = nbsp + string.slice(1);\n return string.replace(/\\t/g, function(){return makeWhiteSpace(indentUnit);})\n .replace(/[ \\u00a0]{2,}/g, function(s) {return makeWhiteSpace(s.length);});\n}", "function replaceSpace(text) {\n\treturn text.replace(/\\r/g, \"\").replace(/\\n/g, \" \");\n}", "function replaceSpace(str) {\n return str.replace(/^(\\s|\\u00A0)+/, '').replace(/(\\s|\\u00A0)+$/, '')\n}", "function splitSpaces(text, trailingBefore) {\n\t\t if (text.length > 1 && !/ /.test(text)) { return text }\n\t\t var spaceBefore = trailingBefore, result = \"\";\n\t\t for (var i = 0; i < text.length; i++) {\n\t\t var ch = text.charAt(i);\n\t\t if (ch == \" \" && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32))\n\t\t { ch = \"\\u00a0\"; }\n\t\t result += ch;\n\t\t spaceBefore = ch == \" \";\n\t\t }\n\t\t return result\n\t\t }", "function elimineSpaces(str) {\n\tvar s = str.replace(/\\s+/g, '');\n\ts = s.replace(/\\t+/g, '');\n\treturn s;\n}", "function nbsp(count)\r\n{\r\n\tvar result = \"\";\r\n\twhile( count-- > 0 )\r\n\t\tresult += \"\\u00a0\";\r\n\treturn result;\r\n}", "function cleanDocumentText(text) {\n var cleanedText = text.replace(/\\u200B\\u200c/g, '');\n var nonBreakingSpaces = String.fromCharCode(160);\n var regex = new RegExp(nonBreakingSpaces, 'g');\n cleanedText = cleanedText.replace(regex, ' ');\n return cleanedText;\n }", "function replaceSpaces(value) {\n var pattern = new RegExp(\" \", \"g\");\n return value.replace(pattern, '&nbsp;');\n}", "function imtrim(s) \n{\n s = s.replace(/(^\\s*)|(\\s*$)/gi,\"\");\n s = s.replace(/[ ]{2,}/gi,\" \");\n s = s.replace(/\\n /,\"\\n\");\n return s;\n}", "function noSpace(x) {\n return x.replace(/[ ]/g, '');\n}", "function makeWhiteSpace(n) {\n var buffer = [], nb = true;\n for (; n > 0; n--) {\n buffer.push((nb || n == 1) ? nbsp : \" \");\n nb = !nb;\n }\n return buffer.join(\"\");\n}", "function fillWhitespace(thing) {\n var txt = $(thing).text();\n var txt2 = \"\";\n var i = 0;\n for(i = 0; i < txt.length; i++) {\n if(txt[i] == \" \") {\n txt2 += \"&nbsp;\";\n }\n else\n txt2 += txt[i];\n }\n return txt2;\n}", "function qctrim(s) {\r\n\ts = s.replace(/(^\\s*)|(\\s*$)/gi,\"\");\r\n\ts = s.replace(/[ ]{2,}/gi,\" \");\r\n\ts = s.replace(/\\n /,\"\\n\");\r\n\treturn s;\r\n}", "function splitSpaces(text, trailingBefore) {\n if (text.length > 1 && !/ /.test(text)) { return text }\n var spaceBefore = trailingBefore, result = \"\";\n for (var i = 0; i < text.length; i++) {\n var ch = text.charAt(i);\n if (ch == \" \" && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32))\n { ch = \"\\u00a0\"; }\n result += ch;\n spaceBefore = ch == \" \";\n }\n return result\n}", "function splitSpaces(text, trailingBefore) {\n if (text.length > 1 && !/ /.test(text)) { return text }\n var spaceBefore = trailingBefore, result = \"\";\n for (var i = 0; i < text.length; i++) {\n var ch = text.charAt(i);\n if (ch == \" \" && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32))\n { ch = \"\\u00a0\"; }\n result += ch;\n spaceBefore = ch == \" \";\n }\n return result\n}", "function elimine2Spaces(str) {\n\tvar s = str.replace(/\\t+/g, ' ');\n\ts = s.replace(/\\s\\s+/g, ' ');\n\treturn s;\n}", "function normalizeWhitespace( text ) {\r\n\t\treturn trim(text).replace(RE_TIDY_CONSECUTIVE_WHITESPACE, SPACE_STRING);\r\n\t}", "function normalizeWhitespace( text ) {\r\n\t\treturn trim(text).replace(RE_TIDY_CONSECUTIVE_WHITESPACE, SPACE_STRING);\r\n\t}", "function replaceWhiteSpaces(text) {\n var i, result = '',\n len = text.length;\n\n for (i = 0; i < len; i += 1) {\n if (text[i] === ' ') {\n result += '&nbsp;';\n } else {\n result += text[i];\n }\n }\n\n return result;\n}", "function splitSpaces(text, trailingBefore) {\n if (text.length > 1 && !/ /.test(text)) {\n return text;\n }\n\n var spaceBefore = trailingBefore,\n result = \"\";\n\n for (var i = 0; i < text.length; i++) {\n var ch = text.charAt(i);\n\n if (ch == \" \" && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32)) {\n ch = \"\\xA0\";\n }\n\n result += ch;\n spaceBefore = ch == \" \";\n }\n\n return result;\n } // Work around nonsense dimensions being reported for stretches of", "function showSpaces(string) {\n return string && string.replace(/^\\s|\\s$/g, '␣');\n}", "function normalizeWhitespace( text ) {\n\t\treturn trim(text).replace(RE_TIDY_CONSECUTIVE_WHITESPACE, SPACE_STRING);\n\t}", "function autoEdWhitespace(str) { //MAIN FUNCTION describes list of fixes\n \n str = str.replace(/\\t/g, \" \");\n \n str = str.replace(/^ ? ? \\n/gm, \"\\n\");\n str = str.replace(/(\\n\\n)\\n+/g, \"$1\");\n str = str.replace(/== ? ?\\n\\n==/g, \"== \\n ==\");\n str = str.replace(/\\n\\n(\\* ?\\[?http)/g, \"\\n$1\");\n \n str = str.replace(/^ ? ? \\n/gm, \"\\n\");\n str = str.replace(/\\n\\n\\*/g, \"\\n*\");\n str = str.replace(/[ \\t][ \\t]+/g, \" \");\n str = str.replace(/([=\\n]\\n)\\n+/g, \"$1\");\n str = str.replace(/ \\n/g, \"\\n\");\n \n //* bullet points\n str = str.replace(/^([\\*#]+:*) /gm, \"$1\");\n str = str.replace(/^([\\*#]+:*)/gm, \"$1 \");\n \n //==Headings==\n str = str.replace(/^(={1,4}) ?(.*?) ?(={1,4})$/gm, \"$1 $2 $3\");\n return str;\n}", "function encodeWhiteSpaces(str) {\n return str.split('').map(function (c) {\n if (c === ' ') {\n return '&nbsp;&nbsp;'\n } else {\n return c;\n }\n }).join('');\n}", "function convertToSpaces(phrase) {\n phrase = phrase.replaceAll(/%20/g, \" \");\n return phrase.replace(moreInfo, \"\");\n}", "function replaceSpace(x){\n var array = x.split('');\n for(i=0;i<=array.length;i++){\n if (array[i] == ' ') {\n array.splice(i,1,'%20');\n }\n }\n return array.join('');\n}", "function outdentOneSpace() {\n utilitymanager_1.um.utilityManager({\n utilType: utilitymanager_1.um.TIXUtilityType.utLineUtility,\n sp: utilitymanager_1.um.TIXSelPolicy.All,\n }, function (up) { return up.intext !== '' && up.intext[0] === ' ' ?\n up.intext.substr(1) : up.intext; });\n }", "function noSpace(x){\n return x.replace(/\\s/g,\"\");\n}", "function filterExtraSpacing(apib) {\n const result = apib.trim().replace(/\\n\\s*\\n\\s*\\n/g, '\\n\\n');\n\n return `${result}\\n`;\n}", "function stripSpaces(textControl){\n\tx = textControl.value;\n\twhile (x.substring(0,1) == ' ') x = x.substring(1);\n\twhile (x.substring(x.length-1,x.length) == ' ') x = x.substring(0,x.length-1);\n\ttextControl.value = x;\n}", "_prepareTextForClipboard(text) {\n const space = String.fromCharCode(32);\n const nonBreakingSpace = String.fromCharCode(160);\n const allNonBreakingSpaces = new RegExp(nonBreakingSpace, 'g');\n\n return text.split('\\n').map((line) => {\n return line.replace(/\\s+$/g, '').replace(allNonBreakingSpaces, space);\n }).join('\\n');\n }", "function checkForNbsp(text){\n if(text == \"\\u00a0\"){\n text = '';\n }\n return text;\n }", "function formatSpaces (str) {\n return str.trim().replace(/ +/g, \" \");\n}", "function normalizeEndings(text) {\n text = text.replace(/\\r\\n/g, '\\n')\n text = text + '\\n'\n\n text = text.replace(/[\\n]{2,}/g, '\\n')\n text = text.replace(/\\n/g, eol)\n\n return text\n}", "function myspacefmt(text) {\n\n\ts = text\n\n\t// Turn special characters back into HTML entities so they don't get stripped\n\t// List is from the tables at http://www.htmlhelp.com/reference/html40/entities/\n\ts = s.replace(/\\uA0/g, '&nbsp;');\n\ts = s.replace(/\\uA1/g, '&iexcl;');\n\ts = s.replace(/\\uA2/g, '&cent;');\n\ts = s.replace(/\\uA3/g, '&pound;');\n\ts = s.replace(/\\uA4/g, '&curren;');\n\ts = s.replace(/\\uA5/g, '&yen;');\n\ts = s.replace(/\\uA6/g, '&brvbar;');\n\ts = s.replace(/\\uA7/g, '&sect;');\n\ts = s.replace(/\\uA8/g, '&uml;');\n\ts = s.replace(/\\uA9/g, '&copy;');\n\ts = s.replace(/\\uAA/g, '&ordf;');\n\ts = s.replace(/\\uAB/g, '&laquo;');\n\ts = s.replace(/\\uAC/g, '&not;');\n\ts = s.replace(/\\uAD/g, '&shy;');\n\ts = s.replace(/\\uAE/g, '&reg;');\n\ts = s.replace(/\\uAF/g, '&macr;');\n\ts = s.replace(/\\uB0/g, '&deg;');\n\ts = s.replace(/\\uB1/g, '&plusmn;');\n\ts = s.replace(/\\uB2/g, '&sup2;');\n\ts = s.replace(/\\uB3/g, '&sup3;');\n\ts = s.replace(/\\uB4/g, '&acute;');\n\ts = s.replace(/\\uB5/g, '&micro;');\n\ts = s.replace(/\\uB6/g, '&para;');\n\ts = s.replace(/\\uB7/g, '&middot;');\n\ts = s.replace(/\\uB8/g, '&cedil;');\n\ts = s.replace(/\\uB9/g, '&sup1;');\n\ts = s.replace(/\\uBA/g, '&ordm;');\n\ts = s.replace(/\\uBB/g, '&raquo;');\n\ts = s.replace(/\\uBC/g, '&frac14;');\n\ts = s.replace(/\\uBD/g, '&frac12;');\n\ts = s.replace(/\\uBE/g, '&frac34;');\n\ts = s.replace(/\\uBF/g, '&iquest;');\n\ts = s.replace(/\\uC0/g, '&Agrave;');\n\ts = s.replace(/\\uC1/g, '&Aacute;');\n\ts = s.replace(/\\uC2/g, '&Acirc;');\n\ts = s.replace(/\\uC3/g, '&Atilde;');\n\ts = s.replace(/\\uC4/g, '&Auml;');\n\ts = s.replace(/\\uC5/g, '&Aring;');\n\ts = s.replace(/\\uC6/g, '&AElig;');\n\ts = s.replace(/\\uC7/g, '&Ccedil;');\n\ts = s.replace(/\\uC8/g, '&Egrave;');\n\ts = s.replace(/\\uC9/g, '&Eacute;');\n\ts = s.replace(/\\uCA/g, '&Ecirc;');\n\ts = s.replace(/\\uCB/g, '&Euml;');\n\ts = s.replace(/\\uCC/g, '&Igrave;');\n\ts = s.replace(/\\uCD/g, '&Iacute;');\n\ts = s.replace(/\\uCE/g, '&Icirc;');\n\ts = s.replace(/\\uCF/g, '&Iuml;');\n\ts = s.replace(/\\uD0/g, '&ETH;');\n\ts = s.replace(/\\uD1/g, '&Ntilde;');\n\ts = s.replace(/\\uD2/g, '&Ograve;');\n\ts = s.replace(/\\uD3/g, '&Oacute;');\n\ts = s.replace(/\\uD4/g, '&Ocirc;');\n\ts = s.replace(/\\uD5/g, '&Otilde;');\n\ts = s.replace(/\\uD6/g, '&Ouml;');\n\ts = s.replace(/\\uD7/g, '&times;');\n\ts = s.replace(/\\uD8/g, '&Oslash;');\n\ts = s.replace(/\\uD9/g, '&Ugrave;');\n\ts = s.replace(/\\uDA/g, '&Uacute;');\n\ts = s.replace(/\\uDB/g, '&Ucirc;');\n\ts = s.replace(/\\uDC/g, '&Uuml;');\n\ts = s.replace(/\\uDD/g, '&Yacute;');\n\ts = s.replace(/\\uDE/g, '&THORN;');\n\ts = s.replace(/\\uDF/g, '&szlig;');\n\ts = s.replace(/\\uE0/g, '&agrave;');\n\ts = s.replace(/\\uE1/g, '&aacute;');\n\ts = s.replace(/\\uE2/g, '&acirc;');\n\ts = s.replace(/\\uE3/g, '&atilde;');\n\ts = s.replace(/\\uE4/g, '&auml;');\n\ts = s.replace(/\\uE5/g, '&aring;');\n\ts = s.replace(/\\uE6/g, '&aelig;');\n\ts = s.replace(/\\uE7/g, '&ccedil;');\n\ts = s.replace(/\\uE8/g, '&egrave;');\n\ts = s.replace(/\\uE9/g, '&eacute;');\n\ts = s.replace(/\\uEA/g, '&ecirc;');\n\ts = s.replace(/\\uEB/g, '&euml;');\n\ts = s.replace(/\\uEC/g, '&igrave;');\n\ts = s.replace(/\\uED/g, '&iacute;');\n\ts = s.replace(/\\uEE/g, '&icirc;');\n\ts = s.replace(/\\uEF/g, '&iuml;');\n\ts = s.replace(/\\uF0/g, '&eth;');\n\ts = s.replace(/\\uF1/g, '&ntilde;');\n\ts = s.replace(/\\uF2/g, '&ograve;');\n\ts = s.replace(/\\uF3/g, '&oacute;');\n\ts = s.replace(/\\uF4/g, '&ocirc;');\n\ts = s.replace(/\\uF5/g, '&otilde;');\n\ts = s.replace(/\\uF6/g, '&ouml;');\n\ts = s.replace(/\\uF7/g, '&divide;');\n\ts = s.replace(/\\uF8/g, '&oslash;');\n\ts = s.replace(/\\uF9/g, '&ugrave;');\n\ts = s.replace(/\\uFA/g, '&uacute;');\n\ts = s.replace(/\\uFB/g, '&ucirc;');\n\ts = s.replace(/\\uFC/g, '&uuml;');\n\ts = s.replace(/\\uFD/g, '&yacute;');\n\ts = s.replace(/\\uFE/g, '&thorn;');\n\ts = s.replace(/\\uFF/g, '&yuml;');\n\ts = s.replace(/\\u192/g, '&fnof;');\n\ts = s.replace(/\\u391/g, '&Alpha;');\n\ts = s.replace(/\\u392/g, '&Beta;');\n\ts = s.replace(/\\u393/g, '&Gamma;');\n\ts = s.replace(/\\u394/g, '&Delta;');\n\ts = s.replace(/\\u395/g, '&Epsilon;');\n\ts = s.replace(/\\u396/g, '&Zeta;');\n\ts = s.replace(/\\u397/g, '&Eta;');\n\ts = s.replace(/\\u398/g, '&Theta;');\n\ts = s.replace(/\\u399/g, '&Iota;');\n\ts = s.replace(/\\u39A/g, '&Kappa;');\n\ts = s.replace(/\\u39B/g, '&Lambda;');\n\ts = s.replace(/\\u39C/g, '&Mu;');\n\ts = s.replace(/\\u39D/g, '&Nu;');\n\ts = s.replace(/\\u39E/g, '&Xi;');\n\ts = s.replace(/\\u39F/g, '&Omicron;');\n\ts = s.replace(/\\u3A0/g, '&Pi;');\n\ts = s.replace(/\\u3A1/g, '&Rho;');\n\ts = s.replace(/\\u3A3/g, '&Sigma;');\n\ts = s.replace(/\\u3A4/g, '&Tau;');\n\ts = s.replace(/\\u3A5/g, '&Upsilon;');\n\ts = s.replace(/\\u3A6/g, '&Phi;');\n\ts = s.replace(/\\u3A7/g, '&Chi;');\n\ts = s.replace(/\\u3A8/g, '&Psi;');\n\ts = s.replace(/\\u3A9/g, '&Omega;');\n\ts = s.replace(/\\u3B1/g, '&alpha;');\n\ts = s.replace(/\\u3B2/g, '&beta;');\n\ts = s.replace(/\\u3B3/g, '&gamma;');\n\ts = s.replace(/\\u3B4/g, '&delta;');\n\ts = s.replace(/\\u3B5/g, '&epsilon;');\n\ts = s.replace(/\\u3B6/g, '&zeta;');\n\ts = s.replace(/\\u3B7/g, '&eta;');\n\ts = s.replace(/\\u3B8/g, '&theta;');\n\ts = s.replace(/\\u3B9/g, '&iota;');\n\ts = s.replace(/\\u3BA/g, '&kappa;');\n\ts = s.replace(/\\u3BB/g, '&lambda;');\n\ts = s.replace(/\\u3BC/g, '&mu;');\n\ts = s.replace(/\\u3BD/g, '&nu;');\n\ts = s.replace(/\\u3BE/g, '&xi;');\n\ts = s.replace(/\\u3BF/g, '&omicron;');\n\ts = s.replace(/\\u3C0/g, '&pi;');\n\ts = s.replace(/\\u3C1/g, '&rho;');\n\ts = s.replace(/\\u3C2/g, '&sigmaf;');\n\ts = s.replace(/\\u3C3/g, '&sigma;');\n\ts = s.replace(/\\u3C4/g, '&tau;');\n\ts = s.replace(/\\u3C5/g, '&upsilon;');\n\ts = s.replace(/\\u3C6/g, '&phi;');\n\ts = s.replace(/\\u3C7/g, '&chi;');\n\ts = s.replace(/\\u3C8/g, '&psi;');\n\ts = s.replace(/\\u3C9/g, '&omega;');\n\ts = s.replace(/\\u3D1/g, '&thetasym;');\n\ts = s.replace(/\\u3D2/g, '&upsih;');\n\ts = s.replace(/\\u3D6/g, '&piv;');\n\ts = s.replace(/\\u2022/g, '&bull;');\n\ts = s.replace(/\\u2026/g, '&hellip;');\n\ts = s.replace(/\\u2032/g, '&prime;');\n\ts = s.replace(/\\u2033/g, '&Prime;');\n\ts = s.replace(/\\u203E/g, '&oline;');\n\ts = s.replace(/\\u2044/g, '&frasl;');\n\ts = s.replace(/\\u2118/g, '&weierp;');\n\ts = s.replace(/\\u2111/g, '&image;');\n\ts = s.replace(/\\u211C/g, '&real;');\n\ts = s.replace(/\\u2122/g, '&trade;');\n\ts = s.replace(/\\u2135/g, '&alefsym;');\n\ts = s.replace(/\\u2190/g, '&larr;');\n\ts = s.replace(/\\u2191/g, '&uarr;');\n\ts = s.replace(/\\u2192/g, '&rarr;');\n\ts = s.replace(/\\u2193/g, '&darr;');\n\ts = s.replace(/\\u2194/g, '&harr;');\n\ts = s.replace(/\\u21B5/g, '&crarr;');\n\ts = s.replace(/\\u21D0/g, '&lArr;');\n\ts = s.replace(/\\u21D1/g, '&uArr;');\n\ts = s.replace(/\\u21D2/g, '&rArr;');\n\ts = s.replace(/\\u21D3/g, '&dArr;');\n\ts = s.replace(/\\u21D4/g, '&hArr;');\n\ts = s.replace(/\\u2200/g, '&forall;');\n\ts = s.replace(/\\u2202/g, '&part;');\n\ts = s.replace(/\\u2203/g, '&exist;');\n\ts = s.replace(/\\u2205/g, '&empty;');\n\ts = s.replace(/\\u2207/g, '&nabla;');\n\ts = s.replace(/\\u2208/g, '&isin;');\n\ts = s.replace(/\\u2209/g, '&notin;');\n\ts = s.replace(/\\u220B/g, '&ni;');\n\ts = s.replace(/\\u220F/g, '&prod;');\n\ts = s.replace(/\\u2211/g, '&sum;');\n\ts = s.replace(/\\u2212/g, '&minus;');\n\ts = s.replace(/\\u2217/g, '&lowast;');\n\ts = s.replace(/\\u221A/g, '&radic;');\n\ts = s.replace(/\\u221D/g, '&prop;');\n\ts = s.replace(/\\u221E/g, '&infin;');\n\ts = s.replace(/\\u2220/g, '&ang;');\n\ts = s.replace(/\\u2227/g, '&and;');\n\ts = s.replace(/\\u2228/g, '&or;');\n\ts = s.replace(/\\u2229/g, '&cap;');\n\ts = s.replace(/\\u222A/g, '&cup;');\n\ts = s.replace(/\\u222B/g, '&int;');\n\ts = s.replace(/\\u2234/g, '&there4;');\n\ts = s.replace(/\\u223C/g, '&sim;');\n\ts = s.replace(/\\u2245/g, '&cong;');\n\ts = s.replace(/\\u2248/g, '&asymp;');\n\ts = s.replace(/\\u2260/g, '&ne;');\n\ts = s.replace(/\\u2261/g, '&equiv;');\n\ts = s.replace(/\\u2264/g, '&le;');\n\ts = s.replace(/\\u2265/g, '&ge;');\n\ts = s.replace(/\\u2282/g, '&sub;');\n\ts = s.replace(/\\u2283/g, '&sup;');\n\ts = s.replace(/\\u2284/g, '&nsub;');\n\ts = s.replace(/\\u2286/g, '&sube;');\n\ts = s.replace(/\\u2287/g, '&supe;');\n\ts = s.replace(/\\u2295/g, '&oplus;');\n\ts = s.replace(/\\u2297/g, '&otimes;');\n\ts = s.replace(/\\u22A5/g, '&perp;');\n\ts = s.replace(/\\u22C5/g, '&sdot;');\n\ts = s.replace(/\\u2308/g, '&lceil;');\n\ts = s.replace(/\\u2309/g, '&rceil;');\n\ts = s.replace(/\\u230A/g, '&lfloor;');\n\ts = s.replace(/\\u230B/g, '&rfloor;');\n\ts = s.replace(/\\u2329/g, '&lang;');\n\ts = s.replace(/\\u232A/g, '&rang;');\n\ts = s.replace(/\\u25CA/g, '&loz;');\n\ts = s.replace(/\\u2660/g, '&spades;');\n\ts = s.replace(/\\u2663/g, '&clubs;');\n\ts = s.replace(/\\u2665/g, '&hearts;');\n\ts = s.replace(/\\u2666/g, '&diams;');\n\ts = s.replace(/\\u152/g, '&OElig;');\n\ts = s.replace(/\\u153/g, '&oelig;');\n\ts = s.replace(/\\u160/g, '&Scaron;');\n\ts = s.replace(/\\u161/g, '&scaron;');\n\ts = s.replace(/\\u178/g, '&Yuml;');\n\ts = s.replace(/\\u2C6/g, '&circ;');\n\ts = s.replace(/\\u2DC/g, '&tilde;');\n\ts = s.replace(/\\u2002/g, '&ensp;');\n\ts = s.replace(/\\u2003/g, '&emsp;');\n\ts = s.replace(/\\u2009/g, '&thinsp;');\n\t// Blanking these four because they screw things up:\n\ts = s.replace(/\\u200C/g, ' ');\n\ts = s.replace(/\\u200D/g, ' ');\n\ts = s.replace(/\\u200E/g, ' ');\n\ts = s.replace(/\\u200F/g, ' ');\n\ts = s.replace(/\\u2020/g, '&dagger;');\n\ts = s.replace(/\\u2021/g, '&Dagger;');\n\ts = s.replace(/\\u2030/g, '&permil;');\n\ts = s.replace(/\\u2039/g, '&lsaquo;');\n\ts = s.replace(/\\u203A/g, '&rsaquo;');\n\ts = s.replace(/\\u20AC/g, '&euro;');\n\t\n\n\treplacements = [\n\n//\t[//g, ''], \n\n\t// Cyrillic quotes\n//\t[/(\\s+|^)\"([^\"]+?)\"(\\s+|$|\\.|\\,)/g, '$1\\u00ab$2\\u00bb$3'],\n\n\t// Latin quotes: \"test\" become smart quotes\n\t[/(\\s+|^)\"([^\\\"]+?)\"(\\s+|$|\\.|\\,)/g, '$1&ldquo;$2&rdquo;$3'],\n\t[/(\\s+|^)'([^\\']+?)'(\\s+|$|\\.|\\,)/g, '$1&lsquo;$2&rsquo;$3'],\n\n\t// Trademark: (TM)\n\t[/\\((tm|TM|\\u0422\\u041C|\\u0442\\u043C)\\)/g, '&trade;'],\n\n\t// Copyright: (C)\n\t[/\\([cC\\u0421\\u0441]\\)/g, '&copy;'],\n\n\t// Registered: (R)\n\t[/\\([rR\\u0420\\u0440]\\)/g, '&reg;'],\n\t\n\t// Hearts, of course! <3\n\t[/(\\s)(<3)(\\s)/g, '$1\\&hearts;$3'],\n\t\n\t// Section symbol, by request: {SS}\n\t[/\\{SS\\}/g, '&sect;'], \n\n\t// Arrows ==> <-- <==> and so on\n\t[/([^<])-{2}>/g, '$1&rarr;'],\n\t[/<-{2}([^>])/g, '&larr;$1'],\n\t[/<-{1,2}>/g, '&harr;'],\n\t[/([^<])={2}>/g, '$1&rArr;'],\n\t[/<={2}([^>])/g, '&lArr;$1'],\n\t[/<={1,2}>/g, '&hArr;'],\n\n\t// Horizontal rules: ---- becomes <hr>\n\t[/\\n----+\\n/g, '<hr>'], \n\t\n\t// Degree sign: degC becomes &deg;C (K does not have a degree sign!)\n\t[/degC(\\s)/g, '&deg;C$1'], \n\t[/degF(\\s)/g, '&deg;F$1'], \t\n\t\n\t// TeX subs and supers: x squared: x^{2} carbon dioxide: CO_{2}\n\t[/\\^\\{(.*?)\\}/g, '<sup>$1</sup>'], \n\t[/_\\{(.*?)\\}/g, '<sub>$1</sub>'], \n\t\t\n\t// Scientific notation: 3.5E2 becomes 3.5&times;10<sup>2</sup>\n\t[/(\\d)E(\\d+)/g, '$1&times;10<sup>$2</sup>'], \n\t\n\t// Plus or minus sign +-5 becomes &plusmn;5\n\t[/\\+-(\\d)/g, '&plusmn;$1'], \n\n\t// Censorship is evil.\n//\t[/A(IM\\s*)\\:/gi, '&Acirc;$1:'],\n\n\t// These screw up your posts if you've got 'em (Myspace sucks). It converts to something similar looking. :-\\ Best I can do...\n//\t[/\\#/gi, '&Dagger;&Dagger;'],\n\t[/\\\\/gi, '&lfloor;'],\n\n\t// Em dash -- two minuses surrounded by spaces\n\t[/(\\s+|^)--(\\s+)/g, '$1\\u2014$2'],\n\n\t// **bold**\t\n\t[/\\*{2}(.+?)\\*{2}/g, '<b>$1</b>'],\n\n\t// '''Wikipedia strong emphasis''' (rendered as bold usually)\n\t[/\\'{3}(.+?)\\'{3}/g, '<strong>$1</strong>'],\n\n\t// //italic//\n\t[/([^\\:]|^)\\/{2}(.+?)\\/{2}/g, '$1<i>$2</i>'],\n\n\t// ''Wikipedia emphasis'' (rendered as italics usually)\n\t[/\\'{2}(.+?)\\'{2}/g, '<em>$1</em>'],\n\n\t// --strikethrough--\n\t[/-{2}(.+?)-{2}/g, '<s>$1</s>'],\n\n\t// __underlined__\n\t[/_{2}(.+?)_{2}/g, '<u>$1</u>'],\n\t\n\t// A few colors? [blue]text[/color] becomes <font color=\"0000BB\">text</font> (will also accept [bl]text[/bl] or whatever)\n\t[/\\[(bk|k|black)\\]([\\s\\S]*?)\\[\\/(\\1|c|color)?\\]/gim,\t\t\t'<font color=\"black\">$2</font>'],\n\t[/\\[(n|navy)\\]([\\s\\S]*?)\\[\\/(\\1|c|color)?\\]/gim,\t\t\t\t'<font color=\"navy\">$2</font>'],\t\n\t[/\\[(gn|green)\\]([\\s\\S]*?)\\[\\/(\\1|c|color)?\\]/gim,\t\t\t\t'<font color=\"green\">$2</font>'],\n\t[/\\[(tl|teal)\\]([\\s\\S]*?)\\[\\/(\\1|c|color)?\\]/gim,\t\t\t\t'<font color=\"teal\">$2</font>'], // [t] would conflict with quote tags\n\t[/\\[(s|silver)\\]([\\s\\S]*?)\\[\\/(\\1|c|color)?\\]/gim,\t\t\t\t'<font color=\"silver\">$2</font>'],\t\n\t[/\\[(bl|be|bu|blue)\\]([\\s\\S]*?)\\[\\/(\\1|c|color)?\\]/gim,\t\t\t'<font color=\"blue\">$2</font>'],\t\n\t[/\\[(l|lime)\\]([\\s\\S]*?)\\[\\/(\\1|c|color)?\\]/gim,\t\t\t\t'<font color=\"lime\">$2</font>'],\t\n\t[/\\[(a|aq|aqua|c|cy|cyan)\\]([\\s\\S]*?)\\[\\/(\\1|c|color)?\\]/gim,\t'<font color=\"aqua\">$2</font>'],\t\n\t[/\\[(m|maroon)\\]([\\s\\S]*?)\\[\\/(\\1|c|color)?\\]/gim,\t\t\t\t'<font color=\"maroon\">$2</font>'],\n\t[/\\[(p|purple|v|violet)\\]([\\s\\S]*?)\\[\\/(\\1|c|color)?\\]/gim,\t\t'<font color=\"purple\">$2</font>'],\t\n\t[/\\[(o|olive)\\]([\\s\\S]*?)\\[\\/(\\1|c|color)?\\]/gim,\t\t\t\t'<font color=\"olive\">$2</font>'],\n\t[/\\[(gy|gray|grey)\\]([\\s\\S]*?)\\[\\/(\\1|c|color)?\\]/gim,\t\t\t'<font color=\"gray\">$2</font>'],\n\t[/\\[(r|red)\\]([\\s\\S]*?)\\[\\/(\\1|c|color)?\\]/gim,\t\t\t\t\t'<font color=\"red\">$2</font>'],\t\n\t[/\\[(f|fuschia|magenta)\\]([\\s\\S]*?)\\[\\/(\\1|c|color)?\\]/gim,\t\t'<font color=\"fuschia\">$2</font>'],\t\n\t[/\\[(y|yw|yellow)\\]([\\s\\S]*?)\\[\\/(\\1|c|color)?\\]/gim,\t\t\t'<font color=\"yellow\">$2</font>'],\t\n\t[/\\[(w|wh|white)\\]([\\s\\S]*?)\\[\\/(\\1|c|color)?\\]/gim,\t\t\t'<font color=\"white\">$2</font>'],\t\n\t\n\t// En dash for number ranges: 1995-2005\n\t[/(\\d+)-(\\d+)/g, '$1\\u2013$2'],\n\n\t// Ellipsis\n//\t[/\\.\\.\\./g, '\\u2026'],\n\n\t// [quote] tags [/quote] (or [q] or [Q] or [t] or whatever)\n\t// First replace the SomeoneWrote: bit with legend tags\n\t[/\\[(quote|q|t)\\](\\s*\\n?)([^\\n]*)Wrote:(\\s*\\n)([\\s\\S]*?)\\[\\/(quote|q|t)\\]/gim, '[$1]<legend>$3 wrote:</legend>$5[/$6]'],\n\t// Then replace the rest with fieldset tags \n\t[/\\[(quote|q|t)\\]([\\s\\S]*?)\\[\\/(quote|q|t)\\]/gim, '<fieldset style=\"border: 1px solid; border-color: aaaaaa; padding: 1em; margin: 1em 2em;\">$2</fieldset>'],\n\t// (This way it can handle nested quotes and optional \"Wrote:\" sections.)\n\n\t// Old version of quotes based directly on Myspace's quote markup:\t\n//\t[/\\[(quote|q|t)\\]([\\s\\S]*?)\\[\\/(quote|q|t)\\]/gim, '<table align=\"center\" bgcolor=\"cccccc\" border=\"0\" cellpadding=\"1\" cellspacing=\"0\" width=\"90%\"><tbody><tr><td><table bgcolor=\"ffffff\" border=\"0\" cellpadding=\"10\" cellspacing=\"0\" width=\"100%\"><tbody><tr><td><p>$2</p></td></tr></tbody></table></td></tr></tbody></table>'],\n\n\t// Image shortcut IMG=http://www.url.com/image.png surrounded by whitespace.\n\t[/(\\s)IMG=(\\S*?)([\\s\\]])/gi, '$1<img src=\"$2\">$3'],\n\t\n\t// Named URLs in wikipedia format [http://address linked text]\n\t[/\\[http:([^ \\t\\v\\f\\n\\r\\]]*?)\\s+(\\S.*?)\\]/gi, '<a href=\"http:$1\">$2</a>'],\n\t\n\t// Myspace URLs [my:Firefox] or [myspace:Firefox] becomes http://www.myspace.com/Firefox\n\t[/\\[(my|myspace):(\\S.*?)\\]/gi, '<a href=\"http://www.myspace.com/$2\">Myspace: $2</a>'],\n\t\n\t// Myspace group URLs [gr:toolbar] or [group:toolbar] becomes http://groups.myspace.com/toolbar\n\t[/\\[(gr|group):(\\S.*?)\\]/gi, '<a href=\"http://groups.myspace.com/$2\">Myspace group: $2</a>'],\n\n\t// Auto-link naked URLs\n\t[/(\\s)http(s)*:(\\S*?)(\\s)/gi, '$1<a href=\"http$2:$3\">http$2:$3</a>$4'],\n\t\n\t// Links to wikipedia articles [[linked text]] (useful in fights)\n\t[/\\[\\[([\\s\\S]+?)\\]\\]/gi, '<a href=\"http://en.wikipedia.org/wiki/$1\">$1</a>']\n\n\t];\n\n\t// Runs through itself over and over until nothing changes, to handle nested quote tags and the like. \n\t// Uses \"for\" instead of \"while\" to prevent infinite loops from poorly written regexps. ;-)\n\tfor( j=0; j<=100; j++) {\n\t\tolds = s;\n\t\tfor( i=0; i < replacements.length; i++) {\n\t\t\ts = s.replace(replacements[i][0], replacements[i][1]);\n\t\t}\n\t\tif(olds == s) {break};\n\t}\n\t\n\treturn s\n}", "function replaceSpace(input) \n{\n if (input.indexOf(\" \")) \n {\n input.replace(\" \", \"%20\"); \n }\n return input;\n}", "removeSpace() {\n\t}", "function wrapSpace(s){\n if (s === \" \"){\n return \"' '\";\n }\n else {\n return s;\n }\n}", "function widont( string ) {\n return string.replace( Private.regexp, \"&#160;$1\" );\n }", "function trimNbspAfterDeleteAndPaddValue() {\n\t\t\tvar rng, container, offset;\n\n\t\t\trng = selection.getRng(true);\n\t\t\tcontainer = rng.startContainer;\n\t\t\toffset = rng.startOffset;\n\n\t\t\tif (container.nodeType == 3 && rng.collapsed) {\n\t\t\t\tif (container.data[offset] === '\\u00a0') {\n\t\t\t\t\tcontainer.deleteData(offset, 1);\n\n\t\t\t\t\tif (!/[\\u00a0| ]$/.test(value)) {\n\t\t\t\t\t\tvalue += ' ';\n\t\t\t\t\t}\n\t\t\t\t} else if (container.data[offset - 1] === '\\u00a0') {\n\t\t\t\t\tcontainer.deleteData(offset - 1, 1);\n\n\t\t\t\t\tif (!/[\\u00a0| ]$/.test(value)) {\n\t\t\t\t\t\tvalue = ' ' + value;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}", "function trimNbspAfterDeleteAndPaddValue() {\n\t\t\tvar rng, container, offset;\n\n\t\t\trng = selection.getRng(true);\n\t\t\tcontainer = rng.startContainer;\n\t\t\toffset = rng.startOffset;\n\n\t\t\tif (container.nodeType == 3 && rng.collapsed) {\n\t\t\t\tif (container.data[offset] === '\\u00a0') {\n\t\t\t\t\tcontainer.deleteData(offset, 1);\n\n\t\t\t\t\tif (!/[\\u00a0| ]$/.test(value)) {\n\t\t\t\t\t\tvalue += ' ';\n\t\t\t\t\t}\n\t\t\t\t} else if (container.data[offset - 1] === '\\u00a0') {\n\t\t\t\t\tcontainer.deleteData(offset - 1, 1);\n\n\t\t\t\t\tif (!/[\\u00a0| ]$/.test(value)) {\n\t\t\t\t\t\tvalue = ' ' + value;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}", "function deleteSpaces(nStr)\r\n{\r\n\t\r\n\tfor(var i=0;i<10;i++)\r\n\t\tnStr=nStr.replace(' ','');\r\n\treturn nStr;\r\n}", "function addSpaceText() {\n\tappendText(\" \");\n}", "space() {\n\t\t\tthis.append(' ');\n\t\t}", "function unspace(string) {\n return string.replace(/\\r\\n|\\n| /g, '')\n}", "function addWhiteSpaces(nbSpaces) {\n let result = '';\n for (let i = 0; i < nbSpaces; i++) {\n result += ' ';\n }\n return result;\n}", "function noSpace(x) {\n let newStr = x.split(\" \").join(\"\");\n return newStr;\n}", "function nbsp(x) {\n var times = x || 1;\n var returns = \"\";\n for (var x = 0; x < times; x++)\n returns += String.fromCharCode(0xA0);\n return returns;\n}", "function trimWithSingleSpace(string) {\n return string.replace(/^[ \\t\\xA0]{2,}/, ' ').\n replace(/[ \\t\\xA0]{2,}$/, ' ').replace(/^\\s+$/, '');\n}", "function trimWithSingleSpace(string) {\n return string.replace(/^[ \\t\\xA0]{2,}/, ' ').\n replace(/[ \\t\\xA0]{2,}$/, ' ').replace(/^\\s+$/, '');\n}", "function cleanWhiteSpace(text) {\n let revisedText = text.replace(/^\\s+|\\s+$/g, \"\").replace(/\\s\\s+/g, \" \");\n return revisedText;\n}", "function trimNbspAfterDeleteAndPaddValue() {\n\t\t\t\t\tvar rng, container, offset;\n\n\t\t\t\t\trng = selection.getRng(true);\n\t\t\t\t\tcontainer = rng.startContainer;\n\t\t\t\t\toffset = rng.startOffset;\n\n\t\t\t\t\tif (container.nodeType == 3 && rng.collapsed) {\n\t\t\t\t\t\tif (container.data[offset] === '\\u00a0') {\n\t\t\t\t\t\t\tcontainer.deleteData(offset, 1);\n\n\t\t\t\t\t\t\tif (!/[\\u00a0| ]$/.test(value)) {\n\t\t\t\t\t\t\t\tvalue += ' ';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else if (container.data[offset - 1] === '\\u00a0') {\n\t\t\t\t\t\t\tcontainer.deleteData(offset - 1, 1);\n\n\t\t\t\t\t\t\tif (!/[\\u00a0| ]$/.test(value)) {\n\t\t\t\t\t\t\t\tvalue = ' ' + value;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}", "function removeDoubleWhiteSpace(phrase) {\n return phrase.replace(/[\\s]+/g, ' ');\n}", "function addSpaces(value) {\n if(typeof(value) == typeof(undefined)) {\n return value;\n }\n\n var parsedValue = value.toString()\n .replace(/[^\\d]/g, '')\n .replace(/(.{4})/g, '$1 ').trim()\n .replace(/\\/$/, '');\n return parsedValue.slice(0,19);\n }", "gobbleSpaces() {\n let ch = this.code;\n while (ch === _Jsep.SPACE_CODE || ch === _Jsep.TAB_CODE || ch === _Jsep.LF_CODE || ch === _Jsep.CR_CODE) {\n ch = this.expr.charCodeAt(++this.index);\n }\n this.runHook(\"gobble-spaces\");\n }", "function noSpace(test){\r\n return test.replace(/\\s+/g,\"\");\r\n \r\n }", "function qwerty_addSpaceText() {\n\tqwerty_appendText(\" \");\n}", "function nobr(s) {\n return s.toString().replace(/<br>/gi, \" \")\n }", "function removeSpaces(str) {\n if (str === null) {\n return;\n }\n str = str.trim();\n for (let i = 0; i < str.length; i++)\n if (str[i] === \" \") {\n var leftStr = str.slice(0, i);\n var rightStr = str.slice(i + 1,);\n str = leftStr + \"%20\" + rightStr;\n }\n return str;\n}", "function stripWhitespace(str) {\n return str.trim().replace(/\\s*\\n\\s*/g, ' ');\n}", "function squeeze(string) {\n return string.replace(/\\s+/g, ' ');\n }", "function noSpace(x){\n return x.split(\"\").filter(el => {return el!==\" \"}).join(\"\")\n }", "function replaceSpaces(str){\n var result = str.replace(/ /g, '');\n\n document.getElementById('content').innerHTML =result;\n }", "function SupprEspaceString(str){\n\tvar result6 = str.trim();\n\treturn result6;\n }", "function normalize(s) {\n\t return s ? s.replace(/\\r?\\n/g, '\\r\\n') : ''\n\t }", "function normalize(s) {\n\t return s ? s.replace(/\\r?\\n/g, '\\r\\n') : ''\n\t }", "function normalize(s) {\n\t return s ? s.replace(/\\r?\\n/g, '\\r\\n') : ''\n\t }", "function normalize(s) {\n\t return s ? s.replace(/\\r?\\n/g, '\\r\\n') : ''\n\t }", "function normalize(s) {\n\t return s ? s.replace(/\\r?\\n/g, '\\r\\n') : ''\n\t }", "function normalize(s) {\n\t return s ? s.replace(/\\r?\\n/g, '\\r\\n') : ''\n\t }", "function removeAllSpaces(textStr){\n var retVal = \"\";\n var strLen = textStr.length;\n var i;\n for (i=0;i<strLen;i++){\n if ( textStr.charAt(i) != \"\\n\" && textStr.charAt(i) != \"\\r\" &&\n textStr.charAt(i) != \"\\t\")\n retVal += textStr.charAt(i);\n }\n return retVal;\n\n}", "function qwerty_addSpaceText() {\r\n\tqwerty_appendText(\" \");\r\n}", "function qwerty_addSpaceText() {\r\n\tqwerty_appendText(\" \");\r\n}", "function qwerty_addSpaceText() {\r\n\tqwerty_appendText(\" \");\r\n}", "function adjustSpaces(fld) {\r\n\tvar val = \"\"\r\n\tl_length_of_data = fld.length;\r\n\tcountspace = 0\r\n\tfor(ctr=0;ctr<l_length_of_data;ctr++){\r\n\t\tif(fld.charAt(ctr) != \" \") {\r\n\t\t\tval = val + fld.charAt(ctr)\r\n\t\t\tcountspace = 0;\r\n\t\t}\r\n\t\telse{\r\n\t\t\tif(countspace == 0){\r\n\t\t\t\tval = val + fld.charAt(ctr);\r\n\t\t\t\tcountspace = 1;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn val\r\n}", "function hardTrim(text) {\n\n\tif (!exists(text)) {\n\t\treturn \"\"\n\t}\n\ttext = text.replace(/^\\&nbsp\\;|<br?\\>*/gi, \"\").replace(/\\&nbsp\\;|<br?\\>$/gi, \"\").trim();\n\n\treturn text\n}", "function squeeze(string) {\n\t\treturn string.replace(/\\s+/g, ' ');\n\t}", "function _coalesceOutput(str){\n\t\treturn typeof(str) == \"undefined\" ? \"&nbsp\" : str;\n\t}", "function reduceDoubleSpaces( string ) {\n\tstring = string.replace( \" \", \" \" );\n\tif ( string.search( \" \" ) > 0 ) {\n\t\treturn reduceDoubleSpaces( string );\n\t}\n\treturn string;\n}", "function replaceNgsp(value) {\n // lexer is replacing the &ngsp; pseudo-entity with NGSP_UNICODE\n return value.replace(new RegExp(NGSP_UNICODE, 'g'), ' ');\n }" ]
[ "0.7739919", "0.75860053", "0.72711277", "0.7261996", "0.7015653", "0.69172597", "0.67173624", "0.66479915", "0.659467", "0.65831417", "0.6578782", "0.6573841", "0.6523409", "0.64220226", "0.64159256", "0.64096767", "0.64095", "0.6408991", "0.6408991", "0.63840115", "0.63695693", "0.63695693", "0.6363498", "0.6355929", "0.63466465", "0.63426405", "0.6279181", "0.624993", "0.6199677", "0.61995393", "0.61821985", "0.6170663", "0.61510736", "0.6142666", "0.61384577", "0.61226225", "0.61219984", "0.61052513", "0.610485", "0.610171", "0.6098043", "0.6086208", "0.60840124", "0.60798204", "0.60798204", "0.60751194", "0.60614693", "0.6059712", "0.60565776", "0.6031953", "0.602584", "0.6010924", "0.6008296", "0.6008296", "0.5994112", "0.5957166", "0.595323", "0.59422565", "0.5939654", "0.5925142", "0.5915553", "0.59106034", "0.5881472", "0.58808714", "0.5859305", "0.58579063", "0.58492726", "0.58203834", "0.581797", "0.581797", "0.581797", "0.581797", "0.581797", "0.581797", "0.5815823", "0.5809494", "0.5809494", "0.5809494", "0.5801284", "0.5797914", "0.57949346", "0.5793968", "0.5791757", "0.57915306" ]
0.65678304
24
Work around nonsense dimensions being reported for stretches of righttoleft text.
function buildTokenBadBidi(inner, order) { return function (builder, text, style, startStyle, endStyle, css, attributes) { style = style ? style + " cm-force-border" : "cm-force-border"; var start = builder.pos, end = start + text.length; for (;;) { // Find the part that overlaps with the start of this text var part = (void 0); for (var i = 0; i < order.length; i++) { part = order[i]; if (part.to > start && part.from <= start) { break } } if (part.to >= end) { return inner(builder, text, style, startStyle, endStyle, css, attributes) } inner(builder, text.slice(0, part.to - start), style, startStyle, null, css, attributes); startStyle = null; text = text.slice(part.to - start); start = part.to; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function textResize(elt, d) {\n\n var textWidth = elt.getComputedTextLength();\n var arrayBro = elt.parentNode.childNodes;\n var len = arrayBro.length;\n var i = len / 2;\n\n if (arrayBro[i].firstChild === null || elt.firstChild === null)\n return null;\n\n while (arrayBro[i].firstChild.nodeValue !== elt.firstChild.nodeValue) {\n i++;\n }\n\n var irect = i - len / 2;\n var rectWidth = parseInt(elt.parentNode.childNodes[irect].getAttribute('width'));\n\n console.log(d.name);\n console.log(textWidth);\n console.log(rectWidth);\n\n return textWidth < rectWidth ? null : rectWidth * 2;\n}", "function va(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=n(\"span\",\"xxxxxxxxxx\"),r=n(\"pre\",[t]);a(e.measure,r);var f=t.getBoundingClientRect(),o=(f.right-f.left)/10;return o>2&&(e.cachedCharWidth=o),o||10}", "getBoundsRightX() {\n if (SharedElementHelpers.IsTextOrShapeElements(this)) {\n return this.content.width;\n }\n return this.content.width / 2;\n }", "function rf(e){var t=e.display;t.lastWrapHeight==t.wrapper.clientHeight&&t.lastWrapWidth==t.wrapper.clientWidth||(\n // Might be a text scaling operation, clear size caches.\n t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize())}", "function R(){var e=s.getBoundingClientRect(),n=\"offset\"+[\"Width\",\"Height\"][t.ort];return 0===t.ort?e.width||s[n]:e.height||s[n]}", "measure(availableSize) {\n let desired = undefined;\n let desiredBounds = undefined;\n if (this.hasChildren()) {\n //Measuring the children\n for (let child of this.children) {\n if (child instanceof TextElement) {\n if (child.canMeasure) {\n availableSize.width = availableSize.width || this.maxWidth || this.minWidth;\n child.measure(availableSize);\n }\n else {\n break;\n }\n }\n else if (!(child instanceof TextElement)) {\n child.measure(availableSize);\n }\n let childSize = child.desiredSize.clone();\n if (child.rotateAngle !== 0) {\n childSize = rotateSize(childSize, child.rotateAngle);\n }\n let right = childSize.width + child.margin.right;\n let bottom = childSize.height + child.margin.bottom;\n let childBounds = new Rect(child.margin.left, child.margin.top, right, bottom);\n if (child.float) {\n let position = child.getAbsolutePosition(childSize);\n if (position !== undefined) {\n continue;\n }\n }\n if ((!(child instanceof TextElement)) || (child instanceof TextElement && child.canConsiderBounds)) {\n if (desiredBounds === undefined) {\n desiredBounds = childBounds;\n }\n else {\n desiredBounds.uniteRect(childBounds);\n }\n }\n }\n if (desiredBounds) {\n let leftMargin = 0;\n let topMargin = 0;\n leftMargin = Math.max(desiredBounds.left, 0);\n topMargin = Math.max(desiredBounds.top, 0);\n desired = new Size(desiredBounds.width + leftMargin, desiredBounds.height + topMargin);\n }\n }\n desired = super.validateDesiredSize(desired, availableSize);\n super.stretchChildren(desired);\n this.desiredSize = desired;\n return desired;\n }", "static estimateTruncateOffset(fullText, containerWidth, actualWidth) {\n const textChars = fullText.length;\n const avgLetterSize = actualWidth / textChars;\n const canFit = containerWidth / avgLetterSize; // number of letters that can fit to container\n const deltaEachSide = (textChars - canFit) / 2; // index that used to truncate for left and right sides\n const endLeft = Math.floor(textChars / 2 - deltaEachSide);\n const startRight = Math.ceil(textChars / 2 + deltaEachSide);\n return {\n endLeft,\n startRight\n };\n }", "function j(){var e=s.getBoundingClientRect(),r=\"offset\"+[\"Width\",\"Height\"][t.ort]\nreturn 0===t.ort?e.width||s[r]:e.height||s[r]}", "function S(){var e=le.getBoundingClientRect(),t=\"offset\"+[\"Width\",\"Height\"][n.ort];return 0===n.ort?e.width||le[t]:e.height||le[t]}", "_getExtraRightWidth(_id) {\n return this._getExtraSize(_id, 'right');\n }", "_getExtraRightWidth(_id) {\n return this._getExtraSize(_id, 'right');\n }", "getExtraWidth(_id) {\n return (\n this._getExtraSize(_id, 'left') +\n this._getExtraSize(_id, 'right')\n );\n }", "getExtraWidth(_id) {\n return (\n this._getExtraSize(_id, 'left') +\n this._getExtraSize(_id, 'right')\n );\n }", "function W(){var t=l.getBoundingClientRect(),e=\"offset\"+[\"Width\",\"Height\"][i.ort];return 0===i.ort?t.width||l[e]:t.height||l[e]}", "getWidth() {\n return this.content >> 22 /* WIDTH_SHIFT */;\n }", "getInnerWidth() {\n mustInherit();\n }", "function fitTextToRect(theText, theWidth, theHeight) {\n // First pass\n\n textSize(18) //got to start somewhere\n tSize = textSize()\n try{\n theText = theText.toString()\n if (theText.length > 0) {\n \n var theArea = int(theWidth * theHeight) //this is the area of the Rect\n var multiplier = 0.01 //this is by how much we want to grow the textSize until its too big\n var withinReason = theArea * 0.3 //this is how much we reduce the are because of line breaks etc\n //how are 0.01 and 0.3 linked?\n\n var thisArea = 0 // start with nothing and grow it until it's too big\n while (thisArea <= withinReason) {\n textSize(tSize)\n let bbox = font.textBounds(theText, 0, 0, tSize);\n thisArea = int(bbox.w * bbox.h)\n tSize = textSize() + multiplier\n }\n print(\"whoo hoo!\", thisArea, withinReason, int(tSize), theLine)\n } else {\n return \"Error\"\n }\n }catch(e){\n print(e)\n return tSize\n \n }\n return tSize\n\n}", "function calculateWidthForText(text) {\n if (spacer === undefined) { // on first call only.\n spacer = document.createElement('span'); \n spacer.style.visibility = 'hidden';\n spacer.style.position = 'fixed';\n spacer.style.outline = '0';\n spacer.style.margin = '0';\n spacer.style.padding = '0';\n spacer.style.border = '0';\n spacer.style.left = '0';\n spacer.style.whiteSpace = 'pre';\n spacer.style.fontSize = config.fontSize;\n spacer.style.fontFamily = config.fontFamily;\n spacer.style.fontWeight = 'normal';\n document.body.appendChild(spacer); \n } \n \n // Used to encode an HTML string into a plain text.\n // taken from http://stackoverflow.com/questions/1219860/javascript-jquery-html-encoding\n spacer.innerHTML = String(text).replace(/&/g, '&amp;')\n .replace(/\"/g, '&quot;')\n .replace(/'/g, '&#39;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;');\n return spacer.getBoundingClientRect().right;\n }", "function calculateWidthForText(text) {\n if (spacer === undefined) { // on first call only.\n spacer = document.createElement('span'); \n spacer.style.visibility = 'hidden';\n spacer.style.position = 'fixed';\n spacer.style.outline = '0';\n spacer.style.margin = '0';\n spacer.style.padding = '0';\n spacer.style.border = '0';\n spacer.style.left = '0';\n spacer.style.whiteSpace = 'pre';\n spacer.style.fontSize = config.fontSize;\n spacer.style.fontFamily = config.fontFamily;\n spacer.style.fontWeight = 'normal';\n document.body.appendChild(spacer); \n } \n \n // Used to encode an HTML string into a plain text.\n // taken from http://stackoverflow.com/questions/1219860/javascript-jquery-html-encoding\n spacer.innerHTML = String(text).replace(/&/g, '&amp;')\n .replace(/\"/g, '&quot;')\n .replace(/'/g, '&#39;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;');\n return spacer.getBoundingClientRect().right;\n }", "function calculateWidthForText(text) {\n if (spacer === undefined) { // on first call only.\n spacer = document.createElement('span'); \n spacer.style.visibility = 'hidden';\n spacer.style.position = 'fixed';\n spacer.style.outline = '0';\n spacer.style.margin = '0';\n spacer.style.padding = '0';\n spacer.style.border = '0';\n spacer.style.left = '0';\n spacer.style.whiteSpace = 'pre';\n spacer.style.fontSize = config.fontSize;\n spacer.style.fontFamily = config.fontFamily;\n spacer.style.fontWeight = 'normal';\n document.body.appendChild(spacer); \n } \n \n // Used to encode an HTML string into a plain text.\n // taken from http://stackoverflow.com/questions/1219860/javascript-jquery-html-encoding\n spacer.innerHTML = String(text).replace(/&/g, '&amp;')\n .replace(/\"/g, '&quot;')\n .replace(/'/g, '&#39;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;');\n return spacer.getBoundingClientRect().right;\n }", "get maxWidth() {}", "innerWidthDependsOnChilds(){if(this.__controlStretchedWidth)return!0;if(this.__columnOptions)for(const columnOption of this.__columnOptions)if(\"Content\"===columnOption.widthMode)return!0;return super.innerWidthDependsOnChilds()}", "function dxt1etc1Size(width, height) {\n return Math.floor((width + 3) / 4) * Math.floor((height + 3) / 4) * 8;\n }", "get width() {\n return this.right - this.left;\n }", "_getNonTransformedDimensions() {\n // Object dimensions\n return new fabric.Point(this.width, this.height).scalarAdd(\n this.padding + boundingBoxPadding\n )\n }", "get Width() { return this.x2 - this.x1; }", "get Width() { return this.x2 - this.x1; }", "function h(a){for(var b=y(\"isRTL\"),c=0;c<a.length;c++){var d=a[c],e=(b?d.isEnd:d.isStart)?R:P,f=(b?d.isStart:d.isEnd)?S:Q,g=e(d.leftCol),h=f(d.rightCol);d.left=g,d.outerWidth=h-g}}", "function q(){var e=p.getBoundingClientRect(),t=\"offset\"+[\"Width\",\"Height\"][r.ort];return 0===r.ort?e.width||p[t]:e.height||p[t]}", "function calculateTextWidth(text, rems) {\n if (typeof rems === \"undefined\") {\n rems = 1;\n }\n\n var $textDiv = $(\"<p>\").css({\n \"font-size\": convertRemToPixels(rems) + \"px\",\n \"position\": \"fixed\",\n \"right\": \"9999px\"\n });\n\n $(\"body\").append($textDiv);\n\n $textDiv.text(text);\n var width = $textDiv.width();\n\n $textDiv.remove();\n\n return width;\n}", "_updateDimensions() {\n if (!this._charSizeService.hasValidSize) {\n return;\n }\n // Calculate the scaled character width. Width is floored as it must be\n // drawn to an integer grid in order for the CharAtlas \"stamps\" to not be\n // blurry. When text is drawn to the grid not using the CharAtlas, it is\n // clipped to ensure there is no overlap with the next cell.\n this.dimensions.scaledCharWidth = Math.floor(this._charSizeService.width * window.devicePixelRatio);\n // Calculate the scaled character height. Height is ceiled in case\n // devicePixelRatio is a floating point number in order to ensure there is\n // enough space to draw the character to the cell.\n this.dimensions.scaledCharHeight = Math.ceil(this._charSizeService.height * window.devicePixelRatio);\n // Calculate the scaled cell height, if lineHeight is not 1 then the value\n // will be floored because since lineHeight can never be lower then 1, there\n // is a guarentee that the scaled line height will always be larger than\n // scaled char height.\n this.dimensions.scaledCellHeight = Math.floor(this.dimensions.scaledCharHeight * this._optionsService.options.lineHeight);\n // Calculate the y coordinate within a cell that text should draw from in\n // order to draw in the center of a cell.\n this.dimensions.scaledCharTop = this._optionsService.options.lineHeight === 1 ? 0 : Math.round((this.dimensions.scaledCellHeight - this.dimensions.scaledCharHeight) / 2);\n // Calculate the scaled cell width, taking the letterSpacing into account.\n this.dimensions.scaledCellWidth = this.dimensions.scaledCharWidth + Math.round(this._optionsService.options.letterSpacing);\n // Calculate the x coordinate with a cell that text should draw from in\n // order to draw in the center of a cell.\n this.dimensions.scaledCharLeft = Math.floor(this._optionsService.options.letterSpacing / 2);\n // Recalculate the canvas dimensions; scaled* define the actual number of\n // pixel in the canvas\n this.dimensions.scaledCanvasHeight = this._bufferService.rows * this.dimensions.scaledCellHeight;\n this.dimensions.scaledCanvasWidth = this._bufferService.cols * this.dimensions.scaledCellWidth;\n // The the size of the canvas on the page. It's very important that this\n // rounds to nearest integer and not ceils as browsers often set\n // window.devicePixelRatio as something like 1.100000023841858, when it's\n // actually 1.1. Ceiling causes blurriness as the backing canvas image is 1\n // pixel too large for the canvas element size.\n this.dimensions.canvasHeight = Math.round(this.dimensions.scaledCanvasHeight / window.devicePixelRatio);\n this.dimensions.canvasWidth = Math.round(this.dimensions.scaledCanvasWidth / window.devicePixelRatio);\n // Get the _actual_ dimensions of an individual cell. This needs to be\n // derived from the canvasWidth/Height calculated above which takes into\n // account window.devicePixelRatio. ICharSizeService.width/height by itself\n // is insufficient when the page is not at 100% zoom level as it's measured\n // in CSS pixels, but the actual char size on the canvas can differ.\n this.dimensions.actualCellHeight = this.dimensions.canvasHeight / this._bufferService.rows;\n this.dimensions.actualCellWidth = this.dimensions.canvasWidth / this._bufferService.cols;\n }", "get defaultCharacterWidth() { return this.viewState.heightOracle.charWidth; }", "function PdfStringLayouter(){/**\n * Checks whether the x co-ordinate is need to set as client size or not.\n * @hidden\n * @private\n */this.isOverloadWithPosition=false;//\n}", "wrapText(textElement, cWidth) {\n // Allow 'function' and 'this', for D3...\n /* eslint-disable func-names, no-invalid-this */\n textElement.each(function () {\n const thisText = Dthree.select(this);\n // Extract properties from D3 bound data, since they\n // don't seem to survive the call...\n thisText.attr({\n 'content': (ddd) => ddd.content,\n 'class': (ddd) => ddd.class,\n 'wrapwidth': (ddd) => ddd.wrapwidth,\n 'leading': (ddd) => ddd.leading,\n 'x': (ddd) => {\n let xVal = ddd.x;\n // Right-aligned?\n if (xVal < 0) {\n xVal += cWidth;\n }\n return xVal;\n },\n });\n const wrapWidth = thisText.attr('wrapwidth');\n // String content as reversed array, by word\n const content = thisText.attr('content');\n const words = content.split(/\\s+/).reverse();\n // X pos for tspans\n const xPos = `${ thisText.attr('x') }px`;\n // Bostock's original had a linecounter, but I don't seem to need that...\n let line = [];\n const leading = `${ thisText.attr('leading') }px`;\n let tspan = thisText.text(null).append('tspan').attr('x', xPos).attr('dy', 0);\n while (words.length > 0) {\n const word = words.pop();\n line.push(word);\n tspan.text(line.join(' '));\n if (tspan.node().getComputedTextLength() > wrapWidth) {\n // debugger;\n line.pop();\n tspan.text(line.join(' '));\n line = [ word ];\n tspan = thisText.append('tspan').attr('x', xPos).attr('dy', leading).text(word);\n }\n }\n });\n }", "get colliderWidth () {\n\t\tlet leftMostX = this.isSignMagnitude ? this.signLabel.x : ZERO;\n\t\tlet rightMostX = this.textLabel.x + this.textLabel.width;\n\t\treturn rightMostX - leftMostX;\n\t}", "function TSplit_doFitWidthFix(d,align){\n\tvar du = d;\n\tvar dd = d;\n\n\tswitch(this.Orientation) {\n\tcase 'h':\n\t\tbreak;\n\tcase 'v':\n\t\tswitch (align) {\n\t\t\tcase 'left':\n this.UpNode.changeWidth(+du);\n this.DownNode.changeWidth(-dd);\n\t\t\t\tbreak;\n\t\t\tcase 'right':\n this.UpNode.changeWidth(-du);\n this.DownNode.changeWidth(+dd);\n\t\t\t\tbreak;\n\t\t\tcase 'nil':\n this.DownNode.changeWidth(+dd);\n\t\t\t\tbreak;\n\t\t}\n\tcase 'n':\n\t\tbreak;\n\t}\n\tthis.doDOM_Refresh();\n}", "getTextWidth(text, font, size) {\n let e = d3.select(this.element)\n .append('svg').attr('id', 'textMeasureContainer')\n .append('text').attr('font-family', font).attr('font-size', size).text(text);\n let len = e.node().getComputedTextLength();\n d3.select(this.element).select('#textMeasureContainer').remove();\n\n return len;\n }", "getRenderedRight(){return e.System.Services.controlManager.checkControlGeometryByControl(this),this.__renderedSizeCache.right}", "function correctDimensions() {\n var width = visuals.getRecorderWidth(true);\n\n if (width < 1) {\n throw _videomailError2.default.create('Recorder width cannot be less than 1!', options);\n } else {\n containerElement.style.width = width + 'px';\n }\n }", "_getExtraLeftWidth(_id) {\n return this._getExtraSize(_id, 'left');\n }", "_getExtraLeftWidth(_id) {\n return this._getExtraSize(_id, 'left');\n }", "function jt(e,t,a){var n=e.options.lineWrapping,r=n&&zt(e);if(!t.measure.heights||n&&t.measure.width!=r){var f=t.measure.heights=[];if(n){t.measure.width=r;for(var o=t.text.firstChild.getClientRects(),i=0;i<o.length-1;i++){var s=o[i],c=o[i+1];Math.abs(s.bottom-c.bottom)>2&&f.push((s.bottom+c.top)/2-a.top)}}f.push(a.bottom-a.top)}}", "function visualLength(text)\n\t{\n\t\tvar ruler = document.getElementById(\"ruler\");\n\t\truler.innerHTML = text;\n\t\treturn ruler.offsetWidth;\n\t}", "getDimensions(width, height) {\n if (!width || !height) {\n return \"\";\n }\n if (!this.containsOnlyNumbers(width, height)) {\n return \"\";\n }\n return `${width}x${height}`;\n }", "getMaxWidthUnit(){return this.__maxWidthUnit}", "function fontSizeForDimensions(str, font, width, height, lower, upper) {\n // Lower and upper bounds for font\n lower = (lower === undefined) ? 0 : lower;\n upper = (upper === undefined) ? height : upper;\n\n // The font size we're guessing with\n var middle = Math.floor((upper + lower) / 2);\n\n if (middle === lower) {\n return middle;\n }\n\n // Get text dimensions\n var tsize = textsize(str, middle, font);\n\n return (\n // Are we above or below ?\n (tsize.width <= width && tsize.height <= height) ?\n // Go up\n fontSizeForDimensions(str, font, width, height, middle, upper) :\n // Go down\n fontSizeForDimensions(str, font, width, height, lower, middle)\n );\n}", "function calculateBounds(properties, laf, flags, iconLeft, dialogLeft) {\r\n\tvar rect = new Rectangle(0, 0, 0, 0);\r\n\t\r\n\tvar portrait = laf.getBoolean(\"is.portrait\", true);\r\n\tvar d = laf.getDimension(\"screen.size\");\r\n\tvar content = laf.getRectangle(\"content.pane.bounds\");\r\n\t\r\n\tvar padding = laf.getInteger(\"note.padding\", 2);\r\n\trect.width = Math.min(d.x, d.y) - padding*2;\r\n\tif (portrait) {\r\n\t\trect.x = content.x + (content.width - rect.width) / 2; \r\n\t}\r\n\telse {\r\n\t\trect.x = d.x - rect.width;\r\n\t}\r\n\t\t\r\n\tvar font = laf.getFont(\"message.font\");\r\n\r\n\tvar info = getTextInfo(properties, laf, font, flags, iconLeft, dialogLeft);\r\n\tvar extent = info[0];\r\n\tvar text = info[1];\r\n\tvar maxWidth = info[2];\r\n\tvar lineGap = info[3];\r\n\t\r\n\tvar height = extent.y + 7*2 + lineGap\r\n\t\r\n\tif (portrait)\r\n\t\trect.y = content.y + content.height - height - padding;\r\n\telse\r\n\t\trect.y = (d.y - height) / 2;\r\n\r\n\trect.height = height;\r\n\t\r\n\t// adjust for insets\r\n\tvar inset = laf.getDimension(\"note.inset\");\r\n\trect.x += inset.x;\r\n\trect.width -= (2 * inset.x);\r\n\trect.height -= (2 * inset.y);\r\n\t\r\n\t// add pixels for shadow\r\n\trect.width += 3;\r\n\trect.height += 3;\r\n\t\r\n\treturn rect;\r\n}", "function presentWrap(stringDimentions) {\n let dimensions = stringDimentions.split('x');\n // [ '43', '3', '21' ]\n\n let length = dimensions[0];\n let width = dimensions[1];\n let height = dimensions[2];\n\n let extra = Math.min((length * width), (width * height), (height * length));\n\n let total = (2 * length * width) + (2 * width * height) + (2 * height * length) + extra;\n console.log(total);\n return total;\n}", "getOuterWidth() {\n mustInherit();\n }", "function Themes_GetRectBorderThickness(interfaceLook)\n{\n\t//for now we hardcode this\n\treturn 1;\n}", "function updateWidthHeight() {\n\tvar width = (document.getElementById(\"clientText\").clientWidth - PADDING_PX) * PX_TO_INCH\n\tvar height = (document.getElementById(\"clientText\").clientHeight - PADDING_PX) * PX_TO_INCH;\n\n\tdocument.getElementById(\"width\").innerHTML = Math.round(width)\n\tdocument.getElementById(\"height\").innerHTML = Math.round(height);\n}", "function computeCustomizedWidth(){\n\tvar note_div = document.querySelector('#note_div');\n\tvar largeWidth = note_div.offsetWidth;\n\tvar margin = NOTE_MARGIN;\n\t//border = 2px\n\tvar border = window.getComputedStyle(note_div).borderWidth[0];\n\treturn (largeWidth - (2*border))/numOfKey -(2*margin) -1;\n}", "function findWidth() {\n if (noteStack == \"stack_bar_top\") {\n return \"100%\";\n }\n if (noteStack == \"stack_bar_bottom\") {\n return \"70%\";\n } else {\n return \"290px\";\n }\n }", "get halfDrawWidth() {\n return this.drawWidth / 2;\n }", "function _reCalculateDimensions(){\n keywordLookupTable = {\n '{{SCREEN_WIDTH}}' : screen.outerWidth(),\n '{{SCREEN_HEIGHT}}' : screen.outerHeight()\n };\n logger.logEvent({'msg': 'recalculated dimensions', 'new_table': keywordLookupTable});\n }", "function stbValign() {\n\t\t\t$(\".split-text-block.fullWidth .valign\").each(function(){\n\t\t\t\tvar height = $(this).outerHeight();\n\t\t\t\tvar margin = height / 2;\n\t\t\t\tvar rightHeight = $(this).parent('.right').siblings('.left').children('img').height();\n\t\t\t\tif (height > rightHeight) {\n\t\t\t\t\t// $(this).css({\"position\": \"relative\", \"margin-top\": \"inherit\", \"top\": \"inherit\", \"left\":\"inherit\", \"right\":\"inherit\", \"padding-bottom\":\"6rem\"});\n\t\t\t\t\t$(this).parent('.right').siblings('.left').height(height);\n\t\t\t\t} else {\n\t\t\t\t\t$(this).parent('.right').height(rightHeight).css('position','relative');\n\t\t\t\t\t$(this).css({\"position\": \"absolute\", \"margin-top\": \"-\"+margin+\"px\", \"top\": \"50%\", \"left\":\"0\", \"right\":\"0\", \"padding-bottom\":\"0\"});\n\t\t\t\t}\n\t\t\t\tif ($(window).width() < '868') {\n\t\t\t\t\t$(this).attr('style', '');\n\t\t\t\t\t$(this).parent('.right').siblings('.left').attr('style', '');\n\t\t\t\t}\n\t\t\t});\n\t\t}", "function getTextPositionInLabel(text) {\r\n\t\ttext = text + \"\";\r\n\t\treturn 15 - (text.length * 2.2); \r\n\t}", "function onResize(cm) {\n\t\t var d = cm.display;\n\t\t if (d.lastWrapHeight == d.wrapper.clientHeight && d.lastWrapWidth == d.wrapper.clientWidth)\n\t\t return;\n\t\t // Might be a text scaling operation, clear size caches.\n\t\t d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;\n\t\t d.scrollbarsClipped = false;\n\t\t cm.setSize();\n\t\t }", "function findDimensions(gd, sliderOpts) {\n var sliderLabels = Drawing.tester.selectAll('g.' + constants.labelGroupClass).data(sliderOpts._visibleSteps);\n sliderLabels.enter().append('g').classed(constants.labelGroupClass, true);\n\n // loop over fake buttons to find width / height\n var maxLabelWidth = 0;\n var labelHeight = 0;\n sliderLabels.each(function (stepOpts) {\n var labelGroup = d3.select(this);\n var text = drawLabel(labelGroup, {\n step: stepOpts\n }, sliderOpts);\n var textNode = text.node();\n if (textNode) {\n var bBox = Drawing.bBox(textNode);\n labelHeight = Math.max(labelHeight, bBox.height);\n maxLabelWidth = Math.max(maxLabelWidth, bBox.width);\n }\n });\n sliderLabels.remove();\n var dims = sliderOpts._dims = {};\n dims.inputAreaWidth = Math.max(constants.railWidth, constants.gripHeight);\n\n // calculate some overall dimensions - some of these are needed for\n // calculating the currentValue dimensions\n var graphSize = gd._fullLayout._size;\n dims.lx = graphSize.l + graphSize.w * sliderOpts.x;\n dims.ly = graphSize.t + graphSize.h * (1 - sliderOpts.y);\n if (sliderOpts.lenmode === 'fraction') {\n // fraction:\n dims.outerLength = Math.round(graphSize.w * sliderOpts.len);\n } else {\n // pixels:\n dims.outerLength = sliderOpts.len;\n }\n\n // The length of the rail, *excluding* padding on either end:\n dims.inputAreaStart = 0;\n dims.inputAreaLength = Math.round(dims.outerLength - sliderOpts.pad.l - sliderOpts.pad.r);\n var textableInputLength = dims.inputAreaLength - 2 * constants.stepInset;\n var availableSpacePerLabel = textableInputLength / (sliderOpts._stepCount - 1);\n var computedSpacePerLabel = maxLabelWidth + constants.labelPadding;\n dims.labelStride = Math.max(1, Math.ceil(computedSpacePerLabel / availableSpacePerLabel));\n dims.labelHeight = labelHeight;\n\n // loop over all possible values for currentValue to find the\n // area we need for it\n dims.currentValueMaxWidth = 0;\n dims.currentValueHeight = 0;\n dims.currentValueTotalHeight = 0;\n dims.currentValueMaxLines = 1;\n if (sliderOpts.currentvalue.visible) {\n // Get the dimensions of the current value label:\n var dummyGroup = Drawing.tester.append('g');\n sliderLabels.each(function (stepOpts) {\n var curValPrefix = drawCurrentValue(dummyGroup, sliderOpts, stepOpts.label);\n var curValSize = curValPrefix.node() && Drawing.bBox(curValPrefix.node()) || {\n width: 0,\n height: 0\n };\n var lines = svgTextUtils.lineCount(curValPrefix);\n dims.currentValueMaxWidth = Math.max(dims.currentValueMaxWidth, Math.ceil(curValSize.width));\n dims.currentValueHeight = Math.max(dims.currentValueHeight, Math.ceil(curValSize.height));\n dims.currentValueMaxLines = Math.max(dims.currentValueMaxLines, lines);\n });\n dims.currentValueTotalHeight = dims.currentValueHeight + sliderOpts.currentvalue.offset;\n dummyGroup.remove();\n }\n dims.height = dims.currentValueTotalHeight + constants.tickOffset + sliderOpts.ticklen + constants.labelOffset + dims.labelHeight + sliderOpts.pad.t + sliderOpts.pad.b;\n var xanchor = 'left';\n if (Lib.isRightAnchor(sliderOpts)) {\n dims.lx -= dims.outerLength;\n xanchor = 'right';\n }\n if (Lib.isCenterAnchor(sliderOpts)) {\n dims.lx -= dims.outerLength / 2;\n xanchor = 'center';\n }\n var yanchor = 'top';\n if (Lib.isBottomAnchor(sliderOpts)) {\n dims.ly -= dims.height;\n yanchor = 'bottom';\n }\n if (Lib.isMiddleAnchor(sliderOpts)) {\n dims.ly -= dims.height / 2;\n yanchor = 'middle';\n }\n dims.outerLength = Math.ceil(dims.outerLength);\n dims.height = Math.ceil(dims.height);\n dims.lx = Math.round(dims.lx);\n dims.ly = Math.round(dims.ly);\n var marginOpts = {\n y: sliderOpts.y,\n b: dims.height * FROM_BR[yanchor],\n t: dims.height * FROM_TL[yanchor]\n };\n if (sliderOpts.lenmode === 'fraction') {\n marginOpts.l = 0;\n marginOpts.xl = sliderOpts.x - sliderOpts.len * FROM_TL[xanchor];\n marginOpts.r = 0;\n marginOpts.xr = sliderOpts.x + sliderOpts.len * FROM_BR[xanchor];\n } else {\n marginOpts.x = sliderOpts.x;\n marginOpts.l = dims.outerLength * FROM_TL[xanchor];\n marginOpts.r = dims.outerLength * FROM_BR[xanchor];\n }\n Plots.autoMargin(gd, autoMarginId(sliderOpts), marginOpts);\n}", "function subtitleSidePosition(subWidth, titleWidth, subScale, titleScale, marginBetween) {\nvar subHalfWidth = (subWidth*subScale)/2;\nvar titleHalfWidth = (titleWidth*titleScale)/2;\n// Calculate how far from the center this title needs to be\nvar centerOffset = subHalfWidth + titleHalfWidth + marginBetween;\nvar offset = ($(window).width()/2) - centerOffset;\n\nreturn offset;\n}", "function checkTextWidth(text){\n const dummyElement = document.createElement(\"div\");\n dummyElement.style = \"font-family: 'Segoe UI'; font-size: 13px; font-weight: 400; opacity: 0;\";\n dummyElement.innerText = text;\n const dummyParent = document.getElementById(\"status_info\");\n dummyParent.appendChild(dummyElement);\n const textWidth = dummyElement.getBoundingClientRect().width;\n dummyParent.removeChild(dummyElement);\n return textWidth;\n }", "function fitText(ctx, str, font, style, width){\n\tvar l=36\n\tvar r=100\n\twhile (r-l>1){\n\t\tvar m=Math.floor((l+r)/2)\n\t\tctx.font = style + \" \" + m.toString()+\"px \"+font\n\t\tif (ctx.measureText(str).width <= width){\n\t\t\tl=m\n\t\t} else {\n\t\t\tr=m\n\t\t}\n\t}\n\treturn l\n}", "function getWidth(){\n\tif( $(\"#visualizationDiv\").width() > MAXWIDTH )\treturn MAXWIDTH - LEGENDWIDHT-20;\n\tif ($(\"#visualizationDiv\").width() < MOBILEBREAKPOINT ) return $(\"#visualizationDiv\").width();\n\treturn $(\"#visualizationDiv\").width() -LEGENDWIDHT-20;\n}", "get fullWidth() {\n\t\t\treturn this.width + self.margin.right + self.margin.left;\n\t\t}", "function resizeTwoFloatObejctsLeftKnown(left , right , papa){\n var widthPapa = $(papa).width();\n var widthLeft = $(left).width();\n $(right).width(widthPapa - widthLeft - 10);\n}", "getRenderedWidth(){return e.System.Services.controlManager.checkControlGeometryByControl(this),this.__renderedSizeCache.width}", "resizeCheck() {\n\t\tlet width = this.textWidth();\n\t\tlet height = this.textHeight();\n\n\t\tif (width != this._size.width || height != this._size.height) {\n\n\t\t\tthis._size = {\n\t\t\t\twidth: width,\n\t\t\t\theight: height\n\t\t\t};\n\n\t\t\tthis.onResize && this.onResize(this._size);\n\t\t\tthis.emit(EVENTS.CONTENTS.RESIZE, this._size);\n\t\t}\n\t}", "_measureLabel() {\r\n let drawContext = canvas._canvas.getContext(\"2d\");\r\n \r\n drawContext.save();\r\n this._setupText(drawContext);\r\n let measurements = drawContext.measureText(this._text);\r\n drawContext.restore();\r\n \r\n let numLines = 1 + (this._text.match(new RegExp(\"\\n\", \"g\")) || []).length;\r\n \r\n this._textWidth = measurements.width;\r\n this._textHeight = this._fontHeight * numLines;\r\n }", "function TSplit_doFitWidthEnh(d,align){\n\tswitch(this.Orientation) {\n\tcase 'h':\n this.UpNode.changeWidth(d);\n this.DownNode.changeWidth(d);\n\t\t\tthis.Width+=d;\t\t\t\t\t\n\t\tbreak;\n\tcase 'v':\n\t\t\tswitch (align) {\n\t\t\t\tcase 'left':\n this.UpNode.changeWidth(d);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'right':\n this.DownNode.changeWidth(d);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'nil':\n this.DownNode.changeWidth(d);\n\t\t\t\t\tbreak;\n\t\t\t}\t\t\t\t\t\n\t\t\tthis.Width += d;\n\t\tbreak;\n\tcase 'n':\n\t\tbreak;\n\t}\n\tthis.doDOM_Refresh();\n}", "function Ea(e){var t=ya(e.display),a=e.options.lineWrapping,n=a&&Math.max(5,e.display.scroller.clientWidth/va(e.display)-3);return function(r){if(he(e.doc,r))return 0;var f=0;if(r.widgets)for(var o=0;o<r.widgets.length;o++)r.widgets[o].height&&(f+=r.widgets[o].height);return a?f+(Math.ceil(r.text.length/n)||1)*t:f+t}}", "function I(){var e=p.getBoundingClientRect(),t=\"offset\"+[\"Width\",\"Height\"][i.ort];return 0===i.ort?e.width||p[t]:e.height||p[t]}", "getRenderedLeft(){return e.System.Services.controlManager.checkControlGeometryByControl(this),this.__renderedSizeCache.left}", "get width() { return this.#format.width; }", "function getWidth(self) {\r\n return (\r\n parseInt(self.clientWidth) -\r\n parseInt(window.getComputedStyle(self).getPropertyValue(\"padding-left\")) -\r\n parseInt(window.getComputedStyle(self).getPropertyValue(\"padding-right\"))\r\n );\r\n}", "function onResize(cm) {\n\t var d = cm.display;\n\t if (d.lastWrapHeight == d.wrapper.clientHeight && d.lastWrapWidth == d.wrapper.clientWidth)\n\t return;\n\t // Might be a text scaling operation, clear size caches.\n\t d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;\n\t d.scrollbarsClipped = false;\n\t cm.setSize();\n\t }", "function onResize(cm) {\n\t var d = cm.display;\n\t if (d.lastWrapHeight == d.wrapper.clientHeight && d.lastWrapWidth == d.wrapper.clientWidth)\n\t return;\n\t // Might be a text scaling operation, clear size caches.\n\t d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;\n\t d.scrollbarsClipped = false;\n\t cm.setSize();\n\t }", "function onResize(cm) {\n\t var d = cm.display;\n\t if (d.lastWrapHeight == d.wrapper.clientHeight && d.lastWrapWidth == d.wrapper.clientWidth)\n\t return;\n\t // Might be a text scaling operation, clear size caches.\n\t d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;\n\t d.scrollbarsClipped = false;\n\t cm.setSize();\n\t }", "getHandleWidth () {\n return this.props.dividerWidth + this.props.handleBleed * 2\n }", "dimension() {\n if (!this.item.width) {\n return '';\n }\n return `${this.item.width}px * ${this.item.height}px`;\n }", "function v(){var t=W.getBoundingClientRect(),e=\"offset\"+[\"Width\",\"Height\"][i.ort];return 0===i.ort?t.width||W[e]:t.height||W[e]}", "get size() {\n var padding = this.padding;\n var width = 0;\n var height = DEFAULT_EXPR_HEIGHT;\n var sizes = this.getHoleSizes();\n var scale_x = this.scale.x;\n\n if (this._stackVertically) {\n width = EMPTY_EXPR_WIDTH;\n height = 0;\n }\n\n if (sizes.length === 0) return { w:this._size.w, h:this._size.h };\n\n sizes.forEach((s) => {\n if (this._stackVertically) {\n height += s.h;\n width = Math.max(width, s.w);\n }\n else {\n height = Math.max(height, s.h);\n width += s.w + padding.inner;\n }\n });\n\n if (this._stackVertically) {\n width += padding.right + padding.left;\n }\n else {\n width += padding.right; // the end\n }\n\n return { w:width, h: height };\n }", "function calculateTextWidth (node) {\n /* istanbul ignore else */\n {\n const range = document.createRange();\n range.selectNode(node.firstChild);\n return range.getBoundingClientRect().width\n }\n}", "handleWrapping() {\n // Off the left or right\n if (this.x < 0) {\n this.x += width;\n }\n else if (this.x > width) {\n this.x -= width;\n }\n constrain(this.y, 0, height);\n }", "function ve(e){if(0==e.height)return 0;for(var t,a=e.text.length,n=e;t=se(n);){var r=t.find(0,!0);n=r.from.line,a+=r.from.ch-r.to.ch}for(n=e;t=ce(n);){var f=t.find(0,!0);a-=n.text.length-f.from.ch,n=f.to.line,a+=n.text.length-f.to.ch}return a}", "applyNodeDimensions() {\n if (this.nodeElements && this.nodeElements.length) {\n this.nodeElements.map(elem => {\n const nativeElement = elem.nativeElement;\n const node = this.graph.nodes.find(n => n.id === nativeElement.id);\n if (!node) {\n return;\n }\n // calculate the height\n let dims;\n try {\n dims = nativeElement.getBBox();\n if (!dims.width || !dims.height) {\n return;\n }\n }\n catch (ex) {\n // Skip drawing if element is not displayed - Firefox would throw an error here\n return;\n }\n if (this.nodeHeight) {\n node.dimension.height =\n node.dimension.height && node.meta.forceDimensions ? node.dimension.height : this.nodeHeight;\n }\n else {\n node.dimension.height =\n node.dimension.height && node.meta.forceDimensions ? node.dimension.height : dims.height;\n }\n if (this.nodeMaxHeight) {\n node.dimension.height = Math.max(node.dimension.height, this.nodeMaxHeight);\n }\n if (this.nodeMinHeight) {\n node.dimension.height = Math.min(node.dimension.height, this.nodeMinHeight);\n }\n if (this.nodeWidth) {\n node.dimension.width =\n node.dimension.width && node.meta.forceDimensions ? node.dimension.width : this.nodeWidth;\n }\n else {\n // calculate the width\n if (nativeElement.getElementsByTagName('text').length) {\n let maxTextDims;\n try {\n for (const textElem of nativeElement.getElementsByTagName('text')) {\n const currentBBox = textElem.getBBox();\n if (!maxTextDims) {\n maxTextDims = currentBBox;\n }\n else {\n if (currentBBox.width > maxTextDims.width) {\n maxTextDims.width = currentBBox.width;\n }\n if (currentBBox.height > maxTextDims.height) {\n maxTextDims.height = currentBBox.height;\n }\n }\n }\n }\n catch (ex) {\n // Skip drawing if element is not displayed - Firefox would throw an error here\n return;\n }\n node.dimension.width =\n node.dimension.width && node.meta.forceDimensions ? node.dimension.width : maxTextDims.width + 20;\n }\n else {\n node.dimension.width =\n node.dimension.width && node.meta.forceDimensions ? node.dimension.width : dims.width;\n }\n }\n if (this.nodeMaxWidth) {\n node.dimension.width = Math.max(node.dimension.width, this.nodeMaxWidth);\n }\n if (this.nodeMinWidth) {\n node.dimension.width = Math.min(node.dimension.width, this.nodeMinWidth);\n }\n });\n }\n }", "function getWidth() {\n\tvar width = document.getElementById(\"clientText\").clientWidth - PADDING_PX;\n\twidth = width * PX_TO_INCH * INCH_TO_METER * METER_TO_CM;\n\treturn width.toFixed(2);\n}", "function estimateWidth(item) {\n fontHeight = height(item);\n return estimate(textValue(item));\n}", "function estimateWidth(item) {\n fontHeight = height(item);\n return estimate(textValue(item));\n}", "function measureText(description) {\n const splitted = description.split(\"~~\");\n const ctx = document.createElement(\"canvas\").getContext(\"2d\");\n return Math.max(\n ctx.measureText(splitted[0]).width,\n ctx.measureText(splitted[1]).width\n );\n}", "handleWrapping() {\n // Off the left or right\n if (this.x < 0) {\n this.x += width;\n } else if (this.x > width) {\n this.x -= width;\n }\n // Off the top or bottom\n if (this.y < 0) {\n this.y += height;\n } else if (this.y > height) {\n this.y -= height;\n }\n }", "handleWrapping() {\n // Off the left or right\n if (this.x < 0) {\n this.x += width;\n } else if (this.x > width) {\n this.x -= width;\n }\n // Off the top or bottom\n if (this.y < 0) {\n this.y += height;\n } else if (this.y > height) {\n this.y -= height;\n }\n }", "function N() {\n var t = p.getBoundingClientRect(),\n e = \"offset\" + [\"Width\", \"Height\"][i.ort];\n return 0 === i.ort ? t.width || p[e] : t.height || p[e]\n }", "function findDimensions(gd, sliderOpts) {\n\t var sliderLabels = gd._tester.selectAll('g.' + constants.labelGroupClass)\n\t .data(sliderOpts.steps);\n\t\n\t sliderLabels.enter().append('g')\n\t .classed(constants.labelGroupClass, true);\n\t\n\t // loop over fake buttons to find width / height\n\t var maxLabelWidth = 0;\n\t var labelHeight = 0;\n\t sliderLabels.each(function(stepOpts) {\n\t var labelGroup = d3.select(this);\n\t\n\t var text = drawLabel(labelGroup, {step: stepOpts}, sliderOpts);\n\t\n\t var tWidth = (text.node() && Drawing.bBox(text.node()).width) || 0;\n\t\n\t // This just overwrites with the last. Which is fine as long as\n\t // the bounding box (probably incorrectly) measures the text *on\n\t // a single line*:\n\t labelHeight = (text.node() && Drawing.bBox(text.node()).height) || 0;\n\t\n\t maxLabelWidth = Math.max(maxLabelWidth, tWidth);\n\t });\n\t\n\t sliderLabels.remove();\n\t\n\t sliderOpts.inputAreaWidth = Math.max(\n\t constants.railWidth,\n\t constants.gripHeight\n\t );\n\t\n\t sliderOpts.currentValueMaxWidth = 0;\n\t sliderOpts.currentValueHeight = 0;\n\t sliderOpts.currentValueTotalHeight = 0;\n\t\n\t if(sliderOpts.currentvalue.visible) {\n\t // Get the dimensions of the current value label:\n\t var dummyGroup = gd._tester.append('g');\n\t\n\t sliderLabels.each(function(stepOpts) {\n\t var curValPrefix = drawCurrentValue(dummyGroup, sliderOpts, stepOpts.label);\n\t var curValSize = (curValPrefix.node() && Drawing.bBox(curValPrefix.node())) || {width: 0, height: 0};\n\t sliderOpts.currentValueMaxWidth = Math.max(sliderOpts.currentValueMaxWidth, Math.ceil(curValSize.width));\n\t sliderOpts.currentValueHeight = Math.max(sliderOpts.currentValueHeight, Math.ceil(curValSize.height));\n\t });\n\t\n\t sliderOpts.currentValueTotalHeight = sliderOpts.currentValueHeight + sliderOpts.currentvalue.offset;\n\t\n\t dummyGroup.remove();\n\t }\n\t\n\t var graphSize = gd._fullLayout._size;\n\t sliderOpts.lx = graphSize.l + graphSize.w * sliderOpts.x;\n\t sliderOpts.ly = graphSize.t + graphSize.h * (1 - sliderOpts.y);\n\t\n\t if(sliderOpts.lenmode === 'fraction') {\n\t // fraction:\n\t sliderOpts.outerLength = Math.round(graphSize.w * sliderOpts.len);\n\t } else {\n\t // pixels:\n\t sliderOpts.outerLength = sliderOpts.len;\n\t }\n\t\n\t // Set the length-wise padding so that the grip ends up *on* the end of\n\t // the bar when at either extreme\n\t sliderOpts.lenPad = Math.round(constants.gripWidth * 0.5);\n\t\n\t // The length of the rail, *excluding* padding on either end:\n\t sliderOpts.inputAreaStart = 0;\n\t sliderOpts.inputAreaLength = Math.round(sliderOpts.outerLength - sliderOpts.pad.l - sliderOpts.pad.r);\n\t\n\t var textableInputLength = sliderOpts.inputAreaLength - 2 * constants.stepInset;\n\t var availableSpacePerLabel = textableInputLength / (sliderOpts.steps.length - 1);\n\t var computedSpacePerLabel = maxLabelWidth + constants.labelPadding;\n\t sliderOpts.labelStride = Math.max(1, Math.ceil(computedSpacePerLabel / availableSpacePerLabel));\n\t sliderOpts.labelHeight = labelHeight;\n\t\n\t sliderOpts.height = sliderOpts.currentValueTotalHeight + constants.tickOffset + sliderOpts.ticklen + constants.labelOffset + sliderOpts.labelHeight + sliderOpts.pad.t + sliderOpts.pad.b;\n\t\n\t var xanchor = 'left';\n\t if(anchorUtils.isRightAnchor(sliderOpts)) {\n\t sliderOpts.lx -= sliderOpts.outerLength;\n\t xanchor = 'right';\n\t }\n\t if(anchorUtils.isCenterAnchor(sliderOpts)) {\n\t sliderOpts.lx -= sliderOpts.outerLength / 2;\n\t xanchor = 'center';\n\t }\n\t\n\t var yanchor = 'top';\n\t if(anchorUtils.isBottomAnchor(sliderOpts)) {\n\t sliderOpts.ly -= sliderOpts.height;\n\t yanchor = 'bottom';\n\t }\n\t if(anchorUtils.isMiddleAnchor(sliderOpts)) {\n\t sliderOpts.ly -= sliderOpts.height / 2;\n\t yanchor = 'middle';\n\t }\n\t\n\t sliderOpts.outerLength = Math.ceil(sliderOpts.outerLength);\n\t sliderOpts.height = Math.ceil(sliderOpts.height);\n\t sliderOpts.lx = Math.round(sliderOpts.lx);\n\t sliderOpts.ly = Math.round(sliderOpts.ly);\n\t\n\t Plots.autoMargin(gd, constants.autoMarginIdRoot + sliderOpts._index, {\n\t x: sliderOpts.x,\n\t y: sliderOpts.y,\n\t l: sliderOpts.outerLength * ({right: 1, center: 0.5}[xanchor] || 0),\n\t r: sliderOpts.outerLength * ({left: 1, center: 0.5}[xanchor] || 0),\n\t b: sliderOpts.height * ({top: 1, middle: 0.5}[yanchor] || 0),\n\t t: sliderOpts.height * ({bottom: 1, middle: 0.5}[yanchor] || 0)\n\t });\n\t}", "function H(){var t=f.getBoundingClientRect(),e=\"offset\"+[\"Width\",\"Height\"][n.ort];return 0===n.ort?t.width||f[e]:t.height||f[e]}", "function textFits(text, nrOfColumns) {\n\n if (renderTextDimensions(text, bottomFont.fontName, bottomFont.fontSize).length <\n (allDimensions.framedImageWidth / nrOfColumns\n - 0.02 * allDimensions.framedImageWidth)) { //leave some space between columns\n return true;\n }\n else {\n return false;\n }\n}", "redimension(fontSize, width, height) {\n this.fontSize = fontSize;\n\n // calculate the pixel dimensions of a single character\n var ctx = this.dimensionCanvas.getContext('2d');\n ctx.font = fontSize + \"px monospace\";\n this.div.style.fontSize = fontSize + \"px\";\n this.charWidth = ctx.measureText(' ').width;\n this.charHeight = fontSize * 1.2;\n\n // calculate the adjustment factors for bold font; bold monospace fonts\n // can be wider than normal weight; boldWidthAdjust is the value for the\n // CSS letter-spacing property to correct this; boldSizeScale provides\n // the scale factor for the font size to correct when letter spacing \n // isn't available (eg canvas rendering)\n ctx.font = \"bold \" + fontSize + \"px monospace\";\n this.boldWidthAdjust = this.charWidth - ctx.measureText(' ').width;\n this.boldSizeScale = this.charWidth / ctx.measureText(' ').width;\n\n // calculate the overall terminal dimensions in pixels and characters\n this.pixWidth = width - 10;\n this.pixHeight = height - 10;\n this.termCols = Math.floor(this.pixWidth / this.charWidth);\n this.termRows = Math.floor(this.pixHeight / this.charHeight);\n\n // Force a minimum size of 10 rows x 20 cols; this will cause visual\n // overflow if the terminal is made smaller\n if (this.termRows < 10) {\n this.termRows = 10\n }\n if (this.termCols < 20) {\n this.termCols = 20;\n }\n\n // The upper and lower limits of the scrollable region\n this.scrollMin = 0;\n this.scrollMax = this.termRows - 1;\n\n // delete all old elements in the terminal DOM node\n while (this.div.firstChild) {\n this.div.removeChild(this.div.firstChild);\n }\n this.rowNodes = [];\n\n // dimension and create the cursor DOM node\n this.cursorNode = document.createElement(\"div\");\n this.cursorNode.classList = \"term-cursor\";\n this.div.appendChild(this.cursorNode);\n this.cursorNode.style.width = this.charWidth + \"px\";\n this.cursorNode.style.height = this.charHeight + \"px\";\n\n // fill in the terminal DOM node for the current draw method\n if (this.drawMethod == 'DOM') {\n\n // build a DOM node for each row in the terminal\n for (var row = 0; row < this.termRows; row++) {\n var rowNode = document.createElement(\"div\");\n rowNode.style.top = row * this.charHeight + \"px\";\n rowNode.style.width = this.pixWidth + \"px\";\n rowNode.classList = \"term-row\";\n this.div.appendChild(rowNode);\n this.rowNodes.push(rowNode);\n }\n }\n else if (this.drawMethod == 'canvas') {\n this.canvas.width = this.pixWidth;\n this.canvas.height = this.pixHeight;\n this.div.appendChild(this.canvas);\n }\n\n // rebuild the character array and report the size change\n this.blankCharArray();\n this.sendResize(this.termRows, this.termCols);\n }", "function checkSize() {\n var truncate = function truncate() {\n if (line < 1) lineData = [that._ellipsis(\"\", line)];else lineData[line - 1] = that._ellipsis(lineData[line - 1], line);\n }; // Constraint the font size\n\n\n fS = max([fS, fMin]);\n fS = min([fS, fMax]);\n\n if (resize) {\n lH = fS * lHRatio;\n wrapper.fontSize(fS).lineHeight(lH);\n style[\"font-size\"] = fS;\n style[\"line-height\"] = lH;\n }\n\n wrapResults = wrapper(t);\n lineData = wrapResults.lines.filter(function (l) {\n return l !== \"\";\n });\n line = lineData.length;\n\n if (wrapResults.truncated) {\n if (resize) {\n fS--;\n\n if (fS < fMin) {\n fS = fMin;\n truncate();\n return;\n } else checkSize();\n } else truncate();\n }\n }", "getDotPatternSize() {\n //const { width } = this.getWindowDimensions();\n return 28; // 28 for all for now\n }", "function onResize(cm) {\n\t\t var d = cm.display;\n\t\t // Might be a text scaling operation, clear size caches.\n\t\t d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;\n\t\t d.scrollbarsClipped = false;\n\t\t cm.setSize();\n\t\t }", "function ImageDimensions() { }", "function getimagewidth(nfullimagewidth,nrating){\r\nvar nwidth = nfullimagewidth;\r\n return \"\\\"\" + nwidth + \"\\\" \"\r\n}" ]
[ "0.6419615", "0.62969416", "0.6237837", "0.60760343", "0.6073828", "0.5946762", "0.592194", "0.58706087", "0.585344", "0.57196945", "0.57196945", "0.5669483", "0.5669483", "0.56625825", "0.56436014", "0.56314695", "0.5612791", "0.55979156", "0.55979156", "0.55979156", "0.559383", "0.55796045", "0.55705154", "0.5567242", "0.55586636", "0.55430424", "0.55430424", "0.5527729", "0.55276865", "0.5524977", "0.55237615", "0.5514983", "0.5513239", "0.5505763", "0.55006903", "0.54877657", "0.5471048", "0.5456006", "0.54451567", "0.54445183", "0.54445183", "0.54237753", "0.5414351", "0.54021174", "0.5401391", "0.5397268", "0.53895456", "0.53873193", "0.5376529", "0.53726786", "0.5364806", "0.534578", "0.532809", "0.5327809", "0.53178614", "0.5310491", "0.5309663", "0.5302052", "0.52988523", "0.5296672", "0.5294386", "0.5290936", "0.52731943", "0.5270788", "0.52656764", "0.5250696", "0.5247208", "0.5246257", "0.5243847", "0.5239273", "0.52354085", "0.5233239", "0.5231169", "0.523096", "0.52306724", "0.52306724", "0.52306724", "0.5225136", "0.52218986", "0.5221037", "0.5216839", "0.52158123", "0.5214685", "0.5212564", "0.52113533", "0.5208194", "0.52051586", "0.52051586", "0.5204321", "0.5200287", "0.5200287", "0.51890814", "0.5183842", "0.51826453", "0.51816493", "0.5171523", "0.5170666", "0.51698565", "0.5164042", "0.51629525", "0.5160306" ]
0.0
-1
Outputs a number of spans to make up a line, taking highlighting and marked text into account.
function insertLineContent(line, builder, styles) { var spans = line.markedSpans, allText = line.text, at = 0; if (!spans) { for (var i$1 = 1; i$1 < styles.length; i$1+=2) { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); } return } var len = allText.length, pos = 0, i = 1, text = "", style, css; var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, collapsed, attributes; for (;;) { if (nextChange == pos) { // Update current marker set spanStyle = spanEndStyle = spanStartStyle = css = ""; attributes = null; collapsed = null; nextChange = Infinity; var foundBookmarks = [], endStyles = (void 0); for (var j = 0; j < spans.length; ++j) { var sp = spans[j], m = sp.marker; if (m.type == "bookmark" && sp.from == pos && m.widgetNode) { foundBookmarks.push(m); } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) { if (sp.to != null && sp.to != pos && nextChange > sp.to) { nextChange = sp.to; spanEndStyle = ""; } if (m.className) { spanStyle += " " + m.className; } if (m.css) { css = (css ? css + ";" : "") + m.css; } if (m.startStyle && sp.from == pos) { spanStartStyle += " " + m.startStyle; } if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); } // support for the old title property // https://github.com/codemirror/CodeMirror/pull/5673 if (m.title) { (attributes || (attributes = {})).title = m.title; } if (m.attributes) { for (var attr in m.attributes) { (attributes || (attributes = {}))[attr] = m.attributes[attr]; } } if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0)) { collapsed = sp; } } else if (sp.from > pos && nextChange > sp.from) { nextChange = sp.from; } } if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2) { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += " " + endStyles[j$1]; } } } if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2) { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } } if (collapsed && (collapsed.from || 0) == pos) { buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos, collapsed.marker, collapsed.from == null); if (collapsed.to == null) { return } if (collapsed.to == pos) { collapsed = false; } } } if (pos >= len) { break } var upto = Math.min(len, nextChange); while (true) { if (text) { var end = pos + text.length; if (!collapsed) { var tokenText = end > upto ? text.slice(0, upto - pos) : text; builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle, spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : "", css, attributes); } if (end >= upto) {text = text.slice(upto - pos); pos = upto; break} pos = end; spanStartStyle = ""; } text = allText.slice(at, at = styles[i++]); style = interpretTokenStyle(styles[i++], builder.cm.options); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function insertLineContent(line, builder, styles) {\n\t var spans = line.markedSpans, allText = line.text, at = 0;\n\t if (!spans) {\n\t for (var i = 1; i < styles.length; i+=2)\n\t builder.addToken(builder, allText.slice(at, at = styles[i]), interpretTokenStyle(styles[i+1], builder.cm.options));\n\t return;\n\t }\n\t\n\t var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n\t var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;\n\t for (;;) {\n\t if (nextChange == pos) { // Update current marker set\n\t spanStyle = spanEndStyle = spanStartStyle = title = css = \"\";\n\t collapsed = null; nextChange = Infinity;\n\t var foundBookmarks = [], endStyles\n\t for (var j = 0; j < spans.length; ++j) {\n\t var sp = spans[j], m = sp.marker;\n\t if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n\t foundBookmarks.push(m);\n\t } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n\t if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n\t nextChange = sp.to;\n\t spanEndStyle = \"\";\n\t }\n\t if (m.className) spanStyle += \" \" + m.className;\n\t if (m.css) css = (css ? css + \";\" : \"\") + m.css;\n\t if (m.startStyle && sp.from == pos) spanStartStyle += \" \" + m.startStyle;\n\t if (m.endStyle && sp.to == nextChange) (endStyles || (endStyles = [])).push(m.endStyle, sp.to)\n\t if (m.title && !title) title = m.title;\n\t if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n\t collapsed = sp;\n\t } else if (sp.from > pos && nextChange > sp.from) {\n\t nextChange = sp.from;\n\t }\n\t }\n\t if (endStyles) for (var j = 0; j < endStyles.length; j += 2)\n\t if (endStyles[j + 1] == nextChange) spanEndStyle += \" \" + endStyles[j]\n\t\n\t if (!collapsed || collapsed.from == pos) for (var j = 0; j < foundBookmarks.length; ++j)\n\t buildCollapsedSpan(builder, 0, foundBookmarks[j]);\n\t if (collapsed && (collapsed.from || 0) == pos) {\n\t buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n\t collapsed.marker, collapsed.from == null);\n\t if (collapsed.to == null) return;\n\t if (collapsed.to == pos) collapsed = false;\n\t }\n\t }\n\t if (pos >= len) break;\n\t\n\t var upto = Math.min(len, nextChange);\n\t while (true) {\n\t if (text) {\n\t var end = pos + text.length;\n\t if (!collapsed) {\n\t var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n\t builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n\t spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", title, css);\n\t }\n\t if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;}\n\t pos = end;\n\t spanStartStyle = \"\";\n\t }\n\t text = allText.slice(at, at = styles[i++]);\n\t style = interpretTokenStyle(styles[i++], builder.cm.options);\n\t }\n\t }\n\t }", "function insertLineContent(line, builder, styles) {\n\t\t var spans = line.markedSpans, allText = line.text, at = 0;\n\t\t if (!spans) {\n\t\t for (var i = 1; i < styles.length; i+=2)\n\t\t builder.addToken(builder, allText.slice(at, at = styles[i]), interpretTokenStyle(styles[i+1], builder.cm.options));\n\t\t return;\n\t\t }\n\t\t\n\t\t var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n\t\t var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;\n\t\t for (;;) {\n\t\t if (nextChange == pos) { // Update current marker set\n\t\t spanStyle = spanEndStyle = spanStartStyle = title = css = \"\";\n\t\t collapsed = null; nextChange = Infinity;\n\t\t var foundBookmarks = [], endStyles\n\t\t for (var j = 0; j < spans.length; ++j) {\n\t\t var sp = spans[j], m = sp.marker;\n\t\t if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n\t\t foundBookmarks.push(m);\n\t\t } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n\t\t if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n\t\t nextChange = sp.to;\n\t\t spanEndStyle = \"\";\n\t\t }\n\t\t if (m.className) spanStyle += \" \" + m.className;\n\t\t if (m.css) css = (css ? css + \";\" : \"\") + m.css;\n\t\t if (m.startStyle && sp.from == pos) spanStartStyle += \" \" + m.startStyle;\n\t\t if (m.endStyle && sp.to == nextChange) (endStyles || (endStyles = [])).push(m.endStyle, sp.to)\n\t\t if (m.title && !title) title = m.title;\n\t\t if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n\t\t collapsed = sp;\n\t\t } else if (sp.from > pos && nextChange > sp.from) {\n\t\t nextChange = sp.from;\n\t\t }\n\t\t }\n\t\t if (endStyles) for (var j = 0; j < endStyles.length; j += 2)\n\t\t if (endStyles[j + 1] == nextChange) spanEndStyle += \" \" + endStyles[j]\n\t\t\n\t\t if (!collapsed || collapsed.from == pos) for (var j = 0; j < foundBookmarks.length; ++j)\n\t\t buildCollapsedSpan(builder, 0, foundBookmarks[j]);\n\t\t if (collapsed && (collapsed.from || 0) == pos) {\n\t\t buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n\t\t collapsed.marker, collapsed.from == null);\n\t\t if (collapsed.to == null) return;\n\t\t if (collapsed.to == pos) collapsed = false;\n\t\t }\n\t\t }\n\t\t if (pos >= len) break;\n\t\t\n\t\t var upto = Math.min(len, nextChange);\n\t\t while (true) {\n\t\t if (text) {\n\t\t var end = pos + text.length;\n\t\t if (!collapsed) {\n\t\t var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n\t\t builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n\t\t spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", title, css);\n\t\t }\n\t\t if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;}\n\t\t pos = end;\n\t\t spanStartStyle = \"\";\n\t\t }\n\t\t text = allText.slice(at, at = styles[i++]);\n\t\t style = interpretTokenStyle(styles[i++], builder.cm.options);\n\t\t }\n\t\t }\n\t\t }", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i = 1; i < styles.length; i+=2)\n builder.addToken(builder, allText.slice(at, at = styles[i]), interpretTokenStyle(styles[i+1], builder.cm.options));\n return;\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = title = css = \"\";\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [];\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n if (m.className) spanStyle += \" \" + m.className;\n if (m.css) css = m.css;\n if (m.startStyle && sp.from == pos) spanStartStyle += \" \" + m.startStyle;\n if (m.endStyle && sp.to == nextChange) spanEndStyle += \" \" + m.endStyle;\n if (m.title && !title) title = m.title;\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n collapsed = sp;\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) return;\n if (collapsed.to == pos) collapsed = false;\n }\n if (!collapsed && foundBookmarks.length) for (var j = 0; j < foundBookmarks.length; ++j)\n buildCollapsedSpan(builder, 0, foundBookmarks[j]);\n }\n if (pos >= len) break;\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", title, css);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n }", "highlightSpan(span) {\n let hashes = hashesForSpan(span);\n if (hashes.length > 0) {\n let labels = createElement('div', {\n position: 'absolute',\n left: 0,\n top: 0,\n zIndex: 10\n });\n\n let allNodes = [];\n hashes.forEach((h, i) => {\n let color = this.colors[i % this.colors.length];\n let nodes = nodesForHash(h);\n\n // For figuring out where to attach the labels\n allNodes = allNodes.concat(nodes);\n\n // Draw underlines for each node\n nodes.forEach((n) => {\n // Calculate line height and number of lines\n let lineHeight = calculateLineHeight(n);\n let lines = Math.ceil(n.offsetHeight/lineHeight);\n let leftOffset = calculateLeftOffset(n);\n\n // Create the underline element\n n.style.position = 'relative';\n let underline = createElement('div', {\n borderTop: `2px solid ${color}`,\n height: `${lineHeight}px`,\n position: 'absolute',\n left: '0',\n right: '0',\n bottom: `-${lineHeight+(i*2)}px`,\n pointerEvents: 'none'\n });\n n.appendChild(underline);\n\n // So we can clean this up later\n this.highlights.push(underline);\n\n // Handle additional lines, if any\n [...Array(lines-1).keys()].forEach((l) => {\n // If last line,\n // figure out where the highlight ends on this line\n // by inserting a marker element.\n // Otherwise we can assume it extends the full line.\n let right = 0;\n if (l == lines - 2) {\n let marker = createElement('span');\n n.appendChild(marker);\n right = `${n.offsetWidth-marker.offsetLeft}px`;\n marker.remove();\n }\n\n let underline = createElement('div', {\n borderTop: `2px solid ${color}`,\n height: `${lineHeight}px`,\n position: 'absolute',\n left: `-${n.offsetLeft-leftOffset}px`,\n right: right,\n bottom: `-${lineHeight+(i*2)+((l+1)*(lineHeight-1))}px`,\n pointerEvents: 'none'\n });\n n.appendChild(underline);\n\n // So we can clean this up later\n this.highlights.push(underline);\n });\n });\n\n // Create the tag label for this hash\n let label = createElement('div', {\n background: color,\n color: '#fff',\n padding: '2px'\n });\n label.innerHTML = this.state.db.get(h).tags.join('<br />');\n labels.appendChild(label);\n });\n\n // Attach to left-most node\n allNodes.sort((a, b) => a.offsetLeft - b.offsetLeft);\n allNodes[0].appendChild(labels);\n labels.style.left = `-${allNodes[0].offsetLeft + labels.offsetWidth}px`;\n\n // So we can clean this up later\n this.highlights.push(labels);\n }\n }", "function insertLineContent(line, builder, styles) {\n\t var spans = line.markedSpans, allText = line.text, at = 0;\n\t if (!spans) {\n\t for (var i = 1; i < styles.length; i+=2)\n\t builder.addToken(builder, allText.slice(at, at = styles[i]), interpretTokenStyle(styles[i+1], builder.cm.options));\n\t return;\n\t }\n\n\t var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n\t var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;\n\t for (;;) {\n\t if (nextChange == pos) { // Update current marker set\n\t spanStyle = spanEndStyle = spanStartStyle = title = css = \"\";\n\t collapsed = null; nextChange = Infinity;\n\t var foundBookmarks = [], endStyles\n\t for (var j = 0; j < spans.length; ++j) {\n\t var sp = spans[j], m = sp.marker;\n\t if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n\t foundBookmarks.push(m);\n\t } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n\t if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n\t nextChange = sp.to;\n\t spanEndStyle = \"\";\n\t }\n\t if (m.className) spanStyle += \" \" + m.className;\n\t if (m.css) css = (css ? css + \";\" : \"\") + m.css;\n\t if (m.startStyle && sp.from == pos) spanStartStyle += \" \" + m.startStyle;\n\t if (m.endStyle && sp.to == nextChange) (endStyles || (endStyles = [])).push(m.endStyle, sp.to)\n\t if (m.title && !title) title = m.title;\n\t if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n\t collapsed = sp;\n\t } else if (sp.from > pos && nextChange > sp.from) {\n\t nextChange = sp.from;\n\t }\n\t }\n\t if (endStyles) for (var j = 0; j < endStyles.length; j += 2)\n\t if (endStyles[j + 1] == nextChange) spanEndStyle += \" \" + endStyles[j]\n\n\t if (!collapsed || collapsed.from == pos) for (var j = 0; j < foundBookmarks.length; ++j)\n\t buildCollapsedSpan(builder, 0, foundBookmarks[j]);\n\t if (collapsed && (collapsed.from || 0) == pos) {\n\t buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n\t collapsed.marker, collapsed.from == null);\n\t if (collapsed.to == null) return;\n\t if (collapsed.to == pos) collapsed = false;\n\t }\n\t }\n\t if (pos >= len) break;\n\n\t var upto = Math.min(len, nextChange);\n\t while (true) {\n\t if (text) {\n\t var end = pos + text.length;\n\t if (!collapsed) {\n\t var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n\t builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n\t spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", title, css);\n\t }\n\t if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;}\n\t pos = end;\n\t spanStartStyle = \"\";\n\t }\n\t text = allText.slice(at, at = styles[i++]);\n\t style = interpretTokenStyle(styles[i++], builder.cm.options);\n\t }\n\t }\n\t }", "function insertLineContent(line, builder, styles) {\n\t var spans = line.markedSpans, allText = line.text, at = 0;\n\t if (!spans) {\n\t for (var i = 1; i < styles.length; i+=2)\n\t builder.addToken(builder, allText.slice(at, at = styles[i]), interpretTokenStyle(styles[i+1], builder.cm.options));\n\t return;\n\t }\n\n\t var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n\t var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;\n\t for (;;) {\n\t if (nextChange == pos) { // Update current marker set\n\t spanStyle = spanEndStyle = spanStartStyle = title = css = \"\";\n\t collapsed = null; nextChange = Infinity;\n\t var foundBookmarks = [], endStyles\n\t for (var j = 0; j < spans.length; ++j) {\n\t var sp = spans[j], m = sp.marker;\n\t if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n\t foundBookmarks.push(m);\n\t } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n\t if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n\t nextChange = sp.to;\n\t spanEndStyle = \"\";\n\t }\n\t if (m.className) spanStyle += \" \" + m.className;\n\t if (m.css) css = (css ? css + \";\" : \"\") + m.css;\n\t if (m.startStyle && sp.from == pos) spanStartStyle += \" \" + m.startStyle;\n\t if (m.endStyle && sp.to == nextChange) (endStyles || (endStyles = [])).push(m.endStyle, sp.to)\n\t if (m.title && !title) title = m.title;\n\t if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n\t collapsed = sp;\n\t } else if (sp.from > pos && nextChange > sp.from) {\n\t nextChange = sp.from;\n\t }\n\t }\n\t if (endStyles) for (var j = 0; j < endStyles.length; j += 2)\n\t if (endStyles[j + 1] == nextChange) spanEndStyle += \" \" + endStyles[j]\n\n\t if (collapsed && (collapsed.from || 0) == pos) {\n\t buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n\t collapsed.marker, collapsed.from == null);\n\t if (collapsed.to == null) return;\n\t if (collapsed.to == pos) collapsed = false;\n\t }\n\t if (!collapsed && foundBookmarks.length) for (var j = 0; j < foundBookmarks.length; ++j)\n\t buildCollapsedSpan(builder, 0, foundBookmarks[j]);\n\t }\n\t if (pos >= len) break;\n\n\t var upto = Math.min(len, nextChange);\n\t while (true) {\n\t if (text) {\n\t var end = pos + text.length;\n\t if (!collapsed) {\n\t var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n\t builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n\t spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", title, css);\n\t }\n\t if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;}\n\t pos = end;\n\t spanStartStyle = \"\";\n\t }\n\t text = allText.slice(at, at = styles[i++]);\n\t style = interpretTokenStyle(styles[i++], builder.cm.options);\n\t }\n\t }\n\t }", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i = 1; i < styles.length; i+=2)\n builder.addToken(builder, allText.slice(at, at = styles[i]), interpretTokenStyle(styles[i+1], builder.cm.options));\n return;\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = title = css = \"\";\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [], endStyles\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n if (m.className) spanStyle += \" \" + m.className;\n if (m.css) css = (css ? css + \";\" : \"\") + m.css;\n if (m.startStyle && sp.from == pos) spanStartStyle += \" \" + m.startStyle;\n if (m.endStyle && sp.to == nextChange) (endStyles || (endStyles = [])).push(m.endStyle, sp.to)\n if (m.title && !title) title = m.title;\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n collapsed = sp;\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n if (endStyles) for (var j = 0; j < endStyles.length; j += 2)\n if (endStyles[j + 1] == nextChange) spanEndStyle += \" \" + endStyles[j]\n\n if (!collapsed || collapsed.from == pos) for (var j = 0; j < foundBookmarks.length; ++j)\n buildCollapsedSpan(builder, 0, foundBookmarks[j]);\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) return;\n if (collapsed.to == pos) collapsed = false;\n }\n }\n if (pos >= len) break;\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", title, css);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n }", "function render(){\n var i = spans.length,\n span;\n while (i-- > 0) {\n span = spans[i];\n renderSpan(span.start, span.end);\n }\n}", "function insertLineContent(line, builder, styles) {\r\n var spans = line.markedSpans, allText = line.text, at = 0;\r\n if (!spans) {\r\n for (var i$1 = 1; i$1 < styles.length; i$1+=2)\r\n { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }\r\n return\r\n }\r\n\r\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\r\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;\r\n for (;;) {\r\n if (nextChange == pos) { // Update current marker set\r\n spanStyle = spanEndStyle = spanStartStyle = title = css = \"\";\r\n collapsed = null; nextChange = Infinity;\r\n var foundBookmarks = [], endStyles = (void 0);\r\n for (var j = 0; j < spans.length; ++j) {\r\n var sp = spans[j], m = sp.marker;\r\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\r\n foundBookmarks.push(m);\r\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\r\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\r\n nextChange = sp.to;\r\n spanEndStyle = \"\";\r\n }\r\n if (m.className) { spanStyle += \" \" + m.className; }\r\n if (m.css) { css = (css ? css + \";\" : \"\") + m.css; }\r\n if (m.startStyle && sp.from == pos) { spanStartStyle += \" \" + m.startStyle; }\r\n if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }\r\n if (m.title && !title) { title = m.title; }\r\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\r\n { collapsed = sp; }\r\n } else if (sp.from > pos && nextChange > sp.from) {\r\n nextChange = sp.from;\r\n }\r\n }\r\n if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)\r\n { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += \" \" + endStyles[j$1]; } } }\r\n\r\n if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)\r\n { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }\r\n if (collapsed && (collapsed.from || 0) == pos) {\r\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\r\n collapsed.marker, collapsed.from == null);\r\n if (collapsed.to == null) { return }\r\n if (collapsed.to == pos) { collapsed = false; }\r\n }\r\n }\r\n if (pos >= len) { break }\r\n\r\n var upto = Math.min(len, nextChange);\r\n while (true) {\r\n if (text) {\r\n var end = pos + text.length;\r\n if (!collapsed) {\r\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\r\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\r\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", title, css);\r\n }\r\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}\r\n pos = end;\r\n spanStartStyle = \"\";\r\n }\r\n text = allText.slice(at, at = styles[i++]);\r\n style = interpretTokenStyle(styles[i++], builder.cm.options);\r\n }\r\n }\r\n}", "function cr(e,t,a,n){var r=t[\"spans_\"+e.id],f=0;e.iter(Math.max(e.first,a),Math.min(e.first+e.size,n),function(a){a.markedSpans&&((r||(r=t[\"spans_\"+e.id]={}))[f]=a.markedSpans),++f})}", "function insertLineContent(line, builder, styles) {\r\n var spans = line.markedSpans, allText = line.text, at = 0;\r\n if (!spans) {\r\n for (var i = 1; i < styles.length; i+=2)\r\n builder.addToken(builder, allText.slice(at, at = styles[i]), interpretTokenStyle(styles[i+1], builder.cm.options));\r\n return;\r\n }\r\n\r\n var len = allText.length, pos = 0, i = 1, text = \"\", style;\r\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;\r\n for (;;) {\r\n if (nextChange == pos) { // Update current marker set\r\n spanStyle = spanEndStyle = spanStartStyle = title = \"\";\r\n collapsed = null; nextChange = Infinity;\r\n var foundBookmarks = [];\r\n for (var j = 0; j < spans.length; ++j) {\r\n var sp = spans[j], m = sp.marker;\r\n if (sp.from <= pos && (sp.to == null || sp.to > pos)) {\r\n if (sp.to != null && nextChange > sp.to) { nextChange = sp.to; spanEndStyle = \"\"; }\r\n if (m.className) spanStyle += \" \" + m.className;\r\n if (m.startStyle && sp.from == pos) spanStartStyle += \" \" + m.startStyle;\r\n if (m.endStyle && sp.to == nextChange) spanEndStyle += \" \" + m.endStyle;\r\n if (m.title && !title) title = m.title;\r\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\r\n collapsed = sp;\r\n } else if (sp.from > pos && nextChange > sp.from) {\r\n nextChange = sp.from;\r\n }\r\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) foundBookmarks.push(m);\r\n }\r\n if (collapsed && (collapsed.from || 0) == pos) {\r\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\r\n collapsed.marker, collapsed.from == null);\r\n if (collapsed.to == null) return;\r\n }\r\n if (!collapsed && foundBookmarks.length) for (var j = 0; j < foundBookmarks.length; ++j)\r\n buildCollapsedSpan(builder, 0, foundBookmarks[j]);\r\n }\r\n if (pos >= len) break;\r\n\r\n var upto = Math.min(len, nextChange);\r\n while (true) {\r\n if (text) {\r\n var end = pos + text.length;\r\n if (!collapsed) {\r\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\r\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\r\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", title);\r\n }\r\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;}\r\n pos = end;\r\n spanStartStyle = \"\";\r\n }\r\n text = allText.slice(at, at = styles[i++]);\r\n style = interpretTokenStyle(styles[i++], builder.cm.options);\r\n }\r\n }\r\n }", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1+=2)\n { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }\n return\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = title = css = \"\";\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [], endStyles = (void 0);\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n if (m.className) { spanStyle += \" \" + m.className; }\n if (m.css) { css = (css ? css + \";\" : \"\") + m.css; }\n if (m.startStyle && sp.from == pos) { spanStartStyle += \" \" + m.startStyle; }\n if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }\n if (m.title && !title) { title = m.title; }\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n { collapsed = sp; }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)\n { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += \" \" + endStyles[j$1]; } } }\n\n if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)\n { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) { return }\n if (collapsed.to == pos) { collapsed = false; }\n }\n }\n if (pos >= len) { break }\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", title, css);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n }", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1+=2)\n { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }\n return\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = title = css = \"\";\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [], endStyles = (void 0);\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n if (m.className) { spanStyle += \" \" + m.className; }\n if (m.css) { css = (css ? css + \";\" : \"\") + m.css; }\n if (m.startStyle && sp.from == pos) { spanStartStyle += \" \" + m.startStyle; }\n if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }\n if (m.title && !title) { title = m.title; }\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n { collapsed = sp; }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)\n { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += \" \" + endStyles[j$1]; } } }\n\n if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)\n { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) { return }\n if (collapsed.to == pos) { collapsed = false; }\n }\n }\n if (pos >= len) { break }\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", title, css);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n }", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans;\n if (!spans) {\n for (var i = 1; i < styles.length; i+=2)\n builder.addToken(builder, styles[i], styleToClass(styles[i+1]));\n return;\n }\n\n var allText = line.text, len = allText.length;\n var pos = 0, i = 1, text = \"\", style;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, collapsed;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = \"\";\n collapsed = null; nextChange = Infinity;\n var foundBookmark = null;\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (sp.from <= pos && (sp.to == null || sp.to > pos)) {\n if (sp.to != null && nextChange > sp.to) { nextChange = sp.to; spanEndStyle = \"\"; }\n if (m.className) spanStyle += \" \" + m.className;\n if (m.startStyle && sp.from == pos) spanStartStyle += \" \" + m.startStyle;\n if (m.endStyle && sp.to == nextChange) spanEndStyle += \" \" + m.endStyle;\n if (m.collapsed && (!collapsed || collapsed.marker.width < m.width))\n collapsed = sp;\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n if (m.type == \"bookmark\" && sp.from == pos && m.replacedWith)\n foundBookmark = m.replacedWith;\n }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len : collapsed.to) - pos,\n collapsed.from != null && collapsed.marker.replacedWith);\n if (collapsed.to == null) return collapsed.marker.find();\n }\n if (foundBookmark && !collapsed) buildCollapsedSpan(builder, 0, foundBookmark);\n }\n if (pos >= len) break;\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style + spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\");\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;}\n pos = end;\n spanStartStyle = \"\";\n }\n text = styles[i++]; style = styleToClass(styles[i++]);\n }\n }\n }", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans;\n if (!spans) {\n for (var i = 1; i < styles.length; i+=2)\n builder.addToken(builder, styles[i], styleToClass(styles[i+1]));\n return;\n }\n\n var allText = line.text, len = allText.length;\n var pos = 0, i = 1, text = \"\", style;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, collapsed;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = \"\";\n collapsed = null; nextChange = Infinity;\n var foundBookmark = null;\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (sp.from <= pos && (sp.to == null || sp.to > pos)) {\n if (sp.to != null && nextChange > sp.to) { nextChange = sp.to; spanEndStyle = \"\"; }\n if (m.className) spanStyle += \" \" + m.className;\n if (m.startStyle && sp.from == pos) spanStartStyle += \" \" + m.startStyle;\n if (m.endStyle && sp.to == nextChange) spanEndStyle += \" \" + m.endStyle;\n if (m.collapsed && (!collapsed || collapsed.marker.width < m.width))\n collapsed = sp;\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n if (m.type == \"bookmark\" && sp.from == pos && m.replacedWith)\n foundBookmark = m.replacedWith;\n }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len : collapsed.to) - pos,\n collapsed.from != null && collapsed.marker.replacedWith);\n if (collapsed.to == null) return collapsed.marker.find();\n }\n if (foundBookmark && !collapsed) buildCollapsedSpan(builder, 0, foundBookmark);\n }\n if (pos >= len) break;\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style + spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\");\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;}\n pos = end;\n spanStartStyle = \"\";\n }\n text = styles[i++]; style = styleToClass(styles[i++]);\n }\n }\n }", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans;\n if (!spans) {\n for (var i = 1; i < styles.length; i+=2)\n builder.addToken(builder, styles[i], styleToClass(styles[i+1]));\n return;\n }\n\n var allText = line.text, len = allText.length;\n var pos = 0, i = 1, text = \"\", style;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, collapsed;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = \"\";\n collapsed = null; nextChange = Infinity;\n var foundBookmark = null;\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (sp.from <= pos && (sp.to == null || sp.to > pos)) {\n if (sp.to != null && nextChange > sp.to) { nextChange = sp.to; spanEndStyle = \"\"; }\n if (m.className) spanStyle += \" \" + m.className;\n if (m.startStyle && sp.from == pos) spanStartStyle += \" \" + m.startStyle;\n if (m.endStyle && sp.to == nextChange) spanEndStyle += \" \" + m.endStyle;\n if (m.collapsed && (!collapsed || collapsed.marker.width < m.width))\n collapsed = sp;\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n if (m.type == \"bookmark\" && sp.from == pos && m.replacedWith)\n foundBookmark = m.replacedWith;\n }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len : collapsed.to) - pos,\n collapsed.from != null && collapsed.marker.replacedWith);\n if (collapsed.to == null) return collapsed.marker.find();\n }\n if (foundBookmark && !collapsed) buildCollapsedSpan(builder, 0, foundBookmark);\n }\n if (pos >= len) break;\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style + spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\");\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;}\n pos = end;\n spanStartStyle = \"\";\n }\n text = styles[i++]; style = styleToClass(styles[i++]);\n }\n }\n }", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i = 1; i < styles.length; i+=2)\n builder.addToken(builder, allText.slice(at, at = styles[i]), interpretTokenStyle(styles[i+1], builder.cm.options));\n return;\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = title = \"\";\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [];\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (sp.from <= pos && (sp.to == null || sp.to > pos)) {\n if (sp.to != null && nextChange > sp.to) { nextChange = sp.to; spanEndStyle = \"\"; }\n if (m.className) spanStyle += \" \" + m.className;\n if (m.startStyle && sp.from == pos) spanStartStyle += \" \" + m.startStyle;\n if (m.endStyle && sp.to == nextChange) spanEndStyle += \" \" + m.endStyle;\n if (m.title && !title) title = m.title;\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n collapsed = sp;\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) foundBookmarks.push(m);\n }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) return;\n }\n if (!collapsed && foundBookmarks.length) for (var j = 0; j < foundBookmarks.length; ++j)\n buildCollapsedSpan(builder, 0, foundBookmarks[j]);\n }\n if (pos >= len) break;\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", title);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n }", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i = 1; i < styles.length; i+=2)\n builder.addToken(builder, allText.slice(at, at = styles[i]), interpretTokenStyle(styles[i+1], builder.cm.options));\n return;\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = title = \"\";\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [];\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (sp.from <= pos && (sp.to == null || sp.to > pos)) {\n if (sp.to != null && nextChange > sp.to) { nextChange = sp.to; spanEndStyle = \"\"; }\n if (m.className) spanStyle += \" \" + m.className;\n if (m.startStyle && sp.from == pos) spanStartStyle += \" \" + m.startStyle;\n if (m.endStyle && sp.to == nextChange) spanEndStyle += \" \" + m.endStyle;\n if (m.title && !title) title = m.title;\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n collapsed = sp;\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) foundBookmarks.push(m);\n }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) return;\n }\n if (!collapsed && foundBookmarks.length) for (var j = 0; j < foundBookmarks.length; ++j)\n buildCollapsedSpan(builder, 0, foundBookmarks[j]);\n }\n if (pos >= len) break;\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", title);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n }", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i = 1; i < styles.length; i+=2)\n builder.addToken(builder, allText.slice(at, at = styles[i]), interpretTokenStyle(styles[i+1], builder.cm.options));\n return;\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = title = \"\";\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [];\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (sp.from <= pos && (sp.to == null || sp.to > pos)) {\n if (sp.to != null && nextChange > sp.to) { nextChange = sp.to; spanEndStyle = \"\"; }\n if (m.className) spanStyle += \" \" + m.className;\n if (m.startStyle && sp.from == pos) spanStartStyle += \" \" + m.startStyle;\n if (m.endStyle && sp.to == nextChange) spanEndStyle += \" \" + m.endStyle;\n if (m.title && !title) title = m.title;\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n collapsed = sp;\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) foundBookmarks.push(m);\n }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) return;\n }\n if (!collapsed && foundBookmarks.length) for (var j = 0; j < foundBookmarks.length; ++j)\n buildCollapsedSpan(builder, 0, foundBookmarks[j]);\n }\n if (pos >= len) break;\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", title);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n }", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i = 1; i < styles.length; i+=2)\n builder.addToken(builder, allText.slice(at, at = styles[i]), interpretTokenStyle(styles[i+1], builder));\n return;\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = title = \"\";\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [];\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (sp.from <= pos && (sp.to == null || sp.to > pos)) {\n if (sp.to != null && nextChange > sp.to) { nextChange = sp.to; spanEndStyle = \"\"; }\n if (m.className) spanStyle += \" \" + m.className;\n if (m.startStyle && sp.from == pos) spanStartStyle += \" \" + m.startStyle;\n if (m.endStyle && sp.to == nextChange) spanEndStyle += \" \" + m.endStyle;\n if (m.title && !title) title = m.title;\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n collapsed = sp;\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n if (m.type == \"bookmark\" && sp.from == pos && m.replacedWith) foundBookmarks.push(m);\n }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) return collapsed.marker.find();\n }\n if (!collapsed && foundBookmarks.length) for (var j = 0; j < foundBookmarks.length; ++j)\n buildCollapsedSpan(builder, 0, foundBookmarks[j]);\n }\n if (pos >= len) break;\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", title);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder);\n }\n }\n }", "function insertLineContent(line, builder, styles) {\n\t\t var spans = line.markedSpans, allText = line.text, at = 0;\n\t\t if (!spans) {\n\t\t for (var i$1 = 1; i$1 < styles.length; i$1+=2)\n\t\t { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }\n\t\t return\n\t\t }\n\n\t\t var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n\t\t var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, collapsed, attributes;\n\t\t for (;;) {\n\t\t if (nextChange == pos) { // Update current marker set\n\t\t spanStyle = spanEndStyle = spanStartStyle = css = \"\";\n\t\t attributes = null;\n\t\t collapsed = null; nextChange = Infinity;\n\t\t var foundBookmarks = [], endStyles = (void 0);\n\t\t for (var j = 0; j < spans.length; ++j) {\n\t\t var sp = spans[j], m = sp.marker;\n\t\t if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n\t\t foundBookmarks.push(m);\n\t\t } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n\t\t if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n\t\t nextChange = sp.to;\n\t\t spanEndStyle = \"\";\n\t\t }\n\t\t if (m.className) { spanStyle += \" \" + m.className; }\n\t\t if (m.css) { css = (css ? css + \";\" : \"\") + m.css; }\n\t\t if (m.startStyle && sp.from == pos) { spanStartStyle += \" \" + m.startStyle; }\n\t\t if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }\n\t\t // support for the old title property\n\t\t // https://github.com/codemirror/CodeMirror/pull/5673\n\t\t if (m.title) { (attributes || (attributes = {})).title = m.title; }\n\t\t if (m.attributes) {\n\t\t for (var attr in m.attributes)\n\t\t { (attributes || (attributes = {}))[attr] = m.attributes[attr]; }\n\t\t }\n\t\t if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n\t\t { collapsed = sp; }\n\t\t } else if (sp.from > pos && nextChange > sp.from) {\n\t\t nextChange = sp.from;\n\t\t }\n\t\t }\n\t\t if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)\n\t\t { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += \" \" + endStyles[j$1]; } } }\n\n\t\t if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)\n\t\t { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }\n\t\t if (collapsed && (collapsed.from || 0) == pos) {\n\t\t buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n\t\t collapsed.marker, collapsed.from == null);\n\t\t if (collapsed.to == null) { return }\n\t\t if (collapsed.to == pos) { collapsed = false; }\n\t\t }\n\t\t }\n\t\t if (pos >= len) { break }\n\n\t\t var upto = Math.min(len, nextChange);\n\t\t while (true) {\n\t\t if (text) {\n\t\t var end = pos + text.length;\n\t\t if (!collapsed) {\n\t\t var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n\t\t builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n\t\t spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", css, attributes);\n\t\t }\n\t\t if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}\n\t\t pos = end;\n\t\t spanStartStyle = \"\";\n\t\t }\n\t\t text = allText.slice(at, at = styles[i++]);\n\t\t style = interpretTokenStyle(styles[i++], builder.cm.options);\n\t\t }\n\t\t }\n\t\t }", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1+=2)\n { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)) }\n return\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = title = css = \"\"\n collapsed = null; nextChange = Infinity\n var foundBookmarks = [], endStyles = (void 0)\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m)\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to\n spanEndStyle = \"\"\n }\n if (m.className) { spanStyle += \" \" + m.className }\n if (m.css) { css = (css ? css + \";\" : \"\") + m.css }\n if (m.startStyle && sp.from == pos) { spanStartStyle += \" \" + m.startStyle }\n if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to) }\n if (m.title && !title) { title = m.title }\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n { collapsed = sp }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from\n }\n }\n if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)\n { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += \" \" + endStyles[j$1] } } }\n\n if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)\n { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]) } }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null)\n if (collapsed.to == null) { return }\n if (collapsed.to == pos) { collapsed = false }\n }\n }\n if (pos >= len) { break }\n\n var upto = Math.min(len, nextChange)\n while (true) {\n if (text) {\n var end = pos + text.length\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", title, css)\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}\n pos = end\n spanStartStyle = \"\"\n }\n text = allText.slice(at, at = styles[i++])\n style = interpretTokenStyle(styles[i++], builder.cm.options)\n }\n }\n}", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1+=2)\n { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)) }\n return\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = title = css = \"\"\n collapsed = null; nextChange = Infinity\n var foundBookmarks = [], endStyles = (void 0)\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m)\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to\n spanEndStyle = \"\"\n }\n if (m.className) { spanStyle += \" \" + m.className }\n if (m.css) { css = (css ? css + \";\" : \"\") + m.css }\n if (m.startStyle && sp.from == pos) { spanStartStyle += \" \" + m.startStyle }\n if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to) }\n if (m.title && !title) { title = m.title }\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n { collapsed = sp }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from\n }\n }\n if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)\n { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += \" \" + endStyles[j$1] } } }\n\n if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)\n { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]) } }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null)\n if (collapsed.to == null) { return }\n if (collapsed.to == pos) { collapsed = false }\n }\n }\n if (pos >= len) { break }\n\n var upto = Math.min(len, nextChange)\n while (true) {\n if (text) {\n var end = pos + text.length\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", title, css)\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}\n pos = end\n spanStartStyle = \"\"\n }\n text = allText.slice(at, at = styles[i++])\n style = interpretTokenStyle(styles[i++], builder.cm.options)\n }\n }\n}", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i = 1; i < styles.length; i+=2)\n builder.addToken(builder, allText.slice(at, at = styles[i]), styleToClass(styles[i+1]));\n return;\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = title = \"\";\n collapsed = null; nextChange = Infinity;\n var foundBookmark = null;\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (sp.from <= pos && (sp.to == null || sp.to > pos)) {\n if (sp.to != null && nextChange > sp.to) { nextChange = sp.to; spanEndStyle = \"\"; }\n if (m.className) spanStyle += \" \" + m.className;\n if (m.startStyle && sp.from == pos) spanStartStyle += \" \" + m.startStyle;\n if (m.endStyle && sp.to == nextChange) spanEndStyle += \" \" + m.endStyle;\n if (m.title && !title) title = m.title;\n if (m.collapsed && (!collapsed || collapsed.marker.size < m.size))\n collapsed = sp;\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n if (m.type == \"bookmark\" && sp.from == pos && m.replacedWith) foundBookmark = m;\n }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) return collapsed.marker.find();\n }\n if (foundBookmark && !collapsed) buildCollapsedSpan(builder, 0, foundBookmark);\n }\n if (pos >= len) break;\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", title);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = styleToClass(styles[i++]);\n }\n }\n }", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i = 1; i < styles.length; i+=2)\n builder.addToken(builder, allText.slice(at, at = styles[i]), interpretTokenStyle(styles[i+1], builder));\n return;\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = title = \"\";\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [];\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (sp.from <= pos && (sp.to == null || sp.to > pos)) {\n if (sp.to != null && nextChange > sp.to) { nextChange = sp.to; spanEndStyle = \"\"; }\n if (m.className) spanStyle += \" \" + m.className;\n if (m.startStyle && sp.from == pos) spanStartStyle += \" \" + m.startStyle;\n if (m.endStyle && sp.to == nextChange) spanEndStyle += \" \" + m.endStyle;\n if (m.title && !title) title = m.title;\n if (m.collapsed && (!collapsed || collapsed.marker.size < m.size))\n collapsed = sp;\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n if (m.type == \"bookmark\" && sp.from == pos && m.replacedWith) foundBookmarks.push(m);\n }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) return collapsed.marker.find();\n }\n if (!collapsed && foundBookmarks.length) for (var j = 0; j < foundBookmarks.length; ++j)\n buildCollapsedSpan(builder, 0, foundBookmarks[j]);\n }\n if (pos >= len) break;\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", title);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder);\n }\n }\n }", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i = 1; i < styles.length; i+=2)\n builder.addToken(builder, allText.slice(at, at = styles[i]), interpretTokenStyle(styles[i+1], builder));\n return;\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = title = \"\";\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [];\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (sp.from <= pos && (sp.to == null || sp.to > pos)) {\n if (sp.to != null && nextChange > sp.to) { nextChange = sp.to; spanEndStyle = \"\"; }\n if (m.className) spanStyle += \" \" + m.className;\n if (m.startStyle && sp.from == pos) spanStartStyle += \" \" + m.startStyle;\n if (m.endStyle && sp.to == nextChange) spanEndStyle += \" \" + m.endStyle;\n if (m.title && !title) title = m.title;\n if (m.collapsed && (!collapsed || collapsed.marker.size < m.size))\n collapsed = sp;\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n if (m.type == \"bookmark\" && sp.from == pos && m.replacedWith) foundBookmarks.push(m);\n }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) return collapsed.marker.find();\n }\n if (!collapsed && foundBookmarks.length) for (var j = 0; j < foundBookmarks.length; ++j)\n buildCollapsedSpan(builder, 0, foundBookmarks[j]);\n }\n if (pos >= len) break;\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", title);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder);\n }\n }\n }", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1+=2)\n { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }\n return\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = title = css = \"\";\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [], endStyles = (void 0);\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n if (m.className) { spanStyle += \" \" + m.className; }\n if (m.css) { css = (css ? css + \";\" : \"\") + m.css; }\n if (m.startStyle && sp.from == pos) { spanStartStyle += \" \" + m.startStyle; }\n if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }\n if (m.title && !title) { title = m.title; }\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n { collapsed = sp; }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)\n { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += \" \" + endStyles[j$1]; } } }\n\n if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)\n { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) { return }\n if (collapsed.to == pos) { collapsed = false; }\n }\n }\n if (pos >= len) { break }\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", title, css);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n}", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1+=2)\n { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }\n return\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = title = css = \"\";\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [], endStyles = (void 0);\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n if (m.className) { spanStyle += \" \" + m.className; }\n if (m.css) { css = (css ? css + \";\" : \"\") + m.css; }\n if (m.startStyle && sp.from == pos) { spanStartStyle += \" \" + m.startStyle; }\n if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }\n if (m.title && !title) { title = m.title; }\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n { collapsed = sp; }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)\n { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += \" \" + endStyles[j$1]; } } }\n\n if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)\n { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) { return }\n if (collapsed.to == pos) { collapsed = false; }\n }\n }\n if (pos >= len) { break }\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", title, css);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n}", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1+=2)\n { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }\n return\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = title = css = \"\";\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [], endStyles = (void 0);\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n if (m.className) { spanStyle += \" \" + m.className; }\n if (m.css) { css = (css ? css + \";\" : \"\") + m.css; }\n if (m.startStyle && sp.from == pos) { spanStartStyle += \" \" + m.startStyle; }\n if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }\n if (m.title && !title) { title = m.title; }\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n { collapsed = sp; }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)\n { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += \" \" + endStyles[j$1]; } } }\n\n if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)\n { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) { return }\n if (collapsed.to == pos) { collapsed = false; }\n }\n }\n if (pos >= len) { break }\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", title, css);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n}", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1+=2)\n { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }\n return\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = title = css = \"\";\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [], endStyles = (void 0);\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n if (m.className) { spanStyle += \" \" + m.className; }\n if (m.css) { css = (css ? css + \";\" : \"\") + m.css; }\n if (m.startStyle && sp.from == pos) { spanStartStyle += \" \" + m.startStyle; }\n if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }\n if (m.title && !title) { title = m.title; }\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n { collapsed = sp; }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)\n { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += \" \" + endStyles[j$1]; } } }\n\n if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)\n { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) { return }\n if (collapsed.to == pos) { collapsed = false; }\n }\n }\n if (pos >= len) { break }\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", title, css);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n}", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1+=2)\n { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }\n return\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = title = css = \"\";\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [], endStyles = (void 0);\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n if (m.className) { spanStyle += \" \" + m.className; }\n if (m.css) { css = (css ? css + \";\" : \"\") + m.css; }\n if (m.startStyle && sp.from == pos) { spanStartStyle += \" \" + m.startStyle; }\n if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }\n if (m.title && !title) { title = m.title; }\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n { collapsed = sp; }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)\n { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += \" \" + endStyles[j$1]; } } }\n\n if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)\n { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) { return }\n if (collapsed.to == pos) { collapsed = false; }\n }\n }\n if (pos >= len) { break }\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", title, css);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n}", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1+=2)\n { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }\n return\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = title = css = \"\";\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [], endStyles = (void 0);\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n if (m.className) { spanStyle += \" \" + m.className; }\n if (m.css) { css = (css ? css + \";\" : \"\") + m.css; }\n if (m.startStyle && sp.from == pos) { spanStartStyle += \" \" + m.startStyle; }\n if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }\n if (m.title && !title) { title = m.title; }\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n { collapsed = sp; }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)\n { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += \" \" + endStyles[j$1]; } } }\n\n if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)\n { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) { return }\n if (collapsed.to == pos) { collapsed = false; }\n }\n }\n if (pos >= len) { break }\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", title, css);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n}", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1+=2)\n { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }\n return\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = title = css = \"\";\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [], endStyles = (void 0);\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n if (m.className) { spanStyle += \" \" + m.className; }\n if (m.css) { css = (css ? css + \";\" : \"\") + m.css; }\n if (m.startStyle && sp.from == pos) { spanStartStyle += \" \" + m.startStyle; }\n if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }\n if (m.title && !title) { title = m.title; }\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n { collapsed = sp; }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)\n { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += \" \" + endStyles[j$1]; } } }\n\n if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)\n { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) { return }\n if (collapsed.to == pos) { collapsed = false; }\n }\n }\n if (pos >= len) { break }\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", title, css);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n}", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1+=2)\n { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }\n return\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = title = css = \"\";\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [], endStyles = (void 0);\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n if (m.className) { spanStyle += \" \" + m.className; }\n if (m.css) { css = (css ? css + \";\" : \"\") + m.css; }\n if (m.startStyle && sp.from == pos) { spanStartStyle += \" \" + m.startStyle; }\n if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }\n if (m.title && !title) { title = m.title; }\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n { collapsed = sp; }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)\n { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += \" \" + endStyles[j$1]; } } }\n\n if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)\n { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) { return }\n if (collapsed.to == pos) { collapsed = false; }\n }\n }\n if (pos >= len) { break }\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", title, css);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n}", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1+=2)\n { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }\n return\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = title = css = \"\";\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [], endStyles = (void 0);\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n if (m.className) { spanStyle += \" \" + m.className; }\n if (m.css) { css = (css ? css + \";\" : \"\") + m.css; }\n if (m.startStyle && sp.from == pos) { spanStartStyle += \" \" + m.startStyle; }\n if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }\n if (m.title && !title) { title = m.title; }\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n { collapsed = sp; }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)\n { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += \" \" + endStyles[j$1]; } } }\n\n if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)\n { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) { return }\n if (collapsed.to == pos) { collapsed = false; }\n }\n }\n if (pos >= len) { break }\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", title, css);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n}", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1+=2)\n { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }\n return\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = title = css = \"\";\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [], endStyles = (void 0);\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n if (m.className) { spanStyle += \" \" + m.className; }\n if (m.css) { css = (css ? css + \";\" : \"\") + m.css; }\n if (m.startStyle && sp.from == pos) { spanStartStyle += \" \" + m.startStyle; }\n if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }\n if (m.title && !title) { title = m.title; }\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n { collapsed = sp; }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)\n { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += \" \" + endStyles[j$1]; } } }\n\n if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)\n { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) { return }\n if (collapsed.to == pos) { collapsed = false; }\n }\n }\n if (pos >= len) { break }\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", title, css);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n}", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1+=2)\n { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }\n return\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = title = css = \"\";\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [], endStyles = (void 0);\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n if (m.className) { spanStyle += \" \" + m.className; }\n if (m.css) { css = (css ? css + \";\" : \"\") + m.css; }\n if (m.startStyle && sp.from == pos) { spanStartStyle += \" \" + m.startStyle; }\n if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }\n if (m.title && !title) { title = m.title; }\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n { collapsed = sp; }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)\n { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += \" \" + endStyles[j$1]; } } }\n\n if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)\n { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) { return }\n if (collapsed.to == pos) { collapsed = false; }\n }\n }\n if (pos >= len) { break }\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", title, css);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n}", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i = 1; i < styles.length; i+=2)\n builder.addToken(builder, allText.slice(at, at = styles[i]), interpretTokenStyle(styles[i+1], builder.cm.options));\n return;\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = title = css = \"\";\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [];\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (sp.from <= pos && (sp.to == null || sp.to > pos)) {\n if (sp.to != null && nextChange > sp.to) { nextChange = sp.to; spanEndStyle = \"\"; }\n if (m.className) spanStyle += \" \" + m.className;\n if (m.css) css = m.css;\n if (m.startStyle && sp.from == pos) spanStartStyle += \" \" + m.startStyle;\n if (m.endStyle && sp.to == nextChange) spanEndStyle += \" \" + m.endStyle;\n if (m.title && !title) title = m.title;\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n collapsed = sp;\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) foundBookmarks.push(m);\n }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) return;\n }\n if (!collapsed && foundBookmarks.length) for (var j = 0; j < foundBookmarks.length; ++j)\n buildCollapsedSpan(builder, 0, foundBookmarks[j]);\n }\n if (pos >= len) break;\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", title, css);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n }", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i = 1; i < styles.length; i+=2)\n builder.addToken(builder, allText.slice(at, at = styles[i]), interpretTokenStyle(styles[i+1], builder.cm.options));\n return;\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = title = css = \"\";\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [];\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (sp.from <= pos && (sp.to == null || sp.to > pos)) {\n if (sp.to != null && nextChange > sp.to) { nextChange = sp.to; spanEndStyle = \"\"; }\n if (m.className) spanStyle += \" \" + m.className;\n if (m.css) css = m.css;\n if (m.startStyle && sp.from == pos) spanStartStyle += \" \" + m.startStyle;\n if (m.endStyle && sp.to == nextChange) spanEndStyle += \" \" + m.endStyle;\n if (m.title && !title) title = m.title;\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n collapsed = sp;\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) foundBookmarks.push(m);\n }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) return;\n }\n if (!collapsed && foundBookmarks.length) for (var j = 0; j < foundBookmarks.length; ++j)\n buildCollapsedSpan(builder, 0, foundBookmarks[j]);\n }\n if (pos >= len) break;\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", title, css);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n }", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans,\n allText = line.text,\n at = 0;\n\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1 += 2) {\n builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1 + 1], builder.cm.options));\n }\n\n return;\n }\n\n var len = allText.length,\n pos = 0,\n i = 1,\n text = \"\",\n style,\n css;\n var nextChange = 0,\n spanStyle,\n spanEndStyle,\n spanStartStyle,\n collapsed,\n attributes;\n\n for (;;) {\n if (nextChange == pos) {\n // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = css = \"\";\n attributes = null;\n collapsed = null;\n nextChange = Infinity;\n var foundBookmarks = [],\n endStyles = void 0;\n\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j],\n m = sp.marker;\n\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n\n if (m.className) {\n spanStyle += \" \" + m.className;\n }\n\n if (m.css) {\n css = (css ? css + \";\" : \"\") + m.css;\n }\n\n if (m.startStyle && sp.from == pos) {\n spanStartStyle += \" \" + m.startStyle;\n }\n\n if (m.endStyle && sp.to == nextChange) {\n (endStyles || (endStyles = [])).push(m.endStyle, sp.to);\n } // support for the old title property\n // https://github.com/codemirror/CodeMirror/pull/5673\n\n\n if (m.title) {\n (attributes || (attributes = {})).title = m.title;\n }\n\n if (m.attributes) {\n for (var attr in m.attributes) {\n (attributes || (attributes = {}))[attr] = m.attributes[attr];\n }\n }\n\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0)) {\n collapsed = sp;\n }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n\n if (endStyles) {\n for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2) {\n if (endStyles[j$1 + 1] == nextChange) {\n spanEndStyle += \" \" + endStyles[j$1];\n }\n }\n }\n\n if (!collapsed || collapsed.from == pos) {\n for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2) {\n buildCollapsedSpan(builder, 0, foundBookmarks[j$2]);\n }\n }\n\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos, collapsed.marker, collapsed.from == null);\n\n if (collapsed.to == null) {\n return;\n }\n\n if (collapsed.to == pos) {\n collapsed = false;\n }\n }\n }\n\n if (pos >= len) {\n break;\n }\n\n var upto = Math.min(len, nextChange);\n\n while (true) {\n if (text) {\n var end = pos + text.length;\n\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle, spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", css, attributes);\n }\n\n if (end >= upto) {\n text = text.slice(upto - pos);\n pos = upto;\n break;\n }\n\n pos = end;\n spanStartStyle = \"\";\n }\n\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n } // These objects are used to represent the visible (currently drawn)", "function addMarkedSpan(line, span) {\n\t\t line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n\t\t span.marker.attachLine(line);\n\t\t }", "function Q(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}", "function addMarkedSpan(line, span) {\n\t line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n\t span.marker.attachLine(line);\n\t }", "function addMarkedSpan(line, span) {\n\t line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n\t span.marker.attachLine(line);\n\t }", "function addMarkedSpan(line, span) {\n\t line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n\t span.marker.attachLine(line);\n\t }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\r\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\r\n span.marker.attachLine(line);\r\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span]\n span.marker.attachLine(line)\n}", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span]\n span.marker.attachLine(line)\n}", "function addMarkedSpan(line, span) {\r\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\r\n span.marker.attachLine(line);\r\n}", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n}", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n}", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n}", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n}", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n}", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n}", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n}", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n}", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n}", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n}", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n}", "function removeMarkedSpan(spans, span) {\n var r;\n\n for (var i = 0; i < spans.length; ++i) {\n if (spans[i] != span) {\n (r || (r = [])).push(spans[i]);\n }\n }\n\n return r;\n } // Add a span to a line.", "markWords(array, index1, index2){\r\n let modArr = [];\r\n array.forEach(function(value, i) {\r\n if (i == index1 || i == index2){\r\n if (i == array.length - 1){\r\n modArr.push(<mark key={i}>{value}</mark>);\r\n }\r\n else{\r\n modArr.push(<span key={i}><mark>{value}</mark>, </span>);\r\n }\r\n }\r\n else{\r\n let val = \"\";\r\n if (i == array.length - 1){\r\n val = value;\r\n }\r\n else{\r\n val = value + \", \"\r\n }\r\n modArr.push(val);\r\n }\r\n });\r\n console.log();\r\n return modArr;\r\n }", "function paintFirstSpanInLine(){\n var oldTop;\n // target = our text\n var $selected = $('#selectme');\n //$selectedArray = $selected.text().split(' ');\n // separate each word into its own span\n $selected.html(\"<span>\" + $selected.text().split(' ').join(\"</span> <span>\") + \"</span>\");\n oldTop = -1;\n $selected.find('span').each(function(){\n var $this = $(this),\n top = $this.position().top;\n if (top > oldTop){\n $this.css(\"color\", \"rgb(0, 255, 180)\");\n oldTop = top;\n }\n });\n}", "function renderSpans(text, spans) {\n if (!spans) {\n return [text];\n }\n if (spans.length > 1000) {\n console.warn(`Not highlighting excessive number of spans to avoid browser hang: ${spans.length}`);\n return [text];\n }\n var out = [];\n var c = 0;\n for (var i = 0; i < spans.length; i += 2) {\n out.push(text.slice(c, c + spans[i]));\n c += spans[i];\n if (i + 1 < spans.length) {\n out.push(createElement('span',\n {className: 'mm', title: 'not present in all failure messages'},\n text.slice(c, c + spans[i+1])));\n c += spans[i + 1];\n }\n }\n return out;\n}", "function insertLineBreaks() {\n var el = d3.select(this);\n var words=d3.select(this).text().split('#');\n \n el.text('');\n \n for (var i = 0; i < words.length; i++) {\n var tspan = el.append('tspan').text(words[i]);\n if (i > 0) {\n tspan.attr('x', 0).attr('dy', '15');\n }\n };\n }" ]
[ "0.6612778", "0.66099524", "0.6578742", "0.6569854", "0.6564896", "0.6564896", "0.6545556", "0.6532712", "0.65212727", "0.65170527", "0.65070033", "0.6499207", "0.6499207", "0.649153", "0.649153", "0.649153", "0.6460711", "0.6460711", "0.6460711", "0.6459593", "0.6459526", "0.6459344", "0.6459344", "0.6451327", "0.6447903", "0.6447903", "0.64444906", "0.64444906", "0.64444906", "0.64444906", "0.64444906", "0.64444906", "0.64444906", "0.64444906", "0.64444906", "0.64444906", "0.64444906", "0.6414536", "0.6414536", "0.63931286", "0.6307955", "0.6262192", "0.62446964", "0.62446964", "0.62446964", "0.62247556", "0.62247556", "0.62247556", "0.62247556", "0.62247556", "0.62247556", "0.62247556", "0.62247556", "0.62247556", "0.62247556", "0.62247556", "0.62247556", "0.62247556", "0.62247556", "0.62247556", "0.62247556", "0.62247556", "0.62247556", "0.62247556", "0.62247556", "0.62247556", "0.6211163", "0.6144393", "0.6144393", "0.614391", "0.61373377", "0.61373377", "0.61373377", "0.61373377", "0.61373377", "0.61373377", "0.61373377", "0.61373377", "0.61373377", "0.61373377", "0.61373377", "0.6075585", "0.60376346", "0.60249186", "0.60023046", "0.5993967" ]
0.64115644
52
These objects are used to represent the visible (currently drawn) part of the document. A LineView may correspond to multiple logical lines, if those are connected by collapsed ranges.
function LineView(doc, line, lineN) { // The starting line this.line = line; // Continuing lines, if any this.rest = visualLineContinued(line); // Number of logical lines in this visual line this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1; this.node = this.text = null; this.hidden = lineIsHidden(doc, line); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line; // Continuing lines, if any\n\n this.rest = visualLineContinued(line); // Number of logical lines in this visual line\n\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n } // Create a range of LineView objects for the given lines.", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line\n // Continuing lines, if any\n this.rest = visualLineContinued(line)\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1\n this.node = this.text = null\n this.hidden = lineIsHidden(doc, line)\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line\n // Continuing lines, if any\n this.rest = visualLineContinued(line)\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1\n this.node = this.text = null\n this.hidden = lineIsHidden(doc, line)\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\r\n // The starting line\r\n this.line = line;\r\n // Continuing lines, if any\r\n this.rest = visualLineContinued(line);\r\n // Number of logical lines in this visual line\r\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\r\n this.node = this.text = null;\r\n this.hidden = lineIsHidden(doc, line);\r\n}", "function LineView(doc, line, lineN) {\n\t\t // The starting line\n\t\t this.line = line;\n\t\t // Continuing lines, if any\n\t\t this.rest = visualLineContinued(line);\n\t\t // Number of logical lines in this visual line\n\t\t this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n\t\t this.node = this.text = null;\n\t\t this.hidden = lineIsHidden(doc, line);\n\t\t }", "function LineView(doc, line, lineN) {\n\t\t // The starting line\n\t\t this.line = line;\n\t\t // Continuing lines, if any\n\t\t this.rest = visualLineContinued(line);\n\t\t // Number of logical lines in this visual line\n\t\t this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n\t\t this.node = this.text = null;\n\t\t this.hidden = lineIsHidden(doc, line);\n\t\t }", "function LineView(doc, line, lineN) {\r\n // The starting line\r\n this.line = line;\r\n // Continuing lines, if any\r\n this.rest = visualLineContinued(line);\r\n // Number of logical lines in this visual line\r\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\r\n this.node = this.text = null;\r\n this.hidden = lineIsHidden(doc, line);\r\n }", "function LineView(doc, line, lineN) {\n\t // The starting line\n\t this.line = line;\n\t // Continuing lines, if any\n\t this.rest = visualLineContinued(line);\n\t // Number of logical lines in this visual line\n\t this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n\t this.node = this.text = null;\n\t this.hidden = lineIsHidden(doc, line);\n\t }", "function LineView(doc, line, lineN) {\n\t // The starting line\n\t this.line = line;\n\t // Continuing lines, if any\n\t this.rest = visualLineContinued(line);\n\t // Number of logical lines in this visual line\n\t this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n\t this.node = this.text = null;\n\t this.hidden = lineIsHidden(doc, line);\n\t }", "function LineView(doc, line, lineN) {\n\t // The starting line\n\t this.line = line;\n\t // Continuing lines, if any\n\t this.rest = visualLineContinued(line);\n\t // Number of logical lines in this visual line\n\t this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n\t this.node = this.text = null;\n\t this.hidden = lineIsHidden(doc, line);\n\t }", "_calcVisibleLines() {\n this._lines.qtMaxVisible = Math.floor(this._matrixHeight / this._cell.heightMin);\n if (this._lines.qtMaxVisible > 3)\n this._lines.qtMinVisible = 3;\n else\n this._lines.qtMinVisible = 1;\n if (this._lines.qtMaxVisible > this._lines.qtTotal)\n this._lines.qtMaxVisible = this._lines.qtTotal;\n if (this._lines.qtMaxVisible < this._lines.qtVisible && this._lines.qtMaxVisible != 0)\n this._lines.qtVisible = this._lines.qtMaxVisible;\n }", "function visibleLines(display, doc, viewPort) {\n var top = viewPort && viewPort.top != null ? Math.max(0, viewPort.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewPort && viewPort.bottom != null ? viewPort.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewPort && viewPort.ensure) {\n var ensureFrom = viewPort.ensure.from.line, ensureTo = viewPort.ensure.to.line;\n if (ensureFrom < from)\n return {from: ensureFrom,\n to: lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight)};\n if (Math.min(ensureTo, doc.lastLine()) >= to)\n return {from: lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight),\n to: ensureTo};\n }\n return {from: from, to: Math.max(to, from + 1)};\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = _lineAtHeight(doc, top),\n to = _lineAtHeight(doc, bottom); // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n\n\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line,\n ensureTo = viewport.ensure.to.line;\n\n if (ensureFrom < from) {\n from = ensureFrom;\n to = _lineAtHeight(doc, _heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = _lineAtHeight(doc, _heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n\n return {\n from: from,\n to: Math.max(to, from + 1)\n };\n } // SCROLLING THINGS INTO VIEW", "function visibleLines(display, doc, viewport) {\n\t\t var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n\t\t top = Math.floor(top - paddingTop(display));\n\t\t var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\t\t\n\t\t var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n\t\t // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n\t\t // forces those lines into the viewport (if possible).\n\t\t if (viewport && viewport.ensure) {\n\t\t var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n\t\t if (ensureFrom < from) {\n\t\t from = ensureFrom;\n\t\t to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n\t\t } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n\t\t from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n\t\t to = ensureTo;\n\t\t }\n\t\t }\n\t\t return {from: from, to: Math.max(to, from + 1)};\n\t\t }", "function visibleLines(display, doc, viewport) {\r\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\r\n top = Math.floor(top - paddingTop(display));\r\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\r\n\r\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\r\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\r\n // forces those lines into the viewport (if possible).\r\n if (viewport && viewport.ensure) {\r\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\r\n if (ensureFrom < from)\r\n return {from: ensureFrom,\r\n to: lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight)};\r\n if (Math.min(ensureTo, doc.lastLine()) >= to)\r\n return {from: lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight),\r\n to: ensureTo};\r\n }\r\n return {from: from, to: Math.max(to, from + 1)};\r\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from)\n return {from: ensureFrom,\n to: lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight)};\n if (Math.min(ensureTo, doc.lastLine()) >= to)\n return {from: lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight),\n to: ensureTo};\n }\n return {from: from, to: Math.max(to, from + 1)};\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from)\n return {from: ensureFrom,\n to: lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight)};\n if (Math.min(ensureTo, doc.lastLine()) >= to)\n return {from: lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight),\n to: ensureTo};\n }\n return {from: from, to: Math.max(to, from + 1)};\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from)\n return {from: ensureFrom,\n to: lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight)};\n if (Math.min(ensureTo, doc.lastLine()) >= to)\n return {from: lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight),\n to: ensureTo};\n }\n return {from: from, to: Math.max(to, from + 1)};\n }", "function visibleLines(display, doc, viewport) {\n\t\t var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n\t\t top = Math.floor(top - paddingTop(display));\n\t\t var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n\t\t var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n\t\t // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n\t\t // forces those lines into the viewport (if possible).\n\t\t if (viewport && viewport.ensure) {\n\t\t var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n\t\t if (ensureFrom < from) {\n\t\t from = ensureFrom;\n\t\t to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n\t\t } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n\t\t from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n\t\t to = ensureTo;\n\t\t }\n\t\t }\n\t\t return {from: from, to: Math.max(to, from + 1)}\n\t\t }", "function buildViewArray(cm, from, to) {\n\t\t var array = [], nextPos;\n\t\t for (var pos = from; pos < to; pos = nextPos) {\n\t\t var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n\t\t nextPos = pos + view.size;\n\t\t array.push(view);\n\t\t }\n\t\t return array;\n\t\t }", "function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line) {\n return {\n map: lineView.measure.map,\n cache: lineView.measure.cache\n };\n }\n\n for (var i = 0; i < lineView.rest.length; i++) {\n if (lineView.rest[i] == line) {\n return {\n map: lineView.measure.maps[i],\n cache: lineView.measure.caches[i]\n };\n }\n }\n\n for (var i$1 = 0; i$1 < lineView.rest.length; i$1++) {\n if (lineNo(lineView.rest[i$1]) > lineN) {\n return {\n map: lineView.measure.maps[i$1],\n cache: lineView.measure.caches[i$1],\n before: true\n };\n }\n }\n } // Render a line into the hidden node display.externalMeasured. Used", "function visibleLines(display, doc, viewport) {\n\t var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n\t top = Math.floor(top - paddingTop(display));\n\t var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\t\n\t var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n\t // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n\t // forces those lines into the viewport (if possible).\n\t if (viewport && viewport.ensure) {\n\t var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n\t if (ensureFrom < from) {\n\t from = ensureFrom;\n\t to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n\t } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n\t from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n\t to = ensureTo;\n\t }\n\t }\n\t return {from: from, to: Math.max(to, from + 1)};\n\t }", "function buildViewArray(cm, from, to) {\n\t\t var array = [], nextPos;\n\t\t for (var pos = from; pos < to; pos = nextPos) {\n\t\t var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n\t\t nextPos = pos + view.size;\n\t\t array.push(view);\n\t\t }\n\t\t return array\n\t\t }", "function visibleLines(display, doc, viewport) {\n\t var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n\t top = Math.floor(top - paddingTop(display));\n\t var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n\t var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n\t // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n\t // forces those lines into the viewport (if possible).\n\t if (viewport && viewport.ensure) {\n\t var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n\t if (ensureFrom < from) {\n\t from = ensureFrom;\n\t to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n\t } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n\t from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n\t to = ensureTo;\n\t }\n\t }\n\t return {from: from, to: Math.max(to, from + 1)};\n\t }", "function visibleLines(display, doc, viewport) {\n\t var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n\t top = Math.floor(top - paddingTop(display));\n\t var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n\t var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n\t // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n\t // forces those lines into the viewport (if possible).\n\t if (viewport && viewport.ensure) {\n\t var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n\t if (ensureFrom < from) {\n\t from = ensureFrom;\n\t to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n\t } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n\t from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n\t to = ensureTo;\n\t }\n\t }\n\t return {from: from, to: Math.max(to, from + 1)};\n\t }", "function visibleLines(display, doc, viewport) {\r\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\r\n top = Math.floor(top - paddingTop(display));\r\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\r\n\r\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\r\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\r\n // forces those lines into the viewport (if possible).\r\n if (viewport && viewport.ensure) {\r\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\r\n if (ensureFrom < from) {\r\n from = ensureFrom;\r\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\r\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\r\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\r\n to = ensureTo;\r\n }\r\n }\r\n return {from: from, to: Math.max(to, from + 1)}\r\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)};\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)};\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)};\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)};\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop\n top = Math.floor(top - paddingTop(display))\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom)\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line\n if (ensureFrom < from) {\n from = ensureFrom\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight)\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight)\n to = ensureTo\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop\n top = Math.floor(top - paddingTop(display))\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom)\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line\n if (ensureFrom < from) {\n from = ensureFrom\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight)\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight)\n to = ensureTo\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function buildViewArray(cm, from, to) {\n\t var array = [], nextPos;\n\t for (var pos = from; pos < to; pos = nextPos) {\n\t var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n\t nextPos = pos + view.size;\n\t array.push(view);\n\t }\n\t return array;\n\t }", "function buildViewArray(cm, from, to) {\n\t var array = [], nextPos;\n\t for (var pos = from; pos < to; pos = nextPos) {\n\t var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n\t nextPos = pos + view.size;\n\t array.push(view);\n\t }\n\t return array;\n\t }", "function buildViewArray(cm, from, to) {\n\t var array = [], nextPos;\n\t for (var pos = from; pos < to; pos = nextPos) {\n\t var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n\t nextPos = pos + view.size;\n\t array.push(view);\n\t }\n\t return array;\n\t }", "get viewportLineBlocks() {\n return this.viewState.viewportLines;\n }", "function buildViewArray(cm, from, to) {\r\n var array = [], nextPos;\r\n for (var pos = from; pos < to; pos = nextPos) {\r\n var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\r\n nextPos = pos + view.size;\r\n array.push(view);\r\n }\r\n return array;\r\n }" ]
[ "0.77587694", "0.7355294", "0.7355294", "0.73397183", "0.73397183", "0.73397183", "0.73397183", "0.73397183", "0.73397183", "0.73397183", "0.73397183", "0.73397183", "0.73397183", "0.73397183", "0.73043203", "0.7289012", "0.7289012", "0.728781", "0.7266966", "0.7266966", "0.7266966", "0.66565335", "0.64408433", "0.639806", "0.6340835", "0.6315052", "0.6305954", "0.6305954", "0.6305954", "0.6289834", "0.6288522", "0.6286063", "0.6280872", "0.62746596", "0.62683105", "0.62683105", "0.62617147", "0.6252447", "0.6252447", "0.6252447", "0.6252447", "0.6251507", "0.6251507", "0.6251507", "0.6251507", "0.6251507", "0.6251507", "0.6251507", "0.6251507", "0.6251507", "0.6251507", "0.6251507", "0.6249346", "0.6249346", "0.6229988", "0.6229988", "0.6229988", "0.6229988", "0.6229988", "0.6229988", "0.6229988", "0.6229988", "0.6229988", "0.6229988", "0.6229988", "0.6229988", "0.6229988", "0.6229988", "0.6229988", "0.6229988", "0.6229988", "0.6202241", "0.6202241", "0.6202241", "0.62018806", "0.6180607" ]
0.7326388
31
Create a range of LineView objects for the given lines.
function buildViewArray(cm, from, to) { var array = [], nextPos; for (var pos = from; pos < to; pos = nextPos) { var view = new LineView(cm.doc, getLine(cm.doc, pos), pos); nextPos = pos + view.size; array.push(view); } return array }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line; // Continuing lines, if any\n\n this.rest = visualLineContinued(line); // Number of logical lines in this visual line\n\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n } // Create a range of LineView objects for the given lines.", "function buildViewArray(cm, from, to) {\n var array = [], nextPos;\n for (var pos = from; pos < to; pos = nextPos) {\n var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n nextPos = pos + view.size;\n array.push(view);\n }\n return array;\n }", "function buildViewArray(cm, from, to) {\n var array = [], nextPos;\n for (var pos = from; pos < to; pos = nextPos) {\n var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n nextPos = pos + view.size;\n array.push(view);\n }\n return array;\n }", "function buildViewArray(cm, from, to) {\n var array = [], nextPos;\n for (var pos = from; pos < to; pos = nextPos) {\n var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n nextPos = pos + view.size;\n array.push(view);\n }\n return array;\n }", "function buildViewArray(cm, from, to) {\n var array = [], nextPos;\n for (var pos = from; pos < to; pos = nextPos) {\n var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n nextPos = pos + view.size;\n array.push(view);\n }\n return array;\n }", "function buildViewArray(cm, from, to) {\n var array = [], nextPos;\n for (var pos = from; pos < to; pos = nextPos) {\n var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n nextPos = pos + view.size;\n array.push(view);\n }\n return array;\n }", "function buildViewArray(cm, from, to) {\n var array = [], nextPos;\n for (var pos = from; pos < to; pos = nextPos) {\n var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n nextPos = pos + view.size;\n array.push(view);\n }\n return array;\n }", "function buildViewArray(cm, from, to) {\n var array = [], nextPos;\n for (var pos = from; pos < to; pos = nextPos) {\n var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n nextPos = pos + view.size;\n array.push(view);\n }\n return array;\n }", "function buildViewArray(cm, from, to) {\n var array = [], nextPos;\n for (var pos = from; pos < to; pos = nextPos) {\n var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n nextPos = pos + view.size;\n array.push(view);\n }\n return array;\n }", "function createLines() {\n var moesLine = new self.StoogeLine();\n moesLine.set('Scene', 1);\n moesLine.set('SetID', self.indoorSet.get('id'));\n moesLine.set('StoogeID', self.moe.get('id'));\n moesLine.set('Line', 'To be or not to be?');\n var larrysLine = new self.StoogeLine();\n larrysLine.set('Scene', 2);\n larrysLine.set('SetID', self.desertSet.get('id'));\n larrysLine.set('StoogeID', self.larry.get('id'));\n larrysLine.set('Line', 'That is the question!');\n spec.integrationStore.putModel(moesLine, function (model, error) {\n if (typeof error != 'undefined') {\n callback(error);\n } else {\n spec.integrationStore.putModel(larrysLine, function (model, error) {\n if (typeof error != 'undefined') {\n callback(error);\n } else {\n createView();\n }\n });\n }\n });\n }", "function buildViewArray(cm, from, to) {\n\t\t var array = [], nextPos;\n\t\t for (var pos = from; pos < to; pos = nextPos) {\n\t\t var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n\t\t nextPos = pos + view.size;\n\t\t array.push(view);\n\t\t }\n\t\t return array;\n\t\t }", "function buildViewArray(cm, from, to) {\r\n var array = [], nextPos;\r\n for (var pos = from; pos < to; pos = nextPos) {\r\n var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\r\n nextPos = pos + view.size;\r\n array.push(view);\r\n }\r\n return array;\r\n }", "function buildViewArray(cm, from, to) {\n\t\t var array = [], nextPos;\n\t\t for (var pos = from; pos < to; pos = nextPos) {\n\t\t var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n\t\t nextPos = pos + view.size;\n\t\t array.push(view);\n\t\t }\n\t\t return array\n\t\t }", "function buildViewArray(cm, from, to) {\n var array = [], nextPos\n for (var pos = from; pos < to; pos = nextPos) {\n var view = new LineView(cm.doc, getLine(cm.doc, pos), pos)\n nextPos = pos + view.size\n array.push(view)\n }\n return array\n}", "function buildViewArray(cm, from, to) {\n var array = [], nextPos\n for (var pos = from; pos < to; pos = nextPos) {\n var view = new LineView(cm.doc, getLine(cm.doc, pos), pos)\n nextPos = pos + view.size\n array.push(view)\n }\n return array\n}", "function buildViewArray(cm, from, to) {\n\t var array = [], nextPos;\n\t for (var pos = from; pos < to; pos = nextPos) {\n\t var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n\t nextPos = pos + view.size;\n\t array.push(view);\n\t }\n\t return array;\n\t }", "function buildViewArray(cm, from, to) {\n\t var array = [], nextPos;\n\t for (var pos = from; pos < to; pos = nextPos) {\n\t var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n\t nextPos = pos + view.size;\n\t array.push(view);\n\t }\n\t return array;\n\t }", "function buildViewArray(cm, from, to) {\n\t var array = [], nextPos;\n\t for (var pos = from; pos < to; pos = nextPos) {\n\t var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n\t nextPos = pos + view.size;\n\t array.push(view);\n\t }\n\t return array;\n\t }", "function buildViewArray(cm, from, to) {\r\n var array = [], nextPos;\r\n for (var pos = from; pos < to; pos = nextPos) {\r\n var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\r\n nextPos = pos + view.size;\r\n array.push(view);\r\n }\r\n return array\r\n}", "function buildViewArray(cm, from, to) {\n var array = [], nextPos;\n for (var pos = from; pos < to; pos = nextPos) {\n var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n nextPos = pos + view.size;\n array.push(view);\n }\n return array\n}", "function buildViewArray(cm, from, to) {\n var array = [], nextPos;\n for (var pos = from; pos < to; pos = nextPos) {\n var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n nextPos = pos + view.size;\n array.push(view);\n }\n return array\n}", "function buildViewArray(cm, from, to) {\n var array = [], nextPos;\n for (var pos = from; pos < to; pos = nextPos) {\n var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n nextPos = pos + view.size;\n array.push(view);\n }\n return array\n}", "function buildViewArray(cm, from, to) {\n var array = [], nextPos;\n for (var pos = from; pos < to; pos = nextPos) {\n var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n nextPos = pos + view.size;\n array.push(view);\n }\n return array\n}", "function buildViewArray(cm, from, to) {\n var array = [], nextPos;\n for (var pos = from; pos < to; pos = nextPos) {\n var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n nextPos = pos + view.size;\n array.push(view);\n }\n return array\n}", "function buildViewArray(cm, from, to) {\n var array = [], nextPos;\n for (var pos = from; pos < to; pos = nextPos) {\n var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n nextPos = pos + view.size;\n array.push(view);\n }\n return array\n}", "function buildViewArray(cm, from, to) {\n var array = [], nextPos;\n for (var pos = from; pos < to; pos = nextPos) {\n var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n nextPos = pos + view.size;\n array.push(view);\n }\n return array\n}", "function buildViewArray(cm, from, to) {\n var array = [], nextPos;\n for (var pos = from; pos < to; pos = nextPos) {\n var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n nextPos = pos + view.size;\n array.push(view);\n }\n return array\n}", "function buildViewArray(cm, from, to) {\n var array = [], nextPos;\n for (var pos = from; pos < to; pos = nextPos) {\n var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n nextPos = pos + view.size;\n array.push(view);\n }\n return array\n}", "function buildViewArray(cm, from, to) {\n var array = [], nextPos;\n for (var pos = from; pos < to; pos = nextPos) {\n var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n nextPos = pos + view.size;\n array.push(view);\n }\n return array\n}", "function buildViewArray(cm, from, to) {\n var array = [], nextPos;\n for (var pos = from; pos < to; pos = nextPos) {\n var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n nextPos = pos + view.size;\n array.push(view);\n }\n return array\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line\n // Continuing lines, if any\n this.rest = visualLineContinued(line)\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1\n this.node = this.text = null\n this.hidden = lineIsHidden(doc, line)\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line\n // Continuing lines, if any\n this.rest = visualLineContinued(line)\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1\n this.node = this.text = null\n this.hidden = lineIsHidden(doc, line)\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\r\n // The starting line\r\n this.line = line;\r\n // Continuing lines, if any\r\n this.rest = visualLineContinued(line);\r\n // Number of logical lines in this visual line\r\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\r\n this.node = this.text = null;\r\n this.hidden = lineIsHidden(doc, line);\r\n }", "function LineView(doc, line, lineN) {\r\n // The starting line\r\n this.line = line;\r\n // Continuing lines, if any\r\n this.rest = visualLineContinued(line);\r\n // Number of logical lines in this visual line\r\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\r\n this.node = this.text = null;\r\n this.hidden = lineIsHidden(doc, line);\r\n}", "function LineView(doc, line, lineN) {\n\t // The starting line\n\t this.line = line;\n\t // Continuing lines, if any\n\t this.rest = visualLineContinued(line);\n\t // Number of logical lines in this visual line\n\t this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n\t this.node = this.text = null;\n\t this.hidden = lineIsHidden(doc, line);\n\t }", "function LineView(doc, line, lineN) {\n\t // The starting line\n\t this.line = line;\n\t // Continuing lines, if any\n\t this.rest = visualLineContinued(line);\n\t // Number of logical lines in this visual line\n\t this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n\t this.node = this.text = null;\n\t this.hidden = lineIsHidden(doc, line);\n\t }", "function LineView(doc, line, lineN) {\n\t // The starting line\n\t this.line = line;\n\t // Continuing lines, if any\n\t this.rest = visualLineContinued(line);\n\t // Number of logical lines in this visual line\n\t this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n\t this.node = this.text = null;\n\t this.hidden = lineIsHidden(doc, line);\n\t }", "function LineView(doc, line, lineN) {\n\t\t // The starting line\n\t\t this.line = line;\n\t\t // Continuing lines, if any\n\t\t this.rest = visualLineContinued(line);\n\t\t // Number of logical lines in this visual line\n\t\t this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n\t\t this.node = this.text = null;\n\t\t this.hidden = lineIsHidden(doc, line);\n\t\t }", "function LineView(doc, line, lineN) {\n\t\t // The starting line\n\t\t this.line = line;\n\t\t // Continuing lines, if any\n\t\t this.rest = visualLineContinued(line);\n\t\t // Number of logical lines in this visual line\n\t\t this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n\t\t this.node = this.text = null;\n\t\t this.hidden = lineIsHidden(doc, line);\n\t\t }", "function addLines(lines) {\n for (var j=0; j<lines.length;j++) {\n // create new line\n var linechart = newLine(lines[j].id)\n // attach data\n linechart\n .data(lines[j].values)\n // refresh\n linechart(); \n }\n }", "function drawForLine(from, to, line) {\n let top = 1e9, bottom = -1e9, horizontal = [];\n function addSpan(from, fromOpen, to, toOpen, dir) {\n // Passing 2/-2 is a kludge to force the view to return\n // coordinates on the proper side of block widgets, since\n // normalizing the side there, though appropriate for most\n // coordsAtPos queries, would break selection drawing.\n let fromCoords = view.coordsAtPos(from, (from == line.to ? -2 : 2));\n let toCoords = view.coordsAtPos(to, (to == line.from ? 2 : -2));\n if (!fromCoords || !toCoords)\n return;\n top = Math.min(fromCoords.top, toCoords.top, top);\n bottom = Math.max(fromCoords.bottom, toCoords.bottom, bottom);\n if (dir == exports.Direction.LTR)\n horizontal.push(ltr && fromOpen ? leftSide : fromCoords.left, ltr && toOpen ? rightSide : toCoords.right);\n else\n horizontal.push(!ltr && toOpen ? leftSide : toCoords.left, !ltr && fromOpen ? rightSide : fromCoords.right);\n }\n let start = from !== null && from !== void 0 ? from : line.from, end = to !== null && to !== void 0 ? to : line.to;\n // Split the range by visible range and document line\n for (let r of view.visibleRanges)\n if (r.to > start && r.from < end) {\n for (let pos = Math.max(r.from, start), endPos = Math.min(r.to, end);;) {\n let docLine = view.state.doc.lineAt(pos);\n for (let span of view.bidiSpans(docLine)) {\n let spanFrom = span.from + docLine.from, spanTo = span.to + docLine.from;\n if (spanFrom >= endPos)\n break;\n if (spanTo > pos)\n addSpan(Math.max(spanFrom, pos), from == null && spanFrom <= start, Math.min(spanTo, endPos), to == null && spanTo >= end, span.dir);\n }\n pos = docLine.to + 1;\n if (pos >= endPos)\n break;\n }\n }\n if (horizontal.length == 0)\n addSpan(start, from == null, end, to == null, view.textDirection);\n return { top, bottom, horizontal };\n }", "function insertLineWidgets(lineView, dims) {\n insertLineWidgetsFor(lineView.line, lineView, dims, true);\n if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\n insertLineWidgetsFor(lineView.rest[i], lineView, dims, false);\n }", "function insertLineWidgets(lineView, dims) {\n insertLineWidgetsFor(lineView.line, lineView, dims, true);\n if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\n insertLineWidgetsFor(lineView.rest[i], lineView, dims, false);\n }", "function insertLineWidgets(lineView, dims) {\n insertLineWidgetsFor(lineView.line, lineView, dims, true);\n if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\n insertLineWidgetsFor(lineView.rest[i], lineView, dims, false);\n }", "function insertLineWidgets(lineView, dims) {\n insertLineWidgetsFor(lineView.line, lineView, dims, true);\n if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\n insertLineWidgetsFor(lineView.rest[i], lineView, dims, false);\n }", "function insertLineWidgets(lineView, dims) {\n insertLineWidgetsFor(lineView.line, lineView, dims, true);\n if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\n insertLineWidgetsFor(lineView.rest[i], lineView, dims, false);\n }", "function insertLineWidgets(lineView, dims) {\n insertLineWidgetsFor(lineView.line, lineView, dims, true);\n if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\n insertLineWidgetsFor(lineView.rest[i], lineView, dims, false);\n }", "function insertLineWidgets(lineView, dims) {\r\n insertLineWidgetsFor(lineView.line, lineView, dims, true);\r\n if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\r\n insertLineWidgetsFor(lineView.rest[i], lineView, dims, false);\r\n }" ]
[ "0.77182955", "0.66010743", "0.66010743", "0.66010743", "0.66010743", "0.66010743", "0.66010743", "0.66010743", "0.66010743", "0.65827054", "0.65815836", "0.6575943", "0.6561047", "0.6553308", "0.6553308", "0.6537662", "0.6537662", "0.6537662", "0.6534156", "0.65170366", "0.65170366", "0.65170366", "0.65170366", "0.65170366", "0.65170366", "0.65170366", "0.65170366", "0.65170366", "0.65170366", "0.65170366", "0.6472657", "0.6472657", "0.64546794", "0.64546794", "0.64546794", "0.64546794", "0.64546794", "0.64546794", "0.64546794", "0.64546794", "0.64546794", "0.64546794", "0.64546794", "0.64536375", "0.64536375", "0.64536375", "0.64536375", "0.64536375", "0.64536375", "0.64536375", "0.64536375", "0.64536375", "0.64536375", "0.64536375", "0.64536375", "0.64536375", "0.64536375", "0.64536375", "0.64536375", "0.64536375", "0.64536375", "0.64536375", "0.64536375", "0.64536375", "0.64536375", "0.64536375", "0.64536375", "0.64536375", "0.6418452", "0.6412902", "0.6387251", "0.6387251", "0.6387251", "0.6386347", "0.6386347", "0.6362791", "0.6328247", "0.6282768", "0.6282768", "0.6282768", "0.6282768", "0.6282768", "0.6282768", "0.62510324" ]
0.65894336
20
Often, we want to signal events at a point where we are in the middle of some work, but don't want the handler to start calling other methods on the editor, which might be in an inconsistent state or simply not expect any other events to happen. signalLater looks whether there are any handlers, and schedules them to be executed when the last operation ends, or, if no operation is active, when a timeout fires.
function signalLater(emitter, type /*, values...*/) { var arr = getHandlers(emitter, type); if (!arr.length) { return } var args = Array.prototype.slice.call(arguments, 2), list; if (operationGroup) { list = operationGroup.delayedCallbacks; } else if (orphanDelayedCallbacks) { list = orphanDelayedCallbacks; } else { list = orphanDelayedCallbacks = []; setTimeout(fireOrphanDelayed, 0); } var loop = function ( i ) { list.push(function () { return arr[i].apply(null, args); }); }; for (var i = 0; i < arr.length; ++i) loop( i ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function signalLater(emitter, type /*, values...*/) {\n\t\t var arr = getHandlers(emitter, type, false)\n\t\t if (!arr.length) return;\n\t\t var args = Array.prototype.slice.call(arguments, 2), list;\n\t\t if (operationGroup) {\n\t\t list = operationGroup.delayedCallbacks;\n\t\t } else if (orphanDelayedCallbacks) {\n\t\t list = orphanDelayedCallbacks;\n\t\t } else {\n\t\t list = orphanDelayedCallbacks = [];\n\t\t setTimeout(fireOrphanDelayed, 0);\n\t\t }\n\t\t function bnd(f) {return function(){f.apply(null, args);};};\n\t\t for (var i = 0; i < arr.length; ++i)\n\t\t list.push(bnd(arr[i]));\n\t\t }", "function signalLater(emitter, type /*, values...*/) {\n\t var arr = getHandlers(emitter, type, false)\n\t if (!arr.length) return;\n\t var args = Array.prototype.slice.call(arguments, 2), list;\n\t if (operationGroup) {\n\t list = operationGroup.delayedCallbacks;\n\t } else if (orphanDelayedCallbacks) {\n\t list = orphanDelayedCallbacks;\n\t } else {\n\t list = orphanDelayedCallbacks = [];\n\t setTimeout(fireOrphanDelayed, 0);\n\t }\n\t function bnd(f) {return function(){f.apply(null, args);};};\n\t for (var i = 0; i < arr.length; ++i)\n\t list.push(bnd(arr[i]));\n\t }", "function signalLater(emitter, type /*, values...*/) {\n\t var arr = getHandlers(emitter, type, false)\n\t if (!arr.length) return;\n\t var args = Array.prototype.slice.call(arguments, 2), list;\n\t if (operationGroup) {\n\t list = operationGroup.delayedCallbacks;\n\t } else if (orphanDelayedCallbacks) {\n\t list = orphanDelayedCallbacks;\n\t } else {\n\t list = orphanDelayedCallbacks = [];\n\t setTimeout(fireOrphanDelayed, 0);\n\t }\n\t function bnd(f) {return function(){f.apply(null, args);};};\n\t for (var i = 0; i < arr.length; ++i)\n\t list.push(bnd(arr[i]));\n\t }", "function signalLater(emitter, type /*, values...*/) {\n\t var arr = getHandlers(emitter, type, false)\n\t if (!arr.length) return;\n\t var args = Array.prototype.slice.call(arguments, 2), list;\n\t if (operationGroup) {\n\t list = operationGroup.delayedCallbacks;\n\t } else if (orphanDelayedCallbacks) {\n\t list = orphanDelayedCallbacks;\n\t } else {\n\t list = orphanDelayedCallbacks = [];\n\t setTimeout(fireOrphanDelayed, 0);\n\t }\n\t function bnd(f) {return function(){f.apply(null, args);};};\n\t for (var i = 0; i < arr.length; ++i)\n\t list.push(bnd(arr[i]));\n\t }", "function signalLater(emitter, type /*, values...*/) {\n\t\t var arr = getHandlers(emitter, type);\n\t\t if (!arr.length) { return }\n\t\t var args = Array.prototype.slice.call(arguments, 2), list;\n\t\t if (operationGroup) {\n\t\t list = operationGroup.delayedCallbacks;\n\t\t } else if (orphanDelayedCallbacks) {\n\t\t list = orphanDelayedCallbacks;\n\t\t } else {\n\t\t list = orphanDelayedCallbacks = [];\n\t\t setTimeout(fireOrphanDelayed, 0);\n\t\t }\n\t\t var loop = function ( i ) {\n\t\t list.push(function () { return arr[i].apply(null, args); });\n\t\t };\n\n\t\t for (var i = 0; i < arr.length; ++i)\n\t\t loop( i );\n\t\t }", "function signalLater(emitter, type /*, values...*/) {\n var arr = getHandlers(emitter, type, false)\n if (!arr.length) return;\n var args = Array.prototype.slice.call(arguments, 2), list;\n if (operationGroup) {\n list = operationGroup.delayedCallbacks;\n } else if (orphanDelayedCallbacks) {\n list = orphanDelayedCallbacks;\n } else {\n list = orphanDelayedCallbacks = [];\n setTimeout(fireOrphanDelayed, 0);\n }\n function bnd(f) {return function(){f.apply(null, args);};};\n for (var i = 0; i < arr.length; ++i)\n list.push(bnd(arr[i]));\n }", "function signalLater(emitter, type /*, values...*/) {\r\n var arr = emitter._handlers && emitter._handlers[type];\r\n if (!arr) return;\r\n var args = Array.prototype.slice.call(arguments, 2), list;\r\n if (operationGroup) {\r\n list = operationGroup.delayedCallbacks;\r\n } else if (orphanDelayedCallbacks) {\r\n list = orphanDelayedCallbacks;\r\n } else {\r\n list = orphanDelayedCallbacks = [];\r\n setTimeout(fireOrphanDelayed, 0);\r\n }\r\n function bnd(f) {return function(){f.apply(null, args);};};\r\n for (var i = 0; i < arr.length; ++i)\r\n list.push(bnd(arr[i]));\r\n }", "function signalLater(emitter, type /*, values...*/) {\n var arr = emitter._handlers && emitter._handlers[type];\n if (!arr) return;\n var args = Array.prototype.slice.call(arguments, 2), list;\n if (operationGroup) {\n list = operationGroup.delayedCallbacks;\n } else if (orphanDelayedCallbacks) {\n list = orphanDelayedCallbacks;\n } else {\n list = orphanDelayedCallbacks = [];\n setTimeout(fireOrphanDelayed, 0);\n }\n function bnd(f) {return function(){f.apply(null, args);};};\n for (var i = 0; i < arr.length; ++i)\n list.push(bnd(arr[i]));\n }", "function signalLater(emitter, type /*, values...*/) {\n var arr = emitter._handlers && emitter._handlers[type];\n if (!arr) return;\n var args = Array.prototype.slice.call(arguments, 2), list;\n if (operationGroup) {\n list = operationGroup.delayedCallbacks;\n } else if (orphanDelayedCallbacks) {\n list = orphanDelayedCallbacks;\n } else {\n list = orphanDelayedCallbacks = [];\n setTimeout(fireOrphanDelayed, 0);\n }\n function bnd(f) {return function(){f.apply(null, args);};};\n for (var i = 0; i < arr.length; ++i)\n list.push(bnd(arr[i]));\n }", "function signalLater(emitter, type /*, values...*/) {\n var arr = emitter._handlers && emitter._handlers[type];\n if (!arr) return;\n var args = Array.prototype.slice.call(arguments, 2), list;\n if (operationGroup) {\n list = operationGroup.delayedCallbacks;\n } else if (orphanDelayedCallbacks) {\n list = orphanDelayedCallbacks;\n } else {\n list = orphanDelayedCallbacks = [];\n setTimeout(fireOrphanDelayed, 0);\n }\n function bnd(f) {return function(){f.apply(null, args);};};\n for (var i = 0; i < arr.length; ++i)\n list.push(bnd(arr[i]));\n }", "function signalLater(emitter, type /*, values...*/) {\n var arr = emitter._handlers && emitter._handlers[type];\n if (!arr) return;\n var args = Array.prototype.slice.call(arguments, 2), list;\n if (operationGroup) {\n list = operationGroup.delayedCallbacks;\n } else if (orphanDelayedCallbacks) {\n list = orphanDelayedCallbacks;\n } else {\n list = orphanDelayedCallbacks = [];\n setTimeout(fireOrphanDelayed, 0);\n }\n function bnd(f) {return function(){f.apply(null, args);};};\n for (var i = 0; i < arr.length; ++i)\n list.push(bnd(arr[i]));\n }", "function signalLater(emitter, type /*, values...*/) {\n var arr = emitter._handlers && emitter._handlers[type];\n if (!arr) return;\n var args = Array.prototype.slice.call(arguments, 2), list;\n if (operationGroup) {\n list = operationGroup.delayedCallbacks;\n } else if (orphanDelayedCallbacks) {\n list = orphanDelayedCallbacks;\n } else {\n list = orphanDelayedCallbacks = [];\n setTimeout(fireOrphanDelayed, 0);\n }\n function bnd(f) {return function(){f.apply(null, args);};};\n for (var i = 0; i < arr.length; ++i)\n list.push(bnd(arr[i]));\n }", "function signalLater(emitter, type\n /*, values...*/\n ) {\n var arr = getHandlers(emitter, type);\n\n if (!arr.length) {\n return;\n }\n\n var args = Array.prototype.slice.call(arguments, 2),\n list;\n\n if (operationGroup) {\n list = operationGroup.delayedCallbacks;\n } else if (orphanDelayedCallbacks) {\n list = orphanDelayedCallbacks;\n } else {\n list = orphanDelayedCallbacks = [];\n setTimeout(fireOrphanDelayed, 0);\n }\n\n var loop = function loop(i) {\n list.push(function () {\n return arr[i].apply(null, args);\n });\n };\n\n for (var i = 0; i < arr.length; ++i) {\n loop(i);\n }\n }", "function signalLater(emitter, type /*, values...*/) {\r\n var arr = getHandlers(emitter, type);\r\n if (!arr.length) { return }\r\n var args = Array.prototype.slice.call(arguments, 2), list;\r\n if (operationGroup) {\r\n list = operationGroup.delayedCallbacks;\r\n } else if (orphanDelayedCallbacks) {\r\n list = orphanDelayedCallbacks;\r\n } else {\r\n list = orphanDelayedCallbacks = [];\r\n setTimeout(fireOrphanDelayed, 0);\r\n }\r\n var loop = function ( i ) {\r\n list.push(function () { return arr[i].apply(null, args); });\r\n };\r\n\r\n for (var i = 0; i < arr.length; ++i)\r\n loop( i );\r\n}", "function signalLater(emitter, type /*, values...*/) {\n var arr = getHandlers(emitter, type);\n if (!arr.length) { return }\n var args = Array.prototype.slice.call(arguments, 2), list;\n if (operationGroup) {\n list = operationGroup.delayedCallbacks;\n } else if (orphanDelayedCallbacks) {\n list = orphanDelayedCallbacks;\n } else {\n list = orphanDelayedCallbacks = [];\n setTimeout(fireOrphanDelayed, 0);\n }\n var loop = function ( i ) {\n list.push(function () { return arr[i].apply(null, args); });\n };\n\n for (var i = 0; i < arr.length; ++i)\n loop( i );\n}", "function signalLater(emitter, type /*, values...*/) {\n var arr = getHandlers(emitter, type);\n if (!arr.length) { return }\n var args = Array.prototype.slice.call(arguments, 2), list;\n if (operationGroup) {\n list = operationGroup.delayedCallbacks;\n } else if (orphanDelayedCallbacks) {\n list = orphanDelayedCallbacks;\n } else {\n list = orphanDelayedCallbacks = [];\n setTimeout(fireOrphanDelayed, 0);\n }\n var loop = function ( i ) {\n list.push(function () { return arr[i].apply(null, args); });\n };\n\n for (var i = 0; i < arr.length; ++i)\n loop( i );\n}", "function signalLater(emitter, type /*, values...*/) {\n var arr = getHandlers(emitter, type);\n if (!arr.length) { return }\n var args = Array.prototype.slice.call(arguments, 2), list;\n if (operationGroup) {\n list = operationGroup.delayedCallbacks;\n } else if (orphanDelayedCallbacks) {\n list = orphanDelayedCallbacks;\n } else {\n list = orphanDelayedCallbacks = [];\n setTimeout(fireOrphanDelayed, 0);\n }\n var loop = function ( i ) {\n list.push(function () { return arr[i].apply(null, args); });\n };\n\n for (var i = 0; i < arr.length; ++i)\n loop( i );\n}", "function signalLater(emitter, type /*, values...*/) {\n var arr = getHandlers(emitter, type);\n if (!arr.length) { return }\n var args = Array.prototype.slice.call(arguments, 2), list;\n if (operationGroup) {\n list = operationGroup.delayedCallbacks;\n } else if (orphanDelayedCallbacks) {\n list = orphanDelayedCallbacks;\n } else {\n list = orphanDelayedCallbacks = [];\n setTimeout(fireOrphanDelayed, 0);\n }\n var loop = function ( i ) {\n list.push(function () { return arr[i].apply(null, args); });\n };\n\n for (var i = 0; i < arr.length; ++i)\n loop( i );\n}", "function signalLater(emitter, type /*, values...*/) {\n var arr = getHandlers(emitter, type);\n if (!arr.length) { return }\n var args = Array.prototype.slice.call(arguments, 2), list;\n if (operationGroup) {\n list = operationGroup.delayedCallbacks;\n } else if (orphanDelayedCallbacks) {\n list = orphanDelayedCallbacks;\n } else {\n list = orphanDelayedCallbacks = [];\n setTimeout(fireOrphanDelayed, 0);\n }\n var loop = function ( i ) {\n list.push(function () { return arr[i].apply(null, args); });\n };\n\n for (var i = 0; i < arr.length; ++i)\n loop( i );\n}", "function signalLater(emitter, type /*, values...*/) {\n var arr = getHandlers(emitter, type);\n if (!arr.length) { return }\n var args = Array.prototype.slice.call(arguments, 2), list;\n if (operationGroup) {\n list = operationGroup.delayedCallbacks;\n } else if (orphanDelayedCallbacks) {\n list = orphanDelayedCallbacks;\n } else {\n list = orphanDelayedCallbacks = [];\n setTimeout(fireOrphanDelayed, 0);\n }\n var loop = function ( i ) {\n list.push(function () { return arr[i].apply(null, args); });\n };\n\n for (var i = 0; i < arr.length; ++i)\n loop( i );\n}", "function signalLater(emitter, type /*, values...*/) {\n var arr = getHandlers(emitter, type);\n if (!arr.length) { return }\n var args = Array.prototype.slice.call(arguments, 2), list;\n if (operationGroup) {\n list = operationGroup.delayedCallbacks;\n } else if (orphanDelayedCallbacks) {\n list = orphanDelayedCallbacks;\n } else {\n list = orphanDelayedCallbacks = [];\n setTimeout(fireOrphanDelayed, 0);\n }\n var loop = function ( i ) {\n list.push(function () { return arr[i].apply(null, args); });\n };\n\n for (var i = 0; i < arr.length; ++i)\n loop( i );\n}", "function signalLater(emitter, type /*, values...*/) {\n var arr = getHandlers(emitter, type);\n if (!arr.length) { return }\n var args = Array.prototype.slice.call(arguments, 2), list;\n if (operationGroup) {\n list = operationGroup.delayedCallbacks;\n } else if (orphanDelayedCallbacks) {\n list = orphanDelayedCallbacks;\n } else {\n list = orphanDelayedCallbacks = [];\n setTimeout(fireOrphanDelayed, 0);\n }\n var loop = function ( i ) {\n list.push(function () { return arr[i].apply(null, args); });\n };\n\n for (var i = 0; i < arr.length; ++i)\n loop( i );\n}", "function signalLater(emitter, type /*, values...*/) {\n var arr = getHandlers(emitter, type);\n if (!arr.length) { return }\n var args = Array.prototype.slice.call(arguments, 2), list;\n if (operationGroup) {\n list = operationGroup.delayedCallbacks;\n } else if (orphanDelayedCallbacks) {\n list = orphanDelayedCallbacks;\n } else {\n list = orphanDelayedCallbacks = [];\n setTimeout(fireOrphanDelayed, 0);\n }\n var loop = function ( i ) {\n list.push(function () { return arr[i].apply(null, args); });\n };\n\n for (var i = 0; i < arr.length; ++i)\n loop( i );\n}", "function signalLater(emitter, type /*, values...*/) {\n var arr = getHandlers(emitter, type);\n if (!arr.length) { return }\n var args = Array.prototype.slice.call(arguments, 2), list;\n if (operationGroup) {\n list = operationGroup.delayedCallbacks;\n } else if (orphanDelayedCallbacks) {\n list = orphanDelayedCallbacks;\n } else {\n list = orphanDelayedCallbacks = [];\n setTimeout(fireOrphanDelayed, 0);\n }\n var loop = function ( i ) {\n list.push(function () { return arr[i].apply(null, args); });\n };\n\n for (var i = 0; i < arr.length; ++i)\n loop( i );\n}", "function signalLater(emitter, type /*, values...*/) {\n var arr = getHandlers(emitter, type);\n if (!arr.length) { return }\n var args = Array.prototype.slice.call(arguments, 2), list;\n if (operationGroup) {\n list = operationGroup.delayedCallbacks;\n } else if (orphanDelayedCallbacks) {\n list = orphanDelayedCallbacks;\n } else {\n list = orphanDelayedCallbacks = [];\n setTimeout(fireOrphanDelayed, 0);\n }\n var loop = function ( i ) {\n list.push(function () { return arr[i].apply(null, args); });\n };\n\n for (var i = 0; i < arr.length; ++i)\n loop( i );\n}", "function signalLater(emitter, type /*, values...*/) {\n var arr = getHandlers(emitter, type)\n if (!arr.length) { return }\n var args = Array.prototype.slice.call(arguments, 2), list\n if (operationGroup) {\n list = operationGroup.delayedCallbacks\n } else if (orphanDelayedCallbacks) {\n list = orphanDelayedCallbacks\n } else {\n list = orphanDelayedCallbacks = []\n setTimeout(fireOrphanDelayed, 0)\n }\n var loop = function ( i ) {\n list.push(function () { return arr[i].apply(null, args); })\n };\n\n for (var i = 0; i < arr.length; ++i)\n loop( i );\n}", "function signalLater(emitter, type /*, values...*/) {\n var arr = getHandlers(emitter, type)\n if (!arr.length) { return }\n var args = Array.prototype.slice.call(arguments, 2), list\n if (operationGroup) {\n list = operationGroup.delayedCallbacks\n } else if (orphanDelayedCallbacks) {\n list = orphanDelayedCallbacks\n } else {\n list = orphanDelayedCallbacks = []\n setTimeout(fireOrphanDelayed, 0)\n }\n var loop = function ( i ) {\n list.push(function () { return arr[i].apply(null, args); })\n };\n\n for (var i = 0; i < arr.length; ++i)\n loop( i );\n}", "afterHandlers (event) {\n\n }", "function _setEmergencyHandlers() {\n $( '.side-slider__advanced__button.flush-db' ).on( 'click', () => {\n gui.confirm( {\n msg: t( 'confirm.deleteall.msg' ),\n heading: t( 'confirm.deleteall.heading' )\n }, {\n posButton: t( 'confirm.deleteall.posButton' ),\n } )\n .then( confirmed => {\n if ( !confirmed ) {\n throw new Error( 'Cancelled by user' );\n }\n return store.flush();\n } )\n .then( () => {\n location.reload();\n } )\n .catch( () => {} );\n } );\n}", "function clearNotifyHandlers() {\n notTicked.length = 0;\n notTicked = undefined;\n }", "function updateLater() {\n\t\t\t\t\t\t// save the laterTimeoutId for canceling\n\t\t\t\t\t\tlaterTimeoutId = $timeout(function() {\n\t\t\t\t\t\t\tcurrentIndex++;\n\t\t\t\t\t\t\t$scope.$digest();\n\t\t\t\t\t\t\tupdateLater(); // schedule another update\n\t\t\t\t\t\t}, 5000);\n\t\t\t\t\t}", "function startLater() {\n Q.delay(80).then(start)\n}", "function shadowTree_signalASlotChange(slot) {\n /**\n * 1. Append slot to slot’s relevant agent’s signal slots.\n * 2. Queue a mutation observer microtask.\n */\n var window = DOMImpl_1.dom.window;\n window._signalSlots.add(slot);\n MutationObserverAlgorithm_1.observer_queueAMutationObserverMicrotask();\n}", "function emit(sender, signal, args) {\n var list = senderMap.get(sender);\n if (!list) {\n return;\n }\n list.refs++;\n try {\n var dirty = invokeList(list, sender, signal, args);\n }\n finally {\n list.refs--;\n }\n if (dirty && list.refs === 0) {\n cleanList(list);\n }\n}", "afterHandling() {}", "function doLaterAlbuns(defer, what) {\n $timeout(function() {\n defer[what]();\n }, 900);\n }", "signalSolved()\n {\n this.solved = true;\n this.trigger('solved');\n return this;\n }", "function somethingChanged()\r\n\t\t{\r\n\t\t\tif (timer)\r\n\t\t\t\treturn;\r\n\r\n\t\t\ttimer = setTimeout( function() {\r\n\t\t\t\ttimer = 0;\r\n\t\t\t\teditor.fire( 'change' );\r\n\t\t\t}, editor.config.minimumChangeMilliseconds || 100);\r\n\t\t}", "function Signal() {\n\n this.listenerBoxes = [];\n\n this._valueClasses = null;\n\n this.listenersNeedCloning = false;\n\n this.setValueClasses(arguments);\n }", "function addHandlers() {\n notesPanel = $('#georapbox-notes-panel');\n\n notesPanel\n .on('click', '.close', togglePanel)\n .on('click', '.georapbox-notes-delete', function (e) {\n e.preventDefault();\n\n var tableRow = $(this).parents('tr');\n var id = tableRow.find('.id').html();\n var date = tableRow.find('.labelIcon').html();\n var note = tableRow.find('.note textarea').val();\n\n id = parseInt(id, 10);\n\n showDeleteNoteDialog(function () {\n deleteNote(id);\n localStorage.removeItem(STORAGE_KEY);\n storageSaveObj(localStorage, STORAGE_KEY, _notes);\n renderNotes();\n });\n })\n .on('click', '.georapbox-notes-edit', function () {\n var tableRow = $(this).parents('tr');\n var textArea = tableRow.find('textarea');\n var textareaTd = tableRow.find('.note');\n var previewTd = tableRow.find('.preview');\n\n textareaTd.show();\n previewTd.hide();\n makeEditable(textArea);\n })\n .on('focusout', 'td.note textarea', function () {\n var self = $(this);\n var noteValue, noteMarkup, noteId;\n var markupArea = self.parent().parent().find('article');\n\n if (self.hasClass('editable')) {\n noteValue = self.val();\n noteId = parseInt(self.parent().parent().find('td.id').html(), 10);\n makeReadOnly(self);\n previewMarkDown(markupArea, self.val());\n noteMarkup = self.parent().next().find('article').html();\n updateNote(noteId, noteValue, noteMarkup);\n localStorage.removeItem(STORAGE_KEY);\n storageSaveObj(localStorage, STORAGE_KEY, _notes);\n renderNotes();\n }\n })\n .on('click', '[data-id=\"georapbox-notes-new-btn\"]', showNewNoteModal)\n .on('click', '[data-id=\"georapbox-notes-import-btn\"]', showImportNotesDialog)\n .on('click', '.georapbox-notes-options-handler', function (e) {\n var options = $(this).next();\n\n e.preventDefault();\n\n if (options.is(':visible')) {\n $(this).removeClass('active');\n options.hide();\n } else {\n $(this).addClass('active');\n options.show();\n }\n })\n .on('click', '.georapbox-notes-extract', function (e) {\n var textareaVal = $(this).parents('tr').find('td.note textarea').val();\n e.preventDefault();\n openFile(textareaVal, '.md');\n })\n .on('click', '[data-id=\"georapbox-notes-export-btn\"]', function (e) {\n var notes = storageGetObj(localStorage, STORAGE_KEY) || [];\n\n e.preventDefault();\n\n try {\n openFile(JSON.stringify(notes, null, 2), '.json');\n } catch (err) {\n console.error(err);\n }\n })\n .on('dragstart', 'tr', reorder.dragndrop.handleDragStart)\n .on('dragenter', 'tr', reorder.dragndrop.handleDragEnter)\n .on('dragover', 'tr', reorder.dragndrop.handleDragOver)\n .on('dragleave', 'tr', reorder.dragndrop.handleDragLeave)\n .on('drop', 'tr', reorder.dragndrop.handleDrop)\n .on('dragend', 'tr', function () {\n var rows = notesPanel.find('tr');\n\n reorder.dragndrop.handleDragEnd(rows);\n\n _notes = [];\n\n rows.each(function () {\n var row = $(this);\n var id = row.find('td.id').html();\n var date = row.find('td.date .labelIcon').html();\n var note = row.find('td.note textarea').val();\n var noteMarkup = row.find('td.preview article').html();\n\n _notes.push({\n id: parseInt(id, 10),\n date: date,\n note: note,\n noteMarkup: noteMarkup\n });\n });\n\n storageSaveObj(localStorage, STORAGE_KEY, _notes);\n });\n\n noteIcon.on('click', togglePanel).appendTo('#main-toolbar .buttons');\n }", "function somethingChanged() {\r\n\t\t\tif (timer)\r\n\t\t\t\treturn;\r\n\r\n\t\t\ttimer = setTimeout(function() {\r\n\t\t\t\ttimer = 0;\r\n\t\t\t\teditor.fire('changing');\r\n\t\t\t}, editor.config.minimumChangeMilliseconds || 100);\r\n\t\t}", "function onEventHandlersChanged() {\n if ((eventHandlers.length > 0) && !eventSocketManager.isStarted) {\n eventSocketManager.start();\n } else if ((eventHandlers.length == 0) && eventSocketManager.isStarted) {\n eventSocketManager.stop();\n }\n }", "function Signal() { }", "function updateLater() {\n // save the timeoutId for canceling\n timeoutId = $timeout(function() {\n updateTime(); // update DOM\n updateLater(); // schedule another update\n }, 1000);\n }", "internalSignalChanged(signal) {\n if (signal.id == this.publishedSignalId) {\n if (this.ready) {\n this.clock++;\n let clocks = new Map();\n if (this.amSource()) {\n clocks.set(this.ownType.tagVal, this.clock);\n }\n else {\n this.lastMatch.forEach((pv) => {\n pv.sClocks.forEach((clockVal, source) => {\n clocks.set(source, clockVal);\n });\n });\n }\n this.lastProp = new this.PropagationValue(this.ownType, signal, clocks, this.clock);\n this.sendToAllChildren(() => {\n this.childRefs.forEach((child) => {\n child.prePropagation(this.lastProp);\n //child.prePropagation(this.ownType.tagVal,signal.getState(),JSON.stringify([...clocks]),this.clock,true)\n });\n });\n }\n else {\n let sigClone = this.libs.clone(signal);\n this.readyListeners.push(() => {\n this.internalSignalChanged(sigClone);\n });\n }\n }\n }", "function updateLater() {\n // save the timeoutId for canceling\n timeoutId = $timeout(function () {\n updateTime(); // update DOM\n updateLater(); // schedule another update\n }, 1000);\n }", "function updateLater() {\n // save the timeoutId for canceling\n timeoutId = $timeout(function() {\n updateTime();\n updateLater(); // schedule another update\n }, 1000);\n }", "function updateLater() {\n \t\t\t// save the timeoutId for canceling\n \t\t\ttimeoutId = $timeout(function() {\n \t\t\t\tupdateTime(); // update DOM\n \t\t\t\tupdateLater(); // schedule another update\n \t\t\t}, 1000);\n \t\t}", "function registerNotificationHandlers() {\n notificationHandlersRegistered = true;\n\n // Attach an onClicked event handler.\n paragon.notifications.onClicked.addListener(function (notificationId) {\n // Bring the main Symphony window to the foreground.\n symphony.app.window.showWindow(\"main\");\n\n // Extract the callback for the current notification.\n var cb = notificationIds[notificationId];\n if (cb) {\n // We found stored callback info, execute it.\n execCallback(cb.method, cb.args);\n }\n });\n\n // Attach an onClosed event handler.\n paragon.notifications.onClosed.addListener(function (notificationId) {\n // Remove the callback info for the notification that has closed.\n delete notificationIds[notificationId];\n });\n }", "function updateLater() {\n\t // save the timeoutId for canceling\n\t timeoutId = $timeout(function() {\n\t updateTime(); // update DOM\n\t updateLater(); // schedule another update\n\t }, 1000);\n\t }", "async function setupQueueFunctionHandlers() {\n // The queue function panel should be modified properly\n // when the active instance is changed to a different instance selection.\n panel.elements.instanceTable.on(\"click\", \".instance-select\", updateQueueFunctions);\n\n // Searching for a function should modify the content to only\n // display functions that match based on name.\n panel.elements.customSearch.keyup(function() {\n // Regenerate all available queueables to match the search\n // terms provided.\n generateAvailableQueueables($(this).val());\n });\n\n // Make sure our custom duration type buttons all properly update\n // the main duration type button's text.\n panel.elements.customDurationSeconds.click(function() {\n // Update main dropdown button to use proper seconds text.\n panel.elements.customDurationType.text(\"Seconds\");\n });\n panel.elements.customDurationMinutes.click(function() {\n // Update main dropdown button to use proper minutes text.\n panel.elements.customDurationType.text(\"Minutes\");\n });\n panel.elements.customDurationHours.click(function() {\n // Update main dropdown button to use proper hours text.\n panel.elements.customDurationType.text(\"Hours\");\n });\n\n\n // Setup the listeners that deal with selecting a certain duration\n // amount for the queued function, \"now\" or \"custom\" can be chosen.\n panel.elements.customNow.click(function() {\n // Make sure the custom now button is set to a disabled state.\n // and the custom custom button is enabled.\n panel.elements.customNow.attr(\"disabled\", true);\n panel.elements.customCustom.attr(\"disabled\", false);\n\n // Make sure we modify the \"Custom\" button to use the\n // proper border radius, since no additional options are present now.\n panel.elements.customCustom.css({\n \"border-top-right-radius\": \"5px\",\n \"border-bottom-right-radius\": \"5px\"\n });\n\n // Hide any of our custom custom content that is only\n // enabled when the custom button is enabled.\n panel.elements.customDuration.attr(\"disabled\", true).fadeOut(100);\n panel.elements.customDurationType.attr(\"disabled\", true).fadeOut(100);\n });\n\n // Setup the listeners that deal with selecting the custom option\n // for choosing queued function durations.\n panel.elements.customCustom.click(function() {\n // Make sure the custom custom button is set to a disabled state\n // and the custom now button is enabled.\n panel.elements.customCustom.attr(\"disabled\", true);\n panel.elements.customNow.attr(\"disabled\", false);\n\n // Make sure we modify the \"custom\" button to now use\n // proper border radius.\n panel.elements.customCustom.css({\n \"border-top-right-radius\": \"0\",\n \"border-bottom-right-radius\": \"0\"\n });\n\n // Display the custom content that is only enabled when\n // the custom button is enabled.\n panel.elements.customDuration.attr(\"disabled\", false).fadeIn(100);\n panel.elements.customDurationType.attr(\"disabled\", false).fadeIn(100);\n });\n\n // Clicking on the queue flush button should attempt to clear\n // out all functions currently queued for the selected instance.\n panel.elements.flushQueue.click(function() {\n // Collect some information before deciding how to\n // deal with the queue flushing.\n let instance = activeInstance();\n let name = activeInstanceName();\n let state = activeInstanceStatus();\n\n // We should only even try to flush a queue if\n // the selected instance is running.\n if (state === \"stopped\") {\n // Instance selected is stopped, notify user about\n // inability to handle flushing.\n generateToast(\"Flush Queue\", `Queued functions cannot be flushed while <em>${name}</em> is stopped.`, \"warning\");\n } else {\n // Instance selected is running or paused, generate a warning if no queued\n // functions are even present, or run functionality to flush.\n if (panel.elements.queuedTableBody.find(\"tr\").length === 0) {\n // No queued functions.\n generateToast(\"Flush Queue\", `No functions are currently queued up to execute against <em>${name}</em>.`, \"warning\");\n } else {\n // Some queued functions are present, let's go ahead and remove them.\n eel.dashboard_queue_function_flush(instance)();\n }\n }\n\n });\n\n // Clicking on any of the function buttons should attempt to\n // queue up the function for the instance that's selected.\n panel.elements.queueablesContent.on(\"click\", \".queue-function\", function() {\n // Collect some information before deciding how to\n // treat the potential queued function.\n let _function = $(this).data(\"function\");\n let formatted = $(this).data(\"formatted\").toLowerCase();\n // Instance information.\n let instance = activeInstance();\n let name = activeInstanceName();\n let state = activeInstanceStatus();\n\n // We should only ever actually send the queue function\n // signal if the selected instance is running.\n if (state === \"stopped\") {\n // Instance selected is stopped, generate a toast letting\n // the user know that they can not queue functions yet.\n generateToast(\"Queue Function\", `Function: <strong>${formatted}</strong> cannot be queued while <em>${name}</em> is stopped.`, \"warning\");\n } else {\n let duration = 0;\n let durationType = panel.elements.customDurationType.text();\n\n // We need to derive some information about what kind of duration\n // or wait period will be used for the function.\n if (panel.elements.customCustom.is(\":disabled\")) {\n // A custom duration is being used. Make sure the user\n // has entered a custom value of some sort.\n if (panel.elements.customDuration.val()) {\n duration = panel.elements.customDuration.val();\n } else {\n return generateToast(\"Queue Function\", `You must enter a valid <strong>duration</strong> if the <em>custom</em> duration button is selected.`, \"danger\");\n }\n }\n\n // The instance selected is either running or paused,\n // we can go ahead and queue up our function.\n // Messages and modifications to the content are handled\n // by our websockets, so we can fire and forget this function.\n eel.dashboard_queue_function(instance, _function, duration, durationType)();\n }\n });\n }", "function SignalDispatcher() {\n return _super.call(this) || this;\n }", "_processDelayedTriggers() {\n if (this.isDestroyed) return;\n let hasChange = false;\n this._delayedTriggers = this._delayedTriggers.filter((evt) => {\n if (evt[0] === 'message-type-model:change' && !hasChange) {\n hasChange = true;\n return true;\n } else if (evt[0] === 'message-type-model:change') {\n return false;\n } else {\n return true;\n }\n });\n super._processDelayedTriggers();\n }", "function T(e,t,n){Q.reference.addEventListener(e,t),n.push({eventType:e,handler:t})}", "function wrapEventHandler(externalHandler) {\n return function (instance) {\n externalHandler(editor);\n };\n }", "handleTimer() {\n this.setTimerInterrupt(true);\n }", "constructor(options) {\n this._cleared = new Signal(this);\n this._disposed = new Signal(this);\n this._editor = null;\n this._inspected = new Signal(this);\n this._isDisposed = false;\n this._pending = 0;\n this._standby = true;\n this._connector = options.connector;\n this._rendermime = options.rendermime;\n this._debouncer = new Debouncer(this.onEditorChange.bind(this), 250);\n }", "function terminate() {\n\tt.murder(eventHandlers.cb);\n}", "function clearNextQueuedFunction () {\n if(bto) {\n clearTimeout(bto);\n bto = null; }\n }", "handlerWillAdd (event, when, handler) {\n\n }", "function Signal() {\n /**\n * @type Array.<SignalBinding>\n * @private\n */\n this._bindings = [];\n this._prevParams = null;\n\n // enforce dispatch to aways work on same context (#47)\n var self = this;\n this.dispatch = function(){\n Signal.prototype.dispatch.apply(self, arguments);\n };\n }", "function ckEditorContentChanged() {\r\n if (timer)\r\n return;\r\n\r\n timer = setTimeout(function() {\r\n timer = 0;\r\n self.fireEvent('contentChanged', self);\r\n }, 100);\r\n }", "function notify(){\n var l = onChangeQueue.length;\n\n while(l--){\n try{\n onChangeQueue[l](service.current);\n }catch(err){\n onChangeQueue.splice(l, 1);\n }\n }\n }", "static get none() {\n return new AbortSignal();\n }", "static get none() {\n return new AbortSignal();\n }", "static get none() {\n return new AbortSignal();\n }", "function Signal() {\n var subs = [];\n return {\n subscribe: function subscribe(cb) {\n subs.push(cb);\n },\n unsubscribe: function unsubscribe(cb) {\n var index = subs.indexOf(cb);\n\n if (index > -1) {\n subs.splice(index, 1);\n }\n },\n abort: function abort() {\n var tmp = [].concat(subs);\n subs.length = 0;\n tmp.forEach(function (cb) {\n try {\n cb();\n } catch (err) {\n logger.error('abort', err);\n }\n });\n }\n };\n}", "function sayHiLater(anyFunctionReference)\n{\n // simulate some code running \n // takes some time ...\n // and more time ...\n anyFunctionReference();\n}", "function Signal() {\n /**\n * @type Array.<SignalBinding>\n * @private\n */\n this._bindings = [];\n this._prevParams = null;\n\n // enforce dispatch to aways work on same context (#47)\n var self = this;\n this.dispatch = function () {\n Signal.prototype.dispatch.apply(self, arguments);\n };\n }", "function y(t){if(null!=t&&null!=t._parent)for(const e in t._handlers)t._parent.removeListener(e,t._handlers[e])}", "function ir(e,t,a,n){var r=e.history,f=n&&n.origin;\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n a==r.lastSelOp||f&&r.lastSelOrigin==f&&(r.lastModTime==r.lastSelTime&&r.lastOrigin==f||or(e,f,p(r.done),t))?r.done[r.done.length-1]=t:sr(t,r.done),r.lastSelTime=+new Date,r.lastSelOrigin=f,r.lastSelOp=a,n&&!1!==n.clearRedo&&nr(r.undone)}", "function _registerEventHandler() {\n\t\t$.$TASMA.find('.button.new').on('click', TaskManager.add);\n\t\t$.$TASMA.find('.tasks-list').on('click', '.button.remove', TaskManager.remove);\n\t\t$.$TASMA.find('.button.remove-all').on('click', TaskManager.removeAll);\n\t\t$.$TASMA.find('.button.save').on('click', TaskManager.save);\n\t\t$.$TASMA.find('.button.cancel').on('click', TaskManager.cancel);\n\t}", "_handleAnyTextareaChanges() {\n const oldValue = this._textarea.value;\n setTimeout(() => {\n // Ignore if a composition has started since the timeout\n if (!this._isComposing) {\n const newValue = this._textarea.value;\n const diff = newValue.replace(oldValue, '');\n if (diff.length > 0) {\n this._dataAlreadySent = diff;\n this._coreService.triggerDataEvent(diff, true);\n }\n }\n }, 0);\n }", "function abortSignal(signal) {\n if (abortedFlags.get(signal) !== false) {\n return;\n }\n abortedFlags.set(signal, true);\n signal.dispatchEvent({ type: \"abort\" });\n}", "function abortSignal(signal) {\n if (abortedFlags.get(signal) !== false) {\n return;\n }\n abortedFlags.set(signal, true);\n signal.dispatchEvent({ type: \"abort\" });\n}", "function eventHandlersOnce() {\n\tif (globalDebug) {console.group(\"Event Handlers Once\");}\n\n\tmenuTrigger();\n\n\tif (globalDebug) {console.groupEnd();}\n}", "function handleEarlyInteraction() {\n clearTimeout(tId);\n cleanup();\n }", "function FP_RMSGB_PRIVATE_Submit(QueuedObject)\n//#else\n//# static function FP_RMSGB_PRIVATE_Submit ( QueuedObject )\n//#endif \n{\n var thisObject = QueuedObject.thisObject;\n var strEvent = QueuedObject.strEvent;\n \n if ((strEvent == \"CONFIRMED\") || (QueuedObject.flaguSignalCanceled)) VF_SY506_PRIVATE_HandleEvent(thisObject, strEvent);\n}", "function onEventTimer() {\n triggerEvents(inbandEvents);\n triggerEvents(inlineEvents);\n removeEvents();\n }", "setSignal(signal) {\n this.signal = signal;\n }", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}" ]
[ "0.6554211", "0.64453864", "0.64453864", "0.64453864", "0.6413596", "0.64093375", "0.62302804", "0.6220109", "0.6220109", "0.6220109", "0.6220109", "0.6220109", "0.6048615", "0.60203564", "0.6013591", "0.6013591", "0.6013591", "0.6013591", "0.6013591", "0.6013591", "0.6013591", "0.6013591", "0.6013591", "0.6013591", "0.6013591", "0.60090977", "0.60090977", "0.5096462", "0.4568947", "0.45465416", "0.45205972", "0.44782802", "0.44594532", "0.4449275", "0.4397897", "0.43962827", "0.43734676", "0.43732667", "0.43678492", "0.43562448", "0.43318558", "0.4313008", "0.42997205", "0.42709923", "0.42595136", "0.4255116", "0.4254913", "0.4230653", "0.4229143", "0.42247507", "0.42227006", "0.41925505", "0.41921175", "0.41769725", "0.41644102", "0.41428706", "0.41280675", "0.41215047", "0.4114243", "0.41095835", "0.41049272", "0.4099984", "0.40893966", "0.408283", "0.408283", "0.408283", "0.4082448", "0.40805674", "0.40805274", "0.4077982", "0.40659955", "0.40629295", "0.40629286", "0.4058616", "0.4058616", "0.40522432", "0.4047971", "0.4038365", "0.40376893", "0.40339482", "0.40121672", "0.40121672", "0.40121672", "0.40121672" ]
0.615517
26
When an aspect of a line changes, a string is added to lineView.changes. This updates the relevant part of the line's DOM structure.
function updateLineForChanges(cm, lineView, lineN, dims) { for (var j = 0; j < lineView.changes.length; j++) { var type = lineView.changes[j]; if (type == "text") { updateLineText(cm, lineView); } else if (type == "gutter") { updateLineGutter(cm, lineView, lineN, dims); } else if (type == "class") { updateLineClasses(cm, lineView); } else if (type == "widget") { updateLineWidgets(cm, lineView, dims); } } lineView.changes = null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateLineForChanges(cm, lineView, lineN, dims) {\n\t\t for (var j = 0; j < lineView.changes.length; j++) {\n\t\t var type = lineView.changes[j];\n\t\t if (type == \"text\") updateLineText(cm, lineView);\n\t\t else if (type == \"gutter\") updateLineGutter(cm, lineView, lineN, dims);\n\t\t else if (type == \"class\") updateLineClasses(lineView);\n\t\t else if (type == \"widget\") updateLineWidgets(cm, lineView, dims);\n\t\t }\n\t\t lineView.changes = null;\n\t\t }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n\t\t for (var j = 0; j < lineView.changes.length; j++) {\n\t\t var type = lineView.changes[j];\n\t\t if (type == \"text\") { updateLineText(cm, lineView); }\n\t\t else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n\t\t else if (type == \"class\") { updateLineClasses(cm, lineView); }\n\t\t else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n\t\t }\n\t\t lineView.changes = null;\n\t\t }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n\t for (var j = 0; j < lineView.changes.length; j++) {\n\t var type = lineView.changes[j];\n\t if (type == \"text\") updateLineText(cm, lineView);\n\t else if (type == \"gutter\") updateLineGutter(cm, lineView, lineN, dims);\n\t else if (type == \"class\") updateLineClasses(lineView);\n\t else if (type == \"widget\") updateLineWidgets(cm, lineView, dims);\n\t }\n\t lineView.changes = null;\n\t }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n\t for (var j = 0; j < lineView.changes.length; j++) {\n\t var type = lineView.changes[j];\n\t if (type == \"text\") updateLineText(cm, lineView);\n\t else if (type == \"gutter\") updateLineGutter(cm, lineView, lineN, dims);\n\t else if (type == \"class\") updateLineClasses(lineView);\n\t else if (type == \"widget\") updateLineWidgets(cm, lineView, dims);\n\t }\n\t lineView.changes = null;\n\t }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n\t for (var j = 0; j < lineView.changes.length; j++) {\n\t var type = lineView.changes[j];\n\t if (type == \"text\") updateLineText(cm, lineView);\n\t else if (type == \"gutter\") updateLineGutter(cm, lineView, lineN, dims);\n\t else if (type == \"class\") updateLineClasses(lineView);\n\t else if (type == \"widget\") updateLineWidgets(cm, lineView, dims);\n\t }\n\t lineView.changes = null;\n\t }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") updateLineText(cm, lineView);\n else if (type == \"gutter\") updateLineGutter(cm, lineView, lineN, dims);\n else if (type == \"class\") updateLineClasses(lineView);\n else if (type == \"widget\") updateLineWidgets(lineView, dims);\n }\n lineView.changes = null;\n }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") updateLineText(cm, lineView);\n else if (type == \"gutter\") updateLineGutter(cm, lineView, lineN, dims);\n else if (type == \"class\") updateLineClasses(lineView);\n else if (type == \"widget\") updateLineWidgets(lineView, dims);\n }\n lineView.changes = null;\n }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") updateLineText(cm, lineView);\n else if (type == \"gutter\") updateLineGutter(cm, lineView, lineN, dims);\n else if (type == \"class\") updateLineClasses(lineView);\n else if (type == \"widget\") updateLineWidgets(lineView, dims);\n }\n lineView.changes = null;\n }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") updateLineText(cm, lineView);\n else if (type == \"gutter\") updateLineGutter(cm, lineView, lineN, dims);\n else if (type == \"class\") updateLineClasses(lineView);\n else if (type == \"widget\") updateLineWidgets(lineView, dims);\n }\n lineView.changes = null;\n }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") updateLineText(cm, lineView);\n else if (type == \"gutter\") updateLineGutter(cm, lineView, lineN, dims);\n else if (type == \"class\") updateLineClasses(lineView);\n else if (type == \"widget\") updateLineWidgets(lineView, dims);\n }\n lineView.changes = null;\n }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") updateLineText(cm, lineView);\n else if (type == \"gutter\") updateLineGutter(cm, lineView, lineN, dims);\n else if (type == \"class\") updateLineClasses(lineView);\n else if (type == \"widget\") updateLineWidgets(lineView, dims);\n }\n lineView.changes = null;\n }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n\n if (type == \"text\") {\n updateLineText(cm, lineView);\n } else if (type == \"gutter\") {\n updateLineGutter(cm, lineView, lineN, dims);\n } else if (type == \"class\") {\n updateLineClasses(cm, lineView);\n } else if (type == \"widget\") {\n updateLineWidgets(cm, lineView, dims);\n }\n }\n\n lineView.changes = null;\n } // Lines with gutter elements, widgets or a background class need to", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") updateLineText(cm, lineView);\n else if (type == \"gutter\") updateLineGutter(cm, lineView, lineN, dims);\n else if (type == \"class\") updateLineClasses(lineView);\n else if (type == \"widget\") updateLineWidgets(cm, lineView, dims);\n }\n lineView.changes = null;\n }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") updateLineText(cm, lineView);\n else if (type == \"gutter\") updateLineGutter(cm, lineView, lineN, dims);\n else if (type == \"class\") updateLineClasses(lineView);\n else if (type == \"widget\") updateLineWidgets(cm, lineView, dims);\n }\n lineView.changes = null;\n }", "function updateLineForChanges(cm, lineView, lineN, dims) {\r\n for (var j = 0; j < lineView.changes.length; j++) {\r\n var type = lineView.changes[j];\r\n if (type == \"text\") updateLineText(cm, lineView);\r\n else if (type == \"gutter\") updateLineGutter(cm, lineView, lineN, dims);\r\n else if (type == \"class\") updateLineClasses(lineView);\r\n else if (type == \"widget\") updateLineWidgets(lineView, dims);\r\n }\r\n lineView.changes = null;\r\n }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j]\n if (type == \"text\") { updateLineText(cm, lineView) }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims) }\n else if (type == \"class\") { updateLineClasses(cm, lineView) }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims) }\n }\n lineView.changes = null\n}", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j]\n if (type == \"text\") { updateLineText(cm, lineView) }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims) }\n else if (type == \"class\") { updateLineClasses(lineView) }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims) }\n }\n lineView.changes = null\n}", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n}", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n}", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n}", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n}", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n}", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n}", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n}", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n}", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n}", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n}", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n}", "function updateLineForChanges(cm, lineView, lineN, dims) {\r\n for (var j = 0; j < lineView.changes.length; j++) {\r\n var type = lineView.changes[j];\r\n if (type == \"text\") { updateLineText(cm, lineView); }\r\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\r\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\r\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\r\n }\r\n lineView.changes = null;\r\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n\n if (lineView.text == lineView.node) {\n lineView.node = built.pre;\n }\n\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\r\n var cls = lineView.text.className;\r\n var built = getLineContent(cm, lineView);\r\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\r\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\r\n lineView.text = built.pre;\r\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\r\n lineView.bgClass = built.bgClass;\r\n lineView.textClass = built.textClass;\r\n updateLineClasses(cm, lineView);\r\n } else if (cls) {\r\n lineView.text.className = cls;\r\n }\r\n}", "function updateLineText(cm, lineView) {\n\t\t var cls = lineView.text.className;\n\t\t var built = getLineContent(cm, lineView);\n\t\t if (lineView.text == lineView.node) { lineView.node = built.pre; }\n\t\t lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n\t\t lineView.text = built.pre;\n\t\t if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n\t\t lineView.bgClass = built.bgClass;\n\t\t lineView.textClass = built.textClass;\n\t\t updateLineClasses(cm, lineView);\n\t\t } else if (cls) {\n\t\t lineView.text.className = cls;\n\t\t }\n\t\t }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className\n var built = getLineContent(cm, lineView)\n if (lineView.text == lineView.node) { lineView.node = built.pre }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text)\n lineView.text = built.pre\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass\n lineView.textClass = built.textClass\n updateLineClasses(cm, lineView)\n } else if (cls) {\n lineView.text.className = cls\n }\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className\n var built = getLineContent(cm, lineView)\n if (lineView.text == lineView.node) { lineView.node = built.pre }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text)\n lineView.text = built.pre\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass\n lineView.textClass = built.textClass\n updateLineClasses(lineView)\n } else if (cls) {\n lineView.text.className = cls\n }\n}", "function updateLineText(cm, lineView) {\r\n var cls = lineView.text.className;\r\n var built = getLineContent(cm, lineView);\r\n if (lineView.text == lineView.node) lineView.node = built.pre;\r\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\r\n lineView.text = built.pre;\r\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\r\n lineView.bgClass = built.bgClass;\r\n lineView.textClass = built.textClass;\r\n updateLineClasses(lineView);\r\n } else if (cls) {\r\n lineView.text.className = cls;\r\n }\r\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) lineView.node = built.pre;\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) lineView.node = built.pre;\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) lineView.node = built.pre;\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) lineView.node = built.pre;\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) lineView.node = built.pre;\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) lineView.node = built.pre;\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) lineView.node = built.pre;\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) lineView.node = built.pre;\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n\t var cls = lineView.text.className;\n\t var built = getLineContent(cm, lineView);\n\t if (lineView.text == lineView.node) lineView.node = built.pre;\n\t lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n\t lineView.text = built.pre;\n\t if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n\t lineView.bgClass = built.bgClass;\n\t lineView.textClass = built.textClass;\n\t updateLineClasses(lineView);\n\t } else if (cls) {\n\t lineView.text.className = cls;\n\t }\n\t }", "function updateLineText(cm, lineView) {\n\t var cls = lineView.text.className;\n\t var built = getLineContent(cm, lineView);\n\t if (lineView.text == lineView.node) lineView.node = built.pre;\n\t lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n\t lineView.text = built.pre;\n\t if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n\t lineView.bgClass = built.bgClass;\n\t lineView.textClass = built.textClass;\n\t updateLineClasses(lineView);\n\t } else if (cls) {\n\t lineView.text.className = cls;\n\t }\n\t }", "function updateLineText(cm, lineView) {\n\t var cls = lineView.text.className;\n\t var built = getLineContent(cm, lineView);\n\t if (lineView.text == lineView.node) lineView.node = built.pre;\n\t lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n\t lineView.text = built.pre;\n\t if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n\t lineView.bgClass = built.bgClass;\n\t lineView.textClass = built.textClass;\n\t updateLineClasses(lineView);\n\t } else if (cls) {\n\t lineView.text.className = cls;\n\t }\n\t }", "function updateLineText(cm, lineView) {\n\t\t var cls = lineView.text.className;\n\t\t var built = getLineContent(cm, lineView);\n\t\t if (lineView.text == lineView.node) lineView.node = built.pre;\n\t\t lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n\t\t lineView.text = built.pre;\n\t\t if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n\t\t lineView.bgClass = built.bgClass;\n\t\t lineView.textClass = built.textClass;\n\t\t updateLineClasses(lineView);\n\t\t } else if (cls) {\n\t\t lineView.text.className = cls;\n\t\t }\n\t\t }", "function regLineChange(cm, line, type) {\n\t\t cm.curOp.viewChanged = true;\n\t\t var display = cm.display, ext = cm.display.externalMeasured;\n\t\t if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n\t\t display.externalMeasured = null;\n\t\t\n\t\t if (line < display.viewFrom || line >= display.viewTo) return;\n\t\t var lineView = display.view[findViewIndex(cm, line)];\n\t\t if (lineView.node == null) return;\n\t\t var arr = lineView.changes || (lineView.changes = []);\n\t\t if (indexOf(arr, type) == -1) arr.push(type);\n\t\t }", "function regLineChange(cm, line, type) {\n\t\t cm.curOp.viewChanged = true;\n\t\t var display = cm.display, ext = cm.display.externalMeasured;\n\t\t if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n\t\t { display.externalMeasured = null; }\n\n\t\t if (line < display.viewFrom || line >= display.viewTo) { return }\n\t\t var lineView = display.view[findViewIndex(cm, line)];\n\t\t if (lineView.node == null) { return }\n\t\t var arr = lineView.changes || (lineView.changes = []);\n\t\t if (indexOf(arr, type) == -1) { arr.push(type); }\n\t\t }", "function regLineChange(cm, line, type) {\n cm.curOp.viewChanged = true;\n var display = cm.display, ext = cm.display.externalMeasured;\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n\n if (line < display.viewFrom || line >= display.viewTo) { return }\n var lineView = display.view[findViewIndex(cm, line)];\n if (lineView.node == null) { return }\n var arr = lineView.changes || (lineView.changes = []);\n if (indexOf(arr, type) == -1) { arr.push(type); }\n }", "function regLineChange(cm, line, type) {\n cm.curOp.viewChanged = true;\n var display = cm.display, ext = cm.display.externalMeasured;\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n\n if (line < display.viewFrom || line >= display.viewTo) { return }\n var lineView = display.view[findViewIndex(cm, line)];\n if (lineView.node == null) { return }\n var arr = lineView.changes || (lineView.changes = []);\n if (indexOf(arr, type) == -1) { arr.push(type); }\n }", "function regLineChange(cm, line, type) {\n cm.curOp.viewChanged = true;\n var display = cm.display, ext = cm.display.externalMeasured;\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n\n if (line < display.viewFrom || line >= display.viewTo) { return }\n var lineView = display.view[findViewIndex(cm, line)];\n if (lineView.node == null) { return }\n var arr = lineView.changes || (lineView.changes = []);\n if (indexOf(arr, type) == -1) { arr.push(type); }\n }", "function regLineChange(cm, line, type) {\n cm.curOp.viewChanged = true;\n var display = cm.display, ext = cm.display.externalMeasured;\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n\n if (line < display.viewFrom || line >= display.viewTo) { return }\n var lineView = display.view[findViewIndex(cm, line)];\n if (lineView.node == null) { return }\n var arr = lineView.changes || (lineView.changes = []);\n if (indexOf(arr, type) == -1) { arr.push(type); }\n }", "function regLineChange(cm, line, type) {\n cm.curOp.viewChanged = true;\n var display = cm.display, ext = cm.display.externalMeasured;\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n\n if (line < display.viewFrom || line >= display.viewTo) { return }\n var lineView = display.view[findViewIndex(cm, line)];\n if (lineView.node == null) { return }\n var arr = lineView.changes || (lineView.changes = []);\n if (indexOf(arr, type) == -1) { arr.push(type); }\n }", "function regLineChange(cm, line, type) {\n cm.curOp.viewChanged = true;\n var display = cm.display, ext = cm.display.externalMeasured;\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n\n if (line < display.viewFrom || line >= display.viewTo) { return }\n var lineView = display.view[findViewIndex(cm, line)];\n if (lineView.node == null) { return }\n var arr = lineView.changes || (lineView.changes = []);\n if (indexOf(arr, type) == -1) { arr.push(type); }\n }", "function regLineChange(cm, line, type) {\n cm.curOp.viewChanged = true;\n var display = cm.display, ext = cm.display.externalMeasured;\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n\n if (line < display.viewFrom || line >= display.viewTo) { return }\n var lineView = display.view[findViewIndex(cm, line)];\n if (lineView.node == null) { return }\n var arr = lineView.changes || (lineView.changes = []);\n if (indexOf(arr, type) == -1) { arr.push(type); }\n }" ]
[ "0.7633977", "0.7631411", "0.7612085", "0.7612085", "0.7612085", "0.760189", "0.760189", "0.760189", "0.760189", "0.760189", "0.760189", "0.7598171", "0.7597313", "0.7597313", "0.75850314", "0.7557656", "0.7553357", "0.7506481", "0.7506481", "0.7506481", "0.7506481", "0.7506481", "0.7506481", "0.7506481", "0.7506481", "0.7506481", "0.7506481", "0.7506481", "0.74821", "0.7052314", "0.7022397", "0.7014641", "0.7010442", "0.7010442", "0.7010442", "0.7010442", "0.7010442", "0.7010442", "0.7010442", "0.7010442", "0.7010442", "0.7010442", "0.7010442", "0.70088446", "0.70062834", "0.70062834", "0.70062834", "0.70062834", "0.70062834", "0.70062834", "0.70062834", "0.70062834", "0.70062834", "0.70062834", "0.70062834", "0.70062834", "0.70062834", "0.70062834", "0.70062834", "0.70062834", "0.70062834", "0.7005161", "0.6995435", "0.6993949", "0.6993949", "0.6993949", "0.6993949", "0.6993949", "0.6993949", "0.6993949", "0.6993949", "0.69917476", "0.69917476", "0.69917476", "0.6990059", "0.6980273", "0.6974858", "0.696299", "0.696299", "0.696299", "0.696299", "0.696299", "0.696299", "0.696299" ]
0.75903237
26
Lines with gutter elements, widgets or a background class need to be wrapped, and have the extra elements added to the wrapper div
function ensureLineWrapped(lineView) { if (lineView.node == lineView.text) { lineView.node = elt("div", null, null, "position: relative"); if (lineView.text.parentNode) { lineView.text.parentNode.replaceChild(lineView.node, lineView.text); } lineView.node.appendChild(lineView.text); if (ie && ie_version < 8) { lineView.node.style.zIndex = 2; } } return lineView.node }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function wa(e){for(var t=e.display,a={},n={},r=t.gutters.clientLeft,f=t.gutters.firstChild,o=0;f;f=f.nextSibling,++o)a[e.options.gutters[o]]=f.offsetLeft+f.clientLeft+r,n[e.options.gutters[o]]=f.clientWidth;return{fixedPos:xa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:a,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}", "function Rn(e){var a=e.display.gutters,r=e.options.gutters;t(a);for(var f=0;f<r.length;++f){var o=r[f],i=a.appendChild(n(\"div\",null,\"CodeMirror-gutter \"+o));\"CodeMirror-linenumbers\"==o&&(e.display.lineGutter=i,i.style.width=(e.display.lineNumWidth||1)+\"px\")}a.style.display=f?\"\":\"none\",In(e)}", "function wrapContent() {\n canvas.find('.column').each(function() {\n var col = $(this);\n var contents = $();\n col.children().each(function() {\n var child = $(this);\n if (child.is('.row, .ge-tools-drawer, .ge-content')) {\n doWrap(contents);\n } else {\n contents = contents.add(child);\n }\n });\n doWrap(contents);\n });\n }", "function addLineClassToWraps(change) {\n var view = change.view;\n change.eachLine(function (info) {\n info.handles.all.forEach(function (handle) {\n view.addLineClass(handle, 'wrap', 'line');\n });\n });\n }", "addGridLines () {\n }", "wrap(wrapper){wrapper.appendChild(this.range.extractContents());this.range.insertNode(wrapper)}", "function _formatWrapper() {\n\t\t\tif ( _settings.wrapper && _settings.wrapper.children().length ) {\n\t\t\t\tif ( _settings.wrapper.css( 'overflow-y' ) !== 'scroll' ) {\n\t\t\t\t\t_settings.wrapper.css( 'overflow-y', 'scroll' );\n\t\t\t\t}\n\t\t\t\tif ( _settings.wrapper.css( 'overflow-x' ) !== 'hidden' ) {\n\t\t\t\t\t_settings.wrapper.css( 'overflow-x', 'hidden' );\n\t\t\t\t}\n\t\t\t\tif ( !_settings.wrapper.children().first().hasClass( 'smoothScrollContainer' ) ) {\n\t\t\t\t\t_settings.wrapper.children().wrapAll( '<div class=\"smoothScrollContainer\" style=\"position:relative; overflow:hidden;\" />' );\n\t\t\t\t}\n\t\t\t}\n\t\t}", "function createCustomLineNumberGutter(editor, lineNumbers, gutterWidth, options = {}) {\n const {\n extraName,\n onClick\n } = options; // 'nuclide-ui-file-changes-line-number-gutter-wX' makes a gutter Xem wide.\n // 'nuclide-ui-file-changes-line-number-gutter' makes a gutter 5em wide\n\n const suffix = gutterWidth > 0 && gutterWidth < MAX_GUTTER_WIDTH ? `-w${gutterWidth}` : '';\n let name = `nuclide-ui-file-changes-line-number-gutter${suffix}`;\n\n if (extraName != null) {\n name += ` ${extraName}`;\n }\n\n const gutter = editor.addGutter({\n name\n });\n let index = -1;\n\n for (const lineNumber of lineNumbers) {\n index++;\n\n if (lineNumber == null) {\n continue;\n }\n\n const marker = editor.markBufferPosition([index, 0], {\n invalidate: 'touch'\n });\n const item = createGutterItem(lineNumber, gutterWidth, onClick);\n gutter.decorateMarker(marker, {\n type: 'gutter',\n item\n });\n gutter.onDidDestroy(() => {\n marker.destroy();\n\n _reactDom.default.unmountComponentAtNode(item);\n });\n }\n\n return gutter;\n}", "function SVGWrap() {}", "wrap(body, spacing = this.indentSpacing) {\n return wrap(this.render(body), this.opts.maxWidth - spacing, { hard: true });\n }", "handleWrapping() {\n // Off the left or right\n if (this.x < 0) {\n this.x += width;\n } else if (this.x > width) {\n this.x -= width;\n }\n // Off the top or bottom\n if (this.y < 0) {\n this.y += height;\n } else if (this.y > height) {\n this.y -= height;\n }\n }", "handleWrapping() {\n // Off the left or right\n if (this.x < 0) {\n this.x += width;\n } else if (this.x > width) {\n this.x -= width;\n }\n // Off the top or bottom\n if (this.y < 0) {\n this.y += height;\n } else if (this.y > height) {\n this.y -= height;\n }\n }", "function createWrapperForGrid(){\n let classMainWrapper = \"wrapper\";\n let idWrapper = \"wrp\";\n let wrap = `\n <div class=${classMainWrapper} id=${idWrapper}></div>\n `;\n document.getElementsByTagName(\"BODY\")[0].innerHTML = wrap;\n}", "function gutter(config) {\n return [gutters(), activeGutters.of(Object.assign(Object.assign({}, defaults), config))];\n}", "_createLineNumbers(editor) {\n const {\n changes,\n newStart: initialOffset\n } = this.props.hunk;\n const changeCount = changes.length;\n const maxDisplayLineNumber = initialOffset + changeCount - 1; // The maximum required gutter width for this hunk, in characters:\n\n const gutterWidth = String(maxDisplayLineNumber).length;\n let deletedLinesInSection = 0;\n let deletedLines = 0; // use a generator to avoid having to precalculate and store an array of\n // line numbers\n\n function* lineNumberGenerator() {\n for (let line = 0; line < changeCount; line++) {\n if (changes[line].type === 'del') {\n deletedLinesInSection++;\n } else {\n deletedLines += deletedLinesInSection;\n deletedLinesInSection = 0;\n }\n\n yield line + initialOffset - deletedLines;\n }\n }\n\n const gutter = createCustomLineNumberGutter(editor, lineNumberGenerator(), gutterWidth, {\n onClick: this.props.onClickLine\n });\n\n this._disposables.add(() => {\n gutter.destroy();\n });\n }", "function insertLineWidgets(cm, lineView, dims) {\n\t\t insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n\t\t if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n\t\t { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }\n\t\t }", "function insertLineWidgets(cm, lineView, dims) {\n\t\t insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n\t\t if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\n\t\t insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false);\n\t\t }", "function renderGutters(display) {\n var gutters = display.gutters, specs = display.gutterSpecs;\n removeChildren(gutters);\n display.lineGutter = null;\n for (var i = 0; i < specs.length; ++i) {\n var ref = specs[i];\n var className = ref.className;\n var style = ref.style;\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + className));\n if (style) { gElt.style.cssText = style; }\n if (className == \"CodeMirror-linenumbers\") {\n display.lineGutter = gElt;\n gElt.style.width = (display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = specs.length ? \"\" : \"none\";\n updateGutterSpace(display);\n }", "function renderGutters(display) {\n var gutters = display.gutters, specs = display.gutterSpecs;\n removeChildren(gutters);\n display.lineGutter = null;\n for (var i = 0; i < specs.length; ++i) {\n var ref = specs[i];\n var className = ref.className;\n var style = ref.style;\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + className));\n if (style) { gElt.style.cssText = style; }\n if (className == \"CodeMirror-linenumbers\") {\n display.lineGutter = gElt;\n gElt.style.width = (display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = specs.length ? \"\" : \"none\";\n updateGutterSpace(display);\n }", "function renderGutters(display) {\n var gutters = display.gutters, specs = display.gutterSpecs;\n removeChildren(gutters);\n display.lineGutter = null;\n for (var i = 0; i < specs.length; ++i) {\n var ref = specs[i];\n var className = ref.className;\n var style = ref.style;\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + className));\n if (style) { gElt.style.cssText = style; }\n if (className == \"CodeMirror-linenumbers\") {\n display.lineGutter = gElt;\n gElt.style.width = (display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = specs.length ? \"\" : \"none\";\n updateGutterSpace(display);\n }", "function renderGutters(display) {\n var gutters = display.gutters, specs = display.gutterSpecs;\n removeChildren(gutters);\n display.lineGutter = null;\n for (var i = 0; i < specs.length; ++i) {\n var ref = specs[i];\n var className = ref.className;\n var style = ref.style;\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + className));\n if (style) { gElt.style.cssText = style; }\n if (className == \"CodeMirror-linenumbers\") {\n display.lineGutter = gElt;\n gElt.style.width = (display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = specs.length ? \"\" : \"none\";\n updateGutterSpace(display);\n }", "function renderGutters(display) {\n var gutters = display.gutters, specs = display.gutterSpecs;\n removeChildren(gutters);\n display.lineGutter = null;\n for (var i = 0; i < specs.length; ++i) {\n var ref = specs[i];\n var className = ref.className;\n var style = ref.style;\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + className));\n if (style) { gElt.style.cssText = style; }\n if (className == \"CodeMirror-linenumbers\") {\n display.lineGutter = gElt;\n gElt.style.width = (display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = specs.length ? \"\" : \"none\";\n updateGutterSpace(display);\n }", "function renderGutters(display) {\n var gutters = display.gutters, specs = display.gutterSpecs;\n removeChildren(gutters);\n display.lineGutter = null;\n for (var i = 0; i < specs.length; ++i) {\n var ref = specs[i];\n var className = ref.className;\n var style = ref.style;\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + className));\n if (style) { gElt.style.cssText = style; }\n if (className == \"CodeMirror-linenumbers\") {\n display.lineGutter = gElt;\n gElt.style.width = (display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = specs.length ? \"\" : \"none\";\n updateGutterSpace(display);\n }", "function renderGutters(display) {\n var gutters = display.gutters, specs = display.gutterSpecs;\n removeChildren(gutters);\n display.lineGutter = null;\n for (var i = 0; i < specs.length; ++i) {\n var ref = specs[i];\n var className = ref.className;\n var style = ref.style;\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + className));\n if (style) { gElt.style.cssText = style; }\n if (className == \"CodeMirror-linenumbers\") {\n display.lineGutter = gElt;\n gElt.style.width = (display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = specs.length ? \"\" : \"none\";\n updateGutterSpace(display);\n }", "function renderGutters(display) {\n var gutters = display.gutters, specs = display.gutterSpecs;\n removeChildren(gutters);\n display.lineGutter = null;\n for (var i = 0; i < specs.length; ++i) {\n var ref = specs[i];\n var className = ref.className;\n var style = ref.style;\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + className));\n if (style) { gElt.style.cssText = style; }\n if (className == \"CodeMirror-linenumbers\") {\n display.lineGutter = gElt;\n gElt.style.width = (display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = specs.length ? \"\" : \"none\";\n updateGutterSpace(display);\n }", "function renderGutters(display) {\n var gutters = display.gutters, specs = display.gutterSpecs;\n removeChildren(gutters);\n display.lineGutter = null;\n for (var i = 0; i < specs.length; ++i) {\n var ref = specs[i];\n var className = ref.className;\n var style = ref.style;\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + className));\n if (style) { gElt.style.cssText = style; }\n if (className == \"CodeMirror-linenumbers\") {\n display.lineGutter = gElt;\n gElt.style.width = (display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = specs.length ? \"\" : \"none\";\n updateGutterSpace(display);\n }", "function renderGutters(display) {\n var gutters = display.gutters, specs = display.gutterSpecs;\n removeChildren(gutters);\n display.lineGutter = null;\n for (var i = 0; i < specs.length; ++i) {\n var ref = specs[i];\n var className = ref.className;\n var style = ref.style;\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + className));\n if (style) { gElt.style.cssText = style; }\n if (className == \"CodeMirror-linenumbers\") {\n display.lineGutter = gElt;\n gElt.style.width = (display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = specs.length ? \"\" : \"none\";\n updateGutterSpace(display);\n }", "function renderGutters(display) {\n var gutters = display.gutters, specs = display.gutterSpecs;\n removeChildren(gutters);\n display.lineGutter = null;\n for (var i = 0; i < specs.length; ++i) {\n var ref = specs[i];\n var className = ref.className;\n var style = ref.style;\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + className));\n if (style) { gElt.style.cssText = style; }\n if (className == \"CodeMirror-linenumbers\") {\n display.lineGutter = gElt;\n gElt.style.width = (display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = specs.length ? \"\" : \"none\";\n updateGutterSpace(display);\n }", "function renderGutters(display) {\n var gutters = display.gutters, specs = display.gutterSpecs;\n removeChildren(gutters);\n display.lineGutter = null;\n for (var i = 0; i < specs.length; ++i) {\n var ref = specs[i];\n var className = ref.className;\n var style = ref.style;\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + className));\n if (style) { gElt.style.cssText = style; }\n if (className == \"CodeMirror-linenumbers\") {\n display.lineGutter = gElt;\n gElt.style.width = (display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = specs.length ? \"\" : \"none\";\n updateGutterSpace(display);\n }", "function renderGutters(display) {\n var gutters = display.gutters, specs = display.gutterSpecs;\n removeChildren(gutters);\n display.lineGutter = null;\n for (var i = 0; i < specs.length; ++i) {\n var ref = specs[i];\n var className = ref.className;\n var style = ref.style;\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + className));\n if (style) { gElt.style.cssText = style; }\n if (className == \"CodeMirror-linenumbers\") {\n display.lineGutter = gElt;\n gElt.style.width = (display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = specs.length ? \"\" : \"none\";\n updateGutterSpace(display);\n }", "function _initLinesForBoxes() {\n var self = this;\n var $rowsWithBoxes = void 0;\n\n $('.row').each(function () {\n if ($(this).find('> * > .nk-box-line').length) {\n $rowsWithBoxes = $rowsWithBoxes ? $rowsWithBoxes.add($(this)) : $(this);\n }\n });\n\n // support for VC\n $('.vc_row').each(function () {\n if ($(this).find('> div > div > div > .nk-box-line').length) {\n $rowsWithBoxes = $rowsWithBoxes ? $rowsWithBoxes.add($(this)) : $(this);\n }\n });\n\n if (!$rowsWithBoxes) {\n return;\n }\n\n function calculate() {\n $rowsWithBoxes.each(function () {\n var currentRowStart = 0;\n var rowDivs = [];\n var topPosition = 0;\n var $this = $(this);\n\n // check all rows and add in array\n $this.children('*').each(function () {\n topPosition = $(this).position().top;\n if (currentRowStart !== topPosition) {\n currentRowStart = topPosition;\n rowDivs.push($(this));\n } else {\n if (rowDivs[rowDivs.length - 1]) {\n rowDivs[rowDivs.length - 1] = rowDivs[rowDivs.length - 1].add($(this));\n } else {\n rowDivs[(rowDivs.length || 1) - 1] = $(this);\n }\n }\n });\n\n // support for VC\n if ($this.hasClass('vc_row')) {\n // remove additional classnames\n $(this).find('> div > div > div > .nk-box-line').removeClass('nk-box-line-top nk-box-last');\n\n // add new classnames\n for (var k = 0; k < rowDivs.length; k++) {\n rowDivs[k].last().find('> div > div > .nk-box-line').addClass('nk-box-last');\n if (k > 0) {\n rowDivs[k].find('> div > div > .nk-box-line').addClass('nk-box-line-top');\n }\n }\n }\n\n // bootstrap\n else {\n // remove additional classnames\n $this.find('> * > .nk-box-line').removeClass('nk-box-line-top nk-box-last');\n\n // add new classnames\n for (var _k = 0; _k < rowDivs.length; _k++) {\n rowDivs[_k].last().children('.nk-box-line').addClass('nk-box-last');\n if (_k > 0) {\n rowDivs[_k].children('.nk-box-line').addClass('nk-box-line-top');\n }\n }\n }\n });\n }\n\n calculate();\n self.debounceResize(calculate);\n}", "function renderGutters(display) {\n\t\t var gutters = display.gutters, specs = display.gutterSpecs;\n\t\t removeChildren(gutters);\n\t\t display.lineGutter = null;\n\t\t for (var i = 0; i < specs.length; ++i) {\n\t\t var ref = specs[i];\n\t\t var className = ref.className;\n\t\t var style = ref.style;\n\t\t var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + className));\n\t\t if (style) { gElt.style.cssText = style; }\n\t\t if (className == \"CodeMirror-linenumbers\") {\n\t\t display.lineGutter = gElt;\n\t\t gElt.style.width = (display.lineNumWidth || 1) + \"px\";\n\t\t }\n\t\t }\n\t\t gutters.style.display = specs.length ? \"\" : \"none\";\n\t\t updateGutterSpace(display);\n\t\t }", "function insertLineWidgets(cm, lineView, dims) {\n\t insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n\t if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\n\t insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false);\n\t }", "function insertLineWidgets(cm, lineView, dims) {\n\t insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n\t if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\n\t insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false);\n\t }", "function insertLineWidgets(cm, lineView, dims) {\n\t insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n\t if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\n\t insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false);\n\t }", "function updateGutters(cm) {\n\t\t var gutters = cm.display.gutters, specs = cm.options.gutters;\n\t\t removeChildren(gutters);\n\t\t for (var i = 0; i < specs.length; ++i) {\n\t\t var gutterClass = specs[i];\n\t\t var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + gutterClass));\n\t\t if (gutterClass == \"CodeMirror-linenumbers\") {\n\t\t cm.display.lineGutter = gElt;\n\t\t gElt.style.width = (cm.display.lineNumWidth || 1) + \"px\";\n\t\t }\n\t\t }\n\t\t gutters.style.display = i ? \"\" : \"none\";\n\t\t updateGutterSpace(cm);\n\t\t }", "function processLineNumbers() {\n if ($(\"#editorDiv\").length > 0) {\n var lineHeight = parseInt($(\"#editorDiv\").css('line-height'));\n var scrollHeight = $(\"#editorDiv\")[0].scrollHeight;\n var numberOfLines = scrollHeight / lineHeight;\n\n for (var i = 1; i < numberOfLines; i++) {\n $('.line-numbers').append('<p>' + i + '</p>');\n //console.log(i);\n }\n\n //set width of line-numbers bar dynamically\n var maxWidth = 0;\n var widestSpan = null;\n var $element;\n $('#lineNumbers p').each(function () {\n $element = $(this);\n if ($element.width() > maxWidth) {\n maxWidth = $element.width();\n widestSpan = $element;\n }\n });\n\n var lineNumberExtraWidthPadding = 10;\n //console.log('widest width line numbers ' + maxWidth);\n $('#lineNumbers').css('width', maxWidth + lineNumberExtraWidthPadding + 'px');\n //$('#editorDiv').css('padding-left', maxWidth + lineNumberExtraWidthPadding + 'px');\n $('.editor-wrapper').css('padding-left', maxWidth + lineNumberExtraWidthPadding + 'px');\n }\n}", "function renderGutters(display) {\n var gutters = display.gutters,\n specs = display.gutterSpecs;\n removeChildren(gutters);\n display.lineGutter = null;\n\n for (var i = 0; i < specs.length; ++i) {\n var ref = specs[i];\n var className = ref.className;\n var style = ref.style;\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + className));\n\n if (style) {\n gElt.style.cssText = style;\n }\n\n if (className == \"CodeMirror-linenumbers\") {\n display.lineGutter = gElt;\n gElt.style.width = (display.lineNumWidth || 1) + \"px\";\n }\n }\n\n gutters.style.display = specs.length ? \"\" : \"none\";\n updateGutterSpace(display);\n }", "function updateGutters(cm) {\n var gutters = cm.display.gutters, specs = cm.options.gutters;\n removeChildren(gutters);\n var i = 0;\n for (; i < specs.length; ++i) {\n var gutterClass = specs[i];\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + gutterClass));\n if (gutterClass == \"CodeMirror-linenumbers\") {\n cm.display.lineGutter = gElt;\n gElt.style.width = (cm.display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = i ? \"\" : \"none\";\n updateGutterSpace(cm);\n }", "function updateGutters(cm) {\n var gutters = cm.display.gutters, specs = cm.options.gutters;\n removeChildren(gutters);\n var i = 0;\n for (; i < specs.length; ++i) {\n var gutterClass = specs[i];\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + gutterClass));\n if (gutterClass == \"CodeMirror-linenumbers\") {\n cm.display.lineGutter = gElt;\n gElt.style.width = (cm.display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = i ? \"\" : \"none\";\n updateGutterSpace(cm);\n }", "function updateGutters(cm) {\n var gutters = cm.display.gutters, specs = cm.options.gutters;\n removeChildren(gutters);\n var i = 0;\n for (; i < specs.length; ++i) {\n var gutterClass = specs[i];\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + gutterClass));\n if (gutterClass == \"CodeMirror-linenumbers\") {\n cm.display.lineGutter = gElt;\n gElt.style.width = (cm.display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = i ? \"\" : \"none\";\n updateGutterSpace(cm);\n }", "function updateGutters(cm) {\n var gutters = cm.display.gutters, specs = cm.options.gutters;\n removeChildren(gutters);\n var i = 0;\n for (; i < specs.length; ++i) {\n var gutterClass = specs[i];\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + gutterClass));\n if (gutterClass == \"CodeMirror-linenumbers\") {\n cm.display.lineGutter = gElt;\n gElt.style.width = (cm.display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = i ? \"\" : \"none\";\n updateGutterSpace(cm);\n }", "function applyMapsDividers() {\n\t\tmyMapsContainer.find('#mapsListContainer .clearfix').remove();\n\t\tmyMapsContainer.find('#mapsListContainer .mappreview').not('.hidden').each(function(index, elem) {\n\t\t\t// Handle row breaks\n\t\t\tvar myMapsDividerHtml = '';\n\t\t\tif (index > 0) {\n\t\t\t\tif (index % 2 == 0) {\n\t\t\t\t\tmyMapsDividerHtml += '<div class=\"clearfix visible-xs-block\"></div>';\n\t\t\t\t}\n\t\t\t\tif (index % 3 == 0) {\n\t\t\t\t\tmyMapsDividerHtml += '<div class=\"clearfix visible-md-block\"></div>';\n\t\t\t\t}\n\t\t\t\tif (index % 4 == 0) {\n\t\t\t\t\tmyMapsDividerHtml += '<div class=\"clearfix visible-lg-block\"></div>';\n\t\t\t\t}\n\t\t\t\tif (myMapsDividerHtml !== '') {\n\t\t\t\t\t$(elem).before(myMapsDividerHtml);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}", "function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }\n }", "function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }\n }", "function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }\n }", "function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }\n }", "function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }\n }", "function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }\n }", "function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }\n }", "function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }\n }", "function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }\n }", "function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }\n }", "function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }\n }", "function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }\n }", "function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }\n }", "function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }\n }", "function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }\n }", "function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }\n }", "function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }\n }", "function updateGutters(cm) {\n var gutters = cm.display.gutters, specs = cm.options.gutters\n removeChildren(gutters)\n var i = 0\n for (; i < specs.length; ++i) {\n var gutterClass = specs[i]\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + gutterClass))\n if (gutterClass == \"CodeMirror-linenumbers\") {\n cm.display.lineGutter = gElt\n gElt.style.width = (cm.display.lineNumWidth || 1) + \"px\"\n }\n }\n gutters.style.display = i ? \"\" : \"none\"\n updateGutterSpace(cm)\n}", "function updateGutters(cm) {\n var gutters = cm.display.gutters, specs = cm.options.gutters\n removeChildren(gutters)\n var i = 0\n for (; i < specs.length; ++i) {\n var gutterClass = specs[i]\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + gutterClass))\n if (gutterClass == \"CodeMirror-linenumbers\") {\n cm.display.lineGutter = gElt\n gElt.style.width = (cm.display.lineNumWidth || 1) + \"px\"\n }\n }\n gutters.style.display = i ? \"\" : \"none\"\n updateGutterSpace(cm)\n}", "function updateGutters(cm) {\r\n var gutters = cm.display.gutters, specs = cm.options.gutters;\r\n removeChildren(gutters);\r\n var i = 0;\r\n for (; i < specs.length; ++i) {\r\n var gutterClass = specs[i];\r\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + gutterClass));\r\n if (gutterClass == \"CodeMirror-linenumbers\") {\r\n cm.display.lineGutter = gElt;\r\n gElt.style.width = (cm.display.lineNumWidth || 1) + \"px\";\r\n }\r\n }\r\n gutters.style.display = i ? \"\" : \"none\";\r\n updateGutterSpace(cm);\r\n}", "wrap() {\n\t\tlet wrapper;\n\t\tif (!this.wrapper) {\n\t\t\twrapper = document.createElement(\"span\");\n\t\t\twrapper.id = this.hiddenId;\n\t\t\tthis.wrapper = wrapper;\n\t\t} else {\n\t\t\twrapper = this.wrapper;\n\t\t}\n\t\telements = [...elements, this];\n\t\treturn wrapper;\n\t}", "function initLinesForBoxes() {\n var self = this;\n var $rowsWithBoxes = void 0;\n\n (0, _utility.$)('.row').each(function eachRow() {\n if ((0, _utility.$)(this).find('> * > .nk-box-line').length) {\n $rowsWithBoxes = $rowsWithBoxes ? $rowsWithBoxes.add((0, _utility.$)(this)) : (0, _utility.$)(this);\n }\n });\n\n // support for VC\n (0, _utility.$)('.vc_row').each(function eachVCRow() {\n if ((0, _utility.$)(this).find('> div > div > div > .nk-box-line').length) {\n $rowsWithBoxes = $rowsWithBoxes ? $rowsWithBoxes.add((0, _utility.$)(this)) : (0, _utility.$)(this);\n }\n });\n\n if (!$rowsWithBoxes) {\n return;\n }\n\n function calculate() {\n $rowsWithBoxes.each(function eachRowWithBoxes() {\n var currentRowStart = 0;\n var rowDivs = [];\n var topPosition = 0;\n var $this = (0, _utility.$)(this);\n\n // check all rows and add in array\n $this.children('*').each(function eachChildrenRow() {\n topPosition = (0, _utility.$)(this).position().top;\n if (currentRowStart !== topPosition) {\n currentRowStart = topPosition;\n rowDivs.push((0, _utility.$)(this));\n } else if (rowDivs[rowDivs.length - 1]) {\n rowDivs[rowDivs.length - 1] = rowDivs[rowDivs.length - 1].add((0, _utility.$)(this));\n } else {\n rowDivs[(rowDivs.length || 1) - 1] = (0, _utility.$)(this);\n }\n });\n\n // support for VC\n if ($this.hasClass('vc_row')) {\n // remove additional classnames\n (0, _utility.$)(this).find('> div > div > div > .nk-box-line').removeClass('nk-box-line-top nk-box-last');\n\n // add new classnames\n for (var k = 0; k < rowDivs.length; k++) {\n rowDivs[k].last().find('> div > div > .nk-box-line').addClass('nk-box-last');\n if (k > 0) {\n rowDivs[k].find('> div > div > .nk-box-line').addClass('nk-box-line-top');\n }\n }\n\n // bootstrap\n } else {\n // remove additional classnames\n $this.find('> * > .nk-box-line').removeClass('nk-box-line-top nk-box-last');\n\n // add new classnames\n for (var _k = 0; _k < rowDivs.length; _k++) {\n rowDivs[_k].last().children('.nk-box-line').addClass('nk-box-last');\n if (_k > 0) {\n rowDivs[_k].children('.nk-box-line').addClass('nk-box-line-top');\n }\n }\n }\n });\n }\n\n calculate();\n self.debounceResize(calculate);\n}", "function updateGutters(cm) {\r\n var gutters = cm.display.gutters, specs = cm.options.gutters;\r\n removeChildren(gutters);\r\n for (var i = 0; i < specs.length; ++i) {\r\n var gutterClass = specs[i];\r\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + gutterClass));\r\n if (gutterClass == \"CodeMirror-linenumbers\") {\r\n cm.display.lineGutter = gElt;\r\n gElt.style.width = (cm.display.lineNumWidth || 1) + \"px\";\r\n }\r\n }\r\n gutters.style.display = i ? \"\" : \"none\";\r\n updateGutterSpace(cm);\r\n }", "function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\n insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false);\n }", "function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\n insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false);\n }", "function updateGutters(cm) {\n var gutters = cm.display.gutters, specs = cm.options.gutters;\n removeChildren(gutters);\n for (var i = 0; i < specs.length; ++i) {\n var gutterClass = specs[i];\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + gutterClass));\n if (gutterClass == \"CodeMirror-linenumbers\") {\n cm.display.lineGutter = gElt;\n gElt.style.width = (cm.display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = i ? \"\" : \"none\";\n updateGutterSpace(cm);\n }", "function updateGutters(cm) {\n var gutters = cm.display.gutters, specs = cm.options.gutters;\n removeChildren(gutters);\n for (var i = 0; i < specs.length; ++i) {\n var gutterClass = specs[i];\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + gutterClass));\n if (gutterClass == \"CodeMirror-linenumbers\") {\n cm.display.lineGutter = gElt;\n gElt.style.width = (cm.display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = i ? \"\" : \"none\";\n updateGutterSpace(cm);\n }", "function updateGutters(cm) {\n var gutters = cm.display.gutters, specs = cm.options.gutters;\n removeChildren(gutters);\n for (var i = 0; i < specs.length; ++i) {\n var gutterClass = specs[i];\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + gutterClass));\n if (gutterClass == \"CodeMirror-linenumbers\") {\n cm.display.lineGutter = gElt;\n gElt.style.width = (cm.display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = i ? \"\" : \"none\";\n updateGutterSpace(cm);\n }", "function updateGutters(cm) {\n var gutters = cm.display.gutters, specs = cm.options.gutters;\n removeChildren(gutters);\n for (var i = 0; i < specs.length; ++i) {\n var gutterClass = specs[i];\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + gutterClass));\n if (gutterClass == \"CodeMirror-linenumbers\") {\n cm.display.lineGutter = gElt;\n gElt.style.width = (cm.display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = i ? \"\" : \"none\";\n updateGutterSpace(cm);\n }", "function updateGutters(cm) {\n var gutters = cm.display.gutters, specs = cm.options.gutters;\n removeChildren(gutters);\n for (var i = 0; i < specs.length; ++i) {\n var gutterClass = specs[i];\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + gutterClass));\n if (gutterClass == \"CodeMirror-linenumbers\") {\n cm.display.lineGutter = gElt;\n gElt.style.width = (cm.display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = i ? \"\" : \"none\";\n updateGutterSpace(cm);\n }", "function updateGutters(cm) {\n var gutters = cm.display.gutters, specs = cm.options.gutters;\n removeChildren(gutters);\n for (var i = 0; i < specs.length; ++i) {\n var gutterClass = specs[i];\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + gutterClass));\n if (gutterClass == \"CodeMirror-linenumbers\") {\n cm.display.lineGutter = gElt;\n gElt.style.width = (cm.display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = i ? \"\" : \"none\";\n updateGutterSpace(cm);\n }", "function updateGutters(cm) {\n var gutters = cm.display.gutters, specs = cm.options.gutters;\n removeChildren(gutters);\n for (var i = 0; i < specs.length; ++i) {\n var gutterClass = specs[i];\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + gutterClass));\n if (gutterClass == \"CodeMirror-linenumbers\") {\n cm.display.lineGutter = gElt;\n gElt.style.width = (cm.display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = i ? \"\" : \"none\";\n updateGutterSpace(cm);\n }", "function updateGutters(cm) {\n var gutters = cm.display.gutters, specs = cm.options.gutters;\n removeChildren(gutters);\n for (var i = 0; i < specs.length; ++i) {\n var gutterClass = specs[i];\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + gutterClass));\n if (gutterClass == \"CodeMirror-linenumbers\") {\n cm.display.lineGutter = gElt;\n gElt.style.width = (cm.display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = i ? \"\" : \"none\";\n updateGutterSpace(cm);\n }", "renderFiller() {\n if (this.state.currentPane != \"myposts\") return <div class=\"AccountsContainerFiller\" />;\n return null;\n }", "function updateGutters(cm) {\n var gutters = cm.display.gutters, specs = cm.options.gutters;\n removeChildren(gutters);\n var i = 0;\n for (; i < specs.length; ++i) {\n var gutterClass = specs[i];\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + gutterClass));\n if (gutterClass == \"CodeMirror-linenumbers\") {\n cm.display.lineGutter = gElt;\n gElt.style.width = (cm.display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = i ? \"\" : \"none\";\n updateGutterSpace(cm);\n}", "function updateGutters(cm) {\n var gutters = cm.display.gutters, specs = cm.options.gutters;\n removeChildren(gutters);\n var i = 0;\n for (; i < specs.length; ++i) {\n var gutterClass = specs[i];\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + gutterClass));\n if (gutterClass == \"CodeMirror-linenumbers\") {\n cm.display.lineGutter = gElt;\n gElt.style.width = (cm.display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = i ? \"\" : \"none\";\n updateGutterSpace(cm);\n}", "function updateGutters(cm) {\n var gutters = cm.display.gutters, specs = cm.options.gutters;\n removeChildren(gutters);\n var i = 0;\n for (; i < specs.length; ++i) {\n var gutterClass = specs[i];\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + gutterClass));\n if (gutterClass == \"CodeMirror-linenumbers\") {\n cm.display.lineGutter = gElt;\n gElt.style.width = (cm.display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = i ? \"\" : \"none\";\n updateGutterSpace(cm);\n}", "function updateGutters(cm) {\n var gutters = cm.display.gutters, specs = cm.options.gutters;\n removeChildren(gutters);\n var i = 0;\n for (; i < specs.length; ++i) {\n var gutterClass = specs[i];\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + gutterClass));\n if (gutterClass == \"CodeMirror-linenumbers\") {\n cm.display.lineGutter = gElt;\n gElt.style.width = (cm.display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = i ? \"\" : \"none\";\n updateGutterSpace(cm);\n}", "function updateGutters(cm) {\n var gutters = cm.display.gutters, specs = cm.options.gutters;\n removeChildren(gutters);\n var i = 0;\n for (; i < specs.length; ++i) {\n var gutterClass = specs[i];\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + gutterClass));\n if (gutterClass == \"CodeMirror-linenumbers\") {\n cm.display.lineGutter = gElt;\n gElt.style.width = (cm.display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = i ? \"\" : \"none\";\n updateGutterSpace(cm);\n}", "function updateGutters(cm) {\n var gutters = cm.display.gutters, specs = cm.options.gutters;\n removeChildren(gutters);\n var i = 0;\n for (; i < specs.length; ++i) {\n var gutterClass = specs[i];\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + gutterClass));\n if (gutterClass == \"CodeMirror-linenumbers\") {\n cm.display.lineGutter = gElt;\n gElt.style.width = (cm.display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = i ? \"\" : \"none\";\n updateGutterSpace(cm);\n}", "function updateGutters(cm) {\n var gutters = cm.display.gutters, specs = cm.options.gutters;\n removeChildren(gutters);\n var i = 0;\n for (; i < specs.length; ++i) {\n var gutterClass = specs[i];\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + gutterClass));\n if (gutterClass == \"CodeMirror-linenumbers\") {\n cm.display.lineGutter = gElt;\n gElt.style.width = (cm.display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = i ? \"\" : \"none\";\n updateGutterSpace(cm);\n}", "function updateGutters(cm) {\n var gutters = cm.display.gutters, specs = cm.options.gutters;\n removeChildren(gutters);\n var i = 0;\n for (; i < specs.length; ++i) {\n var gutterClass = specs[i];\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + gutterClass));\n if (gutterClass == \"CodeMirror-linenumbers\") {\n cm.display.lineGutter = gElt;\n gElt.style.width = (cm.display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = i ? \"\" : \"none\";\n updateGutterSpace(cm);\n}", "function updateGutters(cm) {\n var gutters = cm.display.gutters, specs = cm.options.gutters;\n removeChildren(gutters);\n var i = 0;\n for (; i < specs.length; ++i) {\n var gutterClass = specs[i];\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + gutterClass));\n if (gutterClass == \"CodeMirror-linenumbers\") {\n cm.display.lineGutter = gElt;\n gElt.style.width = (cm.display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = i ? \"\" : \"none\";\n updateGutterSpace(cm);\n}", "function updateGutters(cm) {\n var gutters = cm.display.gutters, specs = cm.options.gutters;\n removeChildren(gutters);\n var i = 0;\n for (; i < specs.length; ++i) {\n var gutterClass = specs[i];\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + gutterClass));\n if (gutterClass == \"CodeMirror-linenumbers\") {\n cm.display.lineGutter = gElt;\n gElt.style.width = (cm.display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = i ? \"\" : \"none\";\n updateGutterSpace(cm);\n}", "function updateGutters(cm) {\n var gutters = cm.display.gutters, specs = cm.options.gutters;\n removeChildren(gutters);\n var i = 0;\n for (; i < specs.length; ++i) {\n var gutterClass = specs[i];\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + gutterClass));\n if (gutterClass == \"CodeMirror-linenumbers\") {\n cm.display.lineGutter = gElt;\n gElt.style.width = (cm.display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = i ? \"\" : \"none\";\n updateGutterSpace(cm);\n}", "function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n\n if (lineView.rest) {\n for (var i = 0; i < lineView.rest.length; i++) {\n insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false);\n }\n }\n }", "insertSplittedCellWidgets(viewer, tableCollection, rowWidget, previousRowIndex) {\n let left = rowWidget.x;\n let tableWidth = 0;\n tableWidth = HelperMethods.convertPointToPixel(rowWidget.ownerTable.tableHolder.tableWidth);\n for (let i = 0; i < rowWidget.childWidgets.length; i++) {\n let cellWidget = rowWidget.childWidgets[i];\n if (Math.round(left) < Math.round(cellWidget.x - cellWidget.margin.left)) {\n if (this.insertRowSpannedWidget(rowWidget, viewer, left, i)) {\n i--;\n continue;\n }\n let length = rowWidget.childWidgets.length;\n this.insertEmptySplittedCellWidget(rowWidget, tableCollection, left, i, previousRowIndex);\n if (length < rowWidget.childWidgets.length) {\n i--;\n continue;\n }\n }\n left += cellWidget.margin.left + cellWidget.width + cellWidget.margin.right;\n if (i === rowWidget.childWidgets.length - 1 && Math.round(left) < Math.round(rowWidget.x + tableWidth)) {\n if (this.insertRowSpannedWidget(rowWidget, viewer, left, i + 1)) {\n continue;\n }\n this.insertEmptySplittedCellWidget(rowWidget, tableCollection, left, i + 1, previousRowIndex);\n continue;\n }\n }\n // tslint:disable-next-line:max-line-length\n // Special case: when the child widgets of row is equal to 0 then the splitted widgets in the viewer is added in the table row widgets. \n if ((isNullOrUndefined(rowWidget.childWidgets) || rowWidget.childWidgets.length === 0) && viewer.splittedCellWidgets.length > 0) {\n for (let j = 0; j < viewer.splittedCellWidgets.length; j++) {\n let widget = viewer.splittedCellWidgets[j];\n if (Math.round(left) <= Math.round(widget.x - widget.margin.left)) {\n if (this.insertRowSpannedWidget(rowWidget, viewer, left, j)) {\n j--;\n continue;\n }\n let count = rowWidget.childWidgets.length;\n this.insertEmptySplittedCellWidget(rowWidget, tableCollection, left, j, previousRowIndex);\n if (count < rowWidget.childWidgets.length) {\n j--;\n continue;\n }\n }\n left += widget.margin.left + widget.width + widget.margin.right;\n if (j === rowWidget.childWidgets.length - 1 && Math.round(left) <\n Math.round(rowWidget.x + tableWidth)) {\n if (this.insertRowSpannedWidget(rowWidget, viewer, left, j + 1)) {\n continue;\n }\n this.insertEmptySplittedCellWidget(rowWidget, tableCollection, left, j + 1, previousRowIndex);\n continue;\n }\n }\n }\n if (viewer.splittedCellWidgets.length > 0) {\n viewer.splittedCellWidgets = [];\n }\n }", "wrapAll(elements, wrapper) {\n elements[0].parentNode.insertBefore(wrapper, elements[0]);\n elements.forEach(x => wrapper.appendChild(x));\n }", "function insertLineWidgets(lineView, dims) {\n insertLineWidgetsFor(lineView.line, lineView, dims, true);\n if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\n insertLineWidgetsFor(lineView.rest[i], lineView, dims, false);\n }", "function insertLineWidgets(lineView, dims) {\n insertLineWidgetsFor(lineView.line, lineView, dims, true);\n if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\n insertLineWidgetsFor(lineView.rest[i], lineView, dims, false);\n }", "function insertLineWidgets(lineView, dims) {\n insertLineWidgetsFor(lineView.line, lineView, dims, true);\n if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\n insertLineWidgetsFor(lineView.rest[i], lineView, dims, false);\n }", "function insertLineWidgets(lineView, dims) {\n insertLineWidgetsFor(lineView.line, lineView, dims, true);\n if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\n insertLineWidgetsFor(lineView.rest[i], lineView, dims, false);\n }", "function insertLineWidgets(lineView, dims) {\n insertLineWidgetsFor(lineView.line, lineView, dims, true);\n if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\n insertLineWidgetsFor(lineView.rest[i], lineView, dims, false);\n }", "function insertLineWidgets(lineView, dims) {\n insertLineWidgetsFor(lineView.line, lineView, dims, true);\n if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\n insertLineWidgetsFor(lineView.rest[i], lineView, dims, false);\n }", "function Ga(e){var t=e.display,a=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=xa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,r=t.gutters.offsetWidth,f=n+\"px\",o=0;o<a.length;o++)if(!a[o].hidden){e.options.fixedGutter&&(a[o].gutter&&(a[o].gutter.style.left=f),a[o].gutterBackground&&(a[o].gutterBackground.style.left=f));var i=a[o].alignable;if(i)for(var s=0;s<i.length;s++)i[s].style.left=f}e.options.fixedGutter&&(t.gutters.style.left=n+r+\"px\")}}", "function insertLineWidgets(cm, lineView, dims) {\r\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\r\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\r\n { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }\r\n}", "function splitLineText() {\r\n\t\t\t\t\t$('.nectar-recent-posts-single_featured.multiple_featured').each(function () {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tvar $slideClass = ($(this).find('.project-slides').length > 0) ? '.project-slide' : '.nectar-recent-post-slide',\r\n\t\t\t\t\t\t$slideInfoClass = ($(this).find('.project-slides').length > 0) ? '.project-info h1' : '.inner-wrap h2 a';\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t$(this).find($slideClass).each(function () {\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t$(this).find($slideInfoClass).each(function () {\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\tvar textArr = $(this).text();\r\n\t\t\t\t\t\t\t\ttextArr = textArr.trim();\r\n\t\t\t\t\t\t\t\ttextArr = textArr.split(' ');\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t$(this)[0].innerHTML = '';\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\tfor (var i = 0; i < textArr.length; i++) {\r\n\t\t\t\t\t\t\t\t\t$(this)[0].innerHTML += '<span>' + textArr[i] + '</span> ';\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t$(this).find($slideInfoClass + ' > span').wrapInner('<span class=\"inner\" />');\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t});\r\n\t\t\t\t\t\r\n\t\t\t\t}", "function updateGutters(cm) {\n\t var gutters = cm.display.gutters, specs = cm.options.gutters;\n\t removeChildren(gutters);\n\t for (var i = 0; i < specs.length; ++i) {\n\t var gutterClass = specs[i];\n\t var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + gutterClass));\n\t if (gutterClass == \"CodeMirror-linenumbers\") {\n\t cm.display.lineGutter = gElt;\n\t gElt.style.width = (cm.display.lineNumWidth || 1) + \"px\";\n\t }\n\t }\n\t gutters.style.display = i ? \"\" : \"none\";\n\t updateGutterSpace(cm);\n\t }" ]
[ "0.63652897", "0.6070703", "0.57518905", "0.56793195", "0.5650686", "0.5588701", "0.55632764", "0.55362713", "0.55177873", "0.5483235", "0.54808384", "0.54808384", "0.5474382", "0.54581654", "0.5456185", "0.54484624", "0.54248106", "0.5405661", "0.5405661", "0.5405661", "0.5405661", "0.5405661", "0.5405661", "0.5405661", "0.5405661", "0.5405661", "0.5405661", "0.5405661", "0.5405661", "0.5405661", "0.53877443", "0.53792006", "0.5358299", "0.5358299", "0.5358299", "0.5355745", "0.53541136", "0.5347789", "0.5344225", "0.5344225", "0.5344225", "0.5344225", "0.53326595", "0.5326543", "0.5326543", "0.5326543", "0.5326543", "0.5326543", "0.5326543", "0.5326543", "0.5326543", "0.5326543", "0.5326543", "0.5326543", "0.5326543", "0.5326543", "0.5326543", "0.5326543", "0.5326543", "0.5326543", "0.53264683", "0.53264683", "0.5321883", "0.5320588", "0.5309806", "0.53020024", "0.528917", "0.528917", "0.52834857", "0.52834857", "0.52834857", "0.52834857", "0.52834857", "0.52834857", "0.52834857", "0.52834857", "0.5265522", "0.52521783", "0.52521783", "0.52521783", "0.52521783", "0.52521783", "0.52521783", "0.52521783", "0.52521783", "0.52521783", "0.52521783", "0.52521783", "0.52443165", "0.52433944", "0.52425724", "0.5233334", "0.5233334", "0.5233334", "0.5233334", "0.5233334", "0.5233334", "0.5225818", "0.52199507", "0.52115524", "0.5210643" ]
0.0
-1
Wrapper around buildLineContent which will reuse the structure in display.externalMeasured when possible.
function getLineContent(cm, lineView) { var ext = cm.display.externalMeasured; if (ext && ext.line == lineView.line) { cm.display.externalMeasured = null; lineView.measure = ext.measure; return ext.built } return buildLineContent(cm, lineView) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getLineContent(cm, lineView) {\n\t\t var ext = cm.display.externalMeasured;\n\t\t if (ext && ext.line == lineView.line) {\n\t\t cm.display.externalMeasured = null;\n\t\t lineView.measure = ext.measure;\n\t\t return ext.built\n\t\t }\n\t\t return buildLineContent(cm, lineView)\n\t\t }", "function getLineContent(cm, lineView) {\n\t\t var ext = cm.display.externalMeasured;\n\t\t if (ext && ext.line == lineView.line) {\n\t\t cm.display.externalMeasured = null;\n\t\t lineView.measure = ext.measure;\n\t\t return ext.built;\n\t\t }\n\t\t return buildLineContent(cm, lineView);\n\t\t }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built;\n }\n return buildLineContent(cm, lineView);\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built;\n }\n return buildLineContent(cm, lineView);\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built;\n }\n return buildLineContent(cm, lineView);\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built;\n }\n return buildLineContent(cm, lineView);\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built;\n }\n return buildLineContent(cm, lineView);\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built;\n }\n return buildLineContent(cm, lineView);\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built;\n }\n return buildLineContent(cm, lineView);\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built;\n }\n return buildLineContent(cm, lineView);\n }", "function getLineContent(cm, lineView) {\n\t var ext = cm.display.externalMeasured;\n\t if (ext && ext.line == lineView.line) {\n\t cm.display.externalMeasured = null;\n\t lineView.measure = ext.measure;\n\t return ext.built;\n\t }\n\t return buildLineContent(cm, lineView);\n\t }", "function getLineContent(cm, lineView) {\n\t var ext = cm.display.externalMeasured;\n\t if (ext && ext.line == lineView.line) {\n\t cm.display.externalMeasured = null;\n\t lineView.measure = ext.measure;\n\t return ext.built;\n\t }\n\t return buildLineContent(cm, lineView);\n\t }", "function getLineContent(cm, lineView) {\n\t var ext = cm.display.externalMeasured;\n\t if (ext && ext.line == lineView.line) {\n\t cm.display.externalMeasured = null;\n\t lineView.measure = ext.measure;\n\t return ext.built;\n\t }\n\t return buildLineContent(cm, lineView);\n\t }", "function getLineContent(cm, lineView) {\r\n var ext = cm.display.externalMeasured;\r\n if (ext && ext.line == lineView.line) {\r\n cm.display.externalMeasured = null;\r\n lineView.measure = ext.measure;\r\n return ext.built;\r\n }\r\n return buildLineContent(cm, lineView);\r\n }", "function buildLineContent(cm, lineView) {\n\t // The padding-right forces the element to have a 'border', which\n\t // is needed on Webkit to be able to get line-level bounding\n\t // rectangles for it (in measureChar).\n\t var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n\t var builder = {pre: elt(\"pre\", [content], \"CodeMirror-line\"), content: content,\n\t col: 0, pos: 0, cm: cm,\n\t splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n\t lineView.measure = {};\n\n\t // Iterate over the logical lines that make up this visual line.\n\t for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n\t var line = i ? lineView.rest[i - 1] : lineView.line, order;\n\t builder.pos = 0;\n\t builder.addToken = buildToken;\n\t // Optionally wire in some hacks into the token-rendering\n\t // algorithm, to deal with browser quirks.\n\t if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n\t builder.addToken = buildTokenBadBidi(builder.addToken, order);\n\t builder.map = [];\n\t var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n\t insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n\t if (line.styleClasses) {\n\t if (line.styleClasses.bgClass)\n\t builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n\t if (line.styleClasses.textClass)\n\t builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n\t }\n\n\t // Ensure at least a single node is present, for measuring.\n\t if (builder.map.length == 0)\n\t builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n\t // Store the map and a cache object for the current logical line\n\t if (i == 0) {\n\t lineView.measure.map = builder.map;\n\t lineView.measure.cache = {};\n\t } else {\n\t (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n\t (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n\t }\n\t }\n\n\t // See issue #2901\n\t if (webkit && /\\bcm-tab\\b/.test(builder.content.lastChild.className))\n\t builder.content.className = \"cm-tab-wrap-hack\";\n\n\t signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n\t if (builder.pre.className)\n\t builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\n\t return builder;\n\t }", "function buildLineContent(cm, lineView) {\n\t // The padding-right forces the element to have a 'border', which\n\t // is needed on Webkit to be able to get line-level bounding\n\t // rectangles for it (in measureChar).\n\t var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n\t var builder = {pre: elt(\"pre\", [content], \"CodeMirror-line\"), content: content,\n\t col: 0, pos: 0, cm: cm,\n\t splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n\t lineView.measure = {};\n\t\n\t // Iterate over the logical lines that make up this visual line.\n\t for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n\t var line = i ? lineView.rest[i - 1] : lineView.line, order;\n\t builder.pos = 0;\n\t builder.addToken = buildToken;\n\t // Optionally wire in some hacks into the token-rendering\n\t // algorithm, to deal with browser quirks.\n\t if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n\t builder.addToken = buildTokenBadBidi(builder.addToken, order);\n\t builder.map = [];\n\t var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n\t insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n\t if (line.styleClasses) {\n\t if (line.styleClasses.bgClass)\n\t builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n\t if (line.styleClasses.textClass)\n\t builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n\t }\n\t\n\t // Ensure at least a single node is present, for measuring.\n\t if (builder.map.length == 0)\n\t builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\t\n\t // Store the map and a cache object for the current logical line\n\t if (i == 0) {\n\t lineView.measure.map = builder.map;\n\t lineView.measure.cache = {};\n\t } else {\n\t (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n\t (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n\t }\n\t }\n\t\n\t // See issue #2901\n\t if (webkit && /\\bcm-tab\\b/.test(builder.content.lastChild.className))\n\t builder.content.className = \"cm-tab-wrap-hack\";\n\t\n\t signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n\t if (builder.pre.className)\n\t builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\t\n\t return builder;\n\t }", "function buildLineContent(cm, lineView) {\n\t\t // The padding-right forces the element to have a 'border', which\n\t\t // is needed on Webkit to be able to get line-level bounding\n\t\t // rectangles for it (in measureChar).\n\t\t var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n\t\t var builder = {pre: elt(\"pre\", [content], \"CodeMirror-line\"), content: content,\n\t\t col: 0, pos: 0, cm: cm,\n\t\t trailingSpace: false,\n\t\t splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n\t\t lineView.measure = {};\n\t\t\n\t\t // Iterate over the logical lines that make up this visual line.\n\t\t for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n\t\t var line = i ? lineView.rest[i - 1] : lineView.line, order;\n\t\t builder.pos = 0;\n\t\t builder.addToken = buildToken;\n\t\t // Optionally wire in some hacks into the token-rendering\n\t\t // algorithm, to deal with browser quirks.\n\t\t if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n\t\t builder.addToken = buildTokenBadBidi(builder.addToken, order);\n\t\t builder.map = [];\n\t\t var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n\t\t insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n\t\t if (line.styleClasses) {\n\t\t if (line.styleClasses.bgClass)\n\t\t builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n\t\t if (line.styleClasses.textClass)\n\t\t builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n\t\t }\n\t\t\n\t\t // Ensure at least a single node is present, for measuring.\n\t\t if (builder.map.length == 0)\n\t\t builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\t\t\n\t\t // Store the map and a cache object for the current logical line\n\t\t if (i == 0) {\n\t\t lineView.measure.map = builder.map;\n\t\t lineView.measure.cache = {};\n\t\t } else {\n\t\t (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n\t\t (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n\t\t }\n\t\t }\n\t\t\n\t\t // See issue #2901\n\t\t if (webkit) {\n\t\t var last = builder.content.lastChild\n\t\t if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n\t\t builder.content.className = \"cm-tab-wrap-hack\";\n\t\t }\n\t\t\n\t\t signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n\t\t if (builder.pre.className)\n\t\t builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\t\t\n\t\t return builder;\n\t\t }", "function buildLineContent(cm, lineView) {\n\t\t // The padding-right forces the element to have a 'border', which\n\t\t // is needed on Webkit to be able to get line-level bounding\n\t\t // rectangles for it (in measureChar).\n\t\t var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n\t\t var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n\t\t col: 0, pos: 0, cm: cm,\n\t\t trailingSpace: false,\n\t\t splitSpaces: cm.getOption(\"lineWrapping\")};\n\t\t lineView.measure = {};\n\n\t\t // Iterate over the logical lines that make up this visual line.\n\t\t for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n\t\t var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n\t\t builder.pos = 0;\n\t\t builder.addToken = buildToken;\n\t\t // Optionally wire in some hacks into the token-rendering\n\t\t // algorithm, to deal with browser quirks.\n\t\t if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n\t\t { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n\t\t builder.map = [];\n\t\t var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n\t\t insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n\t\t if (line.styleClasses) {\n\t\t if (line.styleClasses.bgClass)\n\t\t { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n\t\t if (line.styleClasses.textClass)\n\t\t { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n\t\t }\n\n\t\t // Ensure at least a single node is present, for measuring.\n\t\t if (builder.map.length == 0)\n\t\t { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n\t\t // Store the map and a cache object for the current logical line\n\t\t if (i == 0) {\n\t\t lineView.measure.map = builder.map;\n\t\t lineView.measure.cache = {};\n\t\t } else {\n\t\t (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n\t\t ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n\t\t }\n\t\t }\n\n\t\t // See issue #2901\n\t\t if (webkit) {\n\t\t var last = builder.content.lastChild;\n\t\t if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n\t\t { builder.content.className = \"cm-tab-wrap-hack\"; }\n\t\t }\n\n\t\t signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n\t\t if (builder.pre.className)\n\t\t { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n\t\t return builder\n\t\t }", "function buildLineContent(cm, lineView) {\n\t // The padding-right forces the element to have a 'border', which\n\t // is needed on Webkit to be able to get line-level bounding\n\t // rectangles for it (in measureChar).\n\t var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n\t var builder = {pre: elt(\"pre\", [content], \"CodeMirror-line\"), content: content,\n\t col: 0, pos: 0, cm: cm,\n\t trailingSpace: false,\n\t splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n\t lineView.measure = {};\n\n\t // Iterate over the logical lines that make up this visual line.\n\t for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n\t var line = i ? lineView.rest[i - 1] : lineView.line, order;\n\t builder.pos = 0;\n\t builder.addToken = buildToken;\n\t // Optionally wire in some hacks into the token-rendering\n\t // algorithm, to deal with browser quirks.\n\t if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n\t builder.addToken = buildTokenBadBidi(builder.addToken, order);\n\t builder.map = [];\n\t var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n\t insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n\t if (line.styleClasses) {\n\t if (line.styleClasses.bgClass)\n\t builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n\t if (line.styleClasses.textClass)\n\t builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n\t }\n\n\t // Ensure at least a single node is present, for measuring.\n\t if (builder.map.length == 0)\n\t builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n\t // Store the map and a cache object for the current logical line\n\t if (i == 0) {\n\t lineView.measure.map = builder.map;\n\t lineView.measure.cache = {};\n\t } else {\n\t (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n\t (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n\t }\n\t }\n\n\t // See issue #2901\n\t if (webkit) {\n\t var last = builder.content.lastChild\n\t if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n\t builder.content.className = \"cm-tab-wrap-hack\";\n\t }\n\n\t signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n\t if (builder.pre.className)\n\t builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\n\t return builder;\n\t }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null\n lineView.measure = ext.measure\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null\n lineView.measure = ext.measure\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\r\n var ext = cm.display.externalMeasured;\r\n if (ext && ext.line == lineView.line) {\r\n cm.display.externalMeasured = null;\r\n lineView.measure = ext.measure;\r\n return ext.built\r\n }\r\n return buildLineContent(cm, lineView)\r\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: elt(\"pre\", [content]), content: content, col: 0, pos: 0, cm: cm};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order;\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if ((ie || webkit) && cm.getOption(\"lineWrapping\"))\n builder.addToken = buildTokenSplitSpaces(builder.addToken);\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n if (line.styleClasses.textClass)\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit && /\\bcm-tab\\b/.test(builder.content.lastChild.className))\n builder.content.className = \"cm-tab-wrap-hack\";\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\n return builder;\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: elt(\"pre\", [content]), content: content, col: 0, pos: 0, cm: cm};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order;\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if ((ie || webkit) && cm.getOption(\"lineWrapping\"))\n builder.addToken = buildTokenSplitSpaces(builder.addToken);\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n if (line.styleClasses.textClass)\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit && /\\bcm-tab\\b/.test(builder.content.lastChild.className))\n builder.content.className = \"cm-tab-wrap-hack\";\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\n return builder;\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: elt(\"pre\", [content]), content: content, col: 0, pos: 0, cm: cm};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order;\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if ((ie || webkit) && cm.getOption(\"lineWrapping\"))\n builder.addToken = buildTokenSplitSpaces(builder.addToken);\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n if (line.styleClasses.textClass)\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit && /\\bcm-tab\\b/.test(builder.content.lastChild.className))\n builder.content.className = \"cm-tab-wrap-hack\";\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\n return builder;\n }", "function buildLineContent(cm, lineView) {\r\n // The padding-right forces the element to have a 'border', which\r\n // is needed on Webkit to be able to get line-level bounding\r\n // rectangles for it (in measureChar).\r\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\r\n var builder = {pre: elt(\"pre\", [content]), content: content, col: 0, pos: 0, cm: cm};\r\n lineView.measure = {};\r\n\r\n // Iterate over the logical lines that make up this visual line.\r\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\r\n var line = i ? lineView.rest[i - 1] : lineView.line, order;\r\n builder.pos = 0;\r\n builder.addToken = buildToken;\r\n // Optionally wire in some hacks into the token-rendering\r\n // algorithm, to deal with browser quirks.\r\n if ((ie || webkit) && cm.getOption(\"lineWrapping\"))\r\n builder.addToken = buildTokenSplitSpaces(builder.addToken);\r\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\r\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\r\n builder.map = [];\r\n insertLineContent(line, builder, getLineStyles(cm, line));\r\n if (line.styleClasses) {\r\n if (line.styleClasses.bgClass)\r\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\r\n if (line.styleClasses.textClass)\r\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\r\n }\r\n\r\n // Ensure at least a single node is present, for measuring.\r\n if (builder.map.length == 0)\r\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\r\n\r\n // Store the map and a cache object for the current logical line\r\n if (i == 0) {\r\n lineView.measure.map = builder.map;\r\n lineView.measure.cache = {};\r\n } else {\r\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\r\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\r\n }\r\n }\r\n\r\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\r\n if (builder.pre.className)\r\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\r\n return builder;\r\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: elt(\"pre\", [content]), content: content, col: 0, pos: 0, cm: cm};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order;\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if ((ie || webkit) && cm.getOption(\"lineWrapping\"))\n builder.addToken = buildTokenSplitSpaces(builder.addToken);\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\n builder.map = [];\n insertLineContent(line, builder, getLineStyles(cm, line));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n if (line.styleClasses.textClass)\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n return builder;\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: elt(\"pre\", [content]), content: content, col: 0, pos: 0, cm: cm};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order;\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if ((ie || webkit) && cm.getOption(\"lineWrapping\"))\n builder.addToken = buildTokenSplitSpaces(builder.addToken);\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\n builder.map = [];\n insertLineContent(line, builder, getLineStyles(cm, line));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n if (line.styleClasses.textClass)\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n return builder;\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: elt(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order;\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n if (line.styleClasses.textClass)\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit && /\\bcm-tab\\b/.test(builder.content.lastChild.className))\n builder.content.className = \"cm-tab-wrap-hack\";\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\n return builder;\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built;\n }\n\n return buildLineContent(cm, lineView);\n } // Redraw the line's text. Interacts with the background and text", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {\n pre: eltP(\"pre\", [content], \"CodeMirror-line\"),\n content: content,\n col: 0,\n pos: 0,\n cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")\n };\n lineView.measure = {}; // Iterate over the logical lines that make up this visual line.\n\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line,\n order = void 0;\n builder.pos = 0;\n builder.addToken = buildToken; // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction))) {\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\n }\n\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n\n if (line.styleClasses) {\n if (line.styleClasses.bgClass) {\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n }\n\n if (line.styleClasses.textClass) {\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n }\n } // Ensure at least a single node is present, for measuring.\n\n\n if (builder.map.length == 0) {\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n } // Store the map and a cache object for the current logical line\n\n\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n } // See issue #2901\n\n\n if (webkit) {\n var last = builder.content.lastChild;\n\n if (/\\bcm-tab\\b/.test(last.className) || last.querySelector && last.querySelector(\".cm-tab\")) {\n builder.content.className = \"cm-tab-wrap-hack\";\n }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n\n if (builder.pre.className) {\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n }\n\n return builder;\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: elt(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order;\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n if (line.styleClasses.textClass)\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n builder.content.className = \"cm-tab-wrap-hack\";\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\n return builder;\n }", "function buildLineContent(cm, lineView) {\r\n // The padding-right forces the element to have a 'border', which\r\n // is needed on Webkit to be able to get line-level bounding\r\n // rectangles for it (in measureChar).\r\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\r\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\r\n col: 0, pos: 0, cm: cm,\r\n trailingSpace: false,\r\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\r\n lineView.measure = {};\r\n\r\n // Iterate over the logical lines that make up this visual line.\r\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\r\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\r\n builder.pos = 0;\r\n builder.addToken = buildToken;\r\n // Optionally wire in some hacks into the token-rendering\r\n // algorithm, to deal with browser quirks.\r\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\r\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\r\n builder.map = [];\r\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\r\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\r\n if (line.styleClasses) {\r\n if (line.styleClasses.bgClass)\r\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\r\n if (line.styleClasses.textClass)\r\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\r\n }\r\n\r\n // Ensure at least a single node is present, for measuring.\r\n if (builder.map.length == 0)\r\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\r\n\r\n // Store the map and a cache object for the current logical line\r\n if (i == 0) {\r\n lineView.measure.map = builder.map;\r\n lineView.measure.cache = {};\r\n } else {\r\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\r\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\r\n }\r\n }\r\n\r\n // See issue #2901\r\n if (webkit) {\r\n var last = builder.content.lastChild;\r\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\r\n { builder.content.className = \"cm-tab-wrap-hack\"; }\r\n }\r\n\r\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\r\n if (builder.pre.className)\r\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\r\n\r\n return builder\r\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null)\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")}\n lineView.measure = {}\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0)\n builder.pos = 0\n builder.addToken = buildToken\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order) }\n builder.map = []\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line)\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate))\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\") }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\") }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))) }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map\n lineView.measure.cache = {}\n } else {\n ;(lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({})\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\" }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre)\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\") }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null)\n var builder = {pre: elt(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")}\n // hide from accessibility tree\n content.setAttribute(\"role\", \"presentation\")\n builder.pre.setAttribute(\"role\", \"presentation\")\n lineView.measure = {}\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0)\n builder.pos = 0\n builder.addToken = buildToken\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order) }\n builder.map = []\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line)\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate))\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\") }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\") }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))) }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map\n lineView.measure.cache = {}\n } else {\n ;(lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({})\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\" }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre)\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\") }\n\n return builder\n}", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view;\n } // Get a {top, bottom, left, right} box (in line-local coordinates)", "function updateExternalMeasurement(cm, line) {\n\t\t line = visualLine(line);\n\t\t var lineN = lineNo(line);\n\t\t var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n\t\t view.lineN = lineN;\n\t\t var built = view.built = buildLineContent(cm, view);\n\t\t view.text = built.pre;\n\t\t removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n\t\t return view;\n\t\t }", "function updateExternalMeasurement(cm, line) {\n\t line = visualLine(line);\n\t var lineN = lineNo(line);\n\t var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n\t view.lineN = lineN;\n\t var built = view.built = buildLineContent(cm, view);\n\t view.text = built.pre;\n\t removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n\t return view;\n\t }", "function updateExternalMeasurement(cm, line) {\n\t line = visualLine(line);\n\t var lineN = lineNo(line);\n\t var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n\t view.lineN = lineN;\n\t var built = view.built = buildLineContent(cm, view);\n\t view.text = built.pre;\n\t removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n\t return view;\n\t }", "function updateExternalMeasurement(cm, line) {\n\t line = visualLine(line);\n\t var lineN = lineNo(line);\n\t var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n\t view.lineN = lineN;\n\t var built = view.built = buildLineContent(cm, view);\n\t view.text = built.pre;\n\t removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n\t return view;\n\t }", "function updateExternalMeasurement(cm, line) {\n\t\t line = visualLine(line);\n\t\t var lineN = lineNo(line);\n\t\t var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n\t\t view.lineN = lineN;\n\t\t var built = view.built = buildLineContent(cm, view);\n\t\t view.text = built.pre;\n\t\t removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n\t\t return view\n\t\t }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view;\n }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view;\n }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view;\n }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view;\n }" ]
[ "0.7480917", "0.7473227", "0.7392253", "0.7392253", "0.7392253", "0.7392253", "0.7392253", "0.7392253", "0.7392253", "0.7392253", "0.7390707", "0.7390707", "0.7390707", "0.73619705", "0.72684866", "0.72610617", "0.7257943", "0.72563297", "0.7244617", "0.7222567", "0.7222567", "0.7222567", "0.7222567", "0.7222567", "0.7222567", "0.7222567", "0.7222567", "0.7222567", "0.7222567", "0.7222567", "0.72087026", "0.72087026", "0.7204662", "0.7171511", "0.7171511", "0.7171511", "0.7144054", "0.70926225", "0.70926225", "0.7046054", "0.7035623", "0.7032152", "0.7025049", "0.69973373", "0.6962683", "0.6962683", "0.6962683", "0.6962683", "0.6962683", "0.6962683", "0.6962683", "0.6962683", "0.6962683", "0.6962683", "0.6962683", "0.6962683", "0.6962683", "0.6962683", "0.6962683", "0.6962683", "0.6962683", "0.6926894", "0.6926894", "0.6926894", "0.6926894", "0.6926894", "0.6926894", "0.6926894", "0.6926894", "0.6926894", "0.6923373", "0.69170696", "0.69170696", "0.68308955", "0.6762815", "0.6748941", "0.6739505", "0.6739505", "0.6739505", "0.67352045", "0.66617113", "0.66617113", "0.66617113", "0.66617113" ]
0.7383554
25
Redraw the line's text. Interacts with the background and text classes because the mode may output tokens that influence these classes.
function updateLineText(cm, lineView) { var cls = lineView.text.className; var built = getLineContent(cm, lineView); if (lineView.text == lineView.node) { lineView.node = built.pre; } lineView.text.parentNode.replaceChild(built.pre, lineView.text); lineView.text = built.pre; if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) { lineView.bgClass = built.bgClass; lineView.textClass = built.textClass; updateLineClasses(cm, lineView); } else if (cls) { lineView.text.className = cls; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateLineText(cm, lineView) {\n\t\t var cls = lineView.text.className;\n\t\t var built = getLineContent(cm, lineView);\n\t\t if (lineView.text == lineView.node) lineView.node = built.pre;\n\t\t lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n\t\t lineView.text = built.pre;\n\t\t if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n\t\t lineView.bgClass = built.bgClass;\n\t\t lineView.textClass = built.textClass;\n\t\t updateLineClasses(lineView);\n\t\t } else if (cls) {\n\t\t lineView.text.className = cls;\n\t\t }\n\t\t }", "function updateLineText(cm, lineView) {\n\t\t var cls = lineView.text.className;\n\t\t var built = getLineContent(cm, lineView);\n\t\t if (lineView.text == lineView.node) { lineView.node = built.pre; }\n\t\t lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n\t\t lineView.text = built.pre;\n\t\t if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n\t\t lineView.bgClass = built.bgClass;\n\t\t lineView.textClass = built.textClass;\n\t\t updateLineClasses(cm, lineView);\n\t\t } else if (cls) {\n\t\t lineView.text.className = cls;\n\t\t }\n\t\t }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) lineView.node = built.pre;\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) lineView.node = built.pre;\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) lineView.node = built.pre;\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) lineView.node = built.pre;\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) lineView.node = built.pre;\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) lineView.node = built.pre;\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) lineView.node = built.pre;\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) lineView.node = built.pre;\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\n\t var cls = lineView.text.className;\n\t var built = getLineContent(cm, lineView);\n\t if (lineView.text == lineView.node) lineView.node = built.pre;\n\t lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n\t lineView.text = built.pre;\n\t if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n\t lineView.bgClass = built.bgClass;\n\t lineView.textClass = built.textClass;\n\t updateLineClasses(lineView);\n\t } else if (cls) {\n\t lineView.text.className = cls;\n\t }\n\t }", "function updateLineText(cm, lineView) {\n\t var cls = lineView.text.className;\n\t var built = getLineContent(cm, lineView);\n\t if (lineView.text == lineView.node) lineView.node = built.pre;\n\t lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n\t lineView.text = built.pre;\n\t if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n\t lineView.bgClass = built.bgClass;\n\t lineView.textClass = built.textClass;\n\t updateLineClasses(lineView);\n\t } else if (cls) {\n\t lineView.text.className = cls;\n\t }\n\t }", "function updateLineText(cm, lineView) {\n\t var cls = lineView.text.className;\n\t var built = getLineContent(cm, lineView);\n\t if (lineView.text == lineView.node) lineView.node = built.pre;\n\t lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n\t lineView.text = built.pre;\n\t if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n\t lineView.bgClass = built.bgClass;\n\t lineView.textClass = built.textClass;\n\t updateLineClasses(lineView);\n\t } else if (cls) {\n\t lineView.text.className = cls;\n\t }\n\t }", "function updateLineText(cm, lineView) {\r\n var cls = lineView.text.className;\r\n var built = getLineContent(cm, lineView);\r\n if (lineView.text == lineView.node) lineView.node = built.pre;\r\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\r\n lineView.text = built.pre;\r\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\r\n lineView.bgClass = built.bgClass;\r\n lineView.textClass = built.textClass;\r\n updateLineClasses(lineView);\r\n } else if (cls) {\r\n lineView.text.className = cls;\r\n }\r\n }", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n\n if (lineView.text == lineView.node) {\n lineView.node = built.pre;\n }\n\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }", "function updateLineText(cm, lineView) {\r\n var cls = lineView.text.className;\r\n var built = getLineContent(cm, lineView);\r\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\r\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\r\n lineView.text = built.pre;\r\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\r\n lineView.bgClass = built.bgClass;\r\n lineView.textClass = built.textClass;\r\n updateLineClasses(cm, lineView);\r\n } else if (cls) {\r\n lineView.text.className = cls;\r\n }\r\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className\n var built = getLineContent(cm, lineView)\n if (lineView.text == lineView.node) { lineView.node = built.pre }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text)\n lineView.text = built.pre\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass\n lineView.textClass = built.textClass\n updateLineClasses(lineView)\n } else if (cls) {\n lineView.text.className = cls\n }\n}", "function updateLineText(cm, lineView) {\n var cls = lineView.text.className\n var built = getLineContent(cm, lineView)\n if (lineView.text == lineView.node) { lineView.node = built.pre }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text)\n lineView.text = built.pre\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass\n lineView.textClass = built.textClass\n updateLineClasses(cm, lineView)\n } else if (cls) {\n lineView.text.className = cls\n }\n}", "function drawText()\n\t{\n\t\t// Figure out the correct text\n\t\tvar text = getText();\n\n\t\twid = that.add('text', {\n\t\t\ttext: text,\n\t\t\tcolor: style.color,\n\t\t\tfont: style.font,\n\t\t\tcursor: 'pointer'\n\t\t});\n\n\t\t// Set the width of the widget\n\t\tthat.w = wid.width();\n\n\t\t// Assign a toggler\n\t\twid.applyAction('click', {\n\t\t\tclick: toggleMode\n\t\t});\n\t}", "draw() {\n this.checkContext();\n this.setRendered();\n\n if (!this.formatted) this.format();\n\n const num_lines = this.options.num_lines;\n const width = this.width;\n const x = this.x;\n let y;\n\n // Render lines\n for (let line = 0; line < num_lines; line++) {\n y = this.getYForLine(line);\n\n this.applyStyle();\n if (this.options.line_config[line].visible) {\n this.context.beginPath();\n this.context.moveTo(x, y);\n this.context.lineTo(x + width, y);\n this.context.stroke();\n }\n this.restoreStyle();\n }\n\n // Draw the modifiers (bar lines, coda, segno, repeat brackets, etc.)\n for (let i = 0; i < this.modifiers.length; i++) {\n // Only draw modifier if it has a draw function\n if (typeof this.modifiers[i].draw === 'function') {\n this.modifiers[i].applyStyle(this.context);\n this.modifiers[i].draw(this, this.getModifierXShift(i));\n this.modifiers[i].restoreStyle(this.context);\n }\n }\n\n // Render measure numbers\n if (this.measure > 0) {\n this.context.save();\n this.context.setFont(this.font.family, this.font.size, this.font.weight);\n const text_width = this.context.measureText('' + this.measure).width;\n y = this.getYForTopText(0) + 3;\n this.context.fillText('' + this.measure, this.x - text_width / 2, y);\n this.context.restore();\n }\n\n return this;\n }", "function highlightLine(cm, line, context, forceToEnd) {\n\t\t // A styles array always starts with a number identifying the\n\t\t // mode/overlays that it is based on (for easy invalidation).\n\t\t var st = [cm.state.modeGen], lineClasses = {};\n\t\t // Compute the base array of styles\n\t\t runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },\n\t\t lineClasses, forceToEnd);\n\t\t var state = context.state;\n\n\t\t // Run overlays, adjust style array.\n\t\t var loop = function ( o ) {\n\t\t context.baseTokens = st;\n\t\t var overlay = cm.state.overlays[o], i = 1, at = 0;\n\t\t context.state = true;\n\t\t runMode(cm, line.text, overlay.mode, context, function (end, style) {\n\t\t var start = i;\n\t\t // Ensure there's a token end at the current position, and that i points at it\n\t\t while (at < end) {\n\t\t var i_end = st[i];\n\t\t if (i_end > end)\n\t\t { st.splice(i, 1, end, st[i+1], i_end); }\n\t\t i += 2;\n\t\t at = Math.min(end, i_end);\n\t\t }\n\t\t if (!style) { return }\n\t\t if (overlay.opaque) {\n\t\t st.splice(start, i - start, end, \"overlay \" + style);\n\t\t i = start + 2;\n\t\t } else {\n\t\t for (; start < i; start += 2) {\n\t\t var cur = st[start+1];\n\t\t st[start+1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style;\n\t\t }\n\t\t }\n\t\t }, lineClasses);\n\t\t context.state = state;\n\t\t context.baseTokens = null;\n\t\t context.baseTokenPos = 1;\n\t\t };\n\n\t\t for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );\n\n\t\t return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}\n\t\t }", "function highlightLine(cm, line, state, forceToEnd) {\n\t\t // A styles array always starts with a number identifying the\n\t\t // mode/overlays that it is based on (for easy invalidation).\n\t\t var st = [cm.state.modeGen], lineClasses = {};\n\t\t // Compute the base array of styles\n\t\t runMode(cm, line.text, cm.doc.mode, state, function(end, style) {\n\t\t st.push(end, style);\n\t\t }, lineClasses, forceToEnd);\n\t\t\n\t\t // Run overlays, adjust style array.\n\t\t for (var o = 0; o < cm.state.overlays.length; ++o) {\n\t\t var overlay = cm.state.overlays[o], i = 1, at = 0;\n\t\t runMode(cm, line.text, overlay.mode, true, function(end, style) {\n\t\t var start = i;\n\t\t // Ensure there's a token end at the current position, and that i points at it\n\t\t while (at < end) {\n\t\t var i_end = st[i];\n\t\t if (i_end > end)\n\t\t st.splice(i, 1, end, st[i+1], i_end);\n\t\t i += 2;\n\t\t at = Math.min(end, i_end);\n\t\t }\n\t\t if (!style) return;\n\t\t if (overlay.opaque) {\n\t\t st.splice(start, i - start, end, \"cm-overlay \" + style);\n\t\t i = start + 2;\n\t\t } else {\n\t\t for (; start < i; start += 2) {\n\t\t var cur = st[start+1];\n\t\t st[start+1] = (cur ? cur + \" \" : \"\") + \"cm-overlay \" + style;\n\t\t }\n\t\t }\n\t\t }, lineClasses);\n\t\t }\n\t\t\n\t\t return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null};\n\t\t }", "function highlightLine(cm, line, context, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen],\n lineClasses = {}; // Compute the base array of styles\n\n runMode(cm, line.text, cm.doc.mode, context, function (end, style) {\n return st.push(end, style);\n }, lineClasses, forceToEnd);\n var state = context.state; // Run overlays, adjust style array.\n\n var loop = function loop(o) {\n context.baseTokens = st;\n var overlay = cm.state.overlays[o],\n i = 1,\n at = 0;\n context.state = true;\n runMode(cm, line.text, overlay.mode, context, function (end, style) {\n var start = i; // Ensure there's a token end at the current position, and that i points at it\n\n while (at < end) {\n var i_end = st[i];\n\n if (i_end > end) {\n st.splice(i, 1, end, st[i + 1], i_end);\n }\n\n i += 2;\n at = Math.min(end, i_end);\n }\n\n if (!style) {\n return;\n }\n\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start + 1];\n st[start + 1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style;\n }\n }\n }, lineClasses);\n context.state = state;\n context.baseTokens = null;\n context.baseTokenPos = 1;\n };\n\n for (var o = 0; o < cm.state.overlays.length; ++o) {\n loop(o);\n }\n\n return {\n styles: st,\n classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null\n };\n }", "function update() {\n requestAnimationFrame(update);\n context.fillStyle = \"#000\";\n context.fillRect(0, 0, canvas.width, canvas.height);\n\n context.textBaseline = \"middle\";\n textObjects.forEach(textObject => {\n textObject.draw();\n });\n }", "function highlightLine(cm, line, context, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },\n lineClasses, forceToEnd);\n var state = context.state;\n\n // Run overlays, adjust style array.\n var loop = function ( o ) {\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n context.state = true;\n runMode(cm, line.text, overlay.mode, context, function (end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n { st.splice(i, 1, end, st[i+1], i_end); }\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) { return }\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style;\n }\n }\n }, lineClasses);\n };\n\n for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );\n context.state = state;\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}\n}", "function highlightLine(cm, line, context, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },\n lineClasses, forceToEnd);\n var state = context.state;\n\n // Run overlays, adjust style array.\n var loop = function ( o ) {\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n context.state = true;\n runMode(cm, line.text, overlay.mode, context, function (end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n { st.splice(i, 1, end, st[i+1], i_end); }\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) { return }\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style;\n }\n }\n }, lineClasses);\n };\n\n for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );\n context.state = state;\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}\n}", "function highlightLine(cm, line, context, forceToEnd) {\r\n // A styles array always starts with a number identifying the\r\n // mode/overlays that it is based on (for easy invalidation).\r\n var st = [cm.state.modeGen], lineClasses = {};\r\n // Compute the base array of styles\r\n runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },\r\n lineClasses, forceToEnd);\r\n var state = context.state;\r\n\r\n // Run overlays, adjust style array.\r\n var loop = function ( o ) {\r\n context.baseTokens = st;\r\n var overlay = cm.state.overlays[o], i = 1, at = 0;\r\n context.state = true;\r\n runMode(cm, line.text, overlay.mode, context, function (end, style) {\r\n var start = i;\r\n // Ensure there's a token end at the current position, and that i points at it\r\n while (at < end) {\r\n var i_end = st[i];\r\n if (i_end > end)\r\n { st.splice(i, 1, end, st[i+1], i_end); }\r\n i += 2;\r\n at = Math.min(end, i_end);\r\n }\r\n if (!style) { return }\r\n if (overlay.opaque) {\r\n st.splice(start, i - start, end, \"overlay \" + style);\r\n i = start + 2;\r\n } else {\r\n for (; start < i; start += 2) {\r\n var cur = st[start+1];\r\n st[start+1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style;\r\n }\r\n }\r\n }, lineClasses);\r\n context.state = state;\r\n context.baseTokens = null;\r\n context.baseTokenPos = 1;\r\n };\r\n\r\n for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );\r\n\r\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}\r\n}", "function highlightLine(cm, line, state, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {}\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, state, function (end, style) { return st.push(end, style); },\n lineClasses, forceToEnd)\n\n // Run overlays, adjust style array.\n var loop = function ( o ) {\n var overlay = cm.state.overlays[o], i = 1, at = 0\n runMode(cm, line.text, overlay.mode, true, function (end, style) {\n var start = i\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i]\n if (i_end > end)\n { st.splice(i, 1, end, st[i+1], i_end) }\n i += 2\n at = Math.min(end, i_end)\n }\n if (!style) { return }\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"overlay \" + style)\n i = start + 2\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1]\n st[start+1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style\n }\n }\n }, lineClasses)\n };\n\n for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}\n}", "function highlightLine(cm, line, state, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {}\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, state, function (end, style) { return st.push(end, style); },\n lineClasses, forceToEnd)\n\n // Run overlays, adjust style array.\n var loop = function ( o ) {\n var overlay = cm.state.overlays[o], i = 1, at = 0\n runMode(cm, line.text, overlay.mode, true, function (end, style) {\n var start = i\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i]\n if (i_end > end)\n { st.splice(i, 1, end, st[i+1], i_end) }\n i += 2\n at = Math.min(end, i_end)\n }\n if (!style) { return }\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"overlay \" + style)\n i = start + 2\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1]\n st[start+1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style\n }\n }\n }, lineClasses)\n };\n\n for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}\n}", "function highlightLine(cm, line, context, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },\n lineClasses, forceToEnd);\n var state = context.state;\n\n // Run overlays, adjust style array.\n var loop = function ( o ) {\n context.baseTokens = st;\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n context.state = true;\n runMode(cm, line.text, overlay.mode, context, function (end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n { st.splice(i, 1, end, st[i+1], i_end); }\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) { return }\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style;\n }\n }\n }, lineClasses);\n context.state = state;\n context.baseTokens = null;\n context.baseTokenPos = 1;\n };\n\n for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}\n}", "function highlightLine(cm, line, context, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },\n lineClasses, forceToEnd);\n var state = context.state;\n\n // Run overlays, adjust style array.\n var loop = function ( o ) {\n context.baseTokens = st;\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n context.state = true;\n runMode(cm, line.text, overlay.mode, context, function (end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n { st.splice(i, 1, end, st[i+1], i_end); }\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) { return }\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style;\n }\n }\n }, lineClasses);\n context.state = state;\n context.baseTokens = null;\n context.baseTokenPos = 1;\n };\n\n for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}\n}", "function highlightLine(cm, line, context, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },\n lineClasses, forceToEnd);\n var state = context.state;\n\n // Run overlays, adjust style array.\n var loop = function ( o ) {\n context.baseTokens = st;\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n context.state = true;\n runMode(cm, line.text, overlay.mode, context, function (end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n { st.splice(i, 1, end, st[i+1], i_end); }\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) { return }\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style;\n }\n }\n }, lineClasses);\n context.state = state;\n context.baseTokens = null;\n context.baseTokenPos = 1;\n };\n\n for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}\n}", "function highlightLine(cm, line, context, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },\n lineClasses, forceToEnd);\n var state = context.state;\n\n // Run overlays, adjust style array.\n var loop = function ( o ) {\n context.baseTokens = st;\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n context.state = true;\n runMode(cm, line.text, overlay.mode, context, function (end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n { st.splice(i, 1, end, st[i+1], i_end); }\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) { return }\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style;\n }\n }\n }, lineClasses);\n context.state = state;\n context.baseTokens = null;\n context.baseTokenPos = 1;\n };\n\n for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}\n}", "function highlightLine(cm, line, context, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },\n lineClasses, forceToEnd);\n var state = context.state;\n\n // Run overlays, adjust style array.\n var loop = function ( o ) {\n context.baseTokens = st;\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n context.state = true;\n runMode(cm, line.text, overlay.mode, context, function (end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n { st.splice(i, 1, end, st[i+1], i_end); }\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) { return }\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style;\n }\n }\n }, lineClasses);\n context.state = state;\n context.baseTokens = null;\n context.baseTokenPos = 1;\n };\n\n for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}\n}", "function highlightLine(cm, line, context, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },\n lineClasses, forceToEnd);\n var state = context.state;\n\n // Run overlays, adjust style array.\n var loop = function ( o ) {\n context.baseTokens = st;\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n context.state = true;\n runMode(cm, line.text, overlay.mode, context, function (end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n { st.splice(i, 1, end, st[i+1], i_end); }\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) { return }\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style;\n }\n }\n }, lineClasses);\n context.state = state;\n context.baseTokens = null;\n context.baseTokenPos = 1;\n };\n\n for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}\n}", "function highlightLine(cm, line, context, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },\n lineClasses, forceToEnd);\n var state = context.state;\n\n // Run overlays, adjust style array.\n var loop = function ( o ) {\n context.baseTokens = st;\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n context.state = true;\n runMode(cm, line.text, overlay.mode, context, function (end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n { st.splice(i, 1, end, st[i+1], i_end); }\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) { return }\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style;\n }\n }\n }, lineClasses);\n context.state = state;\n context.baseTokens = null;\n context.baseTokenPos = 1;\n };\n\n for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}\n}", "function highlightLine(cm, line, context, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },\n lineClasses, forceToEnd);\n var state = context.state;\n\n // Run overlays, adjust style array.\n var loop = function ( o ) {\n context.baseTokens = st;\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n context.state = true;\n runMode(cm, line.text, overlay.mode, context, function (end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n { st.splice(i, 1, end, st[i+1], i_end); }\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) { return }\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style;\n }\n }\n }, lineClasses);\n context.state = state;\n context.baseTokens = null;\n context.baseTokenPos = 1;\n };\n\n for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}\n}", "function highlightLine(cm, line, context, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },\n lineClasses, forceToEnd);\n var state = context.state;\n\n // Run overlays, adjust style array.\n var loop = function ( o ) {\n context.baseTokens = st;\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n context.state = true;\n runMode(cm, line.text, overlay.mode, context, function (end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n { st.splice(i, 1, end, st[i+1], i_end); }\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) { return }\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style;\n }\n }\n }, lineClasses);\n context.state = state;\n context.baseTokens = null;\n context.baseTokenPos = 1;\n };\n\n for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}\n}", "function highlightLine(cm, line, context, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },\n lineClasses, forceToEnd);\n var state = context.state;\n\n // Run overlays, adjust style array.\n var loop = function ( o ) {\n context.baseTokens = st;\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n context.state = true;\n runMode(cm, line.text, overlay.mode, context, function (end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n { st.splice(i, 1, end, st[i+1], i_end); }\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) { return }\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style;\n }\n }\n }, lineClasses);\n context.state = state;\n context.baseTokens = null;\n context.baseTokenPos = 1;\n };\n\n for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}\n }", "function highlightLine(cm, line, context, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },\n lineClasses, forceToEnd);\n var state = context.state;\n\n // Run overlays, adjust style array.\n var loop = function ( o ) {\n context.baseTokens = st;\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n context.state = true;\n runMode(cm, line.text, overlay.mode, context, function (end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n { st.splice(i, 1, end, st[i+1], i_end); }\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) { return }\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style;\n }\n }\n }, lineClasses);\n context.state = state;\n context.baseTokens = null;\n context.baseTokenPos = 1;\n };\n\n for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}\n }", "function highlightLine(cm, line, context, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },\n lineClasses, forceToEnd);\n var state = context.state;\n\n // Run overlays, adjust style array.\n var loop = function ( o ) {\n context.baseTokens = st;\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n context.state = true;\n runMode(cm, line.text, overlay.mode, context, function (end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n { st.splice(i, 1, end, st[i+1], i_end); }\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) { return }\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style;\n }\n }\n }, lineClasses);\n context.state = state;\n context.baseTokens = null;\n context.baseTokenPos = 1;\n };\n\n for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}\n }", "function highlightLine(cm, line, context, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },\n lineClasses, forceToEnd);\n var state = context.state;\n\n // Run overlays, adjust style array.\n var loop = function ( o ) {\n context.baseTokens = st;\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n context.state = true;\n runMode(cm, line.text, overlay.mode, context, function (end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n { st.splice(i, 1, end, st[i+1], i_end); }\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) { return }\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style;\n }\n }\n }, lineClasses);\n context.state = state;\n context.baseTokens = null;\n context.baseTokenPos = 1;\n };\n\n for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}\n }", "function highlightLine(cm, line, context, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },\n lineClasses, forceToEnd);\n var state = context.state;\n\n // Run overlays, adjust style array.\n var loop = function ( o ) {\n context.baseTokens = st;\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n context.state = true;\n runMode(cm, line.text, overlay.mode, context, function (end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n { st.splice(i, 1, end, st[i+1], i_end); }\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) { return }\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style;\n }\n }\n }, lineClasses);\n context.state = state;\n context.baseTokens = null;\n context.baseTokenPos = 1;\n };\n\n for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}\n }", "function highlightLine(cm, line, context, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },\n lineClasses, forceToEnd);\n var state = context.state;\n\n // Run overlays, adjust style array.\n var loop = function ( o ) {\n context.baseTokens = st;\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n context.state = true;\n runMode(cm, line.text, overlay.mode, context, function (end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n { st.splice(i, 1, end, st[i+1], i_end); }\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) { return }\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style;\n }\n }\n }, lineClasses);\n context.state = state;\n context.baseTokens = null;\n context.baseTokenPos = 1;\n };\n\n for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}\n }", "function highlightLine(cm, line, context, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },\n lineClasses, forceToEnd);\n var state = context.state;\n\n // Run overlays, adjust style array.\n var loop = function ( o ) {\n context.baseTokens = st;\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n context.state = true;\n runMode(cm, line.text, overlay.mode, context, function (end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n { st.splice(i, 1, end, st[i+1], i_end); }\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) { return }\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style;\n }\n }\n }, lineClasses);\n context.state = state;\n context.baseTokens = null;\n context.baseTokenPos = 1;\n };\n\n for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}\n }", "function highlightLine(cm, line, context, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },\n lineClasses, forceToEnd);\n var state = context.state;\n\n // Run overlays, adjust style array.\n var loop = function ( o ) {\n context.baseTokens = st;\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n context.state = true;\n runMode(cm, line.text, overlay.mode, context, function (end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n { st.splice(i, 1, end, st[i+1], i_end); }\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) { return }\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style;\n }\n }\n }, lineClasses);\n context.state = state;\n context.baseTokens = null;\n context.baseTokenPos = 1;\n };\n\n for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}\n }", "function highlightLine(cm, line, context, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },\n lineClasses, forceToEnd);\n var state = context.state;\n\n // Run overlays, adjust style array.\n var loop = function ( o ) {\n context.baseTokens = st;\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n context.state = true;\n runMode(cm, line.text, overlay.mode, context, function (end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n { st.splice(i, 1, end, st[i+1], i_end); }\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) { return }\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style;\n }\n }\n }, lineClasses);\n context.state = state;\n context.baseTokens = null;\n context.baseTokenPos = 1;\n };\n\n for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}\n }", "function highlightLine(cm, line, context, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },\n lineClasses, forceToEnd);\n var state = context.state;\n\n // Run overlays, adjust style array.\n var loop = function ( o ) {\n context.baseTokens = st;\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n context.state = true;\n runMode(cm, line.text, overlay.mode, context, function (end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n { st.splice(i, 1, end, st[i+1], i_end); }\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) { return }\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style;\n }\n }\n }, lineClasses);\n context.state = state;\n context.baseTokens = null;\n context.baseTokenPos = 1;\n };\n\n for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}\n }", "function highlightLine(cm, line, context, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },\n lineClasses, forceToEnd);\n var state = context.state;\n\n // Run overlays, adjust style array.\n var loop = function ( o ) {\n context.baseTokens = st;\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n context.state = true;\n runMode(cm, line.text, overlay.mode, context, function (end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n { st.splice(i, 1, end, st[i+1], i_end); }\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) { return }\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style;\n }\n }\n }, lineClasses);\n context.state = state;\n context.baseTokens = null;\n context.baseTokenPos = 1;\n };\n\n for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}\n }", "function highlightLine(cm, line, context, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },\n lineClasses, forceToEnd);\n var state = context.state;\n\n // Run overlays, adjust style array.\n var loop = function ( o ) {\n context.baseTokens = st;\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n context.state = true;\n runMode(cm, line.text, overlay.mode, context, function (end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n { st.splice(i, 1, end, st[i+1], i_end); }\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) { return }\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style;\n }\n }\n }, lineClasses);\n context.state = state;\n context.baseTokens = null;\n context.baseTokenPos = 1;\n };\n\n for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}\n }", "function highlightLine(cm, line, context, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },\n lineClasses, forceToEnd);\n var state = context.state;\n\n // Run overlays, adjust style array.\n var loop = function ( o ) {\n context.baseTokens = st;\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n context.state = true;\n runMode(cm, line.text, overlay.mode, context, function (end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n { st.splice(i, 1, end, st[i+1], i_end); }\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) { return }\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style;\n }\n }\n }, lineClasses);\n context.state = state;\n context.baseTokens = null;\n context.baseTokenPos = 1;\n };\n\n for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}\n }", "function highlightLine(cm, line, context, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },\n lineClasses, forceToEnd);\n var state = context.state;\n\n // Run overlays, adjust style array.\n var loop = function ( o ) {\n context.baseTokens = st;\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n context.state = true;\n runMode(cm, line.text, overlay.mode, context, function (end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n { st.splice(i, 1, end, st[i+1], i_end); }\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) { return }\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style;\n }\n }\n }, lineClasses);\n context.state = state;\n context.baseTokens = null;\n context.baseTokenPos = 1;\n };\n\n for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}\n }", "function highlightLine(cm, line, context, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },\n lineClasses, forceToEnd);\n var state = context.state;\n\n // Run overlays, adjust style array.\n var loop = function ( o ) {\n context.baseTokens = st;\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n context.state = true;\n runMode(cm, line.text, overlay.mode, context, function (end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n { st.splice(i, 1, end, st[i+1], i_end); }\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) { return }\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style;\n }\n }\n }, lineClasses);\n context.state = state;\n context.baseTokens = null;\n context.baseTokenPos = 1;\n };\n\n for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}\n }", "function highlightLine(cm, line, context, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },\n lineClasses, forceToEnd);\n var state = context.state;\n\n // Run overlays, adjust style array.\n var loop = function ( o ) {\n context.baseTokens = st;\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n context.state = true;\n runMode(cm, line.text, overlay.mode, context, function (end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n { st.splice(i, 1, end, st[i+1], i_end); }\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) { return }\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style;\n }\n }\n }, lineClasses);\n context.state = state;\n context.baseTokens = null;\n context.baseTokenPos = 1;\n };\n\n for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}\n }", "function highlightLine(cm, line, context, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },\n lineClasses, forceToEnd);\n var state = context.state;\n\n // Run overlays, adjust style array.\n var loop = function ( o ) {\n context.baseTokens = st;\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n context.state = true;\n runMode(cm, line.text, overlay.mode, context, function (end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n { st.splice(i, 1, end, st[i+1], i_end); }\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) { return }\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style;\n }\n }\n }, lineClasses);\n context.state = state;\n context.baseTokens = null;\n context.baseTokenPos = 1;\n };\n\n for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}\n }", "function highlightLine(cm, line, state, forceToEnd) {\r\n // A styles array always starts with a number identifying the\r\n // mode/overlays that it is based on (for easy invalidation).\r\n var st = [cm.state.modeGen], lineClasses = {};\r\n // Compute the base array of styles\r\n runMode(cm, line.text, cm.doc.mode, state, function(end, style) {\r\n st.push(end, style);\r\n }, lineClasses, forceToEnd);\r\n\r\n // Run overlays, adjust style array.\r\n for (var o = 0; o < cm.state.overlays.length; ++o) {\r\n var overlay = cm.state.overlays[o], i = 1, at = 0;\r\n runMode(cm, line.text, overlay.mode, true, function(end, style) {\r\n var start = i;\r\n // Ensure there's a token end at the current position, and that i points at it\r\n while (at < end) {\r\n var i_end = st[i];\r\n if (i_end > end)\r\n st.splice(i, 1, end, st[i+1], i_end);\r\n i += 2;\r\n at = Math.min(end, i_end);\r\n }\r\n if (!style) return;\r\n if (overlay.opaque) {\r\n st.splice(start, i - start, end, \"cm-overlay \" + style);\r\n i = start + 2;\r\n } else {\r\n for (; start < i; start += 2) {\r\n var cur = st[start+1];\r\n st[start+1] = (cur ? cur + \" \" : \"\") + \"cm-overlay \" + style;\r\n }\r\n }\r\n }, lineClasses);\r\n }\r\n\r\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null};\r\n }", "function highlightLine(cm, line, state, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, state, function(end, style) {\n st.push(end, style);\n }, lineClasses, forceToEnd);\n\n // Run overlays, adjust style array.\n for (var o = 0; o < cm.state.overlays.length; ++o) {\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n runMode(cm, line.text, overlay.mode, true, function(end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n st.splice(i, 1, end, st[i+1], i_end);\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) return;\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"cm-overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"cm-overlay \" + style;\n }\n }\n }, lineClasses);\n }\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null};\n }", "function highlightLine(cm, line, state, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, state, function(end, style) {\n st.push(end, style);\n }, lineClasses, forceToEnd);\n\n // Run overlays, adjust style array.\n for (var o = 0; o < cm.state.overlays.length; ++o) {\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n runMode(cm, line.text, overlay.mode, true, function(end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n st.splice(i, 1, end, st[i+1], i_end);\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) return;\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"cm-overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"cm-overlay \" + style;\n }\n }\n }, lineClasses);\n }\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null};\n }", "function highlightLine(cm, line, state, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, state, function(end, style) {\n st.push(end, style);\n }, lineClasses, forceToEnd);\n\n // Run overlays, adjust style array.\n for (var o = 0; o < cm.state.overlays.length; ++o) {\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n runMode(cm, line.text, overlay.mode, true, function(end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n st.splice(i, 1, end, st[i+1], i_end);\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) return;\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"cm-overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"cm-overlay \" + style;\n }\n }\n }, lineClasses);\n }\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null};\n }", "function highlightLine(cm, line, state, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, state, function(end, style) {\n st.push(end, style);\n }, lineClasses, forceToEnd);\n\n // Run overlays, adjust style array.\n for (var o = 0; o < cm.state.overlays.length; ++o) {\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n runMode(cm, line.text, overlay.mode, true, function(end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n st.splice(i, 1, end, st[i+1], i_end);\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) return;\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"cm-overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"cm-overlay \" + style;\n }\n }\n }, lineClasses);\n }\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null};\n }", "function highlightLine(cm, line, state, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, state, function(end, style) {\n st.push(end, style);\n }, lineClasses, forceToEnd);\n\n // Run overlays, adjust style array.\n for (var o = 0; o < cm.state.overlays.length; ++o) {\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n runMode(cm, line.text, overlay.mode, true, function(end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n st.splice(i, 1, end, st[i+1], i_end);\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) return;\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"cm-overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"cm-overlay \" + style;\n }\n }\n }, lineClasses);\n }\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null};\n }", "function highlightLine(cm, line, state, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, state, function(end, style) {\n st.push(end, style);\n }, lineClasses, forceToEnd);\n\n // Run overlays, adjust style array.\n for (var o = 0; o < cm.state.overlays.length; ++o) {\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n runMode(cm, line.text, overlay.mode, true, function(end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n st.splice(i, 1, end, st[i+1], i_end);\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) return;\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"cm-overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"cm-overlay \" + style;\n }\n }\n }, lineClasses);\n }\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null};\n }", "function highlightLine(cm, line, state, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, state, function(end, style) {\n st.push(end, style);\n }, lineClasses, forceToEnd);\n\n // Run overlays, adjust style array.\n for (var o = 0; o < cm.state.overlays.length; ++o) {\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n runMode(cm, line.text, overlay.mode, true, function(end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n st.splice(i, 1, end, st[i+1], i_end);\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) return;\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"cm-overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"cm-overlay \" + style;\n }\n }\n }, lineClasses);\n }\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null};\n }", "render() {\n\t\tif (!this.visible || !this.ctx) return;\n\t\tthis.ctx.font = this.textStyle.font;\n\t\tthis.ctx.fillStyle = this.textStyle.fillStyle;\n\t\tthis.ctx.textAlign = this.textStyle.textAlign;\n\t\tthis.ctx.fillText(this.text, this.x, this.y);\n\t}", "doDraw() {\n draw_context.strokeStyle = \"#000\";\n draw_context.fillStyle = \"#eee\";\n draw_context.font = \"40px Times\";\n draw_context.lineWidth = 10;\n draw_context.strokeText(this.text, canvas_element.width/2, this.vertical);\n draw_context.fillText(this.text, canvas_element.width/2, this.vertical);\n }", "function highlightLine(cm, line, state, forceToEnd) {\n\t // A styles array always starts with a number identifying the\n\t // mode/overlays that it is based on (for easy invalidation).\n\t var st = [cm.state.modeGen], lineClasses = {};\n\t // Compute the base array of styles\n\t runMode(cm, line.text, cm.doc.mode, state, function(end, style) {\n\t st.push(end, style);\n\t }, lineClasses, forceToEnd);\n\t\n\t // Run overlays, adjust style array.\n\t for (var o = 0; o < cm.state.overlays.length; ++o) {\n\t var overlay = cm.state.overlays[o], i = 1, at = 0;\n\t runMode(cm, line.text, overlay.mode, true, function(end, style) {\n\t var start = i;\n\t // Ensure there's a token end at the current position, and that i points at it\n\t while (at < end) {\n\t var i_end = st[i];\n\t if (i_end > end)\n\t st.splice(i, 1, end, st[i+1], i_end);\n\t i += 2;\n\t at = Math.min(end, i_end);\n\t }\n\t if (!style) return;\n\t if (overlay.opaque) {\n\t st.splice(start, i - start, end, \"cm-overlay \" + style);\n\t i = start + 2;\n\t } else {\n\t for (; start < i; start += 2) {\n\t var cur = st[start+1];\n\t st[start+1] = (cur ? cur + \" \" : \"\") + \"cm-overlay \" + style;\n\t }\n\t }\n\t }, lineClasses);\n\t }\n\t\n\t return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null};\n\t }", "function xTextRefresh() {\r\n\txText.attr(\r\n\t\t\"transform\",\r\n\t\t\"translate(\" +\r\n\t\t((width - labelArea) / 2 + labelArea) +\r\n\t\t\", \" +\r\n\t\t(height - margin - tPadBot) +\r\n\t\t\")\"\r\n\t);\r\n}", "function highlightLine(cm, line, state, forceToEnd) {\n\t // A styles array always starts with a number identifying the\n\t // mode/overlays that it is based on (for easy invalidation).\n\t var st = [cm.state.modeGen], lineClasses = {};\n\t // Compute the base array of styles\n\t runMode(cm, line.text, cm.doc.mode, state, function(end, style) {\n\t st.push(end, style);\n\t }, lineClasses, forceToEnd);\n\n\t // Run overlays, adjust style array.\n\t for (var o = 0; o < cm.state.overlays.length; ++o) {\n\t var overlay = cm.state.overlays[o], i = 1, at = 0;\n\t runMode(cm, line.text, overlay.mode, true, function(end, style) {\n\t var start = i;\n\t // Ensure there's a token end at the current position, and that i points at it\n\t while (at < end) {\n\t var i_end = st[i];\n\t if (i_end > end)\n\t st.splice(i, 1, end, st[i+1], i_end);\n\t i += 2;\n\t at = Math.min(end, i_end);\n\t }\n\t if (!style) return;\n\t if (overlay.opaque) {\n\t st.splice(start, i - start, end, \"cm-overlay \" + style);\n\t i = start + 2;\n\t } else {\n\t for (; start < i; start += 2) {\n\t var cur = st[start+1];\n\t st[start+1] = (cur ? cur + \" \" : \"\") + \"cm-overlay \" + style;\n\t }\n\t }\n\t }, lineClasses);\n\t }\n\n\t return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null};\n\t }", "function highlightLine(cm, line, state, forceToEnd) {\n\t // A styles array always starts with a number identifying the\n\t // mode/overlays that it is based on (for easy invalidation).\n\t var st = [cm.state.modeGen], lineClasses = {};\n\t // Compute the base array of styles\n\t runMode(cm, line.text, cm.doc.mode, state, function(end, style) {\n\t st.push(end, style);\n\t }, lineClasses, forceToEnd);\n\n\t // Run overlays, adjust style array.\n\t for (var o = 0; o < cm.state.overlays.length; ++o) {\n\t var overlay = cm.state.overlays[o], i = 1, at = 0;\n\t runMode(cm, line.text, overlay.mode, true, function(end, style) {\n\t var start = i;\n\t // Ensure there's a token end at the current position, and that i points at it\n\t while (at < end) {\n\t var i_end = st[i];\n\t if (i_end > end)\n\t st.splice(i, 1, end, st[i+1], i_end);\n\t i += 2;\n\t at = Math.min(end, i_end);\n\t }\n\t if (!style) return;\n\t if (overlay.opaque) {\n\t st.splice(start, i - start, end, \"cm-overlay \" + style);\n\t i = start + 2;\n\t } else {\n\t for (; start < i; start += 2) {\n\t var cur = st[start+1];\n\t st[start+1] = (cur ? cur + \" \" : \"\") + \"cm-overlay \" + style;\n\t }\n\t }\n\t }, lineClasses);\n\t }\n\n\t return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null};\n\t }", "draw() { \n // redraw the row that have been modified using the current drawMethod \n for (var i = 0; i < this.charArray.length; i++) {\n if (this.charArray[i].modified) {\n this.charArray[i].modified = false;\n if (this.drawMethod == 'DOM') {\n this.drawRowDOM(i);\n }\n else if (this.drawMethod == 'canvas') {\n this.drawRowCanvas(i);\n }\n }\n }\n\n // reposition the cursor node\n this.cursorNode.style.left = this.cursor.x * this.charWidth + \"px\";\n this.cursorNode.style.top = this.cursor.y * this.charHeight + \"px\";\n }", "update(redrawOnly = false) {\n this.graphics.clear();\n if (redrawOnly) {\n this.drawAppropriateLine();\n } else {\n this.draw(true);\n }\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built;\n }\n\n return buildLineContent(cm, lineView);\n } // Redraw the line's text. Interacts with the background and text", "function onChangeLine(txt) {\n changeCurrMeme('line-txt', txt);\n renderCanvas();\n}" ]
[ "0.74870175", "0.7475659", "0.74642247", "0.74642247", "0.74642247", "0.74642247", "0.74642247", "0.74642247", "0.74642247", "0.74642247", "0.74571306", "0.74571306", "0.74571306", "0.74498487", "0.7411686", "0.7344041", "0.732451", "0.732451", "0.732451", "0.732451", "0.732451", "0.732451", "0.732451", "0.732451", "0.732451", "0.732451", "0.732451", "0.73128694", "0.73083806", "0.6452401", "0.6438814", "0.6351048", "0.63095754", "0.6254128", "0.6239789", "0.62371564", "0.62371564", "0.62156254", "0.6203489", "0.6203489", "0.61928034", "0.61928034", "0.61928034", "0.61928034", "0.61928034", "0.61928034", "0.61928034", "0.61928034", "0.61928034", "0.6181789", "0.6181789", "0.6181789", "0.6181789", "0.6181789", "0.6181789", "0.6181789", "0.6181789", "0.6181789", "0.6181789", "0.6181789", "0.6181789", "0.6181789", "0.6181789", "0.6181789", "0.6181789", "0.6181789", "0.61519015", "0.6149164", "0.6149164", "0.6149164", "0.6149164", "0.6149164", "0.6149164", "0.6149164", "0.6146081", "0.61270547", "0.6123454", "0.61008537", "0.60620624", "0.60620624", "0.6050085", "0.6025824", "0.59936607", "0.59914005" ]
0.74458647
27
Build a line's DOM representation from scratch
function buildLineElement(cm, lineView, lineN, dims) { var built = getLineContent(cm, lineView); lineView.text = lineView.node = built.pre; if (built.bgClass) { lineView.bgClass = built.bgClass; } if (built.textClass) { lineView.textClass = built.textClass; } updateLineClasses(cm, lineView); updateLineGutter(cm, lineView, lineN, dims); insertLineWidgets(cm, lineView, dims); return lineView.node }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buildLineElement(cm, lineView, lineN, dims) {\n\t\t var built = getLineContent(cm, lineView);\n\t\t lineView.text = lineView.node = built.pre;\n\t\t if (built.bgClass) { lineView.bgClass = built.bgClass; }\n\t\t if (built.textClass) { lineView.textClass = built.textClass; }\n\n\t\t updateLineClasses(cm, lineView);\n\t\t updateLineGutter(cm, lineView, lineN, dims);\n\t\t insertLineWidgets(cm, lineView, dims);\n\t\t return lineView.node\n\t\t }", "function buildLineElement(cm, lineView, lineN, dims) {\n\t\t var built = getLineContent(cm, lineView);\n\t\t lineView.text = lineView.node = built.pre;\n\t\t if (built.bgClass) lineView.bgClass = built.bgClass;\n\t\t if (built.textClass) lineView.textClass = built.textClass;\n\t\t\n\t\t updateLineClasses(lineView);\n\t\t updateLineGutter(cm, lineView, lineN, dims);\n\t\t insertLineWidgets(cm, lineView, dims);\n\t\t return lineView.node;\n\t\t }", "function buildLineElement(cm, lineView, lineN, dims) {\n\t var built = getLineContent(cm, lineView);\n\t lineView.text = lineView.node = built.pre;\n\t if (built.bgClass) lineView.bgClass = built.bgClass;\n\t if (built.textClass) lineView.textClass = built.textClass;\n\t\n\t updateLineClasses(lineView);\n\t updateLineGutter(cm, lineView, lineN, dims);\n\t insertLineWidgets(cm, lineView, dims);\n\t return lineView.node;\n\t }", "function buildLineElement(cm, lineView, lineN, dims) {\n\t var built = getLineContent(cm, lineView);\n\t lineView.text = lineView.node = built.pre;\n\t if (built.bgClass) lineView.bgClass = built.bgClass;\n\t if (built.textClass) lineView.textClass = built.textClass;\n\n\t updateLineClasses(lineView);\n\t updateLineGutter(cm, lineView, lineN, dims);\n\t insertLineWidgets(cm, lineView, dims);\n\t return lineView.node;\n\t }", "function buildLineElement(cm, lineView, lineN, dims) {\n\t var built = getLineContent(cm, lineView);\n\t lineView.text = lineView.node = built.pre;\n\t if (built.bgClass) lineView.bgClass = built.bgClass;\n\t if (built.textClass) lineView.textClass = built.textClass;\n\n\t updateLineClasses(lineView);\n\t updateLineGutter(cm, lineView, lineN, dims);\n\t insertLineWidgets(cm, lineView, dims);\n\t return lineView.node;\n\t }", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) lineView.bgClass = built.bgClass;\n if (built.textClass) lineView.textClass = built.textClass;\n\n updateLineClasses(lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node;\n }", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) lineView.bgClass = built.bgClass;\n if (built.textClass) lineView.textClass = built.textClass;\n\n updateLineClasses(lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node;\n }", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView)\n lineView.text = lineView.node = built.pre\n if (built.bgClass) { lineView.bgClass = built.bgClass }\n if (built.textClass) { lineView.textClass = built.textClass }\n\n updateLineClasses(cm, lineView)\n updateLineGutter(cm, lineView, lineN, dims)\n insertLineWidgets(cm, lineView, dims)\n return lineView.node\n}", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) lineView.bgClass = built.bgClass;\n if (built.textClass) lineView.textClass = built.textClass;\n\n updateLineClasses(lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(lineView, dims);\n return lineView.node;\n }", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) lineView.bgClass = built.bgClass;\n if (built.textClass) lineView.textClass = built.textClass;\n\n updateLineClasses(lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(lineView, dims);\n return lineView.node;\n }", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) lineView.bgClass = built.bgClass;\n if (built.textClass) lineView.textClass = built.textClass;\n\n updateLineClasses(lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(lineView, dims);\n return lineView.node;\n }", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) lineView.bgClass = built.bgClass;\n if (built.textClass) lineView.textClass = built.textClass;\n\n updateLineClasses(lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(lineView, dims);\n return lineView.node;\n }", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) lineView.bgClass = built.bgClass;\n if (built.textClass) lineView.textClass = built.textClass;\n\n updateLineClasses(lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(lineView, dims);\n return lineView.node;\n }", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) lineView.bgClass = built.bgClass;\n if (built.textClass) lineView.textClass = built.textClass;\n\n updateLineClasses(lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(lineView, dims);\n return lineView.node;\n }", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView)\n lineView.text = lineView.node = built.pre\n if (built.bgClass) { lineView.bgClass = built.bgClass }\n if (built.textClass) { lineView.textClass = built.textClass }\n\n updateLineClasses(lineView)\n updateLineGutter(cm, lineView, lineN, dims)\n insertLineWidgets(cm, lineView, dims)\n return lineView.node\n}", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n}", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n}", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n}", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n}", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n}", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n}", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n}", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n}", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n}", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n}", "function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n}", "function buildLineElement(cm, lineView, lineN, dims) {\r\n var built = getLineContent(cm, lineView);\r\n lineView.text = lineView.node = built.pre;\r\n if (built.bgClass) lineView.bgClass = built.bgClass;\r\n if (built.textClass) lineView.textClass = built.textClass;\r\n\r\n updateLineClasses(lineView);\r\n updateLineGutter(cm, lineView, lineN, dims);\r\n insertLineWidgets(lineView, dims);\r\n return lineView.node;\r\n }", "function buildLineElement(cm, lineView, lineN, dims) {\r\n var built = getLineContent(cm, lineView);\r\n lineView.text = lineView.node = built.pre;\r\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\r\n if (built.textClass) { lineView.textClass = built.textClass; }\r\n\r\n updateLineClasses(cm, lineView);\r\n updateLineGutter(cm, lineView, lineN, dims);\r\n insertLineWidgets(cm, lineView, dims);\r\n return lineView.node\r\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: elt(\"pre\", [content]), content: content, col: 0, pos: 0, cm: cm};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order;\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if ((ie || webkit) && cm.getOption(\"lineWrapping\"))\n builder.addToken = buildTokenSplitSpaces(builder.addToken);\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n if (line.styleClasses.textClass)\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit && /\\bcm-tab\\b/.test(builder.content.lastChild.className))\n builder.content.className = \"cm-tab-wrap-hack\";\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\n return builder;\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: elt(\"pre\", [content]), content: content, col: 0, pos: 0, cm: cm};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order;\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if ((ie || webkit) && cm.getOption(\"lineWrapping\"))\n builder.addToken = buildTokenSplitSpaces(builder.addToken);\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n if (line.styleClasses.textClass)\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit && /\\bcm-tab\\b/.test(builder.content.lastChild.className))\n builder.content.className = \"cm-tab-wrap-hack\";\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\n return builder;\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: elt(\"pre\", [content]), content: content, col: 0, pos: 0, cm: cm};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order;\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if ((ie || webkit) && cm.getOption(\"lineWrapping\"))\n builder.addToken = buildTokenSplitSpaces(builder.addToken);\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n if (line.styleClasses.textClass)\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit && /\\bcm-tab\\b/.test(builder.content.lastChild.className))\n builder.content.className = \"cm-tab-wrap-hack\";\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\n return builder;\n }", "function buildLineContent(cm, lineView) {\r\n // The padding-right forces the element to have a 'border', which\r\n // is needed on Webkit to be able to get line-level bounding\r\n // rectangles for it (in measureChar).\r\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\r\n var builder = {pre: elt(\"pre\", [content]), content: content, col: 0, pos: 0, cm: cm};\r\n lineView.measure = {};\r\n\r\n // Iterate over the logical lines that make up this visual line.\r\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\r\n var line = i ? lineView.rest[i - 1] : lineView.line, order;\r\n builder.pos = 0;\r\n builder.addToken = buildToken;\r\n // Optionally wire in some hacks into the token-rendering\r\n // algorithm, to deal with browser quirks.\r\n if ((ie || webkit) && cm.getOption(\"lineWrapping\"))\r\n builder.addToken = buildTokenSplitSpaces(builder.addToken);\r\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\r\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\r\n builder.map = [];\r\n insertLineContent(line, builder, getLineStyles(cm, line));\r\n if (line.styleClasses) {\r\n if (line.styleClasses.bgClass)\r\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\r\n if (line.styleClasses.textClass)\r\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\r\n }\r\n\r\n // Ensure at least a single node is present, for measuring.\r\n if (builder.map.length == 0)\r\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\r\n\r\n // Store the map and a cache object for the current logical line\r\n if (i == 0) {\r\n lineView.measure.map = builder.map;\r\n lineView.measure.cache = {};\r\n } else {\r\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\r\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\r\n }\r\n }\r\n\r\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\r\n if (builder.pre.className)\r\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\r\n return builder;\r\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: elt(\"pre\", [content]), content: content, col: 0, pos: 0, cm: cm};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order;\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if ((ie || webkit) && cm.getOption(\"lineWrapping\"))\n builder.addToken = buildTokenSplitSpaces(builder.addToken);\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\n builder.map = [];\n insertLineContent(line, builder, getLineStyles(cm, line));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n if (line.styleClasses.textClass)\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n return builder;\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: elt(\"pre\", [content]), content: content, col: 0, pos: 0, cm: cm};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order;\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if ((ie || webkit) && cm.getOption(\"lineWrapping\"))\n builder.addToken = buildTokenSplitSpaces(builder.addToken);\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\n builder.map = [];\n insertLineContent(line, builder, getLineStyles(cm, line));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n if (line.styleClasses.textClass)\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n return builder;\n }", "function buildLineContent(cm, lineView) {\n\t\t // The padding-right forces the element to have a 'border', which\n\t\t // is needed on Webkit to be able to get line-level bounding\n\t\t // rectangles for it (in measureChar).\n\t\t var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n\t\t var builder = {pre: elt(\"pre\", [content], \"CodeMirror-line\"), content: content,\n\t\t col: 0, pos: 0, cm: cm,\n\t\t trailingSpace: false,\n\t\t splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n\t\t lineView.measure = {};\n\t\t\n\t\t // Iterate over the logical lines that make up this visual line.\n\t\t for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n\t\t var line = i ? lineView.rest[i - 1] : lineView.line, order;\n\t\t builder.pos = 0;\n\t\t builder.addToken = buildToken;\n\t\t // Optionally wire in some hacks into the token-rendering\n\t\t // algorithm, to deal with browser quirks.\n\t\t if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n\t\t builder.addToken = buildTokenBadBidi(builder.addToken, order);\n\t\t builder.map = [];\n\t\t var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n\t\t insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n\t\t if (line.styleClasses) {\n\t\t if (line.styleClasses.bgClass)\n\t\t builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n\t\t if (line.styleClasses.textClass)\n\t\t builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n\t\t }\n\t\t\n\t\t // Ensure at least a single node is present, for measuring.\n\t\t if (builder.map.length == 0)\n\t\t builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\t\t\n\t\t // Store the map and a cache object for the current logical line\n\t\t if (i == 0) {\n\t\t lineView.measure.map = builder.map;\n\t\t lineView.measure.cache = {};\n\t\t } else {\n\t\t (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n\t\t (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n\t\t }\n\t\t }\n\t\t\n\t\t // See issue #2901\n\t\t if (webkit) {\n\t\t var last = builder.content.lastChild\n\t\t if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n\t\t builder.content.className = \"cm-tab-wrap-hack\";\n\t\t }\n\t\t\n\t\t signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n\t\t if (builder.pre.className)\n\t\t builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\t\t\n\t\t return builder;\n\t\t }", "function buildLineContent(cm, lineView) {\n\t\t // The padding-right forces the element to have a 'border', which\n\t\t // is needed on Webkit to be able to get line-level bounding\n\t\t // rectangles for it (in measureChar).\n\t\t var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n\t\t var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n\t\t col: 0, pos: 0, cm: cm,\n\t\t trailingSpace: false,\n\t\t splitSpaces: cm.getOption(\"lineWrapping\")};\n\t\t lineView.measure = {};\n\n\t\t // Iterate over the logical lines that make up this visual line.\n\t\t for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n\t\t var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n\t\t builder.pos = 0;\n\t\t builder.addToken = buildToken;\n\t\t // Optionally wire in some hacks into the token-rendering\n\t\t // algorithm, to deal with browser quirks.\n\t\t if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n\t\t { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n\t\t builder.map = [];\n\t\t var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n\t\t insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n\t\t if (line.styleClasses) {\n\t\t if (line.styleClasses.bgClass)\n\t\t { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n\t\t if (line.styleClasses.textClass)\n\t\t { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n\t\t }\n\n\t\t // Ensure at least a single node is present, for measuring.\n\t\t if (builder.map.length == 0)\n\t\t { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n\t\t // Store the map and a cache object for the current logical line\n\t\t if (i == 0) {\n\t\t lineView.measure.map = builder.map;\n\t\t lineView.measure.cache = {};\n\t\t } else {\n\t\t (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n\t\t ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n\t\t }\n\t\t }\n\n\t\t // See issue #2901\n\t\t if (webkit) {\n\t\t var last = builder.content.lastChild;\n\t\t if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n\t\t { builder.content.className = \"cm-tab-wrap-hack\"; }\n\t\t }\n\n\t\t signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n\t\t if (builder.pre.className)\n\t\t { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n\t\t return builder\n\t\t }", "function buildLineContent(cm, lineView) {\n\t // The padding-right forces the element to have a 'border', which\n\t // is needed on Webkit to be able to get line-level bounding\n\t // rectangles for it (in measureChar).\n\t var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n\t var builder = {pre: elt(\"pre\", [content], \"CodeMirror-line\"), content: content,\n\t col: 0, pos: 0, cm: cm,\n\t trailingSpace: false,\n\t splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n\t lineView.measure = {};\n\n\t // Iterate over the logical lines that make up this visual line.\n\t for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n\t var line = i ? lineView.rest[i - 1] : lineView.line, order;\n\t builder.pos = 0;\n\t builder.addToken = buildToken;\n\t // Optionally wire in some hacks into the token-rendering\n\t // algorithm, to deal with browser quirks.\n\t if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n\t builder.addToken = buildTokenBadBidi(builder.addToken, order);\n\t builder.map = [];\n\t var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n\t insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n\t if (line.styleClasses) {\n\t if (line.styleClasses.bgClass)\n\t builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n\t if (line.styleClasses.textClass)\n\t builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n\t }\n\n\t // Ensure at least a single node is present, for measuring.\n\t if (builder.map.length == 0)\n\t builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n\t // Store the map and a cache object for the current logical line\n\t if (i == 0) {\n\t lineView.measure.map = builder.map;\n\t lineView.measure.cache = {};\n\t } else {\n\t (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n\t (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n\t }\n\t }\n\n\t // See issue #2901\n\t if (webkit) {\n\t var last = builder.content.lastChild\n\t if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n\t builder.content.className = \"cm-tab-wrap-hack\";\n\t }\n\n\t signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n\t if (builder.pre.className)\n\t builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\n\t return builder;\n\t }", "function buildLineContent(cm, lineView) {\n\t // The padding-right forces the element to have a 'border', which\n\t // is needed on Webkit to be able to get line-level bounding\n\t // rectangles for it (in measureChar).\n\t var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n\t var builder = {pre: elt(\"pre\", [content], \"CodeMirror-line\"), content: content,\n\t col: 0, pos: 0, cm: cm,\n\t splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n\t lineView.measure = {};\n\n\t // Iterate over the logical lines that make up this visual line.\n\t for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n\t var line = i ? lineView.rest[i - 1] : lineView.line, order;\n\t builder.pos = 0;\n\t builder.addToken = buildToken;\n\t // Optionally wire in some hacks into the token-rendering\n\t // algorithm, to deal with browser quirks.\n\t if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n\t builder.addToken = buildTokenBadBidi(builder.addToken, order);\n\t builder.map = [];\n\t var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n\t insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n\t if (line.styleClasses) {\n\t if (line.styleClasses.bgClass)\n\t builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n\t if (line.styleClasses.textClass)\n\t builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n\t }\n\n\t // Ensure at least a single node is present, for measuring.\n\t if (builder.map.length == 0)\n\t builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n\t // Store the map and a cache object for the current logical line\n\t if (i == 0) {\n\t lineView.measure.map = builder.map;\n\t lineView.measure.cache = {};\n\t } else {\n\t (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n\t (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n\t }\n\t }\n\n\t // See issue #2901\n\t if (webkit && /\\bcm-tab\\b/.test(builder.content.lastChild.className))\n\t builder.content.className = \"cm-tab-wrap-hack\";\n\n\t signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n\t if (builder.pre.className)\n\t builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\n\t return builder;\n\t }", "function buildLineContent(cm, lineView) {\n\t // The padding-right forces the element to have a 'border', which\n\t // is needed on Webkit to be able to get line-level bounding\n\t // rectangles for it (in measureChar).\n\t var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n\t var builder = {pre: elt(\"pre\", [content], \"CodeMirror-line\"), content: content,\n\t col: 0, pos: 0, cm: cm,\n\t splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n\t lineView.measure = {};\n\t\n\t // Iterate over the logical lines that make up this visual line.\n\t for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n\t var line = i ? lineView.rest[i - 1] : lineView.line, order;\n\t builder.pos = 0;\n\t builder.addToken = buildToken;\n\t // Optionally wire in some hacks into the token-rendering\n\t // algorithm, to deal with browser quirks.\n\t if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n\t builder.addToken = buildTokenBadBidi(builder.addToken, order);\n\t builder.map = [];\n\t var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n\t insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n\t if (line.styleClasses) {\n\t if (line.styleClasses.bgClass)\n\t builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n\t if (line.styleClasses.textClass)\n\t builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n\t }\n\t\n\t // Ensure at least a single node is present, for measuring.\n\t if (builder.map.length == 0)\n\t builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\t\n\t // Store the map and a cache object for the current logical line\n\t if (i == 0) {\n\t lineView.measure.map = builder.map;\n\t lineView.measure.cache = {};\n\t } else {\n\t (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n\t (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n\t }\n\t }\n\t\n\t // See issue #2901\n\t if (webkit && /\\bcm-tab\\b/.test(builder.content.lastChild.className))\n\t builder.content.className = \"cm-tab-wrap-hack\";\n\t\n\t signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n\t if (builder.pre.className)\n\t builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\t\n\t return builder;\n\t }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null)\n var builder = {pre: elt(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")}\n // hide from accessibility tree\n content.setAttribute(\"role\", \"presentation\")\n builder.pre.setAttribute(\"role\", \"presentation\")\n lineView.measure = {}\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0)\n builder.pos = 0\n builder.addToken = buildToken\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order) }\n builder.map = []\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line)\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate))\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\") }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\") }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))) }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map\n lineView.measure.cache = {}\n } else {\n ;(lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({})\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\" }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre)\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\") }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {\n pre: eltP(\"pre\", [content], \"CodeMirror-line\"),\n content: content,\n col: 0,\n pos: 0,\n cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")\n };\n lineView.measure = {}; // Iterate over the logical lines that make up this visual line.\n\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line,\n order = void 0;\n builder.pos = 0;\n builder.addToken = buildToken; // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction))) {\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\n }\n\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n\n if (line.styleClasses) {\n if (line.styleClasses.bgClass) {\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n }\n\n if (line.styleClasses.textClass) {\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n }\n } // Ensure at least a single node is present, for measuring.\n\n\n if (builder.map.length == 0) {\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n } // Store the map and a cache object for the current logical line\n\n\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n } // See issue #2901\n\n\n if (webkit) {\n var last = builder.content.lastChild;\n\n if (/\\bcm-tab\\b/.test(last.className) || last.querySelector && last.querySelector(\".cm-tab\")) {\n builder.content.className = \"cm-tab-wrap-hack\";\n }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n\n if (builder.pre.className) {\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n }\n\n return builder;\n }", "function createLine() {\n\t\tlet element = document.createElement('span')\n\t\telement.className = 'line'\n\t\treturn element\n\t}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: elt(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order;\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n if (line.styleClasses.textClass)\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit && /\\bcm-tab\\b/.test(builder.content.lastChild.className))\n builder.content.className = \"cm-tab-wrap-hack\";\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\n return builder;\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: elt(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order;\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n if (line.styleClasses.textClass)\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n builder.content.className = \"cm-tab-wrap-hack\";\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\n return builder;\n }", "function createLine(previousLine){\n let element = document.createElement(\"div\");\n element.setAttribute(\"class\", \"line\");\n element.setAttribute(\"id\", lineCounter);\n element.setAttribute(\"contenteditable\", \"true\");\n\n if(document.getElementById(\"starter\").nextElementSibling == null){ /* root level */\n document.getElementById(\"mainTextArea\").appendChild(element);\n element.focus();\n }else if(previousLine.parentElement.classList.contains(\"header\") || previousLine.parentElement.classList.contains(\"headerMargin\")){\n while(previousLine.parentElement.classList.contains(\"root\") != true){\n previousLine = previousLine.parentElement;\n }\n element.classList.add(\"headerMargin\");\n document.getElementById(previousLine.parentElement.id).appendChild(element);\n element.focus();\n }else{\n document.getElementById(\"mainTextArea\").appendChild(element);\n element.focus();\n }\n setLineType(\"paragraph\");\n countersOperations(\"line\",\"add\");\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null)\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")}\n lineView.measure = {}\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0)\n builder.pos = 0\n builder.addToken = buildToken\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order) }\n builder.map = []\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line)\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate))\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\") }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\") }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))) }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map\n lineView.measure.cache = {}\n } else {\n ;(lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({})\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\" }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre)\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\") }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\r\n // The padding-right forces the element to have a 'border', which\r\n // is needed on Webkit to be able to get line-level bounding\r\n // rectangles for it (in measureChar).\r\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\r\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\r\n col: 0, pos: 0, cm: cm,\r\n trailingSpace: false,\r\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\r\n lineView.measure = {};\r\n\r\n // Iterate over the logical lines that make up this visual line.\r\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\r\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\r\n builder.pos = 0;\r\n builder.addToken = buildToken;\r\n // Optionally wire in some hacks into the token-rendering\r\n // algorithm, to deal with browser quirks.\r\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\r\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\r\n builder.map = [];\r\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\r\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\r\n if (line.styleClasses) {\r\n if (line.styleClasses.bgClass)\r\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\r\n if (line.styleClasses.textClass)\r\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\r\n }\r\n\r\n // Ensure at least a single node is present, for measuring.\r\n if (builder.map.length == 0)\r\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\r\n\r\n // Store the map and a cache object for the current logical line\r\n if (i == 0) {\r\n lineView.measure.map = builder.map;\r\n lineView.measure.cache = {};\r\n } else {\r\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\r\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\r\n }\r\n }\r\n\r\n // See issue #2901\r\n if (webkit) {\r\n var last = builder.content.lastChild;\r\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\r\n { builder.content.className = \"cm-tab-wrap-hack\"; }\r\n }\r\n\r\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\r\n if (builder.pre.className)\r\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\r\n\r\n return builder\r\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function ensureLineWrapped(lineView) {\r\n if (lineView.node == lineView.text) {\r\n lineView.node = elt(\"div\", null, null, \"position: relative\");\r\n if (lineView.text.parentNode)\r\n lineView.text.parentNode.replaceChild(lineView.node, lineView.text);\r\n lineView.node.appendChild(lineView.text);\r\n if (ie && ie_version < 8) lineView.node.style.zIndex = 2;\r\n }\r\n return lineView.node;\r\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}", "function ensureLineWrapped(lineView) {\n if (lineView.node == lineView.text) {\n lineView.node = elt(\"div\", null, null, \"position: relative\");\n if (lineView.text.parentNode)\n lineView.text.parentNode.replaceChild(lineView.node, lineView.text);\n lineView.node.appendChild(lineView.text);\n if (ie && ie_version < 8) lineView.node.style.zIndex = 2;\n }\n return lineView.node;\n }", "function ensureLineWrapped(lineView) {\n if (lineView.node == lineView.text) {\n lineView.node = elt(\"div\", null, null, \"position: relative\");\n if (lineView.text.parentNode)\n lineView.text.parentNode.replaceChild(lineView.node, lineView.text);\n lineView.node.appendChild(lineView.text);\n if (ie && ie_version < 8) lineView.node.style.zIndex = 2;\n }\n return lineView.node;\n }", "function ensureLineWrapped(lineView) {\n if (lineView.node == lineView.text) {\n lineView.node = elt(\"div\", null, null, \"position: relative\");\n if (lineView.text.parentNode)\n lineView.text.parentNode.replaceChild(lineView.node, lineView.text);\n lineView.node.appendChild(lineView.text);\n if (ie && ie_version < 8) lineView.node.style.zIndex = 2;\n }\n return lineView.node;\n }", "function ensureLineWrapped(lineView) {\n if (lineView.node == lineView.text) {\n lineView.node = elt(\"div\", null, null, \"position: relative\");\n if (lineView.text.parentNode)\n lineView.text.parentNode.replaceChild(lineView.node, lineView.text);\n lineView.node.appendChild(lineView.text);\n if (ie && ie_version < 8) lineView.node.style.zIndex = 2;\n }\n return lineView.node;\n }", "function ensureLineWrapped(lineView) {\n if (lineView.node == lineView.text) {\n lineView.node = elt(\"div\", null, null, \"position: relative\");\n if (lineView.text.parentNode)\n lineView.text.parentNode.replaceChild(lineView.node, lineView.text);\n lineView.node.appendChild(lineView.text);\n if (ie && ie_version < 8) lineView.node.style.zIndex = 2;\n }\n return lineView.node;\n }", "function ensureLineWrapped(lineView) {\n if (lineView.node == lineView.text) {\n lineView.node = elt(\"div\", null, null, \"position: relative\");\n if (lineView.text.parentNode)\n lineView.text.parentNode.replaceChild(lineView.node, lineView.text);\n lineView.node.appendChild(lineView.text);\n if (ie && ie_version < 8) lineView.node.style.zIndex = 2;\n }\n return lineView.node;\n }", "function ensureLineWrapped(lineView) {\n if (lineView.node == lineView.text) {\n lineView.node = elt(\"div\", null, null, \"position: relative\");\n if (lineView.text.parentNode)\n lineView.text.parentNode.replaceChild(lineView.node, lineView.text);\n lineView.node.appendChild(lineView.text);\n if (ie && ie_version < 8) lineView.node.style.zIndex = 2;\n }\n return lineView.node;\n }", "function ensureLineWrapped(lineView) {\n if (lineView.node == lineView.text) {\n lineView.node = elt(\"div\", null, null, \"position: relative\");\n if (lineView.text.parentNode)\n lineView.text.parentNode.replaceChild(lineView.node, lineView.text);\n lineView.node.appendChild(lineView.text);\n if (ie && ie_version < 8) lineView.node.style.zIndex = 2;\n }\n return lineView.node;\n }" ]
[ "0.7639888", "0.75955623", "0.75483197", "0.7539128", "0.7539128", "0.7481602", "0.7481602", "0.7476351", "0.7471293", "0.7471293", "0.7471293", "0.7471293", "0.7471293", "0.7471293", "0.74629945", "0.7421916", "0.7421916", "0.7421916", "0.7421916", "0.7421916", "0.7421916", "0.7421916", "0.7421916", "0.7421916", "0.7421916", "0.7421916", "0.7401656", "0.73684686", "0.6966129", "0.6966129", "0.6966129", "0.6954015", "0.6931178", "0.6931178", "0.68820095", "0.68760824", "0.68286073", "0.6826917", "0.67963284", "0.67829174", "0.6716573", "0.66948766", "0.66524017", "0.66512316", "0.6641126", "0.66210943", "0.66163516", "0.66163516", "0.66163516", "0.66163516", "0.66163516", "0.66163516", "0.66163516", "0.66163516", "0.66163516", "0.66163516", "0.66163516", "0.66163516", "0.66163516", "0.66163516", "0.66163516", "0.66163516", "0.66163516", "0.6595643", "0.6540835", "0.6540835", "0.6540835", "0.6540835", "0.6540835", "0.6540835", "0.6540835", "0.6540835", "0.6540835", "0.653947", "0.65367514", "0.65367514", "0.6526483", "0.6526483", "0.6526483", "0.6526483", "0.6526483", "0.6526483", "0.6526483", "0.6526483" ]
0.7545719
14
A lineView may contain multiple logical lines (when merged by collapsed spans). The widgets for all of them need to be drawn.
function insertLineWidgets(cm, lineView, dims) { insertLineWidgetsFor(cm, lineView.line, lineView, dims, true); if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++) { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function insertLineWidgets(lineView, dims) {\n insertLineWidgetsFor(lineView.line, lineView, dims, true);\n if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\n insertLineWidgetsFor(lineView.rest[i], lineView, dims, false);\n }", "function insertLineWidgets(lineView, dims) {\n insertLineWidgetsFor(lineView.line, lineView, dims, true);\n if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\n insertLineWidgetsFor(lineView.rest[i], lineView, dims, false);\n }", "function insertLineWidgets(lineView, dims) {\n insertLineWidgetsFor(lineView.line, lineView, dims, true);\n if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\n insertLineWidgetsFor(lineView.rest[i], lineView, dims, false);\n }", "function insertLineWidgets(lineView, dims) {\n insertLineWidgetsFor(lineView.line, lineView, dims, true);\n if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\n insertLineWidgetsFor(lineView.rest[i], lineView, dims, false);\n }", "function insertLineWidgets(lineView, dims) {\n insertLineWidgetsFor(lineView.line, lineView, dims, true);\n if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\n insertLineWidgetsFor(lineView.rest[i], lineView, dims, false);\n }", "function insertLineWidgets(lineView, dims) {\n insertLineWidgetsFor(lineView.line, lineView, dims, true);\n if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\n insertLineWidgetsFor(lineView.rest[i], lineView, dims, false);\n }", "function insertLineWidgets(lineView, dims) {\r\n insertLineWidgetsFor(lineView.line, lineView, dims, true);\r\n if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\r\n insertLineWidgetsFor(lineView.rest[i], lineView, dims, false);\r\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line; // Continuing lines, if any\n\n this.rest = visualLineContinued(line); // Number of logical lines in this visual line\n\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n } // Create a range of LineView objects for the given lines.", "function insertLineWidgets(cm, lineView, dims) {\n\t\t insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n\t\t if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n\t\t { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }\n\t\t }", "function insertLineWidgets(cm, lineView, dims) {\n\t\t insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n\t\t if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\n\t\t insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false);\n\t\t }", "function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\n insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false);\n }", "function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\n insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false);\n }", "function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true)\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false) } }\n}", "function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true)\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false) } }\n}", "function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n\n if (lineView.rest) {\n for (var i = 0; i < lineView.rest.length; i++) {\n insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false);\n }\n }\n }", "function insertLineWidgets(cm, lineView, dims) {\r\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\r\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\r\n { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }\r\n}", "function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }\n}", "function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }\n}", "function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }\n}", "function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }\n}", "function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }\n}", "function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }\n}", "function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }\n}", "function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }\n}", "function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }\n}", "function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }\n}", "function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }\n}", "function insertLineWidgets(cm, lineView, dims) {\n\t insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n\t if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\n\t insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false);\n\t }", "function insertLineWidgets(cm, lineView, dims) {\n\t insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n\t if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\n\t insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false);\n\t }", "function insertLineWidgets(cm, lineView, dims) {\n\t insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n\t if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\n\t insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false);\n\t }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line\n // Continuing lines, if any\n this.rest = visualLineContinued(line)\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1\n this.node = this.text = null\n this.hidden = lineIsHidden(doc, line)\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line\n // Continuing lines, if any\n this.rest = visualLineContinued(line)\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1\n this.node = this.text = null\n this.hidden = lineIsHidden(doc, line)\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\r\n // The starting line\r\n this.line = line;\r\n // Continuing lines, if any\r\n this.rest = visualLineContinued(line);\r\n // Number of logical lines in this visual line\r\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\r\n this.node = this.text = null;\r\n this.hidden = lineIsHidden(doc, line);\r\n }", "function LineView(doc, line, lineN) {\r\n // The starting line\r\n this.line = line;\r\n // Continuing lines, if any\r\n this.rest = visualLineContinued(line);\r\n // Number of logical lines in this visual line\r\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\r\n this.node = this.text = null;\r\n this.hidden = lineIsHidden(doc, line);\r\n}", "function LineView(doc, line, lineN) {\n\t // The starting line\n\t this.line = line;\n\t // Continuing lines, if any\n\t this.rest = visualLineContinued(line);\n\t // Number of logical lines in this visual line\n\t this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n\t this.node = this.text = null;\n\t this.hidden = lineIsHidden(doc, line);\n\t }", "function LineView(doc, line, lineN) {\n\t // The starting line\n\t this.line = line;\n\t // Continuing lines, if any\n\t this.rest = visualLineContinued(line);\n\t // Number of logical lines in this visual line\n\t this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n\t this.node = this.text = null;\n\t this.hidden = lineIsHidden(doc, line);\n\t }", "function LineView(doc, line, lineN) {\n\t // The starting line\n\t this.line = line;\n\t // Continuing lines, if any\n\t this.rest = visualLineContinued(line);\n\t // Number of logical lines in this visual line\n\t this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n\t this.node = this.text = null;\n\t this.hidden = lineIsHidden(doc, line);\n\t }", "function LineView(doc, line, lineN) {\n\t\t // The starting line\n\t\t this.line = line;\n\t\t // Continuing lines, if any\n\t\t this.rest = visualLineContinued(line);\n\t\t // Number of logical lines in this visual line\n\t\t this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n\t\t this.node = this.text = null;\n\t\t this.hidden = lineIsHidden(doc, line);\n\t\t }", "function LineView(doc, line, lineN) {\n\t\t // The starting line\n\t\t this.line = line;\n\t\t // Continuing lines, if any\n\t\t this.rest = visualLineContinued(line);\n\t\t // Number of logical lines in this visual line\n\t\t this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n\t\t this.node = this.text = null;\n\t\t this.hidden = lineIsHidden(doc, line);\n\t\t }", "function applyLines(){\t\t\t\n\t\t\tscope.clearLines();\n\t\t\t_.chain(controller.lines).each(function(line){\n\t\t\t\t_.chain(line.columns).each(function(column, columnIdx){\t\t\t\t\n\t\t\t\t\tvar $cell = $findCell(line.row, column);\n\t\t\t\t\tscope.addCellState($cell, line, columnIdx);\n\t\t\t\t\tcontroller.onLineCellDrawn(controller, $cell, line, columnIdx);\n\t\t\t\t});\n\t\t\t\tcontroller.onLineDrawn(controller, line);\n\t\t\t});\n\t\t}", "function buildLineContent(cm, lineView) {\n\t\t // The padding-right forces the element to have a 'border', which\n\t\t // is needed on Webkit to be able to get line-level bounding\n\t\t // rectangles for it (in measureChar).\n\t\t var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n\t\t var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n\t\t col: 0, pos: 0, cm: cm,\n\t\t trailingSpace: false,\n\t\t splitSpaces: cm.getOption(\"lineWrapping\")};\n\t\t lineView.measure = {};\n\n\t\t // Iterate over the logical lines that make up this visual line.\n\t\t for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n\t\t var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n\t\t builder.pos = 0;\n\t\t builder.addToken = buildToken;\n\t\t // Optionally wire in some hacks into the token-rendering\n\t\t // algorithm, to deal with browser quirks.\n\t\t if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n\t\t { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n\t\t builder.map = [];\n\t\t var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n\t\t insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n\t\t if (line.styleClasses) {\n\t\t if (line.styleClasses.bgClass)\n\t\t { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n\t\t if (line.styleClasses.textClass)\n\t\t { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n\t\t }\n\n\t\t // Ensure at least a single node is present, for measuring.\n\t\t if (builder.map.length == 0)\n\t\t { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n\t\t // Store the map and a cache object for the current logical line\n\t\t if (i == 0) {\n\t\t lineView.measure.map = builder.map;\n\t\t lineView.measure.cache = {};\n\t\t } else {\n\t\t (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n\t\t ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n\t\t }\n\t\t }\n\n\t\t // See issue #2901\n\t\t if (webkit) {\n\t\t var last = builder.content.lastChild;\n\t\t if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n\t\t { builder.content.className = \"cm-tab-wrap-hack\"; }\n\t\t }\n\n\t\t signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n\t\t if (builder.pre.className)\n\t\t { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n\t\t return builder\n\t\t }", "function buildLineContent(cm, lineView) {\r\n // The padding-right forces the element to have a 'border', which\r\n // is needed on Webkit to be able to get line-level bounding\r\n // rectangles for it (in measureChar).\r\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\r\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\r\n col: 0, pos: 0, cm: cm,\r\n trailingSpace: false,\r\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\r\n lineView.measure = {};\r\n\r\n // Iterate over the logical lines that make up this visual line.\r\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\r\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\r\n builder.pos = 0;\r\n builder.addToken = buildToken;\r\n // Optionally wire in some hacks into the token-rendering\r\n // algorithm, to deal with browser quirks.\r\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\r\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\r\n builder.map = [];\r\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\r\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\r\n if (line.styleClasses) {\r\n if (line.styleClasses.bgClass)\r\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\r\n if (line.styleClasses.textClass)\r\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\r\n }\r\n\r\n // Ensure at least a single node is present, for measuring.\r\n if (builder.map.length == 0)\r\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\r\n\r\n // Store the map and a cache object for the current logical line\r\n if (i == 0) {\r\n lineView.measure.map = builder.map;\r\n lineView.measure.cache = {};\r\n } else {\r\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\r\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\r\n }\r\n }\r\n\r\n // See issue #2901\r\n if (webkit) {\r\n var last = builder.content.lastChild;\r\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\r\n { builder.content.className = \"cm-tab-wrap-hack\"; }\r\n }\r\n\r\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\r\n if (builder.pre.className)\r\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\r\n\r\n return builder\r\n}", "function buildLineContent(cm, lineView) {\n\t // The padding-right forces the element to have a 'border', which\n\t // is needed on Webkit to be able to get line-level bounding\n\t // rectangles for it (in measureChar).\n\t var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n\t var builder = {pre: elt(\"pre\", [content], \"CodeMirror-line\"), content: content,\n\t col: 0, pos: 0, cm: cm,\n\t splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n\t lineView.measure = {};\n\n\t // Iterate over the logical lines that make up this visual line.\n\t for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n\t var line = i ? lineView.rest[i - 1] : lineView.line, order;\n\t builder.pos = 0;\n\t builder.addToken = buildToken;\n\t // Optionally wire in some hacks into the token-rendering\n\t // algorithm, to deal with browser quirks.\n\t if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n\t builder.addToken = buildTokenBadBidi(builder.addToken, order);\n\t builder.map = [];\n\t var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n\t insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n\t if (line.styleClasses) {\n\t if (line.styleClasses.bgClass)\n\t builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n\t if (line.styleClasses.textClass)\n\t builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n\t }\n\n\t // Ensure at least a single node is present, for measuring.\n\t if (builder.map.length == 0)\n\t builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n\t // Store the map and a cache object for the current logical line\n\t if (i == 0) {\n\t lineView.measure.map = builder.map;\n\t lineView.measure.cache = {};\n\t } else {\n\t (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n\t (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n\t }\n\t }\n\n\t // See issue #2901\n\t if (webkit && /\\bcm-tab\\b/.test(builder.content.lastChild.className))\n\t builder.content.className = \"cm-tab-wrap-hack\";\n\n\t signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n\t if (builder.pre.className)\n\t builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\n\t return builder;\n\t }", "function buildLineContent(cm, lineView) {\n\t\t // The padding-right forces the element to have a 'border', which\n\t\t // is needed on Webkit to be able to get line-level bounding\n\t\t // rectangles for it (in measureChar).\n\t\t var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n\t\t var builder = {pre: elt(\"pre\", [content], \"CodeMirror-line\"), content: content,\n\t\t col: 0, pos: 0, cm: cm,\n\t\t trailingSpace: false,\n\t\t splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n\t\t lineView.measure = {};\n\t\t\n\t\t // Iterate over the logical lines that make up this visual line.\n\t\t for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n\t\t var line = i ? lineView.rest[i - 1] : lineView.line, order;\n\t\t builder.pos = 0;\n\t\t builder.addToken = buildToken;\n\t\t // Optionally wire in some hacks into the token-rendering\n\t\t // algorithm, to deal with browser quirks.\n\t\t if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n\t\t builder.addToken = buildTokenBadBidi(builder.addToken, order);\n\t\t builder.map = [];\n\t\t var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n\t\t insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n\t\t if (line.styleClasses) {\n\t\t if (line.styleClasses.bgClass)\n\t\t builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n\t\t if (line.styleClasses.textClass)\n\t\t builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n\t\t }\n\t\t\n\t\t // Ensure at least a single node is present, for measuring.\n\t\t if (builder.map.length == 0)\n\t\t builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\t\t\n\t\t // Store the map and a cache object for the current logical line\n\t\t if (i == 0) {\n\t\t lineView.measure.map = builder.map;\n\t\t lineView.measure.cache = {};\n\t\t } else {\n\t\t (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n\t\t (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n\t\t }\n\t\t }\n\t\t\n\t\t // See issue #2901\n\t\t if (webkit) {\n\t\t var last = builder.content.lastChild\n\t\t if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n\t\t builder.content.className = \"cm-tab-wrap-hack\";\n\t\t }\n\t\t\n\t\t signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n\t\t if (builder.pre.className)\n\t\t builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\t\t\n\t\t return builder;\n\t\t }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }", "function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }" ]
[ "0.7027548", "0.7027548", "0.7027548", "0.7027548", "0.7027548", "0.7027548", "0.70150566", "0.69329065", "0.6855795", "0.68497884", "0.6844549", "0.6844549", "0.68330497", "0.68330497", "0.68291104", "0.68127936", "0.67902917", "0.67902917", "0.67902917", "0.67902917", "0.67902917", "0.67902917", "0.67902917", "0.67902917", "0.67902917", "0.67902917", "0.67902917", "0.67548835", "0.67548835", "0.67548835", "0.66764593", "0.66764593", "0.6656842", "0.6656842", "0.6656842", "0.6656842", "0.6656842", "0.6656842", "0.6656842", "0.6656842", "0.6656842", "0.6656842", "0.6656842", "0.6656842", "0.6656842", "0.6656842", "0.6656842", "0.6656842", "0.6656842", "0.6656842", "0.6656842", "0.6656842", "0.6656842", "0.6656842", "0.6656842", "0.6656842", "0.6656842", "0.6647399", "0.6647399", "0.6647399", "0.6647399", "0.6647399", "0.6647399", "0.6647399", "0.6647399", "0.6647399", "0.6647399", "0.6647399", "0.6635592", "0.6626817", "0.6574152", "0.6574152", "0.6574152", "0.65713733", "0.65713733", "0.64343816", "0.6246301", "0.6201017", "0.6135652", "0.61302215", "0.61225426", "0.61225426", "0.61225426", "0.61225426" ]
0.68482625
24
Return true when the given mouse event happened in a widget
function eventInWidget(display, e) { for (var n = e_target(e); n != display.wrapper; n = n.parentNode) { if (!n || (n.nodeType == 1 && n.getAttribute("cm-ignore-events") == "true") || (n.parentNode == display.sizer && n != display.mover)) { return true } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mouseClicked() {\n // If it has been clicked return true\n return true;\n }", "mouseClicked(){\n //If we are highlighted and we clicked, return true\n if(this.highlighted){\n return true\n }\n //Else return false\n return false;\n }", "hovered(){\n //if mouse is over butotn\n if (mouse.x > this.x1 && mouse.x < this.x2 && mouse.y > this.y1 && mouse.y < this.y2){\n //return that button is being hovered over\n return true;\n }\n }", "function isClicked(rect) {\n if (!rect) return false;\n if (preventInput.left) {\n console.log(\"preventinput\");\n return false;\n }\n\n var clicked = mousePressed.left && isMouseOver(rect);\n if (clicked) {\n // make sure we don't process 2 clicks in 2 subsequent frames if the button is held down\n mousePressed.left = false;\n }\n return clicked;\n}", "function isInside() {\n //mouseX, mouseY\n\n\n\n return bool\n}", "clicked(mouseX, mouseY) {\n if (dist(this.pos.x, this.pos.y, mouseX, mouseY) <= this.r / 2) {\n return true;\n } else {\n return false;\n }\n }", "function handleMouseDown(xpos, ypos, state, evnt, widgets) {\n\tfor(var i = 0; i < widgets.length; i++) {\n\t\tvar widg = widgets[i];\n\t\tif(xpos > widg.x - widg.width/2 && xpos < widg.x + widg.width/2 && ypos > widg.y - widg.height/2 && ypos < widg.y + widg.height/2) {\n\t\t\tisWidgetLocked = true;\n\t\t\tlockedWidget = widg;\n\t\t\tstate = widg.listener.mouseDown(xpos, ypos, state, evnt);\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn state;\n}", "mouseMoved(e){\n //Construct a very small rectangle on the mouse position\n var mouseRect = {x: e.clientX - 5, y: e.clientY - 5, width: 2, height: 2};\n\n //Check if the mouse rect collides with our button rectangle\n //And assign the bool that returns from the function\n this.highlighted = this.collides(this.rect, mouseRect);\n }", "function OnMouseOver(buttonRect : Rect):boolean{\n\tif(buttonRect.Contains(Event.current.mousePosition)){\n\t\treturn true;\n\t}else{\n\t\treturn false;\n\t}\t\t\n}", "mouseDown(x, y, _isLeftButton) {}", "function eventInWidget(display, e) {\n for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\n if (!n || n.ignoreEvents || n.parentNode == display.sizer && n != display.mover) return true;\n }\n }", "function eventInWidget(display, e) {\n for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\n if (!n || n.ignoreEvents || n.parentNode == display.sizer && n != display.mover) return true;\n }\n }", "function eventInWidget(display, e) {\n for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\n if (!n || n.ignoreEvents || n.parentNode == display.sizer && n != display.mover) return true;\n }\n }", "function eventInWidget(display, e) {\n for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\n if (!n || n.ignoreEvents || n.parentNode == display.sizer && n != display.mover) return true;\n }\n }", "_isClickInSelection(event) {\n const coords = this._getMouseBufferCoords(event);\n const start = this._model.finalSelectionStart;\n const end = this._model.finalSelectionEnd;\n if (!start || !end || !coords) {\n return false;\n }\n return this._areCoordsInSelection(coords, start, end);\n }", "uiEvtMouseMovePerformed(x, y) {\r\n if(this.m_common.m_isDrawColorPicker){\r\n return this.m_common.m_colorPicker.uiEvtMouseMovePerformed(x, y);\r\n }\r\n for (let i = 0; i < this.m_slider.length; ++i){\r\n if(this.m_slider[i] !== null){\r\n if(this.m_slider[i].uiEvtMouseMovePerformed(x, y)){\r\n return true;\r\n }\r\n }\r\n if(this.m_colorLabel[i] !== null){\r\n if(this.m_btnModColor[i].uiEvtMouseMovePerformed(x, y)){\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n }", "function eventInWidget(display, e) {\r\n for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\r\n if (!n || n.ignoreEvents || n.parentNode == display.sizer && n != display.mover) return true;\r\n }\r\n }", "function eventInWidget(display, e) {\n\t\t for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\n\t\t if (!n || (n.nodeType == 1 && n.getAttribute(\"cm-ignore-events\") == \"true\") ||\n\t\t (n.parentNode == display.sizer && n != display.mover))\n\t\t { return true }\n\t\t }\n\t\t }", "clickedOn(xPos, yPos) {\n return(xPos > this.x && xPos < this.x + this.w && yPos > this.y && yPos < this.y +this.w);\n }", "checkCursorIsInSelection(widget, point) {\n if (isNullOrUndefined(this.start) || this.isEmpty || isNullOrUndefined(widget)) {\n return false;\n }\n let isSelected = false;\n do {\n if (this.selectedWidgets.containsKey(widget)) {\n let top;\n let left;\n if (widget instanceof LineWidget) {\n top = this.owner.selection.getTop(widget);\n left = this.owner.selection.getLeft(widget);\n }\n else {\n top = widget.y;\n left = widget.x;\n }\n let widgetInfo = this.selectedWidgets.get(widget);\n isSelected = widgetInfo.left <= point.x && top <= point.y &&\n top + widget.height >= point.y && widgetInfo.left + widgetInfo.width >= point.x;\n }\n widget = (widget instanceof LineWidget) ? widget.paragraph : widget.containerWidget;\n } while (!isNullOrUndefined(widget) && !isSelected);\n return isSelected;\n }", "function eventInWidget(display, e) {\n\t for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\n\t if (!n || (n.nodeType == 1 && n.getAttribute(\"cm-ignore-events\") == \"true\") ||\n\t (n.parentNode == display.sizer && n != display.mover))\n\t return true;\n\t }\n\t }", "function eventInWidget(display, e) {\n\t for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\n\t if (!n || (n.nodeType == 1 && n.getAttribute(\"cm-ignore-events\") == \"true\") ||\n\t (n.parentNode == display.sizer && n != display.mover))\n\t return true;\n\t }\n\t }", "function eventInWidget(display, e) {\n\t for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\n\t if (!n || (n.nodeType == 1 && n.getAttribute(\"cm-ignore-events\") == \"true\") ||\n\t (n.parentNode == display.sizer && n != display.mover))\n\t return true;\n\t }\n\t }", "function eventInWidget(display, e) {\n\t\t for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\n\t\t if (!n || (n.nodeType == 1 && n.getAttribute(\"cm-ignore-events\") == \"true\") ||\n\t\t (n.parentNode == display.sizer && n != display.mover))\n\t\t return true;\n\t\t }\n\t\t }", "function isClicked(mouse) {\n for(var i=0;i<Object.keys(icons).length;i++) {\n curr_x = icons[Object.keys(icons)[i]][1];\n curr_y = icons[Object.keys(icons)[i]][2];\n curr_height = icons[Object.keys(icons)[i]][3];\n curr_width = icons[Object.keys(icons)[i]][4];\n if (mouse[0] < curr_x + curr_width && mouse[0] > curr_x - curr_width) {\n if (mouse[1] < curr_y + curr_height && mouse[1] > curr_y - curr_height) {\n return (icons[Object.keys(icons)[i]][0]);\n }\n }\n else {\n }\n }\n return false;\n }", "is_clicked(image, event) {\n var width = image.width\n var height = image.height\n var begin_x = image.x\n var begin_y = image.y\n var end_x = begin_x + width\n var end_y = begin_y + height \n var buffer = 10\n var click_x = event.offsetX\n var click_y = event.offsetY\n var has_been_clicked = false\n\n if (click_x >= begin_x - buffer && click_x <= end_x + buffer && click_y >= begin_y - buffer && click_y <= end_y + buffer) {\n has_been_clicked = true\n } else {\n has_been_clicked = false\n }\n\n return has_been_clicked\n }", "click(e) {\n this._modifiers(e);\n const _leftClick = Event.isLeftClick(e);\n this.status.button1 = _leftClick;\n this.status.button2 = !_leftClick;\n const [xd, yd] = this.status.mouseDownDiff;\n if (xd > 20 || yd > 20) {\n return true;\n }\n else {\n return this.handleClick(e);\n }\n }", "click(e) {\n this._modifiers(e);\n const _leftClick = Event.isLeftClick(e);\n this.status.button1 = _leftClick;\n this.status.button2 = !_leftClick;\n const [xd, yd] = this.status.mouseDownDiff;\n if (xd > 20 || yd > 20) {\n return true;\n }\n else {\n return this.handleClick(e);\n }\n }", "uiEvtMouseInPerformed() {\r\n if (this.m_headerTree.uiEvtMouseInPerformed()) {\r\n return true;\r\n }\r\n this.m_mosPushStat = false;\r\n this.m_mosPushPrvX = 0;\r\n return false;\r\n }", "mouseUp() {\n for (let i = this.children.length - 1; i >= 0; i--) {\n //Breakout of clicks when object found\n let ret = this.children[i].mouseUp();\n if (ret === true) {\n return true\n }\n }\n }", "function eventInWidget(display, e) {\n for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\n if (!n || (n.nodeType == 1 && n.getAttribute(\"cm-ignore-events\") == \"true\") ||\n (n.parentNode == display.sizer && n != display.mover))\n return true;\n }\n }", "function eventInWidget(display, e) {\n for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\n if (!n || (n.nodeType == 1 && n.getAttribute(\"cm-ignore-events\") == \"true\") ||\n (n.parentNode == display.sizer && n != display.mover))\n return true;\n }\n }", "function eventInWidget(display, e) {\n for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\n if (!n || (n.nodeType == 1 && n.getAttribute(\"cm-ignore-events\") == \"true\") ||\n (n.parentNode == display.sizer && n != display.mover))\n return true;\n }\n }", "function eventInWidget(display, e) {\n for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\n if (!n || (n.nodeType == 1 && n.getAttribute(\"cm-ignore-events\") == \"true\") ||\n (n.parentNode == display.sizer && n != display.mover))\n return true;\n }\n }", "function eventInWidget(display, e) {\r\n for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\r\n if (!n || (n.nodeType == 1 && n.getAttribute(\"cm-ignore-events\") == \"true\") ||\r\n (n.parentNode == display.sizer && n != display.mover))\r\n { return true }\r\n }\r\n}", "function eventInWidget(display, e) {\n for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\n if (!n || (n.nodeType == 1 && n.getAttribute(\"cm-ignore-events\") == \"true\") ||\n (n.parentNode == display.sizer && n != display.mover))\n { return true }\n }\n}", "function eventInWidget(display, e) {\n for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\n if (!n || (n.nodeType == 1 && n.getAttribute(\"cm-ignore-events\") == \"true\") ||\n (n.parentNode == display.sizer && n != display.mover))\n { return true }\n }\n}", "function eventInWidget(display, e) {\n for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\n if (!n || (n.nodeType == 1 && n.getAttribute(\"cm-ignore-events\") == \"true\") ||\n (n.parentNode == display.sizer && n != display.mover))\n { return true }\n }\n}", "function eventInWidget(display, e) {\n for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\n if (!n || (n.nodeType == 1 && n.getAttribute(\"cm-ignore-events\") == \"true\") ||\n (n.parentNode == display.sizer && n != display.mover))\n { return true }\n }\n}", "function eventInWidget(display, e) {\n for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\n if (!n || (n.nodeType == 1 && n.getAttribute(\"cm-ignore-events\") == \"true\") ||\n (n.parentNode == display.sizer && n != display.mover))\n { return true }\n }\n}", "function eventInWidget(display, e) {\n for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\n if (!n || (n.nodeType == 1 && n.getAttribute(\"cm-ignore-events\") == \"true\") ||\n (n.parentNode == display.sizer && n != display.mover))\n { return true }\n }\n}", "function eventInWidget(display, e) {\n for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\n if (!n || (n.nodeType == 1 && n.getAttribute(\"cm-ignore-events\") == \"true\") ||\n (n.parentNode == display.sizer && n != display.mover))\n { return true }\n }\n}", "function eventInWidget(display, e) {\n for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\n if (!n || (n.nodeType == 1 && n.getAttribute(\"cm-ignore-events\") == \"true\") ||\n (n.parentNode == display.sizer && n != display.mover))\n { return true }\n }\n}", "function eventInWidget(display, e) {\n for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\n if (!n || (n.nodeType == 1 && n.getAttribute(\"cm-ignore-events\") == \"true\") ||\n (n.parentNode == display.sizer && n != display.mover))\n { return true }\n }\n}", "function eventInWidget(display, e) {\n for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\n if (!n || (n.nodeType == 1 && n.getAttribute(\"cm-ignore-events\") == \"true\") ||\n (n.parentNode == display.sizer && n != display.mover))\n { return true }\n }\n}", "function eventInWidget(display, e) {\n for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\n if (!n || (n.nodeType == 1 && n.getAttribute(\"cm-ignore-events\") == \"true\") ||\n (n.parentNode == display.sizer && n != display.mover))\n { return true }\n }\n}", "function eventInWidget(display, e) {\n for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\n if (!n || (n.nodeType == 1 && n.getAttribute(\"cm-ignore-events\") == \"true\") ||\n (n.parentNode == display.sizer && n != display.mover))\n { return true }\n }\n}", "function eventInWidget(display, e) {\n for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\n if (!n || (n.nodeType == 1 && n.getAttribute(\"cm-ignore-events\") == \"true\") ||\n (n.parentNode == display.sizer && n != display.mover))\n { return true }\n }\n}", "uiEvtMouseLeftPerformed(x, y) {\r\n if(this.m_common.m_isDrawColorPicker){\r\n return this.m_common.m_colorPicker.uiEvtMouseLeftPerformed(x, y);\r\n }\r\n for (let i = 0; i < this.m_slider.length; ++i) {\r\n if(this.m_slider[i] !== null){\r\n if (this.m_slider[i].uiEvtMouseLeftPerformed(x, y)) {\r\n return true;\r\n }\r\n }\r\n if(this.m_colorLabel[i] !== null){\r\n if (this.m_btnModColor[i].uiEvtMouseLeftPerformed(x, y)) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n }", "function mouse_clicked(){\n\t\treturn M.mouse_clicked;\n\t}", "mouseUp(x, y, _isLeftButton) {}", "function mouseIsInCanvas(p) {\n if (p.mouseX < 0)\n return false;\n if (p.mouseX > p.width)\n return false;\n if (p.mouseY < 0)\n return false;\n if (p.mouseY > p.height)\n return false;\n return true;\n }", "function mousePressEvent(event) {\n var clickedOverlay = Overlays.getOverlayAtPoint({x: event.x, y: event.y});\n for (i = 0; i < NUMBER_OF_COLLISION_BUTTONS; i++) {\n if (clickedOverlay == buttons[i]) {\n var enabled = !(buttonStates[i]);\n updateButton(i, enabled);\n }\n }\n}", "function isMouseEvent(value) {\n return isType(value, 'MouseEvent');\n}", "function isLeftClickEvent(ev) { return ev.button === 0; }", "function cursorInBounds() {\n var boundOb = $(event.currentTarget);\n try {boundOb.offset();} catch {return false;}\n var xTest = boundOb.offset().left;\n var yTest = boundOb.offset().top;\n\n if(event.pageX >= xTest && event.pageY >= yTest && event.pageX <= xTest+boundOb.width() && event.pageY <= yTest+boundOb.height()) {\n return true;\n }\n return false;\n}", "function isEvent() {\n trigger = 1;\n if (label === eventLabel) {\n eventTrigger = true;\n return true;\n } else {\n eventTrigger = false;\n return false;\n }\n}", "isMouseOver() {\n return mouseX > this.x - this.w / 2 && mouseX < this.x + this.w / 2\n && mouseY > this.y - this.h / 2 && mouseY < this.y + this.h / 2;\n }", "isMouseOver(element) {\n if (!element) {\n element = this.$el\n }\n let { x, y } = this.$store.state.mousePosition\n let rect = element.getBoundingClientRect()\n return x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom\n }", "function clickedScrollbar(evt) {\n return document.documentElement.clientWidth <= evt.clientX || document.documentElement.clientHeight <= evt.clientY;\n }", "function eltWithPressEvent(elt, who)\n {\n var m_e, attr;\n var events = new Array();\n var res = false;\n\n if (! who)\n who = 'both';\n if (who == 'keyboard' || who == 'both')\n events = new Array('ONKEYPRESS','ONKEYDOWN','ONKEYUP');\n if (who == 'mouse' || who == 'both')\n {\n m_e = new Array('ONCLICK','ONDBLCLICK','ONMOUSEDOWN','ONMOUSEUP');\n events = events.concat(m_e);\n }\n\n for (var i = 0; i < events.length; i++)\n {\n attr = elt.getAttribute(events[i]);\n if (isDefinedAttr(attr))\n {\n res = true;\n break;\n }\n }\n return res;\n }", "function _clicked_ele_trigger(oEle,e)\r\n{\r\n\tif(isNaN(e))\r\n\t{\r\n\t\tvar mLeft = app.findMousePos(e)[0];\r\n\t}\r\n\telse\r\n\t{\r\n\t\tvar mLeft = e;\r\n\t}\r\n\r\n\tvar eleMaxRight = oEle.offsetWidth + app.eleLeft(oEle);\r\n\tvar eleMinRight = eleMaxRight - 16;\r\n\r\n\tif((mLeft>eleMinRight)&&(mLeft<eleMaxRight))\r\n\t{\r\n\t\treturn true;\r\n\t}\r\n\treturn false;\r\n}", "function clickedScrollbar(evt) {\n return document.documentElement.clientWidth <= evt.clientX || document.documentElement.clientHeight <= evt.clientY;\n}", "function clickedScrollbar(evt) {\n return document.documentElement.clientWidth <= evt.clientX || document.documentElement.clientHeight <= evt.clientY;\n}", "function clickedScrollbar(evt) {\n return document.documentElement.clientWidth <= evt.clientX || document.documentElement.clientHeight <= evt.clientY;\n}", "function clickedScrollbar(evt) {\n return document.documentElement.clientWidth <= evt.clientX || document.documentElement.clientHeight <= evt.clientY;\n}", "function clickedScrollbar(evt) {\n return document.documentElement.clientWidth <= evt.clientX || document.documentElement.clientHeight <= evt.clientY;\n}", "function clickedScrollbar(evt) {\n return document.documentElement.clientWidth <= evt.clientX || document.documentElement.clientHeight <= evt.clientY;\n}", "function clickedScrollbar(evt) {\n return document.documentElement.clientWidth <= evt.clientX || document.documentElement.clientHeight <= evt.clientY;\n}", "function clickedScrollbar(evt) {\n return document.documentElement.clientWidth <= evt.clientX || document.documentElement.clientHeight <= evt.clientY;\n}", "function clickedScrollbar(evt) {\n return document.documentElement.clientWidth <= evt.clientX || document.documentElement.clientHeight <= evt.clientY;\n}", "function clickedScrollbar(evt) {\n return document.documentElement.clientWidth <= evt.clientX || document.documentElement.clientHeight <= evt.clientY;\n}", "function clickedScrollbar(evt) {\n return document.documentElement.clientWidth <= evt.clientX || document.documentElement.clientHeight <= evt.clientY;\n}", "function clickedScrollbar(evt) {\n return document.documentElement.clientWidth <= evt.clientX || document.documentElement.clientHeight <= evt.clientY;\n}", "function clickedScrollbar(evt) {\n return document.documentElement.clientWidth <= evt.clientX || document.documentElement.clientHeight <= evt.clientY;\n}", "clicked(x, y)\r\n {\r\n var d = dist(x, y, this.x, this.y);\r\n if(d < this.radius)\r\n {\r\n return true;\r\n }\r\n }", "function isFakeMousedownFromScreenReader(event) {\n return event.buttons === 0;\n}", "function mouseOnScrollbar() {\n var clickOnScrollbar = false;\n if (ev && (ev.currentTarget.children.length > 0)) {\n var child = ev.currentTarget.children[0];\n var hasScrollbar = child.scrollHeight > child.clientHeight;\n if (hasScrollbar && child.children.length > 0) {\n var relPosX = ev.pageX - ev.currentTarget.getBoundingClientRect().left;\n if (relPosX > child.querySelector('md-option').offsetWidth)\n clickOnScrollbar = true;\n }\n }\n return clickOnScrollbar;\n }", "function mouseOnScrollbar() {\n var clickOnScrollbar = false;\n if (ev && (ev.currentTarget.children.length > 0)) {\n var child = ev.currentTarget.children[0];\n var hasScrollbar = child.scrollHeight > child.clientHeight;\n if (hasScrollbar && child.children.length > 0) {\n var relPosX = ev.pageX - ev.currentTarget.getBoundingClientRect().left;\n if (relPosX > child.querySelector('md-option').offsetWidth)\n clickOnScrollbar = true;\n }\n }\n return clickOnScrollbar;\n }", "function mouseOnScrollbar() {\n var clickOnScrollbar = false;\n if (ev && (ev.currentTarget.children.length > 0)) {\n var child = ev.currentTarget.children[0];\n var hasScrollbar = child.scrollHeight > child.clientHeight;\n if (hasScrollbar && child.children.length > 0) {\n var relPosX = ev.pageX - ev.currentTarget.getBoundingClientRect().left;\n if (relPosX > child.querySelector('md-option').offsetWidth)\n clickOnScrollbar = true;\n }\n }\n return clickOnScrollbar;\n }", "function mouseOnScrollbar() {\n var clickOnScrollbar = false;\n if (ev && (ev.currentTarget.children.length > 0)) {\n var child = ev.currentTarget.children[0];\n var hasScrollbar = child.scrollHeight > child.clientHeight;\n if (hasScrollbar && child.children.length > 0) {\n var relPosX = ev.pageX - ev.currentTarget.getBoundingClientRect().left;\n if (relPosX > child.querySelector('md-option').offsetWidth)\n clickOnScrollbar = true;\n }\n }\n return clickOnScrollbar;\n }", "function clickedScrollbar(evt) {\n\t return document.documentElement.clientWidth <= evt.clientX || document.documentElement.clientHeight <= evt.clientY;\n\t}", "onIntersectedByMouse(){\n }", "function mousePosIsInSelectableArea(pos) {\n\t\tif(pos.x > leftMarg - 2 && pos.x <= leftMarg + drawW + 2 && pos.y > topMarg - 2 && pos.y <= topMarg + drawH + 2) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}" ]
[ "0.7194196", "0.7059485", "0.68766373", "0.6852455", "0.6758913", "0.67542046", "0.6751924", "0.66846025", "0.6671108", "0.664715", "0.6614089", "0.6614089", "0.6614089", "0.6614089", "0.6591147", "0.6567154", "0.65445554", "0.6489968", "0.64857376", "0.64652973", "0.646091", "0.646091", "0.646091", "0.64608014", "0.64554703", "0.6447244", "0.6426479", "0.6426479", "0.6423523", "0.64094824", "0.63925207", "0.63925207", "0.63925207", "0.63925207", "0.6390943", "0.63826776", "0.63826776", "0.63826776", "0.63826776", "0.63826776", "0.63826776", "0.63826776", "0.63826776", "0.63826776", "0.63826776", "0.63826776", "0.63826776", "0.63826776", "0.63754", "0.63646096", "0.6354467", "0.632638", "0.6324855", "0.6264875", "0.62350833", "0.62185514", "0.6214705", "0.61926657", "0.6187039", "0.6186274", "0.61727774", "0.61689454", "0.6163615", "0.6161763", "0.6161763", "0.6161763", "0.6161763", "0.6161763", "0.6161763", "0.6161763", "0.6161763", "0.6161763", "0.6161763", "0.6161763", "0.6161763", "0.61539066", "0.61531", "0.61505306", "0.61505306", "0.61505306", "0.61505306", "0.6149568", "0.6141029", "0.6121011" ]
0.6431442
40
Ensure the lineView.wrapping.heights array is populated. This is an array of bottom offsets for the lines that make up a drawn line. When lineWrapping is on, there might be more than one height.
function ensureLineHeights(cm, lineView, rect) { var wrapping = cm.options.lineWrapping; var curWidth = wrapping && displayWidth(cm); if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) { var heights = lineView.measure.heights = []; if (wrapping) { lineView.measure.width = curWidth; var rects = lineView.text.firstChild.getClientRects(); for (var i = 0; i < rects.length - 1; i++) { var cur = rects[i], next = rects[i + 1]; if (Math.abs(cur.bottom - next.bottom) > 2) { heights.push((cur.bottom + next.top) / 2 - rect.top); } } } heights.push(rect.bottom - rect.top); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ensureLineHeights(cm, lineView, rect) {\n var wrapping = cm.options.lineWrapping;\n var curWidth = wrapping && cm.display.scroller.clientWidth;\n if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\n var heights = lineView.measure.heights = [];\n if (wrapping) {\n lineView.measure.width = curWidth;\n var rects = lineView.text.firstChild.getClientRects();\n for (var i = 0; i < rects.length - 1; i++) {\n var cur = rects[i], next = rects[i + 1];\n if (Math.abs(cur.bottom - next.bottom) > 2)\n heights.push((cur.bottom + next.top) / 2 - rect.top);\n }\n }\n heights.push(rect.bottom - rect.top);\n }\n }", "function ensureLineHeights(cm, lineView, rect) {\n var wrapping = cm.options.lineWrapping;\n var curWidth = wrapping && cm.display.scroller.clientWidth;\n if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\n var heights = lineView.measure.heights = [];\n if (wrapping) {\n lineView.measure.width = curWidth;\n var rects = lineView.text.firstChild.getClientRects();\n for (var i = 0; i < rects.length - 1; i++) {\n var cur = rects[i], next = rects[i + 1];\n if (Math.abs(cur.bottom - next.bottom) > 2)\n heights.push((cur.bottom + next.top) / 2 - rect.top);\n }\n }\n heights.push(rect.bottom - rect.top);\n }\n }", "function ensureLineHeights(cm, lineView, rect) {\n var wrapping = cm.options.lineWrapping;\n var curWidth = wrapping && cm.display.scroller.clientWidth;\n if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\n var heights = lineView.measure.heights = [];\n if (wrapping) {\n lineView.measure.width = curWidth;\n var rects = lineView.text.firstChild.getClientRects();\n for (var i = 0; i < rects.length - 1; i++) {\n var cur = rects[i], next = rects[i + 1];\n if (Math.abs(cur.bottom - next.bottom) > 2)\n heights.push((cur.bottom + next.top) / 2 - rect.top);\n }\n }\n heights.push(rect.bottom - rect.top);\n }\n }", "function ensureLineHeights(cm, lineView, rect) {\n var wrapping = cm.options.lineWrapping;\n var curWidth = wrapping && cm.display.scroller.clientWidth;\n if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\n var heights = lineView.measure.heights = [];\n if (wrapping) {\n lineView.measure.width = curWidth;\n var rects = lineView.text.firstChild.getClientRects();\n for (var i = 0; i < rects.length - 1; i++) {\n var cur = rects[i], next = rects[i + 1];\n if (Math.abs(cur.bottom - next.bottom) > 2)\n heights.push((cur.bottom + next.top) / 2 - rect.top);\n }\n }\n heights.push(rect.bottom - rect.top);\n }\n }", "function ensureLineHeights(cm, lineView, rect) {\r\n var wrapping = cm.options.lineWrapping;\r\n var curWidth = wrapping && cm.display.scroller.clientWidth;\r\n if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\r\n var heights = lineView.measure.heights = [];\r\n if (wrapping) {\r\n lineView.measure.width = curWidth;\r\n var rects = lineView.text.firstChild.getClientRects();\r\n for (var i = 0; i < rects.length - 1; i++) {\r\n var cur = rects[i], next = rects[i + 1];\r\n if (Math.abs(cur.bottom - next.bottom) > 2)\r\n heights.push((cur.bottom + next.top) / 2 - rect.top);\r\n }\r\n }\r\n heights.push(rect.bottom - rect.top);\r\n }\r\n }", "function ensureLineHeights(cm, lineView, rect) {\n var wrapping = cm.options.lineWrapping;\n var curWidth = wrapping && displayWidth(cm);\n if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\n var heights = lineView.measure.heights = [];\n if (wrapping) {\n lineView.measure.width = curWidth;\n var rects = lineView.text.firstChild.getClientRects();\n for (var i = 0; i < rects.length - 1; i++) {\n var cur = rects[i], next = rects[i + 1];\n if (Math.abs(cur.bottom - next.bottom) > 2)\n heights.push((cur.bottom + next.top) / 2 - rect.top);\n }\n }\n heights.push(rect.bottom - rect.top);\n }\n }", "function ensureLineHeights(cm, lineView, rect) {\n var wrapping = cm.options.lineWrapping;\n var curWidth = wrapping && displayWidth(cm);\n if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\n var heights = lineView.measure.heights = [];\n if (wrapping) {\n lineView.measure.width = curWidth;\n var rects = lineView.text.firstChild.getClientRects();\n for (var i = 0; i < rects.length - 1; i++) {\n var cur = rects[i], next = rects[i + 1];\n if (Math.abs(cur.bottom - next.bottom) > 2)\n heights.push((cur.bottom + next.top) / 2 - rect.top);\n }\n }\n heights.push(rect.bottom - rect.top);\n }\n }", "function ensureLineHeights(cm, lineView, rect) {\n var wrapping = cm.options.lineWrapping;\n var curWidth = wrapping && displayWidth(cm);\n if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\n var heights = lineView.measure.heights = [];\n if (wrapping) {\n lineView.measure.width = curWidth;\n var rects = lineView.text.firstChild.getClientRects();\n for (var i = 0; i < rects.length - 1; i++) {\n var cur = rects[i], next = rects[i + 1];\n if (Math.abs(cur.bottom - next.bottom) > 2)\n heights.push((cur.bottom + next.top) / 2 - rect.top);\n }\n }\n heights.push(rect.bottom - rect.top);\n }\n }", "function ensureLineHeights(cm, lineView, rect) {\n var wrapping = cm.options.lineWrapping;\n var curWidth = wrapping && displayWidth(cm);\n if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\n var heights = lineView.measure.heights = [];\n if (wrapping) {\n lineView.measure.width = curWidth;\n var rects = lineView.text.firstChild.getClientRects();\n for (var i = 0; i < rects.length - 1; i++) {\n var cur = rects[i], next = rects[i + 1];\n if (Math.abs(cur.bottom - next.bottom) > 2)\n heights.push((cur.bottom + next.top) / 2 - rect.top);\n }\n }\n heights.push(rect.bottom - rect.top);\n }\n }", "function ensureLineHeights(cm, lineView, rect) {\n\t\t var wrapping = cm.options.lineWrapping;\n\t\t var curWidth = wrapping && displayWidth(cm);\n\t\t if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\n\t\t var heights = lineView.measure.heights = [];\n\t\t if (wrapping) {\n\t\t lineView.measure.width = curWidth;\n\t\t var rects = lineView.text.firstChild.getClientRects();\n\t\t for (var i = 0; i < rects.length - 1; i++) {\n\t\t var cur = rects[i], next = rects[i + 1];\n\t\t if (Math.abs(cur.bottom - next.bottom) > 2)\n\t\t heights.push((cur.bottom + next.top) / 2 - rect.top);\n\t\t }\n\t\t }\n\t\t heights.push(rect.bottom - rect.top);\n\t\t }\n\t\t }", "function ensureLineHeights(cm, lineView, rect) {\n\t\t var wrapping = cm.options.lineWrapping;\n\t\t var curWidth = wrapping && displayWidth(cm);\n\t\t if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\n\t\t var heights = lineView.measure.heights = [];\n\t\t if (wrapping) {\n\t\t lineView.measure.width = curWidth;\n\t\t var rects = lineView.text.firstChild.getClientRects();\n\t\t for (var i = 0; i < rects.length - 1; i++) {\n\t\t var cur = rects[i], next = rects[i + 1];\n\t\t if (Math.abs(cur.bottom - next.bottom) > 2)\n\t\t { heights.push((cur.bottom + next.top) / 2 - rect.top); }\n\t\t }\n\t\t }\n\t\t heights.push(rect.bottom - rect.top);\n\t\t }\n\t\t }", "function ensureLineHeights(cm, lineView, rect) {\n\t var wrapping = cm.options.lineWrapping;\n\t var curWidth = wrapping && displayWidth(cm);\n\t if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\n\t var heights = lineView.measure.heights = [];\n\t if (wrapping) {\n\t lineView.measure.width = curWidth;\n\t var rects = lineView.text.firstChild.getClientRects();\n\t for (var i = 0; i < rects.length - 1; i++) {\n\t var cur = rects[i], next = rects[i + 1];\n\t if (Math.abs(cur.bottom - next.bottom) > 2)\n\t heights.push((cur.bottom + next.top) / 2 - rect.top);\n\t }\n\t }\n\t heights.push(rect.bottom - rect.top);\n\t }\n\t }", "function ensureLineHeights(cm, lineView, rect) {\n\t var wrapping = cm.options.lineWrapping;\n\t var curWidth = wrapping && displayWidth(cm);\n\t if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\n\t var heights = lineView.measure.heights = [];\n\t if (wrapping) {\n\t lineView.measure.width = curWidth;\n\t var rects = lineView.text.firstChild.getClientRects();\n\t for (var i = 0; i < rects.length - 1; i++) {\n\t var cur = rects[i], next = rects[i + 1];\n\t if (Math.abs(cur.bottom - next.bottom) > 2)\n\t heights.push((cur.bottom + next.top) / 2 - rect.top);\n\t }\n\t }\n\t heights.push(rect.bottom - rect.top);\n\t }\n\t }", "function ensureLineHeights(cm, lineView, rect) {\n\t var wrapping = cm.options.lineWrapping;\n\t var curWidth = wrapping && displayWidth(cm);\n\t if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\n\t var heights = lineView.measure.heights = [];\n\t if (wrapping) {\n\t lineView.measure.width = curWidth;\n\t var rects = lineView.text.firstChild.getClientRects();\n\t for (var i = 0; i < rects.length - 1; i++) {\n\t var cur = rects[i], next = rects[i + 1];\n\t if (Math.abs(cur.bottom - next.bottom) > 2)\n\t heights.push((cur.bottom + next.top) / 2 - rect.top);\n\t }\n\t }\n\t heights.push(rect.bottom - rect.top);\n\t }\n\t }", "function ensureLineHeights(cm, lineView, rect) {\n var wrapping = cm.options.lineWrapping\n var curWidth = wrapping && displayWidth(cm)\n if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\n var heights = lineView.measure.heights = []\n if (wrapping) {\n lineView.measure.width = curWidth\n var rects = lineView.text.firstChild.getClientRects()\n for (var i = 0; i < rects.length - 1; i++) {\n var cur = rects[i], next = rects[i + 1]\n if (Math.abs(cur.bottom - next.bottom) > 2)\n { heights.push((cur.bottom + next.top) / 2 - rect.top) }\n }\n }\n heights.push(rect.bottom - rect.top)\n }\n}", "function ensureLineHeights(cm, lineView, rect) {\n var wrapping = cm.options.lineWrapping\n var curWidth = wrapping && displayWidth(cm)\n if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\n var heights = lineView.measure.heights = []\n if (wrapping) {\n lineView.measure.width = curWidth\n var rects = lineView.text.firstChild.getClientRects()\n for (var i = 0; i < rects.length - 1; i++) {\n var cur = rects[i], next = rects[i + 1]\n if (Math.abs(cur.bottom - next.bottom) > 2)\n { heights.push((cur.bottom + next.top) / 2 - rect.top) }\n }\n }\n heights.push(rect.bottom - rect.top)\n }\n}", "function ensureLineHeights(cm, lineView, rect) {\n var wrapping = cm.options.lineWrapping;\n var curWidth = wrapping && displayWidth(cm);\n if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\n var heights = lineView.measure.heights = [];\n if (wrapping) {\n lineView.measure.width = curWidth;\n var rects = lineView.text.firstChild.getClientRects();\n for (var i = 0; i < rects.length - 1; i++) {\n var cur = rects[i], next = rects[i + 1];\n if (Math.abs(cur.bottom - next.bottom) > 2)\n { heights.push((cur.bottom + next.top) / 2 - rect.top); }\n }\n }\n heights.push(rect.bottom - rect.top);\n }\n}", "function ensureLineHeights(cm, lineView, rect) {\n var wrapping = cm.options.lineWrapping;\n var curWidth = wrapping && displayWidth(cm);\n if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\n var heights = lineView.measure.heights = [];\n if (wrapping) {\n lineView.measure.width = curWidth;\n var rects = lineView.text.firstChild.getClientRects();\n for (var i = 0; i < rects.length - 1; i++) {\n var cur = rects[i], next = rects[i + 1];\n if (Math.abs(cur.bottom - next.bottom) > 2)\n { heights.push((cur.bottom + next.top) / 2 - rect.top); }\n }\n }\n heights.push(rect.bottom - rect.top);\n }\n}", "function ensureLineHeights(cm, lineView, rect) {\n var wrapping = cm.options.lineWrapping;\n var curWidth = wrapping && displayWidth(cm);\n if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\n var heights = lineView.measure.heights = [];\n if (wrapping) {\n lineView.measure.width = curWidth;\n var rects = lineView.text.firstChild.getClientRects();\n for (var i = 0; i < rects.length - 1; i++) {\n var cur = rects[i], next = rects[i + 1];\n if (Math.abs(cur.bottom - next.bottom) > 2)\n { heights.push((cur.bottom + next.top) / 2 - rect.top); }\n }\n }\n heights.push(rect.bottom - rect.top);\n }\n}", "function ensureLineHeights(cm, lineView, rect) {\n var wrapping = cm.options.lineWrapping;\n var curWidth = wrapping && displayWidth(cm);\n if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\n var heights = lineView.measure.heights = [];\n if (wrapping) {\n lineView.measure.width = curWidth;\n var rects = lineView.text.firstChild.getClientRects();\n for (var i = 0; i < rects.length - 1; i++) {\n var cur = rects[i], next = rects[i + 1];\n if (Math.abs(cur.bottom - next.bottom) > 2)\n { heights.push((cur.bottom + next.top) / 2 - rect.top); }\n }\n }\n heights.push(rect.bottom - rect.top);\n }\n}", "function ensureLineHeights(cm, lineView, rect) {\n var wrapping = cm.options.lineWrapping;\n var curWidth = wrapping && displayWidth(cm);\n if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\n var heights = lineView.measure.heights = [];\n if (wrapping) {\n lineView.measure.width = curWidth;\n var rects = lineView.text.firstChild.getClientRects();\n for (var i = 0; i < rects.length - 1; i++) {\n var cur = rects[i], next = rects[i + 1];\n if (Math.abs(cur.bottom - next.bottom) > 2)\n { heights.push((cur.bottom + next.top) / 2 - rect.top); }\n }\n }\n heights.push(rect.bottom - rect.top);\n }\n}", "function ensureLineHeights(cm, lineView, rect) {\n var wrapping = cm.options.lineWrapping;\n var curWidth = wrapping && displayWidth(cm);\n if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\n var heights = lineView.measure.heights = [];\n if (wrapping) {\n lineView.measure.width = curWidth;\n var rects = lineView.text.firstChild.getClientRects();\n for (var i = 0; i < rects.length - 1; i++) {\n var cur = rects[i], next = rects[i + 1];\n if (Math.abs(cur.bottom - next.bottom) > 2)\n { heights.push((cur.bottom + next.top) / 2 - rect.top); }\n }\n }\n heights.push(rect.bottom - rect.top);\n }\n}", "function ensureLineHeights(cm, lineView, rect) {\n var wrapping = cm.options.lineWrapping;\n var curWidth = wrapping && displayWidth(cm);\n if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\n var heights = lineView.measure.heights = [];\n if (wrapping) {\n lineView.measure.width = curWidth;\n var rects = lineView.text.firstChild.getClientRects();\n for (var i = 0; i < rects.length - 1; i++) {\n var cur = rects[i], next = rects[i + 1];\n if (Math.abs(cur.bottom - next.bottom) > 2)\n { heights.push((cur.bottom + next.top) / 2 - rect.top); }\n }\n }\n heights.push(rect.bottom - rect.top);\n }\n}", "function ensureLineHeights(cm, lineView, rect) {\n var wrapping = cm.options.lineWrapping;\n var curWidth = wrapping && displayWidth(cm);\n if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\n var heights = lineView.measure.heights = [];\n if (wrapping) {\n lineView.measure.width = curWidth;\n var rects = lineView.text.firstChild.getClientRects();\n for (var i = 0; i < rects.length - 1; i++) {\n var cur = rects[i], next = rects[i + 1];\n if (Math.abs(cur.bottom - next.bottom) > 2)\n { heights.push((cur.bottom + next.top) / 2 - rect.top); }\n }\n }\n heights.push(rect.bottom - rect.top);\n }\n}", "function ensureLineHeights(cm, lineView, rect) {\n var wrapping = cm.options.lineWrapping;\n var curWidth = wrapping && displayWidth(cm);\n if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\n var heights = lineView.measure.heights = [];\n if (wrapping) {\n lineView.measure.width = curWidth;\n var rects = lineView.text.firstChild.getClientRects();\n for (var i = 0; i < rects.length - 1; i++) {\n var cur = rects[i], next = rects[i + 1];\n if (Math.abs(cur.bottom - next.bottom) > 2)\n { heights.push((cur.bottom + next.top) / 2 - rect.top); }\n }\n }\n heights.push(rect.bottom - rect.top);\n }\n}", "function ensureLineHeights(cm, lineView, rect) {\n var wrapping = cm.options.lineWrapping;\n var curWidth = wrapping && displayWidth(cm);\n if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\n var heights = lineView.measure.heights = [];\n if (wrapping) {\n lineView.measure.width = curWidth;\n var rects = lineView.text.firstChild.getClientRects();\n for (var i = 0; i < rects.length - 1; i++) {\n var cur = rects[i], next = rects[i + 1];\n if (Math.abs(cur.bottom - next.bottom) > 2)\n { heights.push((cur.bottom + next.top) / 2 - rect.top); }\n }\n }\n heights.push(rect.bottom - rect.top);\n }\n}", "function ensureLineHeights(cm, lineView, rect) {\n var wrapping = cm.options.lineWrapping;\n var curWidth = wrapping && displayWidth(cm);\n if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\n var heights = lineView.measure.heights = [];\n if (wrapping) {\n lineView.measure.width = curWidth;\n var rects = lineView.text.firstChild.getClientRects();\n for (var i = 0; i < rects.length - 1; i++) {\n var cur = rects[i], next = rects[i + 1];\n if (Math.abs(cur.bottom - next.bottom) > 2)\n { heights.push((cur.bottom + next.top) / 2 - rect.top); }\n }\n }\n heights.push(rect.bottom - rect.top);\n }\n}", "function ensureLineHeights(cm, lineView, rect) {\r\n var wrapping = cm.options.lineWrapping;\r\n var curWidth = wrapping && displayWidth(cm);\r\n if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\r\n var heights = lineView.measure.heights = [];\r\n if (wrapping) {\r\n lineView.measure.width = curWidth;\r\n var rects = lineView.text.firstChild.getClientRects();\r\n for (var i = 0; i < rects.length - 1; i++) {\r\n var cur = rects[i], next = rects[i + 1];\r\n if (Math.abs(cur.bottom - next.bottom) > 2)\r\n { heights.push((cur.bottom + next.top) / 2 - rect.top); }\r\n }\r\n }\r\n heights.push(rect.bottom - rect.top);\r\n }\r\n}", "function ensureLineHeights(cm, lineView, rect) {\n var wrapping = cm.options.lineWrapping;\n var curWidth = wrapping && displayWidth(cm);\n\n if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\n var heights = lineView.measure.heights = [];\n\n if (wrapping) {\n lineView.measure.width = curWidth;\n var rects = lineView.text.firstChild.getClientRects();\n\n for (var i = 0; i < rects.length - 1; i++) {\n var cur = rects[i],\n next = rects[i + 1];\n\n if (Math.abs(cur.bottom - next.bottom) > 2) {\n heights.push((cur.bottom + next.top) / 2 - rect.top);\n }\n }\n }\n\n heights.push(rect.bottom - rect.top);\n }\n } // Find a line map (mapping character offsets to text nodes) and a", "ensureLineGaps(current, mayMeasure) {\n let wrapping = this.heightOracle.lineWrapping;\n let margin = wrapping ? 10000 /* MarginWrap */ : 2000 /* Margin */, halfMargin = margin >> 1, doubleMargin = margin << 1;\n // The non-wrapping logic won't work at all in predominantly right-to-left text.\n if (this.defaultTextDirection != exports.Direction.LTR && !wrapping)\n return [];\n let gaps = [];\n let addGap = (from, to, line, structure) => {\n if (to - from < halfMargin)\n return;\n let sel = this.state.selection.main, avoid = [sel.from];\n if (!sel.empty)\n avoid.push(sel.to);\n for (let pos of avoid) {\n if (pos > from && pos < to) {\n addGap(from, pos - 10 /* SelectionMargin */, line, structure);\n addGap(pos + 10 /* SelectionMargin */, to, line, structure);\n return;\n }\n }\n let gap = find(current, gap => gap.from >= line.from && gap.to <= line.to &&\n Math.abs(gap.from - from) < halfMargin && Math.abs(gap.to - to) < halfMargin &&\n !avoid.some(pos => gap.from < pos && gap.to > pos));\n if (!gap) {\n // When scrolling down, snap gap ends to line starts to avoid shifts in wrapping\n if (to < line.to && mayMeasure && wrapping &&\n mayMeasure.visibleRanges.some(r => r.from <= to && r.to >= to)) {\n let lineStart = mayMeasure.moveToLineBoundary(state.EditorSelection.cursor(to), false, true).head;\n if (lineStart > from)\n to = lineStart;\n }\n gap = new LineGap(from, to, this.gapSize(line, from, to, structure));\n }\n gaps.push(gap);\n };\n for (let line of this.viewportLines) {\n if (line.length < doubleMargin)\n continue;\n let structure = lineStructure(line.from, line.to, this.stateDeco);\n if (structure.total < doubleMargin)\n continue;\n let target = this.scrollTarget ? this.scrollTarget.range.head : null;\n let viewFrom, viewTo;\n if (wrapping) {\n let marginHeight = (margin / this.heightOracle.lineLength) * this.heightOracle.lineHeight;\n let top, bot;\n if (target != null) {\n let targetFrac = findFraction(structure, target);\n let spaceFrac = ((this.visibleBottom - this.visibleTop) / 2 + marginHeight) / line.height;\n top = targetFrac - spaceFrac;\n bot = targetFrac + spaceFrac;\n }\n else {\n top = (this.visibleTop - line.top - marginHeight) / line.height;\n bot = (this.visibleBottom - line.top + marginHeight) / line.height;\n }\n viewFrom = findPosition(structure, top);\n viewTo = findPosition(structure, bot);\n }\n else {\n let totalWidth = structure.total * this.heightOracle.charWidth;\n let marginWidth = margin * this.heightOracle.charWidth;\n let left, right;\n if (target != null) {\n let targetFrac = findFraction(structure, target);\n let spaceFrac = ((this.pixelViewport.right - this.pixelViewport.left) / 2 + marginWidth) / totalWidth;\n left = targetFrac - spaceFrac;\n right = targetFrac + spaceFrac;\n }\n else {\n left = (this.pixelViewport.left - marginWidth) / totalWidth;\n right = (this.pixelViewport.right + marginWidth) / totalWidth;\n }\n viewFrom = findPosition(structure, left);\n viewTo = findPosition(structure, right);\n }\n if (viewFrom > line.from)\n addGap(line.from, viewFrom, line, structure);\n if (viewTo < line.to)\n addGap(viewTo, line.to, line, structure);\n }\n return gaps;\n }", "get lineWrapping() { return this.viewState.heightOracle.lineWrapping; }", "function lineHeight(){\n\t\thistoryLine.each(function(index, element){\n\t\t\tif(index == $('.line').length - 1){\n\t\t\t\treturn false;\n\t\t\t} else{\n\t\t\t\tvar thisBlock = $(this).closest('.history-item').height()/2;\n\t\t\t\tvar nextBlock = $(this).closest('.history-item').next().height()/2;\n\t\t\t\tvar h = thisBlock+nextBlock;\n\t\t\t\t$(this).height(h);\n\t\t\t}\n\t\t\t\n\t\t})\n\t}", "function setHLinePos(hlinesInGap) {\n for (var i = 0; i < hlinesInGap.length; ++i) {\n if (i > 0) {\n totalHeight += 0.25;\n }\n\n hlines.push({\n pos: totalHeight,\n isDashed: hlinesInGap[i]\n });\n }\n }", "function setHLinePos(hlinesInGap) {\n for (var i = 0; i < hlinesInGap.length; ++i) {\n if (i > 0) {\n totalHeight += 0.25;\n }\n\n hlines.push({\n pos: totalHeight,\n isDashed: hlinesInGap[i]\n });\n }\n }", "function setHLinePos(hlinesInGap) {\n for (var i = 0; i < hlinesInGap.length; ++i) {\n if (i > 0) {\n totalHeight += 0.25;\n }\n\n hlines.push({\n pos: totalHeight,\n isDashed: hlinesInGap[i]\n });\n }\n }", "function getMaxLines(height) {\n var availHeight = height || element.clientHeight,\n lineHeight = getLineHeight(element);\n\n return Math.max(Math.floor(availHeight / lineHeight), 0);\n }", "lineBlockAtHeight(height) {\n this.readMeasured();\n return this.viewState.lineBlockAtHeight(height);\n }", "function getMaxLines(height) {\n var availHeight = height || element.clientHeight,\n lineHeight = getLineHeight(element);\n\n return Math.max(Math.floor(availHeight/lineHeight), 0);\n }", "function handerLines() {\n if (lines) {\n return Object.keys(lines).forEach(key => {\n var row = lines[key];\n var start = lines[key].start;\n var end = lines[key].end;\n\n if (start) {\n // For now we focus on the horiztonal and vertical first. \n if (start.x === '0' && start.y === '0') {\n x1 = DEFAULT_X;\n y1 = DEFAULT_Y;\n }\n\n else if (start.y !== '0') {\n x1 = (parseInt(start.x) * 80) + DEFAULT_X;\n y1 = (parseInt(start.y) * 72) + (DEFAULT_Y * parseInt(start.y));\n }\n\n // For some reason, second and fourth row in ys are showing off the corridation. \n else {\n x1 = (parseInt(start.x) * 80) + DEFAULT_X;\n y1 = (parseInt(start.y) * 72) + DEFAULT_Y;\n }\n }\n\n if (end) {\n if (end.x === '0' && end.y === '0') {\n x2 = DEFAULT_X;\n y2 = DEFAULT_Y;\n }\n else if (end.y !== '0') {\n x2 = parseInt(end.x) * 80 + DEFAULT_X;\n y2 = (parseInt(end.y) * 72) + (DEFAULT_Y * parseInt(end.y));\n }\n else {\n x2 = parseInt(end.x) * 80 + DEFAULT_X;\n y2 = (parseInt(end.y) * 72) + DEFAULT_Y;\n }\n }\n return temp.push([x1, y1, x2, y2]);\n // temp.push(<line x1={x1} y1={y1} x2={x2} y2={y2} />) // DON'T TOUCH THIS!\n });\n\n }\n // setTest(prevState => [prevState, x1])\n }", "function getMaxLines(height) {\n var availHeight = height || getElemHeight(element),\n lineHeight = getLineHeight(element);\n\n return Math.max(Math.floor(availHeight/lineHeight), 0);\n }", "get defaultLineHeight() { return this.viewState.heightOracle.lineHeight; }", "_calcVisibleLines() {\n this._lines.qtMaxVisible = Math.floor(this._matrixHeight / this._cell.heightMin);\n if (this._lines.qtMaxVisible > 3)\n this._lines.qtMinVisible = 3;\n else\n this._lines.qtMinVisible = 1;\n if (this._lines.qtMaxVisible > this._lines.qtTotal)\n this._lines.qtMaxVisible = this._lines.qtTotal;\n if (this._lines.qtMaxVisible < this._lines.qtVisible && this._lines.qtMaxVisible != 0)\n this._lines.qtVisible = this._lines.qtMaxVisible;\n }", "buildScrollMap() {\n if (!this.totalLineCount) {\n return null;\n }\n const scrollMap = [];\n const nonEmptyList = [];\n for (let i = 0; i < this.totalLineCount; i++) {\n scrollMap.push(-1);\n }\n nonEmptyList.push(0);\n scrollMap[0] = 0;\n // write down the offsetTop of element that has 'data-line' property to scrollMap\n const lineElements = this.previewElement.getElementsByClassName(\"sync-line\");\n for (let i = 0; i < lineElements.length; i++) {\n let el = lineElements[i];\n let t = el.getAttribute(\"data-line\");\n if (!t) {\n continue;\n }\n t = parseInt(t, 10);\n if (!t) {\n continue;\n }\n // this is for ignoring footnote scroll match\n if (t < nonEmptyList[nonEmptyList.length - 1]) {\n el.removeAttribute(\"data-line\");\n }\n else {\n nonEmptyList.push(t);\n let offsetTop = 0;\n while (el && el !== this.previewElement) {\n offsetTop += el.offsetTop;\n el = el.offsetParent;\n }\n scrollMap[t] = Math.round(offsetTop);\n }\n }\n nonEmptyList.push(this.totalLineCount);\n scrollMap.push(this.previewElement.scrollHeight);\n let pos = 0;\n for (let i = 0; i < this.totalLineCount; i++) {\n if (scrollMap[i] !== -1) {\n pos++;\n continue;\n }\n const a = nonEmptyList[pos - 1];\n const b = nonEmptyList[pos];\n scrollMap[i] = Math.round((scrollMap[b] * (i - a) + scrollMap[a] * (b - i)) / (b - a));\n }\n return scrollMap; // scrollMap's length == screenLineCount (vscode can't get screenLineCount... sad)\n }", "function visibleLines(display, doc, viewPort) {\n var top = viewPort && viewPort.top != null ? Math.max(0, viewPort.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewPort && viewPort.bottom != null ? viewPort.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewPort && viewPort.ensure) {\n var ensureFrom = viewPort.ensure.from.line, ensureTo = viewPort.ensure.to.line;\n if (ensureFrom < from)\n return {from: ensureFrom,\n to: lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight)};\n if (Math.min(ensureTo, doc.lastLine()) >= to)\n return {from: lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight),\n to: ensureTo};\n }\n return {from: from, to: Math.max(to, from + 1)};\n }", "drawLines() {\n // Early bailout for timeaxis without start date\n if (!this.client.timeAxis.startDate) {\n return;\n }\n\n // We cannot rely on timeAxisViewModel because rendered header may not include full top header.\n // This means we should generate whole top level tick and then iterate over ticks, calculating lines position\n // depending on header config\n const me = this,\n { client } = me,\n { timeAxis } = client,\n axisStart = timeAxis.startDate,\n viewModel = client.timeAxisViewModel,\n tickSize = viewModel.tickSize,\n element = client.backgroundCanvas,\n canvas = document.createElement('canvas'),\n ctx = canvas.getContext('2d'),\n linesForLevel = viewModel.columnLinesFor,\n // header to draw lines for\n targetHeader = viewModel.headerConfig[linesForLevel],\n headers = viewModel.headers,\n // header which is used to draw major lines\n upperHeader = headers[headers.indexOf(targetHeader) - 1] || headers[0],\n // header defining ticks\n lowerHeader = headers[headers.length - 1],\n // when unit is year we should use 1 as increment\n startDate = timeAxis.floorDate(\n axisStart,\n false,\n upperHeader.unit,\n upperHeader.unit === 'year' ? 1 : upperHeader.increment || 1\n ),\n endDate = DateHelper.getNext(startDate, upperHeader.unit, upperHeader.increment || 1, timeAxis.weekStartDay),\n // we rendered one upper header and need to calculate how many ticks fit in it\n ticksInHeader =\n Math.round(DateHelper.getDurationInUnit(startDate, endDate, lowerHeader.unit)) / (lowerHeader.increment || 1),\n nbrLinesToDraw =\n Math.round(DateHelper.getDurationInUnit(startDate, endDate, targetHeader.unit)) / (targetHeader.increment || 1),\n // shows how many ticks should we skip before drawing next line\n ratio = ticksInHeader / nbrLinesToDraw;\n\n if (client.isHorizontal) {\n if (axisStart) {\n const doUnitsAlign = headers.length > 1 && DateHelper.doesUnitsAlign(upperHeader.unit, targetHeader.unit),\n offsetDate = doUnitsAlign\n ? startDate\n : timeAxis.floorDate(axisStart, false, targetHeader.unit, targetHeader.increment),\n // TODO: isContinuous check solved the issue I was seeing but not very generic\n offset = !timeAxis.isContinuous\n ? 0\n : (DateHelper.getDurationInUnit(offsetDate, axisStart, lowerHeader.unit, true) / timeAxis.increment) *\n tickSize,\n // this is position from left side of the canvas to draw first line, otherwi\n startPos = 10,\n height = 20;\n\n DomHelper.removeEachSelector(element, '.b-column-line-major');\n\n let isMajor = false,\n majorHeaderIsRegular = true;\n\n if (\n targetHeader !== upperHeader &&\n doUnitsAlign &&\n lowerHeader.unit === 'day' &&\n DateHelper.compareUnits(upperHeader.unit, 'month') !== -1\n ) {\n // This condition means, that major lines are irregular, e.g. when lower level is days and upper is\n // months. Since months have different duration, we cannot safely repeat images\n majorHeaderIsRegular = false;\n timeAxis.forEachAuxInterval(upperHeader.unit, upperHeader.increment, (start, end) => {\n DomHelper.append(element, {\n tag: 'div',\n className: 'b-column-line-major',\n style: `left:${viewModel.getPositionFromDate(end) - 1}px;`\n });\n });\n }\n\n // hack for FF to not crash when trying to create too wide canvas.\n canvas.width = Math.min(ticksInHeader * 2 * tickSize, 32767);\n canvas.height = height;\n ctx.translate(-0.5, -0.5);\n ctx.lineWidth = 2;\n\n for (let i = 0; i < nbrLinesToDraw; i++) {\n // Only first interval may be major\n if (i === 0) {\n // Filtered time axis should not have any major lines\n isMajor = upperHeader !== targetHeader && doUnitsAlign && majorHeaderIsRegular && timeAxis.isContinuous;\n } else {\n isMajor = false;\n }\n\n const tickStyle = (isMajor && me.majorTickStyle) || (!isMajor && me.tickStyle);\n if (tickStyle !== 'solid') {\n switch (tickStyle) {\n case 'dashed':\n ctx.setLineDash([6, 4]);\n break;\n case 'dotted':\n ctx.setLineDash([2, 3]);\n break;\n }\n }\n\n ctx.beginPath();\n ctx.strokeStyle = isMajor ? me.majorTickColor : me.tickColor;\n\n // draw ticks\n ctx.moveTo(i * ratio * tickSize * 2 + startPos - 1, 0);\n ctx.lineTo(i * ratio * tickSize * 2 + startPos - 1, height + 2);\n ctx.stroke();\n }\n\n // use as background image\n element.style.backgroundImage = `url(${canvas.toDataURL()})`;\n element.style.backgroundSize = `${canvas.width / 2}px`;\n element.style.backgroundPositionX = `${-(startPos / 2 + offset)}px`;\n }\n } else {\n // hack for FF to not crash when trying to create too wide canvas.\n canvas.width = client.timeAxisColumn.resourceColumns.columnWidth * 2;\n canvas.height = 2;\n ctx.translate(-0.5, -0.5);\n ctx.lineWidth = 2;\n\n if (axisStart) {\n DomHelper.removeEachSelector(element, '.b-column-line-major');\n\n // Major lines always as divs to not get so large image\n if (targetHeader !== upperHeader) {\n timeAxis.forEachAuxInterval(upperHeader.unit, upperHeader.increment, (start, end) => {\n DomHelper.append(element, {\n tag: 'div',\n className: 'b-column-line-major',\n style: `top:${viewModel.getPositionFromDate(end) - 1}px;`\n });\n });\n }\n\n if (me.tickStyle !== 'solid') {\n switch (me.tickStyle) {\n case 'dashed':\n ctx.setLineDash([6, 4]);\n break;\n case 'dotted':\n ctx.setLineDash([2, 3]);\n break;\n }\n }\n\n const height = ratio * tickSize * 2;\n\n canvas.height = height;\n\n ctx.beginPath();\n ctx.strokeStyle = me.tickColor;\n ctx.lineWidth = 2;\n\n // draw ticks\n ctx.moveTo(0, height - 1);\n ctx.lineTo(canvas.width + 2, height - 1);\n ctx.stroke();\n }\n\n ctx.beginPath();\n ctx.strokeStyle = me.tickColor;\n\n // draw ticks\n ctx.moveTo(canvas.width - 1, 0);\n ctx.lineTo(canvas.width - 1, canvas.height + 2);\n ctx.stroke();\n\n // use as background image\n element.style.backgroundImage = `url(${canvas.toDataURL()})`;\n element.style.backgroundSize = `${canvas.width / 2}px`;\n element.style.backgroundPositionX = '0';\n }\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)};\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)};\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)};\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)};\n }", "function linesOnScroll() {\n $('.line-container').each(function () {\n w_h = $(window).height();\n winTop = $(window).scrollTop();\n elOffTop = $(this).offset().top;\n line = $(this).find('.vertical-line');\n elOffTop < winTop + w_h - 300 ? ($(this).addClass('active'), line.css({height: line.attr('data-height') + 'px'})) : ($(this).removeClass('active'), line.css({height: 0 + 'px'}));\n });\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = _lineAtHeight(doc, top),\n to = _lineAtHeight(doc, bottom); // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n\n\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line,\n ensureTo = viewport.ensure.to.line;\n\n if (ensureFrom < from) {\n from = ensureFrom;\n to = _lineAtHeight(doc, _heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = _lineAtHeight(doc, _heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n\n return {\n from: from,\n to: Math.max(to, from + 1)\n };\n } // SCROLLING THINGS INTO VIEW", "function updateHeightsInViewport(cm) {\n var display = cm.display;\n var prevBottom = display.lineDiv.offsetTop;\n\n for (var i = 0; i < display.view.length; i++) {\n var cur = display.view[i],\n wrapping = cm.options.lineWrapping;\n var height = void 0,\n width = 0;\n\n if (cur.hidden) {\n continue;\n }\n\n if (ie && ie_version < 8) {\n var bot = cur.node.offsetTop + cur.node.offsetHeight;\n height = bot - prevBottom;\n prevBottom = bot;\n } else {\n var box = cur.node.getBoundingClientRect();\n height = box.bottom - box.top; // Check that lines don't extend past the right of the current\n // editor width\n\n if (!wrapping && cur.text.firstChild) {\n width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1;\n }\n }\n\n var diff = cur.line.height - height;\n\n if (diff > .005 || diff < -.005) {\n updateLineHeight(cur.line, height);\n updateWidgetHeight(cur.line);\n\n if (cur.rest) {\n for (var j = 0; j < cur.rest.length; j++) {\n updateWidgetHeight(cur.rest[j]);\n }\n }\n }\n\n if (width > cm.display.sizerWidth) {\n var chWidth = Math.ceil(width / charWidth(cm.display));\n\n if (chWidth > cm.display.maxLineLength) {\n cm.display.maxLineLength = chWidth;\n cm.display.maxLine = cur.line;\n cm.display.maxLineChanged = true;\n }\n }\n }\n } // Read and store the height of line widgets associated with the", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from)\n return {from: ensureFrom,\n to: lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight)};\n if (Math.min(ensureTo, doc.lastLine()) >= to)\n return {from: lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight),\n to: ensureTo};\n }\n return {from: from, to: Math.max(to, from + 1)};\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from)\n return {from: ensureFrom,\n to: lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight)};\n if (Math.min(ensureTo, doc.lastLine()) >= to)\n return {from: lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight),\n to: ensureTo};\n }\n return {from: from, to: Math.max(to, from + 1)};\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from)\n return {from: ensureFrom,\n to: lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight)};\n if (Math.min(ensureTo, doc.lastLine()) >= to)\n return {from: lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight),\n to: ensureTo};\n }\n return {from: from, to: Math.max(to, from + 1)};\n }", "function visibleLines(display, doc, viewport) {\n\t var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n\t top = Math.floor(top - paddingTop(display));\n\t var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n\t var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n\t // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n\t // forces those lines into the viewport (if possible).\n\t if (viewport && viewport.ensure) {\n\t var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n\t if (ensureFrom < from) {\n\t from = ensureFrom;\n\t to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n\t } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n\t from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n\t to = ensureTo;\n\t }\n\t }\n\t return {from: from, to: Math.max(to, from + 1)};\n\t }", "function visibleLines(display, doc, viewport) {\n\t var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n\t top = Math.floor(top - paddingTop(display));\n\t var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n\t var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n\t // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n\t // forces those lines into the viewport (if possible).\n\t if (viewport && viewport.ensure) {\n\t var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n\t if (ensureFrom < from) {\n\t from = ensureFrom;\n\t to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n\t } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n\t from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n\t to = ensureTo;\n\t }\n\t }\n\t return {from: from, to: Math.max(to, from + 1)};\n\t }", "scroll(eraseAttr, isWrapped = false) {\n const buffer = this._bufferService.buffer;\n let newLine;\n newLine = this._cachedBlankLine;\n if (!newLine || newLine.length !== this.cols || newLine.getFg(0) !== eraseAttr.fg || newLine.getBg(0) !== eraseAttr.bg) {\n newLine = buffer.getBlankLine(eraseAttr, isWrapped);\n this._cachedBlankLine = newLine;\n }\n newLine.isWrapped = isWrapped;\n const topRow = buffer.ybase + buffer.scrollTop;\n const bottomRow = buffer.ybase + buffer.scrollBottom;\n if (buffer.scrollTop === 0) {\n // Determine whether the buffer is going to be trimmed after insertion.\n const willBufferBeTrimmed = buffer.lines.isFull;\n // Insert the line using the fastest method\n if (bottomRow === buffer.lines.length - 1) {\n if (willBufferBeTrimmed) {\n buffer.lines.recycle().copyFrom(newLine);\n }\n else {\n buffer.lines.push(newLine.clone());\n }\n }\n else {\n buffer.lines.splice(bottomRow + 1, 0, newLine.clone());\n }\n // Only adjust ybase and ydisp when the buffer is not trimmed\n if (!willBufferBeTrimmed) {\n buffer.ybase++;\n // Only scroll the ydisp with ybase if the user has not scrolled up\n if (!this._bufferService.isUserScrolling) {\n buffer.ydisp++;\n }\n }\n else {\n // When the buffer is full and the user has scrolled up, keep the text\n // stable unless ydisp is right at the top\n if (this._bufferService.isUserScrolling) {\n buffer.ydisp = Math.max(buffer.ydisp - 1, 0);\n }\n }\n }\n else {\n // scrollTop is non-zero which means no line will be going to the\n // scrollback, instead we can just shift them in-place.\n const scrollRegionHeight = bottomRow - topRow + 1 /* as it's zero-based */;\n buffer.lines.shiftElements(topRow + 1, scrollRegionHeight - 1, -1);\n buffer.lines.set(bottomRow, newLine.clone());\n }\n // Move the viewport to the bottom of the buffer unless the user is\n // scrolling.\n if (!this._bufferService.isUserScrolling) {\n buffer.ydisp = buffer.ybase;\n }\n // Flag rows that need updating\n this._dirtyRowService.markRangeDirty(buffer.scrollTop, buffer.scrollBottom);\n this._onScroll.fire(buffer.ydisp);\n }", "get viewportLineBlocks() {\n return this.viewState.viewportLines;\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop\n top = Math.floor(top - paddingTop(display))\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom)\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line\n if (ensureFrom < from) {\n from = ensureFrom\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight)\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight)\n to = ensureTo\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop\n top = Math.floor(top - paddingTop(display))\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom)\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line\n if (ensureFrom < from) {\n from = ensureFrom\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight)\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight)\n to = ensureTo\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n\t var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n\t top = Math.floor(top - paddingTop(display));\n\t var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\t\n\t var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n\t // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n\t // forces those lines into the viewport (if possible).\n\t if (viewport && viewport.ensure) {\n\t var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n\t if (ensureFrom < from) {\n\t from = ensureFrom;\n\t to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n\t } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n\t from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n\t to = ensureTo;\n\t }\n\t }\n\t return {from: from, to: Math.max(to, from + 1)};\n\t }", "function visibleLines(display, doc, viewport) {\r\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\r\n top = Math.floor(top - paddingTop(display));\r\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\r\n\r\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\r\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\r\n // forces those lines into the viewport (if possible).\r\n if (viewport && viewport.ensure) {\r\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\r\n if (ensureFrom < from)\r\n return {from: ensureFrom,\r\n to: lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight)};\r\n if (Math.min(ensureTo, doc.lastLine()) >= to)\r\n return {from: lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight),\r\n to: ensureTo};\r\n }\r\n return {from: from, to: Math.max(to, from + 1)};\r\n }", "function updateHeightsInViewport(cm) {\n var display = cm.display;\n var prevBottom = display.lineDiv.offsetTop;\n var viewTop = Math.max(0, display.scroller.getBoundingClientRect().top);\n var oldHeight = display.lineDiv.getBoundingClientRect().top;\n var mustScroll = 0;\n for (var i = 0; i < display.view.length; i++) {\n var cur = display.view[i], wrapping = cm.options.lineWrapping;\n var height = (void 0), width = 0;\n if (cur.hidden) { continue }\n oldHeight += cur.line.height;\n if (ie && ie_version < 8) {\n var bot = cur.node.offsetTop + cur.node.offsetHeight;\n height = bot - prevBottom;\n prevBottom = bot;\n } else {\n var box = cur.node.getBoundingClientRect();\n height = box.bottom - box.top;\n // Check that lines don't extend past the right of the current\n // editor width\n if (!wrapping && cur.text.firstChild)\n { width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1; }\n }\n var diff = cur.line.height - height;\n if (diff > .005 || diff < -.005) {\n if (oldHeight < viewTop) { mustScroll -= diff; }\n updateLineHeight(cur.line, height);\n updateWidgetHeight(cur.line);\n if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)\n { updateWidgetHeight(cur.rest[j]); } }\n }\n if (width > cm.display.sizerWidth) {\n var chWidth = Math.ceil(width / charWidth(cm.display));\n if (chWidth > cm.display.maxLineLength) {\n cm.display.maxLineLength = chWidth;\n cm.display.maxLine = cur.line;\n cm.display.maxLineChanged = true;\n }\n }\n }\n if (Math.abs(mustScroll) > 2) { display.scroller.scrollTop += mustScroll; }\n }", "function updateHeightsInViewport(cm) {\n var display = cm.display;\n var prevBottom = display.lineDiv.offsetTop;\n var viewTop = Math.max(0, display.scroller.getBoundingClientRect().top);\n var oldHeight = display.lineDiv.getBoundingClientRect().top;\n var mustScroll = 0;\n for (var i = 0; i < display.view.length; i++) {\n var cur = display.view[i], wrapping = cm.options.lineWrapping;\n var height = (void 0), width = 0;\n if (cur.hidden) { continue }\n oldHeight += cur.line.height;\n if (ie && ie_version < 8) {\n var bot = cur.node.offsetTop + cur.node.offsetHeight;\n height = bot - prevBottom;\n prevBottom = bot;\n } else {\n var box = cur.node.getBoundingClientRect();\n height = box.bottom - box.top;\n // Check that lines don't extend past the right of the current\n // editor width\n if (!wrapping && cur.text.firstChild)\n { width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1; }\n }\n var diff = cur.line.height - height;\n if (diff > .005 || diff < -.005) {\n if (oldHeight < viewTop) { mustScroll -= diff; }\n updateLineHeight(cur.line, height);\n updateWidgetHeight(cur.line);\n if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)\n { updateWidgetHeight(cur.rest[j]); } }\n }\n if (width > cm.display.sizerWidth) {\n var chWidth = Math.ceil(width / charWidth(cm.display));\n if (chWidth > cm.display.maxLineLength) {\n cm.display.maxLineLength = chWidth;\n cm.display.maxLine = cur.line;\n cm.display.maxLineChanged = true;\n }\n }\n }\n if (Math.abs(mustScroll) > 2) { display.scroller.scrollTop += mustScroll; }\n }", "function visibleLines(display, doc, viewport) {\n\t\t var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n\t\t top = Math.floor(top - paddingTop(display));\n\t\t var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n\t\t var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n\t\t // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n\t\t // forces those lines into the viewport (if possible).\n\t\t if (viewport && viewport.ensure) {\n\t\t var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n\t\t if (ensureFrom < from) {\n\t\t from = ensureFrom;\n\t\t to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n\t\t } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n\t\t from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n\t\t to = ensureTo;\n\t\t }\n\t\t }\n\t\t return {from: from, to: Math.max(to, from + 1)}\n\t\t }", "function appSalesLines(element, height) {}" ]
[ "0.7546182", "0.7546182", "0.7546182", "0.7546182", "0.7498462", "0.73648065", "0.73648065", "0.73648065", "0.73648065", "0.7262307", "0.7261923", "0.72531855", "0.72531855", "0.72531855", "0.72389436", "0.72389436", "0.71971226", "0.71971226", "0.71971226", "0.71971226", "0.71971226", "0.71971226", "0.71971226", "0.71971226", "0.71971226", "0.71971226", "0.71971226", "0.7183894", "0.69939774", "0.64053094", "0.6336004", "0.6295537", "0.606671", "0.606671", "0.606671", "0.60153365", "0.6012496", "0.5951712", "0.5945131", "0.5883071", "0.58672553", "0.5631831", "0.54943", "0.5490949", "0.54804903", "0.5453016", "0.5453016", "0.5453016", "0.5453016", "0.5453016", "0.5453016", "0.5453016", "0.5453016", "0.5453016", "0.5453016", "0.5453016", "0.5453016", "0.5453016", "0.5453016", "0.5453016", "0.5453016", "0.5453016", "0.5451039", "0.5451039", "0.5451039", "0.5451039", "0.54141736", "0.54131866", "0.5410151", "0.5403668", "0.5403668", "0.5403668", "0.5398929", "0.5398929", "0.53972524", "0.539282", "0.53916323", "0.53916323", "0.5379176", "0.53673357", "0.5364082", "0.5364082", "0.5363413", "0.53531545" ]
0.7377386
20
Find a line map (mapping character offsets to text nodes) and a measurement cache for the given line number. (A line view might contain multiple lines when collapsed ranges are present.)
function mapFromLineView(lineView, line, lineN) { if (lineView.line == line) { return {map: lineView.measure.map, cache: lineView.measure.cache} } for (var i = 0; i < lineView.rest.length; i++) { if (lineView.rest[i] == line) { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } } for (var i$1 = 0; i$1 < lineView.rest.length; i$1++) { if (lineNo(lineView.rest[i$1]) > lineN) { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line) {\n return {\n map: lineView.measure.map,\n cache: lineView.measure.cache\n };\n }\n\n for (var i = 0; i < lineView.rest.length; i++) {\n if (lineView.rest[i] == line) {\n return {\n map: lineView.measure.maps[i],\n cache: lineView.measure.caches[i]\n };\n }\n }\n\n for (var i$1 = 0; i$1 < lineView.rest.length; i$1++) {\n if (lineNo(lineView.rest[i$1]) > lineN) {\n return {\n map: lineView.measure.maps[i$1],\n cache: lineView.measure.caches[i$1],\n before: true\n };\n }\n }\n } // Render a line into the hidden node display.externalMeasured. Used", "function mapFromLineView(lineView, line, lineN) {\n\t\t if (lineView.line == line)\n\t\t { return {map: lineView.measure.map, cache: lineView.measure.cache} }\n\t\t if (lineView.rest) {\n\t\t for (var i = 0; i < lineView.rest.length; i++)\n\t\t { if (lineView.rest[i] == line)\n\t\t { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }\n\t\t for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)\n\t\t { if (lineNo(lineView.rest[i$1]) > lineN)\n\t\t { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }\n\t\t }\n\t\t }", "function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line)\n { return {map: lineView.measure.map, cache: lineView.measure.cache} }\n if (lineView.rest) {\n for (var i = 0; i < lineView.rest.length; i++)\n { if (lineView.rest[i] == line)\n { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }\n for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)\n { if (lineNo(lineView.rest[i$1]) > lineN)\n { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }\n }\n }", "function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line)\n { return {map: lineView.measure.map, cache: lineView.measure.cache} }\n if (lineView.rest) {\n for (var i = 0; i < lineView.rest.length; i++)\n { if (lineView.rest[i] == line)\n { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }\n for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)\n { if (lineNo(lineView.rest[i$1]) > lineN)\n { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }\n }\n }", "function mapFromLineView(lineView, line, lineN) {\r\n if (lineView.line == line)\r\n { return { map: lineView.measure.map, cache: lineView.measure.cache, before: false }; }\r\n for (var i = 0; i < lineView.rest.length; i++)\r\n { if (lineView.rest[i] == line)\r\n { return { map: lineView.measure.maps[i], cache: lineView.measure.caches[i], before: false }; } }\r\n for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)\r\n { if (lineView.rest[i$1].lineNo() > lineN)\r\n { return { map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true }; } }\r\n }", "function mapFromLineView(lineView, line, lineN) {\n\t\t if (lineView.line == line)\n\t\t return {map: lineView.measure.map, cache: lineView.measure.cache};\n\t\t for (var i = 0; i < lineView.rest.length; i++)\n\t\t if (lineView.rest[i] == line)\n\t\t return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]};\n\t\t for (var i = 0; i < lineView.rest.length; i++)\n\t\t if (lineNo(lineView.rest[i]) > lineN)\n\t\t return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i], before: true};\n\t\t }", "function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line)\n return {map: lineView.measure.map, cache: lineView.measure.cache};\n for (var i = 0; i < lineView.rest.length; i++)\n if (lineView.rest[i] == line)\n return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]};\n for (var i = 0; i < lineView.rest.length; i++)\n if (lineNo(lineView.rest[i]) > lineN)\n return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i], before: true};\n }", "function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line)\n return {map: lineView.measure.map, cache: lineView.measure.cache};\n for (var i = 0; i < lineView.rest.length; i++)\n if (lineView.rest[i] == line)\n return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]};\n for (var i = 0; i < lineView.rest.length; i++)\n if (lineNo(lineView.rest[i]) > lineN)\n return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i], before: true};\n }", "function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line)\n return {map: lineView.measure.map, cache: lineView.measure.cache};\n for (var i = 0; i < lineView.rest.length; i++)\n if (lineView.rest[i] == line)\n return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]};\n for (var i = 0; i < lineView.rest.length; i++)\n if (lineNo(lineView.rest[i]) > lineN)\n return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i], before: true};\n }", "function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line)\n return {map: lineView.measure.map, cache: lineView.measure.cache};\n for (var i = 0; i < lineView.rest.length; i++)\n if (lineView.rest[i] == line)\n return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]};\n for (var i = 0; i < lineView.rest.length; i++)\n if (lineNo(lineView.rest[i]) > lineN)\n return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i], before: true};\n }", "function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line)\n return {map: lineView.measure.map, cache: lineView.measure.cache};\n for (var i = 0; i < lineView.rest.length; i++)\n if (lineView.rest[i] == line)\n return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]};\n for (var i = 0; i < lineView.rest.length; i++)\n if (lineNo(lineView.rest[i]) > lineN)\n return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i], before: true};\n }", "function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line)\n return {map: lineView.measure.map, cache: lineView.measure.cache};\n for (var i = 0; i < lineView.rest.length; i++)\n if (lineView.rest[i] == line)\n return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]};\n for (var i = 0; i < lineView.rest.length; i++)\n if (lineNo(lineView.rest[i]) > lineN)\n return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i], before: true};\n }", "function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line)\n return {map: lineView.measure.map, cache: lineView.measure.cache};\n for (var i = 0; i < lineView.rest.length; i++)\n if (lineView.rest[i] == line)\n return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]};\n for (var i = 0; i < lineView.rest.length; i++)\n if (lineNo(lineView.rest[i]) > lineN)\n return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i], before: true};\n }", "function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line)\n return {map: lineView.measure.map, cache: lineView.measure.cache};\n for (var i = 0; i < lineView.rest.length; i++)\n if (lineView.rest[i] == line)\n return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]};\n for (var i = 0; i < lineView.rest.length; i++)\n if (lineNo(lineView.rest[i]) > lineN)\n return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i], before: true};\n }", "function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line)\n { return {map: lineView.measure.map, cache: lineView.measure.cache} }\n for (var i = 0; i < lineView.rest.length; i++)\n { if (lineView.rest[i] == line)\n { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }\n for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)\n { if (lineNo(lineView.rest[i$1]) > lineN)\n { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }\n}", "function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line)\n { return {map: lineView.measure.map, cache: lineView.measure.cache} }\n for (var i = 0; i < lineView.rest.length; i++)\n { if (lineView.rest[i] == line)\n { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }\n for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)\n { if (lineNo(lineView.rest[i$1]) > lineN)\n { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }\n}", "function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line)\n { return {map: lineView.measure.map, cache: lineView.measure.cache} }\n for (var i = 0; i < lineView.rest.length; i++)\n { if (lineView.rest[i] == line)\n { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }\n for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)\n { if (lineNo(lineView.rest[i$1]) > lineN)\n { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }\n}", "function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line)\n { return {map: lineView.measure.map, cache: lineView.measure.cache} }\n for (var i = 0; i < lineView.rest.length; i++)\n { if (lineView.rest[i] == line)\n { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }\n for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)\n { if (lineNo(lineView.rest[i$1]) > lineN)\n { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }\n}", "function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line)\n { return {map: lineView.measure.map, cache: lineView.measure.cache} }\n for (var i = 0; i < lineView.rest.length; i++)\n { if (lineView.rest[i] == line)\n { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }\n for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)\n { if (lineNo(lineView.rest[i$1]) > lineN)\n { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }\n}", "function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line)\n { return {map: lineView.measure.map, cache: lineView.measure.cache} }\n for (var i = 0; i < lineView.rest.length; i++)\n { if (lineView.rest[i] == line)\n { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }\n for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)\n { if (lineNo(lineView.rest[i$1]) > lineN)\n { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }\n}", "function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line)\n { return {map: lineView.measure.map, cache: lineView.measure.cache} }\n for (var i = 0; i < lineView.rest.length; i++)\n { if (lineView.rest[i] == line)\n { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }\n for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)\n { if (lineNo(lineView.rest[i$1]) > lineN)\n { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }\n}", "function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line)\n { return {map: lineView.measure.map, cache: lineView.measure.cache} }\n for (var i = 0; i < lineView.rest.length; i++)\n { if (lineView.rest[i] == line)\n { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }\n for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)\n { if (lineNo(lineView.rest[i$1]) > lineN)\n { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }\n}", "function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line)\n { return {map: lineView.measure.map, cache: lineView.measure.cache} }\n for (var i = 0; i < lineView.rest.length; i++)\n { if (lineView.rest[i] == line)\n { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }\n for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)\n { if (lineNo(lineView.rest[i$1]) > lineN)\n { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }\n}", "function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line)\n { return {map: lineView.measure.map, cache: lineView.measure.cache} }\n for (var i = 0; i < lineView.rest.length; i++)\n { if (lineView.rest[i] == line)\n { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }\n for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)\n { if (lineNo(lineView.rest[i$1]) > lineN)\n { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }\n}", "function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line)\n { return {map: lineView.measure.map, cache: lineView.measure.cache} }\n for (var i = 0; i < lineView.rest.length; i++)\n { if (lineView.rest[i] == line)\n { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }\n for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)\n { if (lineNo(lineView.rest[i$1]) > lineN)\n { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }\n}", "function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line)\n { return {map: lineView.measure.map, cache: lineView.measure.cache} }\n for (var i = 0; i < lineView.rest.length; i++)\n { if (lineView.rest[i] == line)\n { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }\n for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)\n { if (lineNo(lineView.rest[i$1]) > lineN)\n { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }\n}", "function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line)\n { return {map: lineView.measure.map, cache: lineView.measure.cache} }\n for (var i = 0; i < lineView.rest.length; i++)\n { if (lineView.rest[i] == line)\n { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }\n for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)\n { if (lineNo(lineView.rest[i$1]) > lineN)\n { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }\n}", "function mapFromLineView(lineView, line, lineN) {\n\t if (lineView.line == line)\n\t return {map: lineView.measure.map, cache: lineView.measure.cache};\n\t for (var i = 0; i < lineView.rest.length; i++)\n\t if (lineView.rest[i] == line)\n\t return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]};\n\t for (var i = 0; i < lineView.rest.length; i++)\n\t if (lineNo(lineView.rest[i]) > lineN)\n\t return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i], before: true};\n\t }", "function mapFromLineView(lineView, line, lineN) {\n\t if (lineView.line == line)\n\t return {map: lineView.measure.map, cache: lineView.measure.cache};\n\t for (var i = 0; i < lineView.rest.length; i++)\n\t if (lineView.rest[i] == line)\n\t return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]};\n\t for (var i = 0; i < lineView.rest.length; i++)\n\t if (lineNo(lineView.rest[i]) > lineN)\n\t return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i], before: true};\n\t }", "function mapFromLineView(lineView, line, lineN) {\n\t if (lineView.line == line)\n\t return {map: lineView.measure.map, cache: lineView.measure.cache};\n\t for (var i = 0; i < lineView.rest.length; i++)\n\t if (lineView.rest[i] == line)\n\t return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]};\n\t for (var i = 0; i < lineView.rest.length; i++)\n\t if (lineNo(lineView.rest[i]) > lineN)\n\t return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i], before: true};\n\t }", "function mapFromLineView(lineView, line, lineN) {\r\n if (lineView.line == line)\r\n { return {map: lineView.measure.map, cache: lineView.measure.cache} }\r\n for (var i = 0; i < lineView.rest.length; i++)\r\n { if (lineView.rest[i] == line)\r\n { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }\r\n for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)\r\n { if (lineNo(lineView.rest[i$1]) > lineN)\r\n { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }\r\n}", "function mapFromLineView(lineView, line, lineN) {\r\n if (lineView.line == line)\r\n return {map: lineView.measure.map, cache: lineView.measure.cache};\r\n for (var i = 0; i < lineView.rest.length; i++)\r\n if (lineView.rest[i] == line)\r\n return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]};\r\n for (var i = 0; i < lineView.rest.length; i++)\r\n if (lineNo(lineView.rest[i]) > lineN)\r\n return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i], before: true};\r\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null\n lineView.measure = ext.measure\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null\n lineView.measure = ext.measure\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built;\n }\n return buildLineContent(cm, lineView);\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built;\n }\n return buildLineContent(cm, lineView);\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built;\n }\n return buildLineContent(cm, lineView);\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built;\n }\n return buildLineContent(cm, lineView);\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built;\n }\n return buildLineContent(cm, lineView);\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built;\n }\n return buildLineContent(cm, lineView);\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built;\n }\n return buildLineContent(cm, lineView);\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built;\n }\n return buildLineContent(cm, lineView);\n }", "function getLineContent(cm, lineView) {\r\n var ext = cm.display.externalMeasured;\r\n if (ext && ext.line == lineView.line) {\r\n cm.display.externalMeasured = null;\r\n lineView.measure = ext.measure;\r\n return ext.built\r\n }\r\n return buildLineContent(cm, lineView)\r\n}", "function getLineContent(cm, lineView) {\r\n var ext = cm.display.externalMeasured;\r\n if (ext && ext.line == lineView.line) {\r\n cm.display.externalMeasured = null;\r\n lineView.measure = ext.measure;\r\n return ext.built;\r\n }\r\n return buildLineContent(cm, lineView);\r\n }", "function getLineContent(cm, lineView) {\n\t\t var ext = cm.display.externalMeasured;\n\t\t if (ext && ext.line == lineView.line) {\n\t\t cm.display.externalMeasured = null;\n\t\t lineView.measure = ext.measure;\n\t\t return ext.built;\n\t\t }\n\t\t return buildLineContent(cm, lineView);\n\t\t }", "function getLineContent(cm, lineView) {\n\t var ext = cm.display.externalMeasured;\n\t if (ext && ext.line == lineView.line) {\n\t cm.display.externalMeasured = null;\n\t lineView.measure = ext.measure;\n\t return ext.built;\n\t }\n\t return buildLineContent(cm, lineView);\n\t }", "function getLineContent(cm, lineView) {\n\t var ext = cm.display.externalMeasured;\n\t if (ext && ext.line == lineView.line) {\n\t cm.display.externalMeasured = null;\n\t lineView.measure = ext.measure;\n\t return ext.built;\n\t }\n\t return buildLineContent(cm, lineView);\n\t }", "function getLineContent(cm, lineView) {\n\t var ext = cm.display.externalMeasured;\n\t if (ext && ext.line == lineView.line) {\n\t cm.display.externalMeasured = null;\n\t lineView.measure = ext.measure;\n\t return ext.built;\n\t }\n\t return buildLineContent(cm, lineView);\n\t }", "function getLineContent(cm, lineView) {\n\t\t var ext = cm.display.externalMeasured;\n\t\t if (ext && ext.line == lineView.line) {\n\t\t cm.display.externalMeasured = null;\n\t\t lineView.measure = ext.measure;\n\t\t return ext.built\n\t\t }\n\t\t return buildLineContent(cm, lineView)\n\t\t }", "function prepareMeasureForLine(cm, line) {\n\t var lineN = lineNo(line);\n\t var view = findViewForLine(cm, lineN);\n\t if (view && !view.text) {\n\t view = null;\n\t } else if (view && view.changes) {\n\t updateLineForChanges(cm, view, lineN, getDimensions(cm));\n\t cm.curOp.forceUpdate = true;\n\t }\n\t if (!view)\n\t view = updateExternalMeasurement(cm, line);\n\n\t var info = mapFromLineView(view, line, lineN);\n\t return {\n\t line: line, view: view, rect: null,\n\t map: info.map, cache: info.cache, before: info.before,\n\t hasHeights: false\n\t };\n\t }", "function prepareMeasureForLine(cm, line) {\n\t var lineN = lineNo(line);\n\t var view = findViewForLine(cm, lineN);\n\t if (view && !view.text) {\n\t view = null;\n\t } else if (view && view.changes) {\n\t updateLineForChanges(cm, view, lineN, getDimensions(cm));\n\t cm.curOp.forceUpdate = true;\n\t }\n\t if (!view)\n\t view = updateExternalMeasurement(cm, line);\n\n\t var info = mapFromLineView(view, line, lineN);\n\t return {\n\t line: line, view: view, rect: null,\n\t map: info.map, cache: info.cache, before: info.before,\n\t hasHeights: false\n\t };\n\t }", "function prepareMeasureForLine(cm, line) {\n\t\t var lineN = lineNo(line);\n\t\t var view = findViewForLine(cm, lineN);\n\t\t if (view && !view.text) {\n\t\t view = null;\n\t\t } else if (view && view.changes) {\n\t\t updateLineForChanges(cm, view, lineN, getDimensions(cm));\n\t\t cm.curOp.forceUpdate = true;\n\t\t }\n\t\t if (!view)\n\t\t view = updateExternalMeasurement(cm, line);\n\t\t\n\t\t var info = mapFromLineView(view, line, lineN);\n\t\t return {\n\t\t line: line, view: view, rect: null,\n\t\t map: info.map, cache: info.cache, before: info.before,\n\t\t hasHeights: false\n\t\t };\n\t\t }", "function prepareMeasureForLine(cm, line) {\n\t var lineN = lineNo(line);\n\t var view = findViewForLine(cm, lineN);\n\t if (view && !view.text) {\n\t view = null;\n\t } else if (view && view.changes) {\n\t updateLineForChanges(cm, view, lineN, getDimensions(cm));\n\t cm.curOp.forceUpdate = true;\n\t }\n\t if (!view)\n\t view = updateExternalMeasurement(cm, line);\n\t\n\t var info = mapFromLineView(view, line, lineN);\n\t return {\n\t line: line, view: view, rect: null,\n\t map: info.map, cache: info.cache, before: info.before,\n\t hasHeights: false\n\t };\n\t }", "function prepareMeasureForLine(cm, line) {\n var lineN = lineNo(line);\n var view = findViewForLine(cm, lineN);\n if (view && !view.text) {\n view = null;\n } else if (view && view.changes) {\n updateLineForChanges(cm, view, lineN, getDimensions(cm));\n cm.curOp.forceUpdate = true;\n }\n if (!view)\n { view = updateExternalMeasurement(cm, line); }\n\n var info = mapFromLineView(view, line, lineN);\n return {\n line: line, view: view, rect: null,\n map: info.map, cache: info.cache, before: info.before,\n hasHeights: false\n }\n }", "function prepareMeasureForLine(cm, line) {\n var lineN = lineNo(line);\n var view = findViewForLine(cm, lineN);\n if (view && !view.text) {\n view = null;\n } else if (view && view.changes) {\n updateLineForChanges(cm, view, lineN, getDimensions(cm));\n cm.curOp.forceUpdate = true;\n }\n if (!view)\n { view = updateExternalMeasurement(cm, line); }\n\n var info = mapFromLineView(view, line, lineN);\n return {\n line: line, view: view, rect: null,\n map: info.map, cache: info.cache, before: info.before,\n hasHeights: false\n }\n }", "function prepareMeasureForLine(cm, line) {\n var lineN = lineNo(line);\n var view = findViewForLine(cm, lineN);\n if (view && !view.text) {\n view = null;\n } else if (view && view.changes) {\n updateLineForChanges(cm, view, lineN, getDimensions(cm));\n cm.curOp.forceUpdate = true;\n }\n if (!view)\n { view = updateExternalMeasurement(cm, line); }\n\n var info = mapFromLineView(view, line, lineN);\n return {\n line: line, view: view, rect: null,\n map: info.map, cache: info.cache, before: info.before,\n hasHeights: false\n }\n }", "function prepareMeasureForLine(cm, line) {\n var lineN = lineNo(line);\n var view = findViewForLine(cm, lineN);\n if (view && !view.text) {\n view = null;\n } else if (view && view.changes) {\n updateLineForChanges(cm, view, lineN, getDimensions(cm));\n cm.curOp.forceUpdate = true;\n }\n if (!view)\n { view = updateExternalMeasurement(cm, line); }\n\n var info = mapFromLineView(view, line, lineN);\n return {\n line: line, view: view, rect: null,\n map: info.map, cache: info.cache, before: info.before,\n hasHeights: false\n }\n }", "function prepareMeasureForLine(cm, line) {\n var lineN = lineNo(line);\n var view = findViewForLine(cm, lineN);\n if (view && !view.text) {\n view = null;\n } else if (view && view.changes) {\n updateLineForChanges(cm, view, lineN, getDimensions(cm));\n cm.curOp.forceUpdate = true;\n }\n if (!view)\n { view = updateExternalMeasurement(cm, line); }\n\n var info = mapFromLineView(view, line, lineN);\n return {\n line: line, view: view, rect: null,\n map: info.map, cache: info.cache, before: info.before,\n hasHeights: false\n }\n }" ]
[ "0.75483626", "0.7491622", "0.74201775", "0.74201775", "0.74123937", "0.74108994", "0.7395338", "0.7395338", "0.7395338", "0.7395338", "0.7395338", "0.7395338", "0.7395338", "0.7395338", "0.73932946", "0.73932946", "0.73932946", "0.73932946", "0.73932946", "0.73932946", "0.73932946", "0.73932946", "0.73932946", "0.73932946", "0.73932946", "0.73932946", "0.73932946", "0.7375367", "0.7375367", "0.7375367", "0.735419", "0.7351716", "0.6049528", "0.6049528", "0.6049528", "0.6049528", "0.6049528", "0.6049528", "0.6049528", "0.6049528", "0.6049528", "0.6049528", "0.6049528", "0.6049528", "0.6049528", "0.6049528", "0.6049528", "0.6049528", "0.6049528", "0.60444224", "0.60444224", "0.60444224", "0.60444224", "0.60444224", "0.60444224", "0.60444224", "0.60444224", "0.60444224", "0.60444224", "0.60444224", "0.6036798", "0.6036798", "0.6035709", "0.6035709", "0.6035709", "0.6035709", "0.6035709", "0.6035709", "0.6035709", "0.6035709", "0.60144687", "0.6009757", "0.60036206", "0.5999518", "0.5999518", "0.5999518", "0.5998861", "0.5943762", "0.5943762", "0.5943538", "0.59253246", "0.59229094", "0.59229094", "0.59229094", "0.59229094", "0.59229094" ]
0.7439926
11
Render a line into the hidden node display.externalMeasured. Used when measurement is needed for a line that's not in the viewport.
function updateExternalMeasurement(cm, line) { line = visualLine(line); var lineN = lineNo(line); var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN); view.lineN = lineN; var built = view.built = buildLineContent(cm, view); view.text = built.pre; removeChildrenAndAdd(cm.display.lineMeasure, built.pre); return view }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view;\n } // Get a {top, bottom, left, right} box (in line-local coordinates)", "function updateExternalMeasurement(cm, line) {\r\n line = visualLine(line);\r\n var lineN = lineNo(line);\r\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\r\n view.lineN = lineN;\r\n var built = view.built = buildLineContent(cm, view);\r\n view.text = built.pre;\r\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\r\n return view;\r\n }", "function updateExternalMeasurement(cm, line) {\n\t\t line = visualLine(line);\n\t\t var lineN = lineNo(line);\n\t\t var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n\t\t view.lineN = lineN;\n\t\t var built = view.built = buildLineContent(cm, view);\n\t\t view.text = built.pre;\n\t\t removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n\t\t return view\n\t\t }", "function updateExternalMeasurement(cm, line) {\n\t\t line = visualLine(line);\n\t\t var lineN = lineNo(line);\n\t\t var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n\t\t view.lineN = lineN;\n\t\t var built = view.built = buildLineContent(cm, view);\n\t\t view.text = built.pre;\n\t\t removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n\t\t return view;\n\t\t }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view;\n }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view;\n }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view;\n }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view;\n }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view;\n }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view;\n }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view;\n }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view;\n }", "function updateExternalMeasurement(cm, line) {\r\n line = visualLine(line);\r\n var lineN = lineNo(line);\r\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\r\n view.lineN = lineN;\r\n var built = view.built = buildLineContent(cm, view);\r\n view.text = built.pre;\r\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\r\n return view\r\n}", "function updateExternalMeasurement(cm, line) {\n\t line = visualLine(line);\n\t var lineN = lineNo(line);\n\t var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n\t view.lineN = lineN;\n\t var built = view.built = buildLineContent(cm, view);\n\t view.text = built.pre;\n\t removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n\t return view;\n\t }", "function updateExternalMeasurement(cm, line) {\n\t line = visualLine(line);\n\t var lineN = lineNo(line);\n\t var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n\t view.lineN = lineN;\n\t var built = view.built = buildLineContent(cm, view);\n\t view.text = built.pre;\n\t removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n\t return view;\n\t }", "function updateExternalMeasurement(cm, line) {\n\t line = visualLine(line);\n\t var lineN = lineNo(line);\n\t var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n\t view.lineN = lineN;\n\t var built = view.built = buildLineContent(cm, view);\n\t view.text = built.pre;\n\t removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n\t return view;\n\t }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line)\n var lineN = lineNo(line)\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN)\n view.lineN = lineN\n var built = view.built = buildLineContent(cm, view)\n view.text = built.pre\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre)\n return view\n}", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line)\n var lineN = lineNo(line)\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN)\n view.lineN = lineN\n var built = view.built = buildLineContent(cm, view)\n view.text = built.pre\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre)\n return view\n}", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n}", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n}", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n}", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n}", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n}", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n}", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n}", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n}", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n}", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n}", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n}", "function getLineContent(cm, lineView) {\n\t\t var ext = cm.display.externalMeasured;\n\t\t if (ext && ext.line == lineView.line) {\n\t\t cm.display.externalMeasured = null;\n\t\t lineView.measure = ext.measure;\n\t\t return ext.built\n\t\t }\n\t\t return buildLineContent(cm, lineView)\n\t\t }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built;\n }\n return buildLineContent(cm, lineView);\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built;\n }\n return buildLineContent(cm, lineView);\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built;\n }\n return buildLineContent(cm, lineView);\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built;\n }\n return buildLineContent(cm, lineView);\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built;\n }\n return buildLineContent(cm, lineView);\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built;\n }\n return buildLineContent(cm, lineView);\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built;\n }\n return buildLineContent(cm, lineView);\n }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built;\n }\n return buildLineContent(cm, lineView);\n }", "function getLineContent(cm, lineView) {\n\t\t var ext = cm.display.externalMeasured;\n\t\t if (ext && ext.line == lineView.line) {\n\t\t cm.display.externalMeasured = null;\n\t\t lineView.measure = ext.measure;\n\t\t return ext.built;\n\t\t }\n\t\t return buildLineContent(cm, lineView);\n\t\t }", "function getLineContent(cm, lineView) {\r\n var ext = cm.display.externalMeasured;\r\n if (ext && ext.line == lineView.line) {\r\n cm.display.externalMeasured = null;\r\n lineView.measure = ext.measure;\r\n return ext.built;\r\n }\r\n return buildLineContent(cm, lineView);\r\n }", "function getLineContent(cm, lineView) {\r\n var ext = cm.display.externalMeasured;\r\n if (ext && ext.line == lineView.line) {\r\n cm.display.externalMeasured = null;\r\n lineView.measure = ext.measure;\r\n return ext.built\r\n }\r\n return buildLineContent(cm, lineView)\r\n}", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null\n lineView.measure = ext.measure\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null\n lineView.measure = ext.measure\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}", "function getLineContent(cm, lineView) {\n\t var ext = cm.display.externalMeasured;\n\t if (ext && ext.line == lineView.line) {\n\t cm.display.externalMeasured = null;\n\t lineView.measure = ext.measure;\n\t return ext.built;\n\t }\n\t return buildLineContent(cm, lineView);\n\t }", "function getLineContent(cm, lineView) {\n\t var ext = cm.display.externalMeasured;\n\t if (ext && ext.line == lineView.line) {\n\t cm.display.externalMeasured = null;\n\t lineView.measure = ext.measure;\n\t return ext.built;\n\t }\n\t return buildLineContent(cm, lineView);\n\t }", "function getLineContent(cm, lineView) {\n\t var ext = cm.display.externalMeasured;\n\t if (ext && ext.line == lineView.line) {\n\t cm.display.externalMeasured = null;\n\t lineView.measure = ext.measure;\n\t return ext.built;\n\t }\n\t return buildLineContent(cm, lineView);\n\t }", "function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built;\n }\n\n return buildLineContent(cm, lineView);\n } // Redraw the line's text. Interacts with the background and text", "function visualLine(line) {\n\t\t var merged;\n\t\t while (merged = collapsedSpanAtStart(line))\n\t\t { line = merged.find(-1, true).line; }\n\t\t return line\n\t\t }", "function visualLine(line) {\n\t\t var merged;\n\t\t while (merged = collapsedSpanAtStart(line))\n\t\t line = merged.find(-1, true).line;\n\t\t return line;\n\t\t }", "function visualLine(line) {\r\n var merged;\r\n while (merged = collapsedSpanAtStart(line))\r\n line = merged.find(-1, true).line;\r\n return line;\r\n }", "function visualLine(line) {\n\t var merged;\n\t while (merged = collapsedSpanAtStart(line))\n\t line = merged.find(-1, true).line;\n\t return line;\n\t }", "function visualLine(line) {\n\t var merged;\n\t while (merged = collapsedSpanAtStart(line))\n\t line = merged.find(-1, true).line;\n\t return line;\n\t }", "function visualLine(line) {\n\t var merged;\n\t while (merged = collapsedSpanAtStart(line))\n\t line = merged.find(-1, true).line;\n\t return line;\n\t }", "function visualLine(line) {\r\n var merged;\r\n while (merged = collapsedSpanAtStart(line))\r\n { line = merged.find(-1, true).line; }\r\n return line\r\n}", "function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n { line = merged.find(-1, true).line; }\n return line\n }", "function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n { line = merged.find(-1, true).line; }\n return line\n }" ]
[ "0.75342", "0.7487335", "0.7484259", "0.74745804", "0.74694103", "0.74694103", "0.74694103", "0.74694103", "0.74694103", "0.74694103", "0.74694103", "0.74694103", "0.74650806", "0.7460484", "0.7460484", "0.7460484", "0.7459808", "0.7459808", "0.74311703", "0.74311703", "0.74311703", "0.74311703", "0.74311703", "0.74311703", "0.74311703", "0.74311703", "0.74311703", "0.74311703", "0.74311703", "0.6883545", "0.68749315", "0.68749315", "0.68749315", "0.68749315", "0.68749315", "0.68749315", "0.68749315", "0.68749315", "0.68749315", "0.68749315", "0.68749315", "0.68749315", "0.68749315", "0.68749315", "0.68749315", "0.68749315", "0.68749315", "0.6797791", "0.6797791", "0.6797791", "0.6797791", "0.6797791", "0.6797791", "0.6797791", "0.6797791", "0.67892885", "0.6769597", "0.6742036", "0.6739001", "0.6739001", "0.6739001", "0.6739001", "0.6739001", "0.6739001", "0.6739001", "0.6739001", "0.6739001", "0.6739001", "0.6739001", "0.6734921", "0.6734921", "0.67065674", "0.67065674", "0.67065674", "0.6444761", "0.6295508", "0.6285934", "0.6260222", "0.6240616", "0.6240616", "0.6240616", "0.623732", "0.6235701", "0.6235701" ]
0.7475978
14
Find a line view that corresponds to the given line number.
function findViewForLine(cm, lineN) { if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo) { return cm.display.view[findViewIndex(cm, lineN)] } var ext = cm.display.externalMeasured; if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size) { return ext } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n return cm.display.view[findViewIndex(cm, lineN)];\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n return ext;\n }", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n return cm.display.view[findViewIndex(cm, lineN)];\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n return ext;\n }", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n return cm.display.view[findViewIndex(cm, lineN)];\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n return ext;\n }", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n return cm.display.view[findViewIndex(cm, lineN)];\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n return ext;\n }", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n return cm.display.view[findViewIndex(cm, lineN)];\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n return ext;\n }", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n return cm.display.view[findViewIndex(cm, lineN)];\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n return ext;\n }", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n return cm.display.view[findViewIndex(cm, lineN)];\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n return ext;\n }", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n return cm.display.view[findViewIndex(cm, lineN)];\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n return ext;\n }", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n}", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n}", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n}", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n}", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n}", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n}", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n}", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n}", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n}", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n}", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n}", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n}", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n}", "function findViewForLine(cm, lineN) {\n\t if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n\t return cm.display.view[findViewIndex(cm, lineN)];\n\t var ext = cm.display.externalMeasured;\n\t if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n\t return ext;\n\t }", "function findViewForLine(cm, lineN) {\n\t if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n\t return cm.display.view[findViewIndex(cm, lineN)];\n\t var ext = cm.display.externalMeasured;\n\t if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n\t return ext;\n\t }", "function findViewForLine(cm, lineN) {\n\t if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n\t return cm.display.view[findViewIndex(cm, lineN)];\n\t var ext = cm.display.externalMeasured;\n\t if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n\t return ext;\n\t }", "function findViewForLine(cm, lineN) {\r\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\r\n { return cm.display.view[findViewIndex(cm, lineN)] }\r\n var ext = cm.display.externalMeasured;\r\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\r\n { return ext }\r\n}", "function findViewForLine(cm, lineN) {\n\t\t if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n\t\t return cm.display.view[findViewIndex(cm, lineN)];\n\t\t var ext = cm.display.externalMeasured;\n\t\t if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n\t\t return ext;\n\t\t }", "function findViewForLine(cm, lineN) {\r\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\r\n { return cm.display.view[findViewIndex(cm, lineN)]; }\r\n var ext = cm.display.externalMeasured;\r\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\r\n { return ext; }\r\n }", "function findViewForLine(cm, lineN) {\n\t\t if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n\t\t { return cm.display.view[findViewIndex(cm, lineN)] }\n\t\t var ext = cm.display.externalMeasured;\n\t\t if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n\t\t { return ext }\n\t\t }", "function findViewForLine(cm, lineN) {\r\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\r\n return cm.display.view[findViewIndex(cm, lineN)];\r\n var ext = cm.display.externalMeasured;\r\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\r\n return ext;\r\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line; // Continuing lines, if any\n\n this.rest = visualLineContinued(line); // Number of logical lines in this visual line\n\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n } // Create a range of LineView objects for the given lines.", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line\n // Continuing lines, if any\n this.rest = visualLineContinued(line)\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1\n this.node = this.text = null\n this.hidden = lineIsHidden(doc, line)\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line\n // Continuing lines, if any\n this.rest = visualLineContinued(line)\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1\n this.node = this.text = null\n this.hidden = lineIsHidden(doc, line)\n}", "function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line) {\n return {\n map: lineView.measure.map,\n cache: lineView.measure.cache\n };\n }\n\n for (var i = 0; i < lineView.rest.length; i++) {\n if (lineView.rest[i] == line) {\n return {\n map: lineView.measure.maps[i],\n cache: lineView.measure.caches[i]\n };\n }\n }\n\n for (var i$1 = 0; i$1 < lineView.rest.length; i$1++) {\n if (lineNo(lineView.rest[i$1]) > lineN) {\n return {\n map: lineView.measure.maps[i$1],\n cache: lineView.measure.caches[i$1],\n before: true\n };\n }\n }\n } // Render a line into the hidden node display.externalMeasured. Used", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\r\n // The starting line\r\n this.line = line;\r\n // Continuing lines, if any\r\n this.rest = visualLineContinued(line);\r\n // Number of logical lines in this visual line\r\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\r\n this.node = this.text = null;\r\n this.hidden = lineIsHidden(doc, line);\r\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\r\n // The starting line\r\n this.line = line;\r\n // Continuing lines, if any\r\n this.rest = visualLineContinued(line);\r\n // Number of logical lines in this visual line\r\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\r\n this.node = this.text = null;\r\n this.hidden = lineIsHidden(doc, line);\r\n}", "function LineView(doc, line, lineN) {\n\t // The starting line\n\t this.line = line;\n\t // Continuing lines, if any\n\t this.rest = visualLineContinued(line);\n\t // Number of logical lines in this visual line\n\t this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n\t this.node = this.text = null;\n\t this.hidden = lineIsHidden(doc, line);\n\t }", "function LineView(doc, line, lineN) {\n\t // The starting line\n\t this.line = line;\n\t // Continuing lines, if any\n\t this.rest = visualLineContinued(line);\n\t // Number of logical lines in this visual line\n\t this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n\t this.node = this.text = null;\n\t this.hidden = lineIsHidden(doc, line);\n\t }", "function LineView(doc, line, lineN) {\n\t // The starting line\n\t this.line = line;\n\t // Continuing lines, if any\n\t this.rest = visualLineContinued(line);\n\t // Number of logical lines in this visual line\n\t this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n\t this.node = this.text = null;\n\t this.hidden = lineIsHidden(doc, line);\n\t }", "function LineView(doc, line, lineN) {\n\t\t // The starting line\n\t\t this.line = line;\n\t\t // Continuing lines, if any\n\t\t this.rest = visualLineContinued(line);\n\t\t // Number of logical lines in this visual line\n\t\t this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n\t\t this.node = this.text = null;\n\t\t this.hidden = lineIsHidden(doc, line);\n\t\t }", "function LineView(doc, line, lineN) {\n\t\t // The starting line\n\t\t this.line = line;\n\t\t // Continuing lines, if any\n\t\t this.rest = visualLineContinued(line);\n\t\t // Number of logical lines in this visual line\n\t\t this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n\t\t this.node = this.text = null;\n\t\t this.hidden = lineIsHidden(doc, line);\n\t\t }", "function mapFromLineView(lineView, line, lineN) {\r\n if (lineView.line == line)\r\n { return { map: lineView.measure.map, cache: lineView.measure.cache, before: false }; }\r\n for (var i = 0; i < lineView.rest.length; i++)\r\n { if (lineView.rest[i] == line)\r\n { return { map: lineView.measure.maps[i], cache: lineView.measure.caches[i], before: false }; } }\r\n for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)\r\n { if (lineView.rest[i$1].lineNo() > lineN)\r\n { return { map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true }; } }\r\n }", "function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line)\n { return {map: lineView.measure.map, cache: lineView.measure.cache} }\n for (var i = 0; i < lineView.rest.length; i++)\n { if (lineView.rest[i] == line)\n { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }\n for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)\n { if (lineNo(lineView.rest[i$1]) > lineN)\n { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }\n}", "function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line)\n { return {map: lineView.measure.map, cache: lineView.measure.cache} }\n for (var i = 0; i < lineView.rest.length; i++)\n { if (lineView.rest[i] == line)\n { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }\n for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)\n { if (lineNo(lineView.rest[i$1]) > lineN)\n { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }\n}", "function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line)\n { return {map: lineView.measure.map, cache: lineView.measure.cache} }\n for (var i = 0; i < lineView.rest.length; i++)\n { if (lineView.rest[i] == line)\n { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }\n for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)\n { if (lineNo(lineView.rest[i$1]) > lineN)\n { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }\n}", "function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line)\n { return {map: lineView.measure.map, cache: lineView.measure.cache} }\n for (var i = 0; i < lineView.rest.length; i++)\n { if (lineView.rest[i] == line)\n { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }\n for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)\n { if (lineNo(lineView.rest[i$1]) > lineN)\n { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }\n}", "function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line)\n { return {map: lineView.measure.map, cache: lineView.measure.cache} }\n for (var i = 0; i < lineView.rest.length; i++)\n { if (lineView.rest[i] == line)\n { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }\n for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)\n { if (lineNo(lineView.rest[i$1]) > lineN)\n { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }\n}", "function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line)\n { return {map: lineView.measure.map, cache: lineView.measure.cache} }\n for (var i = 0; i < lineView.rest.length; i++)\n { if (lineView.rest[i] == line)\n { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }\n for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)\n { if (lineNo(lineView.rest[i$1]) > lineN)\n { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }\n}", "function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line)\n { return {map: lineView.measure.map, cache: lineView.measure.cache} }\n for (var i = 0; i < lineView.rest.length; i++)\n { if (lineView.rest[i] == line)\n { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }\n for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)\n { if (lineNo(lineView.rest[i$1]) > lineN)\n { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }\n}" ]
[ "0.7489299", "0.7489299", "0.7489299", "0.7489299", "0.7489299", "0.7489299", "0.7489299", "0.7489299", "0.74819213", "0.74819213", "0.74819213", "0.74819213", "0.74819213", "0.74819213", "0.74819213", "0.74819213", "0.74819213", "0.74819213", "0.74819213", "0.7480697", "0.7480697", "0.74304026", "0.74304026", "0.74304026", "0.74068034", "0.7395699", "0.73956794", "0.7379585", "0.7377336", "0.6917401", "0.689603", "0.689603", "0.6886397", "0.6867255", "0.6867255", "0.6867255", "0.6867255", "0.6867255", "0.6867255", "0.6867255", "0.6867255", "0.6867255", "0.6867255", "0.6867255", "0.6867255", "0.6867255", "0.6867255", "0.6867255", "0.6867255", "0.6867255", "0.6867255", "0.6867255", "0.6867255", "0.6867255", "0.6867255", "0.6867255", "0.6867255", "0.6867255", "0.68664277", "0.6849408", "0.6849408", "0.6849408", "0.6849408", "0.6849408", "0.6849408", "0.6849408", "0.6849408", "0.6849408", "0.6849408", "0.6849408", "0.68480426", "0.6824086", "0.6824086", "0.6824086", "0.68001354", "0.68001354", "0.6609179", "0.65807784", "0.65807784", "0.65807784", "0.65807784", "0.65807784", "0.65807784", "0.65807784" ]
0.7497042
11
Measurement can be split in two steps, the setup work that applies to the whole line, and the measurement of the actual character. Functions like coordsChar, that need to do a lot of measurements in a row, can thus ensure that the setup work is only done once.
function prepareMeasureForLine(cm, line) { var lineN = lineNo(line); var view = findViewForLine(cm, lineN); if (view && !view.text) { view = null; } else if (view && view.changes) { updateLineForChanges(cm, view, lineN, getDimensions(cm)); cm.curOp.forceUpdate = true; } if (!view) { view = updateExternalMeasurement(cm, line); } var info = mapFromLineView(view, line, lineN); return { line: line, view: view, rect: null, map: info.map, cache: info.cache, before: info.before, hasHeights: false } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function prepareMeasureForLine(cm, line) {\n var lineN = lineNo(line);\n var view = findViewForLine(cm, lineN);\n\n if (view && !view.text) {\n view = null;\n } else if (view && view.changes) {\n updateLineForChanges(cm, view, lineN, getDimensions(cm));\n cm.curOp.forceUpdate = true;\n }\n\n if (!view) {\n view = updateExternalMeasurement(cm, line);\n }\n\n var info = mapFromLineView(view, line, lineN);\n return {\n line: line,\n view: view,\n rect: null,\n map: info.map,\n cache: info.cache,\n before: info.before,\n hasHeights: false\n };\n } // Given a prepared measurement object, measures the position of an", "function prepareMeasureForLine(cm, line) {\n\t\t var lineN = lineNo(line);\n\t\t var view = findViewForLine(cm, lineN);\n\t\t if (view && !view.text) {\n\t\t view = null;\n\t\t } else if (view && view.changes) {\n\t\t updateLineForChanges(cm, view, lineN, getDimensions(cm));\n\t\t cm.curOp.forceUpdate = true;\n\t\t }\n\t\t if (!view)\n\t\t view = updateExternalMeasurement(cm, line);\n\t\t\n\t\t var info = mapFromLineView(view, line, lineN);\n\t\t return {\n\t\t line: line, view: view, rect: null,\n\t\t map: info.map, cache: info.cache, before: info.before,\n\t\t hasHeights: false\n\t\t };\n\t\t }", "function prepareMeasureForLine(cm, line) {\n\t\t var lineN = lineNo(line);\n\t\t var view = findViewForLine(cm, lineN);\n\t\t if (view && !view.text) {\n\t\t view = null;\n\t\t } else if (view && view.changes) {\n\t\t updateLineForChanges(cm, view, lineN, getDimensions(cm));\n\t\t cm.curOp.forceUpdate = true;\n\t\t }\n\t\t if (!view)\n\t\t { view = updateExternalMeasurement(cm, line); }\n\n\t\t var info = mapFromLineView(view, line, lineN);\n\t\t return {\n\t\t line: line, view: view, rect: null,\n\t\t map: info.map, cache: info.cache, before: info.before,\n\t\t hasHeights: false\n\t\t }\n\t\t }", "function prepareMeasureForLine(cm, line) {\n\t var lineN = lineNo(line);\n\t var view = findViewForLine(cm, lineN);\n\t if (view && !view.text) {\n\t view = null;\n\t } else if (view && view.changes) {\n\t updateLineForChanges(cm, view, lineN, getDimensions(cm));\n\t cm.curOp.forceUpdate = true;\n\t }\n\t if (!view)\n\t view = updateExternalMeasurement(cm, line);\n\t\n\t var info = mapFromLineView(view, line, lineN);\n\t return {\n\t line: line, view: view, rect: null,\n\t map: info.map, cache: info.cache, before: info.before,\n\t hasHeights: false\n\t };\n\t }", "function prepareMeasureForLine(cm, line) {\n var lineN = lineNo(line)\n var view = findViewForLine(cm, lineN)\n if (view && !view.text) {\n view = null\n } else if (view && view.changes) {\n updateLineForChanges(cm, view, lineN, getDimensions(cm))\n cm.curOp.forceUpdate = true\n }\n if (!view)\n { view = updateExternalMeasurement(cm, line) }\n\n var info = mapFromLineView(view, line, lineN)\n return {\n line: line, view: view, rect: null,\n map: info.map, cache: info.cache, before: info.before,\n hasHeights: false\n }\n}", "function prepareMeasureForLine(cm, line) {\n var lineN = lineNo(line)\n var view = findViewForLine(cm, lineN)\n if (view && !view.text) {\n view = null\n } else if (view && view.changes) {\n updateLineForChanges(cm, view, lineN, getDimensions(cm))\n cm.curOp.forceUpdate = true\n }\n if (!view)\n { view = updateExternalMeasurement(cm, line) }\n\n var info = mapFromLineView(view, line, lineN)\n return {\n line: line, view: view, rect: null,\n map: info.map, cache: info.cache, before: info.before,\n hasHeights: false\n }\n}", "function prepareMeasureForLine(cm, line) {\n\t var lineN = lineNo(line);\n\t var view = findViewForLine(cm, lineN);\n\t if (view && !view.text) {\n\t view = null;\n\t } else if (view && view.changes) {\n\t updateLineForChanges(cm, view, lineN, getDimensions(cm));\n\t cm.curOp.forceUpdate = true;\n\t }\n\t if (!view)\n\t view = updateExternalMeasurement(cm, line);\n\n\t var info = mapFromLineView(view, line, lineN);\n\t return {\n\t line: line, view: view, rect: null,\n\t map: info.map, cache: info.cache, before: info.before,\n\t hasHeights: false\n\t };\n\t }", "function prepareMeasureForLine(cm, line) {\n\t var lineN = lineNo(line);\n\t var view = findViewForLine(cm, lineN);\n\t if (view && !view.text) {\n\t view = null;\n\t } else if (view && view.changes) {\n\t updateLineForChanges(cm, view, lineN, getDimensions(cm));\n\t cm.curOp.forceUpdate = true;\n\t }\n\t if (!view)\n\t view = updateExternalMeasurement(cm, line);\n\n\t var info = mapFromLineView(view, line, lineN);\n\t return {\n\t line: line, view: view, rect: null,\n\t map: info.map, cache: info.cache, before: info.before,\n\t hasHeights: false\n\t };\n\t }", "function prepareMeasureForLine(cm, line) {\n var lineN = lineNo(line);\n var view = findViewForLine(cm, lineN);\n if (view && !view.text) {\n view = null;\n } else if (view && view.changes) {\n updateLineForChanges(cm, view, lineN, getDimensions(cm));\n cm.curOp.forceUpdate = true;\n }\n if (!view)\n { view = updateExternalMeasurement(cm, line); }\n\n var info = mapFromLineView(view, line, lineN);\n return {\n line: line, view: view, rect: null,\n map: info.map, cache: info.cache, before: info.before,\n hasHeights: false\n }\n}", "function prepareMeasureForLine(cm, line) {\n var lineN = lineNo(line);\n var view = findViewForLine(cm, lineN);\n if (view && !view.text) {\n view = null;\n } else if (view && view.changes) {\n updateLineForChanges(cm, view, lineN, getDimensions(cm));\n cm.curOp.forceUpdate = true;\n }\n if (!view)\n { view = updateExternalMeasurement(cm, line); }\n\n var info = mapFromLineView(view, line, lineN);\n return {\n line: line, view: view, rect: null,\n map: info.map, cache: info.cache, before: info.before,\n hasHeights: false\n }\n}", "function prepareMeasureForLine(cm, line) {\n var lineN = lineNo(line);\n var view = findViewForLine(cm, lineN);\n if (view && !view.text) {\n view = null;\n } else if (view && view.changes) {\n updateLineForChanges(cm, view, lineN, getDimensions(cm));\n cm.curOp.forceUpdate = true;\n }\n if (!view)\n { view = updateExternalMeasurement(cm, line); }\n\n var info = mapFromLineView(view, line, lineN);\n return {\n line: line, view: view, rect: null,\n map: info.map, cache: info.cache, before: info.before,\n hasHeights: false\n }\n}", "function prepareMeasureForLine(cm, line) {\n var lineN = lineNo(line);\n var view = findViewForLine(cm, lineN);\n if (view && !view.text) {\n view = null;\n } else if (view && view.changes) {\n updateLineForChanges(cm, view, lineN, getDimensions(cm));\n cm.curOp.forceUpdate = true;\n }\n if (!view)\n { view = updateExternalMeasurement(cm, line); }\n\n var info = mapFromLineView(view, line, lineN);\n return {\n line: line, view: view, rect: null,\n map: info.map, cache: info.cache, before: info.before,\n hasHeights: false\n }\n}", "function prepareMeasureForLine(cm, line) {\n var lineN = lineNo(line);\n var view = findViewForLine(cm, lineN);\n if (view && !view.text) {\n view = null;\n } else if (view && view.changes) {\n updateLineForChanges(cm, view, lineN, getDimensions(cm));\n cm.curOp.forceUpdate = true;\n }\n if (!view)\n { view = updateExternalMeasurement(cm, line); }\n\n var info = mapFromLineView(view, line, lineN);\n return {\n line: line, view: view, rect: null,\n map: info.map, cache: info.cache, before: info.before,\n hasHeights: false\n }\n}", "function prepareMeasureForLine(cm, line) {\n var lineN = lineNo(line);\n var view = findViewForLine(cm, lineN);\n if (view && !view.text) {\n view = null;\n } else if (view && view.changes) {\n updateLineForChanges(cm, view, lineN, getDimensions(cm));\n cm.curOp.forceUpdate = true;\n }\n if (!view)\n { view = updateExternalMeasurement(cm, line); }\n\n var info = mapFromLineView(view, line, lineN);\n return {\n line: line, view: view, rect: null,\n map: info.map, cache: info.cache, before: info.before,\n hasHeights: false\n }\n}", "function prepareMeasureForLine(cm, line) {\n var lineN = lineNo(line);\n var view = findViewForLine(cm, lineN);\n if (view && !view.text) {\n view = null;\n } else if (view && view.changes) {\n updateLineForChanges(cm, view, lineN, getDimensions(cm));\n cm.curOp.forceUpdate = true;\n }\n if (!view)\n { view = updateExternalMeasurement(cm, line); }\n\n var info = mapFromLineView(view, line, lineN);\n return {\n line: line, view: view, rect: null,\n map: info.map, cache: info.cache, before: info.before,\n hasHeights: false\n }\n}", "function prepareMeasureForLine(cm, line) {\n var lineN = lineNo(line);\n var view = findViewForLine(cm, lineN);\n if (view && !view.text) {\n view = null;\n } else if (view && view.changes) {\n updateLineForChanges(cm, view, lineN, getDimensions(cm));\n cm.curOp.forceUpdate = true;\n }\n if (!view)\n { view = updateExternalMeasurement(cm, line); }\n\n var info = mapFromLineView(view, line, lineN);\n return {\n line: line, view: view, rect: null,\n map: info.map, cache: info.cache, before: info.before,\n hasHeights: false\n }\n}", "function prepareMeasureForLine(cm, line) {\n var lineN = lineNo(line);\n var view = findViewForLine(cm, lineN);\n if (view && !view.text) {\n view = null;\n } else if (view && view.changes) {\n updateLineForChanges(cm, view, lineN, getDimensions(cm));\n cm.curOp.forceUpdate = true;\n }\n if (!view)\n { view = updateExternalMeasurement(cm, line); }\n\n var info = mapFromLineView(view, line, lineN);\n return {\n line: line, view: view, rect: null,\n map: info.map, cache: info.cache, before: info.before,\n hasHeights: false\n }\n}", "function prepareMeasureForLine(cm, line) {\n var lineN = lineNo(line);\n var view = findViewForLine(cm, lineN);\n if (view && !view.text) {\n view = null;\n } else if (view && view.changes) {\n updateLineForChanges(cm, view, lineN, getDimensions(cm));\n cm.curOp.forceUpdate = true;\n }\n if (!view)\n { view = updateExternalMeasurement(cm, line); }\n\n var info = mapFromLineView(view, line, lineN);\n return {\n line: line, view: view, rect: null,\n map: info.map, cache: info.cache, before: info.before,\n hasHeights: false\n }\n}", "function prepareMeasureForLine(cm, line) {\n var lineN = lineNo(line);\n var view = findViewForLine(cm, lineN);\n if (view && !view.text) {\n view = null;\n } else if (view && view.changes) {\n updateLineForChanges(cm, view, lineN, getDimensions(cm));\n cm.curOp.forceUpdate = true;\n }\n if (!view)\n { view = updateExternalMeasurement(cm, line); }\n\n var info = mapFromLineView(view, line, lineN);\n return {\n line: line, view: view, rect: null,\n map: info.map, cache: info.cache, before: info.before,\n hasHeights: false\n }\n}", "function prepareMeasureForLine(cm, line) {\n var lineN = lineNo(line);\n var view = findViewForLine(cm, lineN);\n if (view && !view.text) {\n view = null;\n } else if (view && view.changes) {\n updateLineForChanges(cm, view, lineN, getDimensions(cm));\n cm.curOp.forceUpdate = true;\n }\n if (!view)\n view = updateExternalMeasurement(cm, line);\n\n var info = mapFromLineView(view, line, lineN);\n return {\n line: line, view: view, rect: null,\n map: info.map, cache: info.cache, before: info.before,\n hasHeights: false\n };\n }", "function prepareMeasureForLine(cm, line) {\r\n var lineN = lineNo(line);\r\n var view = findViewForLine(cm, lineN);\r\n if (view && !view.text) {\r\n view = null;\r\n } else if (view && view.changes) {\r\n updateLineForChanges(cm, view, lineN, getDimensions(cm));\r\n cm.curOp.forceUpdate = true;\r\n }\r\n if (!view)\r\n { view = updateExternalMeasurement(cm, line); }\r\n\r\n var info = mapFromLineView(view, line, lineN);\r\n return {\r\n line: line, view: view, rect: null,\r\n map: info.map, cache: info.cache, before: info.before,\r\n hasHeights: false\r\n }\r\n}", "function prepareMeasureForLine(cm, line) {\r\n var lineN = lineNo(line);\r\n var view = findViewForLine(cm, lineN);\r\n if (view && !view.text)\r\n view = null;\r\n else if (view && view.changes)\r\n updateLineForChanges(cm, view, lineN, getDimensions(cm));\r\n if (!view)\r\n view = updateExternalMeasurement(cm, line);\r\n\r\n var info = mapFromLineView(view, line, lineN);\r\n return {\r\n line: line, view: view, rect: null,\r\n map: info.map, cache: info.cache, before: info.before,\r\n hasHeights: false\r\n };\r\n }", "function prepareMeasureForLine(cm, line) {\n var lineN = lineNo(line);\n var view = findViewForLine(cm, lineN);\n if (view && !view.text)\n view = null;\n else if (view && view.changes)\n updateLineForChanges(cm, view, lineN, getDimensions(cm));\n if (!view)\n view = updateExternalMeasurement(cm, line);\n\n var info = mapFromLineView(view, line, lineN);\n return {\n line: line, view: view, rect: null,\n map: info.map, cache: info.cache, before: info.before,\n hasHeights: false\n };\n }", "function prepareMeasureForLine(cm, line) {\n var lineN = lineNo(line);\n var view = findViewForLine(cm, lineN);\n if (view && !view.text)\n view = null;\n else if (view && view.changes)\n updateLineForChanges(cm, view, lineN, getDimensions(cm));\n if (!view)\n view = updateExternalMeasurement(cm, line);\n\n var info = mapFromLineView(view, line, lineN);\n return {\n line: line, view: view, rect: null,\n map: info.map, cache: info.cache, before: info.before,\n hasHeights: false\n };\n }", "function prepareMeasureForLine(cm, line) {\n var lineN = lineNo(line);\n var view = findViewForLine(cm, lineN);\n if (view && !view.text)\n view = null;\n else if (view && view.changes)\n updateLineForChanges(cm, view, lineN, getDimensions(cm));\n if (!view)\n view = updateExternalMeasurement(cm, line);\n\n var info = mapFromLineView(view, line, lineN);\n return {\n line: line, view: view, rect: null,\n map: info.map, cache: info.cache, before: info.before,\n hasHeights: false\n };\n }", "function prepareMeasureForLine(cm, line) {\n var lineN = lineNo(line);\n var view = findViewForLine(cm, lineN);\n if (view && !view.text)\n view = null;\n else if (view && view.changes)\n updateLineForChanges(cm, view, lineN, getDimensions(cm));\n if (!view)\n view = updateExternalMeasurement(cm, line);\n\n var info = mapFromLineView(view, line, lineN);\n return {\n line: line, view: view, rect: null,\n map: info.map, cache: info.cache, before: info.before,\n hasHeights: false\n };\n }", "function prepareMeasureForLine(cm, line) {\n var lineN = lineNo(line);\n var view = findViewForLine(cm, lineN);\n if (view && !view.text)\n view = null;\n else if (view && view.changes)\n updateLineForChanges(cm, view, lineN, getDimensions(cm));\n if (!view)\n view = updateExternalMeasurement(cm, line);\n\n var info = mapFromLineView(view, line, lineN);\n return {\n line: line, view: view, rect: null,\n map: info.map, cache: info.cache, before: info.before,\n hasHeights: false\n };\n }", "function prepareMeasureForLine(cm, line) {\n var lineN = lineNo(line);\n var view = findViewForLine(cm, lineN);\n if (view && !view.text)\n view = null;\n else if (view && view.changes)\n updateLineForChanges(cm, view, lineN, getDimensions(cm));\n if (!view)\n view = updateExternalMeasurement(cm, line);\n\n var info = mapFromLineView(view, line, lineN);\n return {\n line: line, view: view, rect: null,\n map: info.map, cache: info.cache, before: info.before,\n hasHeights: false\n };\n }", "function prepareMeasureForLine(cm, line) {\n var lineN = lineNo(line);\n var view = findViewForLine(cm, lineN);\n if (view && !view.text)\n view = null;\n else if (view && view.changes)\n updateLineForChanges(cm, view, lineN, getDimensions(cm));\n if (!view)\n view = updateExternalMeasurement(cm, line);\n\n var info = mapFromLineView(view, line, lineN);\n return {\n line: line, view: view, rect: null,\n map: info.map, cache: info.cache, before: info.before,\n hasHeights: false\n };\n }", "drawShallowLine(xInit, yInit, xFinal, deltaX, deltaY, keyCharacter) {\n\n let gridSquares = getSquaresForShallowLine(xInit, yInit, xFinal, deltaX, deltaY, keyCharacter);\n\n // clear any characters previously added to the grid square\n gridSquares.clear.forEach(square => {\n this.clearPreviousCharacter(square);\n });\n\n // add the required character to the square at location (x,y)\n gridSquares.add.forEach(square => {\n this.addCharacterToSquare(square.x, square.y, square.char);\n })\n }", "_updateDimensions() {\n if (!this._charSizeService.hasValidSize) {\n return;\n }\n // Calculate the scaled character width. Width is floored as it must be\n // drawn to an integer grid in order for the CharAtlas \"stamps\" to not be\n // blurry. When text is drawn to the grid not using the CharAtlas, it is\n // clipped to ensure there is no overlap with the next cell.\n this.dimensions.scaledCharWidth = Math.floor(this._charSizeService.width * window.devicePixelRatio);\n // Calculate the scaled character height. Height is ceiled in case\n // devicePixelRatio is a floating point number in order to ensure there is\n // enough space to draw the character to the cell.\n this.dimensions.scaledCharHeight = Math.ceil(this._charSizeService.height * window.devicePixelRatio);\n // Calculate the scaled cell height, if lineHeight is not 1 then the value\n // will be floored because since lineHeight can never be lower then 1, there\n // is a guarentee that the scaled line height will always be larger than\n // scaled char height.\n this.dimensions.scaledCellHeight = Math.floor(this.dimensions.scaledCharHeight * this._optionsService.options.lineHeight);\n // Calculate the y coordinate within a cell that text should draw from in\n // order to draw in the center of a cell.\n this.dimensions.scaledCharTop = this._optionsService.options.lineHeight === 1 ? 0 : Math.round((this.dimensions.scaledCellHeight - this.dimensions.scaledCharHeight) / 2);\n // Calculate the scaled cell width, taking the letterSpacing into account.\n this.dimensions.scaledCellWidth = this.dimensions.scaledCharWidth + Math.round(this._optionsService.options.letterSpacing);\n // Calculate the x coordinate with a cell that text should draw from in\n // order to draw in the center of a cell.\n this.dimensions.scaledCharLeft = Math.floor(this._optionsService.options.letterSpacing / 2);\n // Recalculate the canvas dimensions; scaled* define the actual number of\n // pixel in the canvas\n this.dimensions.scaledCanvasHeight = this._bufferService.rows * this.dimensions.scaledCellHeight;\n this.dimensions.scaledCanvasWidth = this._bufferService.cols * this.dimensions.scaledCellWidth;\n // The the size of the canvas on the page. It's very important that this\n // rounds to nearest integer and not ceils as browsers often set\n // window.devicePixelRatio as something like 1.100000023841858, when it's\n // actually 1.1. Ceiling causes blurriness as the backing canvas image is 1\n // pixel too large for the canvas element size.\n this.dimensions.canvasHeight = Math.round(this.dimensions.scaledCanvasHeight / window.devicePixelRatio);\n this.dimensions.canvasWidth = Math.round(this.dimensions.scaledCanvasWidth / window.devicePixelRatio);\n // Get the _actual_ dimensions of an individual cell. This needs to be\n // derived from the canvasWidth/Height calculated above which takes into\n // account window.devicePixelRatio. ICharSizeService.width/height by itself\n // is insufficient when the page is not at 100% zoom level as it's measured\n // in CSS pixels, but the actual char size on the canvas can differ.\n this.dimensions.actualCellHeight = this.dimensions.canvasHeight / this._bufferService.rows;\n this.dimensions.actualCellWidth = this.dimensions.canvasWidth / this._bufferService.cols;\n }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view;\n } // Get a {top, bottom, left, right} box (in line-local coordinates)", "function measureChar(cm, line, ch, bias) {\n return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias);\n } // Find a line view that corresponds to the given line number.", "function updateExternalMeasurement(cm, line) {\n\t\t line = visualLine(line);\n\t\t var lineN = lineNo(line);\n\t\t var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n\t\t view.lineN = lineN;\n\t\t var built = view.built = buildLineContent(cm, view);\n\t\t view.text = built.pre;\n\t\t removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n\t\t return view\n\t\t }", "function updateExternalMeasurement(cm, line) {\n\t\t line = visualLine(line);\n\t\t var lineN = lineNo(line);\n\t\t var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n\t\t view.lineN = lineN;\n\t\t var built = view.built = buildLineContent(cm, view);\n\t\t view.text = built.pre;\n\t\t removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n\t\t return view;\n\t\t }", "function updateExternalMeasurement(cm, line) {\n\t line = visualLine(line);\n\t var lineN = lineNo(line);\n\t var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n\t view.lineN = lineN;\n\t var built = view.built = buildLineContent(cm, view);\n\t view.text = built.pre;\n\t removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n\t return view;\n\t }", "function updateExternalMeasurement(cm, line) {\n\t line = visualLine(line);\n\t var lineN = lineNo(line);\n\t var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n\t view.lineN = lineN;\n\t var built = view.built = buildLineContent(cm, view);\n\t view.text = built.pre;\n\t removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n\t return view;\n\t }", "function updateExternalMeasurement(cm, line) {\n\t line = visualLine(line);\n\t var lineN = lineNo(line);\n\t var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n\t view.lineN = lineN;\n\t var built = view.built = buildLineContent(cm, view);\n\t view.text = built.pre;\n\t removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n\t return view;\n\t }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line)\n var lineN = lineNo(line)\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN)\n view.lineN = lineN\n var built = view.built = buildLineContent(cm, view)\n view.text = built.pre\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre)\n return view\n}", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line)\n var lineN = lineNo(line)\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN)\n view.lineN = lineN\n var built = view.built = buildLineContent(cm, view)\n view.text = built.pre\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre)\n return view\n}", "function updateExternalMeasurement(cm, line) {\r\n line = visualLine(line);\r\n var lineN = lineNo(line);\r\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\r\n view.lineN = lineN;\r\n var built = view.built = buildLineContent(cm, view);\r\n view.text = built.pre;\r\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\r\n return view\r\n}", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n }", "function updateExternalMeasurement(cm, line) {\r\n line = visualLine(line);\r\n var lineN = lineNo(line);\r\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\r\n view.lineN = lineN;\r\n var built = view.built = buildLineContent(cm, view);\r\n view.text = built.pre;\r\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\r\n return view;\r\n }", "function coordsChar(x, y) {\n if (y < 0) y = 0;\n var th = textHeight(), cw = charWidth(), heightPos = displayOffset + Math.floor(y / th);\n var lineNo = lineAtHeight(doc, heightPos);\n if (lineNo >= doc.size) return {line: doc.size - 1, ch: getLine(doc.size - 1).text.length};\n var lineObj = getLine(lineNo), text = lineObj.text;\n var tw = options.lineWrapping, innerOff = tw ? heightPos - heightAtLine(doc, lineNo) : 0;\n if (x <= 0 && innerOff == 0) return {line: lineNo, ch: 0};\n function getX(len) {\n var sp = measureLine(lineObj, len);\n if (tw) {\n var off = Math.round(sp.top / th);\n return Math.max(0, sp.left + (off - innerOff) * scroller.clientWidth);\n }\n return sp.left;\n }\n var from = 0, fromX = 0, to = text.length, toX;\n // Guess a suitable upper bound for our search.\n var estimated = Math.min(to, Math.ceil((x + innerOff * scroller.clientWidth * .9) / cw));\n for (;;) {\n var estX = getX(estimated);\n if (estX <= x && estimated < to) estimated = Math.min(to, Math.ceil(estimated * 1.2));\n else {toX = estX; to = estimated; break;}\n }\n if (x > toX) return {line: lineNo, ch: to};\n // Try to guess a suitable lower bound as well.\n estimated = Math.floor(to * 0.8); estX = getX(estimated);\n if (estX < x) {from = estimated; fromX = estX;}\n // Do a binary search between these bounds.\n for (;;) {\n if (to - from <= 1) return {line: lineNo, ch: (toX - x > x - fromX) ? from : to};\n var middle = Math.ceil((from + to) / 2), middleX = getX(middle);\n if (middleX > x) {to = middle; toX = middleX;}\n else {from = middle; fromX = middleX;}\n }\n }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view;\n }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view;\n }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view;\n }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view;\n }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view;\n }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view;\n }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view;\n }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view;\n }", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n}", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n}", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n}", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n}", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n}", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n}", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n}", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n}", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n}", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n}", "function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n}", "function coordsChar(x, y) {\n if (y < 0) y = 0;\n var th = textHeight(), cw = charWidth(), heightPos = displayOffset + Math.floor(y / th);\n var lineNo = lineAtHeight(doc, heightPos);\n if (lineNo >= doc.size) return {line: doc.size - 1, ch: getLine(doc.size - 1).text.length};\n var lineObj = getLine(lineNo), text = lineObj.text;\n var tw = options.lineWrapping, innerOff = tw ? heightPos - heightAtLine(doc, lineNo) : 0;\n if (x <= 0 && innerOff == 0) return {line: lineNo, ch: 0};\n function getX(len) {\n var sp = measureLine(lineObj, len);\n if (tw) {\n var off = Math.round(sp.top / th);\n return Math.max(0, sp.left + (off - innerOff) * scroller.clientWidth);\n }\n return sp.left;\n }\n var from = 0, fromX = 0, to = text.length, toX;\n // Guess a suitable upper bound for our search.\n var estimated = Math.min(to, Math.ceil((x + innerOff * scroller.clientWidth * .9) / cw));\n for (;;) {\n var estX = getX(estimated);\n if (estX <= x && estimated < to) estimated = Math.min(to, Math.ceil(estimated * 1.2));\n else {toX = estX; to = estimated; break;}\n }\n if (x > toX) return {line: lineNo, ch: to};\n // Try to guess a suitable lower bound as well.\n estimated = Math.floor(to * 0.8); estX = getX(estimated);\n if (estX < x) {from = estimated; fromX = estX;}\n // Do a binary search between these bounds.\n for (;;) {\n if (to - from <= 1) return {line: lineNo, ch: (toX - x > x - fromX) ? from : to};\n var middle = Math.ceil((from + to) / 2), middleX = getX(middle);\n if (middleX > x) {to = middle; toX = middleX;}\n else {from = middle; fromX = middleX;}\n }\n }", "function coordsChar(x, y) {\n if (y < 0) y = 0;\n var th = textHeight(), cw = charWidth(), heightPos = displayOffset + Math.floor(y / th);\n var lineNo = lineAtHeight(doc, heightPos);\n if (lineNo >= doc.size) return {line: doc.size - 1, ch: getLine(doc.size - 1).text.length};\n var lineObj = getLine(lineNo), text = lineObj.text;\n var tw = options.lineWrapping, innerOff = tw ? heightPos - heightAtLine(doc, lineNo) : 0;\n if (x <= 0 && innerOff == 0) return {line: lineNo, ch: 0};\n function getX(len) {\n var sp = measureLine(lineObj, len);\n if (tw) {\n var off = Math.round(sp.top / th);\n return Math.max(0, sp.left + (off - innerOff) * scroller.clientWidth);\n }\n return sp.left;\n }\n var from = 0, fromX = 0, to = text.length, toX;\n // Guess a suitable upper bound for our search.\n var estimated = Math.min(to, Math.ceil((x + innerOff * scroller.clientWidth * .9) / cw));\n for (;;) {\n var estX = getX(estimated);\n if (estX <= x && estimated < to) estimated = Math.min(to, Math.ceil(estimated * 1.2));\n else {toX = estX; to = estimated; break;}\n }\n if (x > toX) return {line: lineNo, ch: to};\n // Try to guess a suitable lower bound as well.\n estimated = Math.floor(to * 0.8); estX = getX(estimated);\n if (estX < x) {from = estimated; fromX = estX;}\n // Do a binary search between these bounds.\n for (;;) {\n if (to - from <= 1) return {line: lineNo, ch: (toX - x > x - fromX) ? from : to};\n var middle = Math.ceil((from + to) / 2), middleX = getX(middle);\n if (middleX > x) {to = middle; toX = middleX;}\n else {from = middle; fromX = middleX;}\n }\n }", "function coordsChar(x, y) {\n if (y < 0) y = 0;\n var th = textHeight(), cw = charWidth(), heightPos = displayOffset + Math.floor(y / th);\n var lineNo = lineAtHeight(doc, heightPos);\n if (lineNo >= doc.size) return {line: doc.size - 1, ch: getLine(doc.size - 1).text.length};\n var lineObj = getLine(lineNo), text = lineObj.text;\n var tw = options.lineWrapping, innerOff = tw ? heightPos - heightAtLine(doc, lineNo) : 0;\n if (x <= 0 && innerOff == 0) return {line: lineNo, ch: 0};\n function getX(len) {\n var sp = measureLine(lineObj, len);\n if (tw) {\n var off = Math.round(sp.top / th);\n return Math.max(0, sp.left + (off - innerOff) * scroller.clientWidth);\n }\n return sp.left;\n }\n var from = 0, fromX = 0, to = text.length, toX;\n // Guess a suitable upper bound for our search.\n var estimated = Math.min(to, Math.ceil((x + innerOff * scroller.clientWidth * .9) / cw));\n for (;;) {\n var estX = getX(estimated);\n if (estX <= x && estimated < to) estimated = Math.min(to, Math.ceil(estimated * 1.2));\n else {toX = estX; to = estimated; break;}\n }\n if (x > toX) return {line: lineNo, ch: to};\n // Try to guess a suitable lower bound as well.\n estimated = Math.floor(to * 0.8); estX = getX(estimated);\n if (estX < x) {from = estimated; fromX = estX;}\n // Do a binary search between these bounds.\n for (;;) {\n if (to - from <= 1) return {line: lineNo, ch: (toX - x > x - fromX) ? from : to};\n var middle = Math.ceil((from + to) / 2), middleX = getX(middle);\n if (middleX > x) {to = middle; toX = middleX;}\n else {from = middle; fromX = middleX;}\n }\n }", "function coordsChar(cm, x, y) {\n\t\t var doc = cm.doc;\n\t\t y += cm.display.viewOffset;\n\t\t if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n\t\t var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n\t\t if (lineN > last)\n\t\t return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n\t\t if (x < 0) x = 0;\n\t\t\n\t\t var lineObj = getLine(doc, lineN);\n\t\t for (;;) {\n\t\t var found = coordsCharInner(cm, lineObj, lineN, x, y);\n\t\t var merged = collapsedSpanAtEnd(lineObj);\n\t\t var mergedPos = merged && merged.find(0, true);\n\t\t if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n\t\t lineN = lineNo(lineObj = mergedPos.to.line);\n\t\t else\n\t\t return found;\n\t\t }\n\t\t }", "function coordsChar(cm, x, y) {\r\n var doc = cm.doc;\r\n y += cm.display.viewOffset;\r\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\r\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\r\n if (lineN > last)\r\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\r\n if (x < 0) x = 0;\r\n\r\n var lineObj = getLine(doc, lineN);\r\n for (;;) {\r\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\r\n var merged = collapsedSpanAtEnd(lineObj);\r\n var mergedPos = merged && merged.find(0, true);\r\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\r\n lineN = lineNo(lineObj = mergedPos.to.line);\r\n else\r\n return found;\r\n }\r\n }" ]
[ "0.61007935", "0.6079905", "0.60480803", "0.5923985", "0.5918367", "0.5918367", "0.589796", "0.589796", "0.5888241", "0.5888241", "0.5888241", "0.5888241", "0.5888241", "0.5888241", "0.5888241", "0.5888241", "0.5888241", "0.5888241", "0.5888241", "0.5875767", "0.5873418", "0.5843824", "0.5841723", "0.5841723", "0.5841723", "0.5841723", "0.5841723", "0.5841723", "0.5841723", "0.5650378", "0.5596247", "0.5546035", "0.5452164", "0.5440502", "0.5427535", "0.5394498", "0.5394498", "0.5394498", "0.5393006", "0.5393006", "0.5377188", "0.53750944", "0.53750944", "0.53750944", "0.53750944", "0.53750944", "0.53750944", "0.53750944", "0.53750944", "0.53750944", "0.53750944", "0.53750944", "0.53750944", "0.53750944", "0.53750944", "0.53750944", "0.53750944", "0.53750944", "0.535572", "0.5354973", "0.5350915", "0.5350915", "0.5350915", "0.5350915", "0.5350915", "0.5350915", "0.5350915", "0.5350915", "0.53449893", "0.53449893", "0.53449893", "0.53449893", "0.53449893", "0.53449893", "0.53449893", "0.53449893", "0.53449893", "0.53449893", "0.53449893", "0.5313312", "0.5313312", "0.5313312", "0.5310655", "0.5293785" ]
0.5901451
17
Given a prepared measurement object, measures the position of an actual character (or fetches it from the cache).
function measureCharPrepared(cm, prepared, ch, bias, varHeight) { if (prepared.before) { ch = -1; } var key = ch + (bias || ""), found; if (prepared.cache.hasOwnProperty(key)) { found = prepared.cache[key]; } else { if (!prepared.rect) { prepared.rect = prepared.view.text.getBoundingClientRect(); } if (!prepared.hasHeights) { ensureLineHeights(cm, prepared.view, prepared.rect); prepared.hasHeights = true; } found = measureCharInner(cm, prepared, ch, bias); if (!found.bogus) { prepared.cache[key] = found; } } return {left: found.left, right: found.right, top: varHeight ? found.rtop : found.top, bottom: varHeight ? found.rbottom : found.bottom} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n if (prepared.before) ch = -1;\n var key = ch + (bias || \"\"), found;\n if (prepared.cache.hasOwnProperty(key)) {\n found = prepared.cache[key];\n } else {\n if (!prepared.rect)\n prepared.rect = prepared.view.text.getBoundingClientRect();\n if (!prepared.hasHeights) {\n ensureLineHeights(cm, prepared.view, prepared.rect);\n prepared.hasHeights = true;\n }\n found = measureCharInner(cm, prepared, ch, bias);\n if (!found.bogus) prepared.cache[key] = found;\n }\n return {left: found.left, right: found.right,\n top: varHeight ? found.rtop : found.top,\n bottom: varHeight ? found.rbottom : found.bottom};\n }", "function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n if (prepared.before) ch = -1;\n var key = ch + (bias || \"\"), found;\n if (prepared.cache.hasOwnProperty(key)) {\n found = prepared.cache[key];\n } else {\n if (!prepared.rect)\n prepared.rect = prepared.view.text.getBoundingClientRect();\n if (!prepared.hasHeights) {\n ensureLineHeights(cm, prepared.view, prepared.rect);\n prepared.hasHeights = true;\n }\n found = measureCharInner(cm, prepared, ch, bias);\n if (!found.bogus) prepared.cache[key] = found;\n }\n return {left: found.left, right: found.right,\n top: varHeight ? found.rtop : found.top,\n bottom: varHeight ? found.rbottom : found.bottom};\n }", "function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n if (prepared.before) ch = -1;\n var key = ch + (bias || \"\"), found;\n if (prepared.cache.hasOwnProperty(key)) {\n found = prepared.cache[key];\n } else {\n if (!prepared.rect)\n prepared.rect = prepared.view.text.getBoundingClientRect();\n if (!prepared.hasHeights) {\n ensureLineHeights(cm, prepared.view, prepared.rect);\n prepared.hasHeights = true;\n }\n found = measureCharInner(cm, prepared, ch, bias);\n if (!found.bogus) prepared.cache[key] = found;\n }\n return {left: found.left, right: found.right,\n top: varHeight ? found.rtop : found.top,\n bottom: varHeight ? found.rbottom : found.bottom};\n }", "function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n if (prepared.before) ch = -1;\n var key = ch + (bias || \"\"), found;\n if (prepared.cache.hasOwnProperty(key)) {\n found = prepared.cache[key];\n } else {\n if (!prepared.rect)\n prepared.rect = prepared.view.text.getBoundingClientRect();\n if (!prepared.hasHeights) {\n ensureLineHeights(cm, prepared.view, prepared.rect);\n prepared.hasHeights = true;\n }\n found = measureCharInner(cm, prepared, ch, bias);\n if (!found.bogus) prepared.cache[key] = found;\n }\n return {left: found.left, right: found.right,\n top: varHeight ? found.rtop : found.top,\n bottom: varHeight ? found.rbottom : found.bottom};\n }", "function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n if (prepared.before) ch = -1;\n var key = ch + (bias || \"\"), found;\n if (prepared.cache.hasOwnProperty(key)) {\n found = prepared.cache[key];\n } else {\n if (!prepared.rect)\n prepared.rect = prepared.view.text.getBoundingClientRect();\n if (!prepared.hasHeights) {\n ensureLineHeights(cm, prepared.view, prepared.rect);\n prepared.hasHeights = true;\n }\n found = measureCharInner(cm, prepared, ch, bias);\n if (!found.bogus) prepared.cache[key] = found;\n }\n return {left: found.left, right: found.right,\n top: varHeight ? found.rtop : found.top,\n bottom: varHeight ? found.rbottom : found.bottom};\n }", "function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n if (prepared.before) ch = -1;\n var key = ch + (bias || \"\"), found;\n if (prepared.cache.hasOwnProperty(key)) {\n found = prepared.cache[key];\n } else {\n if (!prepared.rect)\n prepared.rect = prepared.view.text.getBoundingClientRect();\n if (!prepared.hasHeights) {\n ensureLineHeights(cm, prepared.view, prepared.rect);\n prepared.hasHeights = true;\n }\n found = measureCharInner(cm, prepared, ch, bias);\n if (!found.bogus) prepared.cache[key] = found;\n }\n return {left: found.left, right: found.right,\n top: varHeight ? found.rtop : found.top,\n bottom: varHeight ? found.rbottom : found.bottom};\n }", "function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n if (prepared.before) ch = -1;\n var key = ch + (bias || \"\"), found;\n if (prepared.cache.hasOwnProperty(key)) {\n found = prepared.cache[key];\n } else {\n if (!prepared.rect)\n prepared.rect = prepared.view.text.getBoundingClientRect();\n if (!prepared.hasHeights) {\n ensureLineHeights(cm, prepared.view, prepared.rect);\n prepared.hasHeights = true;\n }\n found = measureCharInner(cm, prepared, ch, bias);\n if (!found.bogus) prepared.cache[key] = found;\n }\n return {left: found.left, right: found.right,\n top: varHeight ? found.rtop : found.top,\n bottom: varHeight ? found.rbottom : found.bottom};\n }", "function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n if (prepared.before) ch = -1;\n var key = ch + (bias || \"\"), found;\n if (prepared.cache.hasOwnProperty(key)) {\n found = prepared.cache[key];\n } else {\n if (!prepared.rect)\n prepared.rect = prepared.view.text.getBoundingClientRect();\n if (!prepared.hasHeights) {\n ensureLineHeights(cm, prepared.view, prepared.rect);\n prepared.hasHeights = true;\n }\n found = measureCharInner(cm, prepared, ch, bias);\n if (!found.bogus) prepared.cache[key] = found;\n }\n return {left: found.left, right: found.right,\n top: varHeight ? found.rtop : found.top,\n bottom: varHeight ? found.rbottom : found.bottom};\n }", "function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n\t\t if (prepared.before) ch = -1;\n\t\t var key = ch + (bias || \"\"), found;\n\t\t if (prepared.cache.hasOwnProperty(key)) {\n\t\t found = prepared.cache[key];\n\t\t } else {\n\t\t if (!prepared.rect)\n\t\t prepared.rect = prepared.view.text.getBoundingClientRect();\n\t\t if (!prepared.hasHeights) {\n\t\t ensureLineHeights(cm, prepared.view, prepared.rect);\n\t\t prepared.hasHeights = true;\n\t\t }\n\t\t found = measureCharInner(cm, prepared, ch, bias);\n\t\t if (!found.bogus) prepared.cache[key] = found;\n\t\t }\n\t\t return {left: found.left, right: found.right,\n\t\t top: varHeight ? found.rtop : found.top,\n\t\t bottom: varHeight ? found.rbottom : found.bottom};\n\t\t }", "function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n\t\t if (prepared.before) { ch = -1; }\n\t\t var key = ch + (bias || \"\"), found;\n\t\t if (prepared.cache.hasOwnProperty(key)) {\n\t\t found = prepared.cache[key];\n\t\t } else {\n\t\t if (!prepared.rect)\n\t\t { prepared.rect = prepared.view.text.getBoundingClientRect(); }\n\t\t if (!prepared.hasHeights) {\n\t\t ensureLineHeights(cm, prepared.view, prepared.rect);\n\t\t prepared.hasHeights = true;\n\t\t }\n\t\t found = measureCharInner(cm, prepared, ch, bias);\n\t\t if (!found.bogus) { prepared.cache[key] = found; }\n\t\t }\n\t\t return {left: found.left, right: found.right,\n\t\t top: varHeight ? found.rtop : found.top,\n\t\t bottom: varHeight ? found.rbottom : found.bottom}\n\t\t }", "function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\r\n if (prepared.before) ch = -1;\r\n var key = ch + (bias || \"\"), found;\r\n if (prepared.cache.hasOwnProperty(key)) {\r\n found = prepared.cache[key];\r\n } else {\r\n if (!prepared.rect)\r\n prepared.rect = prepared.view.text.getBoundingClientRect();\r\n if (!prepared.hasHeights) {\r\n ensureLineHeights(cm, prepared.view, prepared.rect);\r\n prepared.hasHeights = true;\r\n }\r\n found = measureCharInner(cm, prepared, ch, bias);\r\n if (!found.bogus) prepared.cache[key] = found;\r\n }\r\n return {left: found.left, right: found.right,\r\n top: varHeight ? found.rtop : found.top,\r\n bottom: varHeight ? found.rbottom : found.bottom};\r\n }", "function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n if (prepared.before) {\n ch = -1;\n }\n\n var key = ch + (bias || \"\"),\n found;\n\n if (prepared.cache.hasOwnProperty(key)) {\n found = prepared.cache[key];\n } else {\n if (!prepared.rect) {\n prepared.rect = prepared.view.text.getBoundingClientRect();\n }\n\n if (!prepared.hasHeights) {\n ensureLineHeights(cm, prepared.view, prepared.rect);\n prepared.hasHeights = true;\n }\n\n found = measureCharInner(cm, prepared, ch, bias);\n\n if (!found.bogus) {\n prepared.cache[key] = found;\n }\n }\n\n return {\n left: found.left,\n right: found.right,\n top: varHeight ? found.rtop : found.top,\n bottom: varHeight ? found.rbottom : found.bottom\n };\n }", "function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\r\n if (prepared.before) { ch = -1; }\r\n var key = ch + (bias || \"\"), found;\r\n if (prepared.cache.hasOwnProperty(key)) {\r\n found = prepared.cache[key];\r\n } else {\r\n if (!prepared.rect)\r\n { prepared.rect = prepared.view.text.getBoundingClientRect(); }\r\n if (!prepared.hasHeights) {\r\n ensureLineHeights(cm, prepared.view, prepared.rect);\r\n prepared.hasHeights = true;\r\n }\r\n found = measureCharInner(cm, prepared, ch, bias);\r\n if (!found.bogus) { prepared.cache[key] = found; }\r\n }\r\n return {left: found.left, right: found.right,\r\n top: varHeight ? found.rtop : found.top,\r\n bottom: varHeight ? found.rbottom : found.bottom}\r\n}", "function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n if (prepared.before) { ch = -1 }\n var key = ch + (bias || \"\"), found\n if (prepared.cache.hasOwnProperty(key)) {\n found = prepared.cache[key]\n } else {\n if (!prepared.rect)\n { prepared.rect = prepared.view.text.getBoundingClientRect() }\n if (!prepared.hasHeights) {\n ensureLineHeights(cm, prepared.view, prepared.rect)\n prepared.hasHeights = true\n }\n found = measureCharInner(cm, prepared, ch, bias)\n if (!found.bogus) { prepared.cache[key] = found }\n }\n return {left: found.left, right: found.right,\n top: varHeight ? found.rtop : found.top,\n bottom: varHeight ? found.rbottom : found.bottom}\n}", "function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n if (prepared.before) { ch = -1 }\n var key = ch + (bias || \"\"), found\n if (prepared.cache.hasOwnProperty(key)) {\n found = prepared.cache[key]\n } else {\n if (!prepared.rect)\n { prepared.rect = prepared.view.text.getBoundingClientRect() }\n if (!prepared.hasHeights) {\n ensureLineHeights(cm, prepared.view, prepared.rect)\n prepared.hasHeights = true\n }\n found = measureCharInner(cm, prepared, ch, bias)\n if (!found.bogus) { prepared.cache[key] = found }\n }\n return {left: found.left, right: found.right,\n top: varHeight ? found.rtop : found.top,\n bottom: varHeight ? found.rbottom : found.bottom}\n}", "function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n\t if (prepared.before) ch = -1;\n\t var key = ch + (bias || \"\"), found;\n\t if (prepared.cache.hasOwnProperty(key)) {\n\t found = prepared.cache[key];\n\t } else {\n\t if (!prepared.rect)\n\t prepared.rect = prepared.view.text.getBoundingClientRect();\n\t if (!prepared.hasHeights) {\n\t ensureLineHeights(cm, prepared.view, prepared.rect);\n\t prepared.hasHeights = true;\n\t }\n\t found = measureCharInner(cm, prepared, ch, bias);\n\t if (!found.bogus) prepared.cache[key] = found;\n\t }\n\t return {left: found.left, right: found.right,\n\t top: varHeight ? found.rtop : found.top,\n\t bottom: varHeight ? found.rbottom : found.bottom};\n\t }", "function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n\t if (prepared.before) ch = -1;\n\t var key = ch + (bias || \"\"), found;\n\t if (prepared.cache.hasOwnProperty(key)) {\n\t found = prepared.cache[key];\n\t } else {\n\t if (!prepared.rect)\n\t prepared.rect = prepared.view.text.getBoundingClientRect();\n\t if (!prepared.hasHeights) {\n\t ensureLineHeights(cm, prepared.view, prepared.rect);\n\t prepared.hasHeights = true;\n\t }\n\t found = measureCharInner(cm, prepared, ch, bias);\n\t if (!found.bogus) prepared.cache[key] = found;\n\t }\n\t return {left: found.left, right: found.right,\n\t top: varHeight ? found.rtop : found.top,\n\t bottom: varHeight ? found.rbottom : found.bottom};\n\t }", "function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n\t if (prepared.before) ch = -1;\n\t var key = ch + (bias || \"\"), found;\n\t if (prepared.cache.hasOwnProperty(key)) {\n\t found = prepared.cache[key];\n\t } else {\n\t if (!prepared.rect)\n\t prepared.rect = prepared.view.text.getBoundingClientRect();\n\t if (!prepared.hasHeights) {\n\t ensureLineHeights(cm, prepared.view, prepared.rect);\n\t prepared.hasHeights = true;\n\t }\n\t found = measureCharInner(cm, prepared, ch, bias);\n\t if (!found.bogus) prepared.cache[key] = found;\n\t }\n\t return {left: found.left, right: found.right,\n\t top: varHeight ? found.rtop : found.top,\n\t bottom: varHeight ? found.rbottom : found.bottom};\n\t }", "function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n if (prepared.before) { ch = -1; }\n var key = ch + (bias || \"\"), found;\n if (prepared.cache.hasOwnProperty(key)) {\n found = prepared.cache[key];\n } else {\n if (!prepared.rect)\n { prepared.rect = prepared.view.text.getBoundingClientRect(); }\n if (!prepared.hasHeights) {\n ensureLineHeights(cm, prepared.view, prepared.rect);\n prepared.hasHeights = true;\n }\n found = measureCharInner(cm, prepared, ch, bias);\n if (!found.bogus) { prepared.cache[key] = found; }\n }\n return {left: found.left, right: found.right,\n top: varHeight ? found.rtop : found.top,\n bottom: varHeight ? found.rbottom : found.bottom}\n}", "function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n if (prepared.before) { ch = -1; }\n var key = ch + (bias || \"\"), found;\n if (prepared.cache.hasOwnProperty(key)) {\n found = prepared.cache[key];\n } else {\n if (!prepared.rect)\n { prepared.rect = prepared.view.text.getBoundingClientRect(); }\n if (!prepared.hasHeights) {\n ensureLineHeights(cm, prepared.view, prepared.rect);\n prepared.hasHeights = true;\n }\n found = measureCharInner(cm, prepared, ch, bias);\n if (!found.bogus) { prepared.cache[key] = found; }\n }\n return {left: found.left, right: found.right,\n top: varHeight ? found.rtop : found.top,\n bottom: varHeight ? found.rbottom : found.bottom}\n}", "function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n if (prepared.before) { ch = -1; }\n var key = ch + (bias || \"\"), found;\n if (prepared.cache.hasOwnProperty(key)) {\n found = prepared.cache[key];\n } else {\n if (!prepared.rect)\n { prepared.rect = prepared.view.text.getBoundingClientRect(); }\n if (!prepared.hasHeights) {\n ensureLineHeights(cm, prepared.view, prepared.rect);\n prepared.hasHeights = true;\n }\n found = measureCharInner(cm, prepared, ch, bias);\n if (!found.bogus) { prepared.cache[key] = found; }\n }\n return {left: found.left, right: found.right,\n top: varHeight ? found.rtop : found.top,\n bottom: varHeight ? found.rbottom : found.bottom}\n}", "function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n if (prepared.before) { ch = -1; }\n var key = ch + (bias || \"\"), found;\n if (prepared.cache.hasOwnProperty(key)) {\n found = prepared.cache[key];\n } else {\n if (!prepared.rect)\n { prepared.rect = prepared.view.text.getBoundingClientRect(); }\n if (!prepared.hasHeights) {\n ensureLineHeights(cm, prepared.view, prepared.rect);\n prepared.hasHeights = true;\n }\n found = measureCharInner(cm, prepared, ch, bias);\n if (!found.bogus) { prepared.cache[key] = found; }\n }\n return {left: found.left, right: found.right,\n top: varHeight ? found.rtop : found.top,\n bottom: varHeight ? found.rbottom : found.bottom}\n}", "function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n if (prepared.before) { ch = -1; }\n var key = ch + (bias || \"\"), found;\n if (prepared.cache.hasOwnProperty(key)) {\n found = prepared.cache[key];\n } else {\n if (!prepared.rect)\n { prepared.rect = prepared.view.text.getBoundingClientRect(); }\n if (!prepared.hasHeights) {\n ensureLineHeights(cm, prepared.view, prepared.rect);\n prepared.hasHeights = true;\n }\n found = measureCharInner(cm, prepared, ch, bias);\n if (!found.bogus) { prepared.cache[key] = found; }\n }\n return {left: found.left, right: found.right,\n top: varHeight ? found.rtop : found.top,\n bottom: varHeight ? found.rbottom : found.bottom}\n}", "function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n if (prepared.before) { ch = -1; }\n var key = ch + (bias || \"\"), found;\n if (prepared.cache.hasOwnProperty(key)) {\n found = prepared.cache[key];\n } else {\n if (!prepared.rect)\n { prepared.rect = prepared.view.text.getBoundingClientRect(); }\n if (!prepared.hasHeights) {\n ensureLineHeights(cm, prepared.view, prepared.rect);\n prepared.hasHeights = true;\n }\n found = measureCharInner(cm, prepared, ch, bias);\n if (!found.bogus) { prepared.cache[key] = found; }\n }\n return {left: found.left, right: found.right,\n top: varHeight ? found.rtop : found.top,\n bottom: varHeight ? found.rbottom : found.bottom}\n}", "function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n if (prepared.before) { ch = -1; }\n var key = ch + (bias || \"\"), found;\n if (prepared.cache.hasOwnProperty(key)) {\n found = prepared.cache[key];\n } else {\n if (!prepared.rect)\n { prepared.rect = prepared.view.text.getBoundingClientRect(); }\n if (!prepared.hasHeights) {\n ensureLineHeights(cm, prepared.view, prepared.rect);\n prepared.hasHeights = true;\n }\n found = measureCharInner(cm, prepared, ch, bias);\n if (!found.bogus) { prepared.cache[key] = found; }\n }\n return {left: found.left, right: found.right,\n top: varHeight ? found.rtop : found.top,\n bottom: varHeight ? found.rbottom : found.bottom}\n}", "function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n if (prepared.before) { ch = -1; }\n var key = ch + (bias || \"\"), found;\n if (prepared.cache.hasOwnProperty(key)) {\n found = prepared.cache[key];\n } else {\n if (!prepared.rect)\n { prepared.rect = prepared.view.text.getBoundingClientRect(); }\n if (!prepared.hasHeights) {\n ensureLineHeights(cm, prepared.view, prepared.rect);\n prepared.hasHeights = true;\n }\n found = measureCharInner(cm, prepared, ch, bias);\n if (!found.bogus) { prepared.cache[key] = found; }\n }\n return {left: found.left, right: found.right,\n top: varHeight ? found.rtop : found.top,\n bottom: varHeight ? found.rbottom : found.bottom}\n}", "function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n if (prepared.before) { ch = -1; }\n var key = ch + (bias || \"\"), found;\n if (prepared.cache.hasOwnProperty(key)) {\n found = prepared.cache[key];\n } else {\n if (!prepared.rect)\n { prepared.rect = prepared.view.text.getBoundingClientRect(); }\n if (!prepared.hasHeights) {\n ensureLineHeights(cm, prepared.view, prepared.rect);\n prepared.hasHeights = true;\n }\n found = measureCharInner(cm, prepared, ch, bias);\n if (!found.bogus) { prepared.cache[key] = found; }\n }\n return {left: found.left, right: found.right,\n top: varHeight ? found.rtop : found.top,\n bottom: varHeight ? found.rbottom : found.bottom}\n}", "function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n if (prepared.before) { ch = -1; }\n var key = ch + (bias || \"\"), found;\n if (prepared.cache.hasOwnProperty(key)) {\n found = prepared.cache[key];\n } else {\n if (!prepared.rect)\n { prepared.rect = prepared.view.text.getBoundingClientRect(); }\n if (!prepared.hasHeights) {\n ensureLineHeights(cm, prepared.view, prepared.rect);\n prepared.hasHeights = true;\n }\n found = measureCharInner(cm, prepared, ch, bias);\n if (!found.bogus) { prepared.cache[key] = found; }\n }\n return {left: found.left, right: found.right,\n top: varHeight ? found.rtop : found.top,\n bottom: varHeight ? found.rbottom : found.bottom}\n}", "function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n if (prepared.before) { ch = -1; }\n var key = ch + (bias || \"\"), found;\n if (prepared.cache.hasOwnProperty(key)) {\n found = prepared.cache[key];\n } else {\n if (!prepared.rect)\n { prepared.rect = prepared.view.text.getBoundingClientRect(); }\n if (!prepared.hasHeights) {\n ensureLineHeights(cm, prepared.view, prepared.rect);\n prepared.hasHeights = true;\n }\n found = measureCharInner(cm, prepared, ch, bias);\n if (!found.bogus) { prepared.cache[key] = found; }\n }\n return {left: found.left, right: found.right,\n top: varHeight ? found.rtop : found.top,\n bottom: varHeight ? found.rbottom : found.bottom}\n}", "function coordsChar(cm, x, y) {\n\t var doc = cm.doc;\n\t y += cm.display.viewOffset;\n\t if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n\t var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n\t if (lineN > last)\n\t return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n\t if (x < 0) x = 0;\n\t\n\t var lineObj = getLine(doc, lineN);\n\t for (;;) {\n\t var found = coordsCharInner(cm, lineObj, lineN, x, y);\n\t var merged = collapsedSpanAtEnd(lineObj);\n\t var mergedPos = merged && merged.find(0, true);\n\t if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n\t lineN = lineNo(lineObj = mergedPos.to.line);\n\t else\n\t return found;\n\t }\n\t }", "function coordsChar(cm, x, y) {\n\t var doc = cm.doc;\n\t y += cm.display.viewOffset;\n\t if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n\t var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n\t if (lineN > last)\n\t return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n\t if (x < 0) x = 0;\n\n\t var lineObj = getLine(doc, lineN);\n\t for (;;) {\n\t var found = coordsCharInner(cm, lineObj, lineN, x, y);\n\t var merged = collapsedSpanAtEnd(lineObj);\n\t var mergedPos = merged && merged.find(0, true);\n\t if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n\t lineN = lineNo(lineObj = mergedPos.to.line);\n\t else\n\t return found;\n\t }\n\t }", "function coordsChar(cm, x, y) {\n\t var doc = cm.doc;\n\t y += cm.display.viewOffset;\n\t if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n\t var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n\t if (lineN > last)\n\t return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n\t if (x < 0) x = 0;\n\n\t var lineObj = getLine(doc, lineN);\n\t for (;;) {\n\t var found = coordsCharInner(cm, lineObj, lineN, x, y);\n\t var merged = collapsedSpanAtEnd(lineObj);\n\t var mergedPos = merged && merged.find(0, true);\n\t if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n\t lineN = lineNo(lineObj = mergedPos.to.line);\n\t else\n\t return found;\n\t }\n\t }", "function coordsChar(cm, x, y) {\n\t\t var doc = cm.doc;\n\t\t y += cm.display.viewOffset;\n\t\t if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n\t\t var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n\t\t if (lineN > last)\n\t\t return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n\t\t if (x < 0) x = 0;\n\t\t\n\t\t var lineObj = getLine(doc, lineN);\n\t\t for (;;) {\n\t\t var found = coordsCharInner(cm, lineObj, lineN, x, y);\n\t\t var merged = collapsedSpanAtEnd(lineObj);\n\t\t var mergedPos = merged && merged.find(0, true);\n\t\t if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n\t\t lineN = lineNo(lineObj = mergedPos.to.line);\n\t\t else\n\t\t return found;\n\t\t }\n\t\t }", "function measureChar(cm, line, ch, bias) {\n return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias);\n } // Find a line view that corresponds to the given line number.", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n if (x < 0) x = 0;\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n lineN = lineNo(lineObj = mergedPos.to.line);\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n if (x < 0) x = 0;\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n lineN = lineNo(lineObj = mergedPos.to.line);\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n if (x < 0) x = 0;\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n lineN = lineNo(lineObj = mergedPos.to.line);\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n if (x < 0) x = 0;\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n lineN = lineNo(lineObj = mergedPos.to.line);\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n if (x < 0) x = 0;\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n lineN = lineNo(lineObj = mergedPos.to.line);\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n if (x < 0) x = 0;\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n lineN = lineNo(lineObj = mergedPos.to.line);\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n if (x < 0) x = 0;\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n lineN = lineNo(lineObj = mergedPos.to.line);\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n if (x < 0) x = 0;\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n lineN = lineNo(lineObj = mergedPos.to.line);\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\r\n var doc = cm.doc;\r\n y += cm.display.viewOffset;\r\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\r\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\r\n if (lineN > last)\r\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\r\n if (x < 0) x = 0;\r\n\r\n var lineObj = getLine(doc, lineN);\r\n for (;;) {\r\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\r\n var merged = collapsedSpanAtEnd(lineObj);\r\n var mergedPos = merged && merged.find(0, true);\r\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\r\n lineN = lineNo(lineObj = mergedPos.to.line);\r\n else\r\n return found;\r\n }\r\n }", "coordsForChar(pos) {\n this.readMeasured();\n return this.docView.coordsForChar(pos);\n }", "convertPointToCharacterPosition(text, point) {\n var position = 0;\n var w = 0;\n for (var i = 0, n = text.length; i < n; i++) {\n\n var charWidth = this.calculateCharacterSize(text.charAt(i))[0];\n var halfWidth = charWidth / 2;\n\n if (i > 0) {\n w = this.calculateSize(text.substr(0, i))[0];\n }\n\n // basic rounding calculation bast on character\n // width\n if (w + halfWidth > point) {\n break;\n }\n\n position++;\n }\n\n return position;\n }", "function coordsChar(cm, x, y) {\n\t\t var doc = cm.doc;\n\t\t y += cm.display.viewOffset;\n\t\t if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) }\n\t\t var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n\t\t if (lineN > last)\n\t\t { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) }\n\t\t if (x < 0) { x = 0; }\n\n\t\t var lineObj = getLine(doc, lineN);\n\t\t for (;;) {\n\t\t var found = coordsCharInner(cm, lineObj, lineN, x, y);\n\t\t var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));\n\t\t if (!collapsed) { return found }\n\t\t var rangeEnd = collapsed.find(1);\n\t\t if (rangeEnd.line == lineN) { return rangeEnd }\n\t\t lineObj = getLine(doc, lineN = rangeEnd.line);\n\t\t }\n\t\t }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n var lineNo = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineNo > last)\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n if (x < 0) x = 0;\n\n for (;;) {\n var lineObj = getLine(doc, lineNo);\n var found = coordsCharInner(cm, lineObj, lineNo, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find();\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n lineNo = mergedPos.to.line;\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n var lineNo = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineNo > last)\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n if (x < 0) x = 0;\n\n for (;;) {\n var lineObj = getLine(doc, lineNo);\n var found = coordsCharInner(cm, lineObj, lineNo, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find();\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n lineNo = mergedPos.to.line;\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n var lineNo = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineNo > last)\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n if (x < 0) x = 0;\n\n for (;;) {\n var lineObj = getLine(doc, lineNo);\n var found = coordsCharInner(cm, lineObj, lineNo, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find();\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n lineNo = mergedPos.to.line;\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n var lineNo = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineNo > last)\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n if (x < 0) x = 0;\n\n for (;;) {\n var lineObj = getLine(doc, lineNo);\n var found = coordsCharInner(cm, lineObj, lineNo, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find();\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n lineNo = mergedPos.to.line;\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.view.doc;\n y += cm.display.viewOffset;\n if (y < 0) return {line: 0, ch: 0, outside: true};\n var lineNo = lineAtHeight(doc, y);\n if (lineNo >= doc.size) return {line: doc.size - 1, ch: getLine(doc, doc.size - 1).text.length};\n if (x < 0) x = 0;\n\n for (;;) {\n var lineObj = getLine(doc, lineNo);\n var found = coordsCharInner(cm, lineObj, lineNo, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find();\n if (merged && found.ch >= mergedPos.from.ch)\n lineNo = mergedPos.to.line;\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.view.doc;\n y += cm.display.viewOffset;\n if (y < 0) return {line: 0, ch: 0, outside: true};\n var lineNo = lineAtHeight(doc, y);\n if (lineNo >= doc.size) return {line: doc.size - 1, ch: getLine(doc, doc.size - 1).text.length};\n if (x < 0) x = 0;\n\n for (;;) {\n var lineObj = getLine(doc, lineNo);\n var found = coordsCharInner(cm, lineObj, lineNo, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find();\n if (merged && found.ch >= mergedPos.from.ch)\n lineNo = mergedPos.to.line;\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.view.doc;\n y += cm.display.viewOffset;\n if (y < 0) return {line: 0, ch: 0, outside: true};\n var lineNo = lineAtHeight(doc, y);\n if (lineNo >= doc.size) return {line: doc.size - 1, ch: getLine(doc, doc.size - 1).text.length};\n if (x < 0) x = 0;\n\n for (;;) {\n var lineObj = getLine(doc, lineNo);\n var found = coordsCharInner(cm, lineObj, lineNo, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find();\n if (merged && found.ch >= mergedPos.from.ch)\n lineNo = mergedPos.to.line;\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc\n y += cm.display.viewOffset\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0 }\n\n var lineObj = getLine(doc, lineN)\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y)\n var merged = collapsedSpanAtEnd(lineObj)\n var mergedPos = merged && merged.find(0, true)\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n { lineN = lineNo(lineObj = mergedPos.to.line) }\n else\n { return found }\n }\n}", "function coordsChar(cm, x, y) {\n var doc = cm.doc\n y += cm.display.viewOffset\n if (y < 0) { return PosWithInfo(doc.first, 0, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1) }\n if (x < 0) { x = 0 }\n\n var lineObj = getLine(doc, lineN)\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y)\n var merged = collapsedSpanAtEnd(lineObj)\n var mergedPos = merged && merged.find(0, true)\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n { lineN = lineNo(lineObj = mergedPos.to.line) }\n else\n { return found }\n }\n}", "function coordsChar(cm, x, y) {\r\n var doc = cm.doc;\r\n y += cm.display.viewOffset;\r\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\r\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\r\n if (lineN > last)\r\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\r\n if (x < 0) { x = 0; }\r\n\r\n var lineObj = getLine(doc, lineN);\r\n for (;;) {\r\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\r\n var merged = collapsedSpanAtEnd(lineObj);\r\n var mergedPos = merged && merged.find(0, true);\r\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\r\n { lineN = lineNo(lineObj = mergedPos.to.line); }\r\n else\r\n { return found }\r\n }\r\n}", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n { lineN = lineNo(lineObj = mergedPos.to.line); }\n else\n { return found }\n }\n}", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n { lineN = lineNo(lineObj = mergedPos.to.line); }\n else\n { return found }\n }\n}", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n { lineN = lineNo(lineObj = mergedPos.to.line); }\n else\n { return found }\n }\n}", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n { lineN = lineNo(lineObj = mergedPos.to.line); }\n else\n { return found }\n }\n}", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n { lineN = lineNo(lineObj = mergedPos.to.line); }\n else\n { return found }\n }\n}", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n { lineN = lineNo(lineObj = mergedPos.to.line); }\n else\n { return found }\n }\n}", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n { lineN = lineNo(lineObj = mergedPos.to.line); }\n else\n { return found }\n }\n}", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n { lineN = lineNo(lineObj = mergedPos.to.line); }\n else\n { return found }\n }\n}", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n}", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n}", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n}" ]
[ "0.6956434", "0.6956434", "0.6956434", "0.6956434", "0.6956434", "0.6956434", "0.6956434", "0.6956434", "0.6944827", "0.6935705", "0.69277096", "0.6926043", "0.69001466", "0.6898976", "0.6898976", "0.6890307", "0.6890307", "0.6890307", "0.68885005", "0.68885005", "0.68885005", "0.68885005", "0.68885005", "0.68885005", "0.68885005", "0.68885005", "0.68885005", "0.68885005", "0.68885005", "0.6079568", "0.6059316", "0.6059316", "0.6048747", "0.60169554", "0.601449", "0.601449", "0.601449", "0.601449", "0.601449", "0.601449", "0.601449", "0.601449", "0.60091096", "0.5976643", "0.59754246", "0.5970408", "0.5967882", "0.5967882", "0.5967882", "0.5967882", "0.59606665", "0.59606665", "0.59606665", "0.5944504", "0.5937667", "0.59325826", "0.5927456", "0.5927456", "0.5927456", "0.5927456", "0.5927456", "0.5927456", "0.5927456", "0.5927456", "0.5903835", "0.5903835", "0.5903835", "0.5903835", "0.5903835", "0.58897406", "0.58897406", "0.58897406", "0.58897406", "0.58897406", "0.58897406", "0.58897406", "0.58897406", "0.58897406", "0.58897406", "0.58897406", "0.58897406", "0.58830434", "0.58830434", "0.58830434" ]
0.6947927
23
Work around problem with bounding client rects on ranges being returned incorrectly when zoomed on IE10 and below.
function maybeUpdateRectForZooming(measure, rect) { if (!window.screen || screen.logicalXDPI == null || screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure)) { return rect } var scaleX = screen.logicalXDPI / screen.deviceXDPI; var scaleY = screen.logicalYDPI / screen.deviceYDPI; return {left: rect.left * scaleX, right: rect.right * scaleX, top: rect.top * scaleY, bottom: rect.bottom * scaleY} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getRangeBoundingClientRect(range){// \"Return a DOMRect object describing the smallest rectangle that includes\r\n\t// the first rectangle in list and all of the remaining rectangles of which\r\n\t// the height or width is not zero.\"\r\n\t// http://www.w3.org/TR/cssom-view/#dom-range-getboundingclientrect\r\n\tvar rects=getRangeClientRects(range);var top=0;var right=0;var bottom=0;var left=0;if(rects.length){var _rects$=rects[0];top=_rects$.top;right=_rects$.right;bottom=_rects$.bottom;left=_rects$.left;for(var ii=1;ii<rects.length;ii++){var rect=rects[ii];if(rect.height!==0||rect.width!==0){top=Math.min(top,rect.top);right=Math.max(right,rect.right);bottom=Math.max(bottom,rect.bottom);left=Math.min(left,rect.left);}}}return{top:top,right:right,bottom:bottom,left:left,width:right-left,height:bottom-top};}", "function actuallyGetRangeBoundingRect(range) {\n\t // XXX: to be revised when this Chrome bug is fixed:\n\t // https://bugs.chromium.org/p/chromium/issues/detail?id=612459\n\t if (microsoft || browser$3.chrome) {\n\t // Workaround browser bugs: IE and Chrome would sometimes\n\t // return 0 or 1-width rectangles before or after the main\n\t // one. https://github.com/telerik/kendo/issues/4674\n\t\n\t // Actually Chrome 50 got worse, since the rectangles can now have the width of a\n\t // full character, making it hard to tell whether it's a bogus rectangle or valid\n\t // selection location. The workaround is to ignore rectangles that fall on the\n\t // previous line. https://github.com/telerik/kendo/issues/5740\n\t var rectangles = range.getClientRects(), box = {\n\t top : Infinity,\n\t right : -Infinity,\n\t bottom : -Infinity,\n\t left : Infinity\n\t }, done = false;\n\t for (var i = 0; i < rectangles.length; ++i) {\n\t var b = rectangles[i];\n\t if (b.width <= 1 || b.bottom === prevLineBottom) {\n\t continue; // bogus rectangle\n\t }\n\t box.left = Math.min(b.left , box.left);\n\t box.top = Math.min(b.top , box.top);\n\t box.right = Math.max(b.right , box.right);\n\t box.bottom = Math.max(b.bottom , box.bottom);\n\t done = true;\n\t }\n\t if (!done) {\n\t return range.getBoundingClientRect();\n\t }\n\t box.width = box.right - box.left;\n\t box.height = box.bottom - box.top;\n\t return box;\n\t }\n\t return range.getBoundingClientRect();\n\t }", "function actuallyGetRangeBoundingRect(range) {\n // XXX: to be revised when this Chrome bug is fixed:\n // https://bugs.chromium.org/p/chromium/issues/detail?id=612459\n if (browser$2.msie || browser$2.chrome) {\n // Workaround browser bugs: IE and Chrome would sometimes\n // return 0 or 1-width rectangles before or after the main\n // one. https://github.com/telerik/kendo/issues/4674\n\n // Actually Chrome 50 got worse, since the rectangles can now have the width of a\n // full character, making it hard to tell whether it's a bogus rectangle or valid\n // selection location. The workaround is to ignore rectangles that fall on the\n // previous line. https://github.com/telerik/kendo/issues/5740\n var rectangles = range.getClientRects(), box = {\n top : Infinity,\n right : -Infinity,\n bottom : -Infinity,\n left : Infinity\n };\n for (var i = 0; i < rectangles.length; ++i) {\n var b = rectangles[i];\n if (b.width <= 1 || b.bottom === prevLineBottom) {\n continue; // bogus rectangle\n }\n box.left = Math.min(b.left , box.left);\n box.top = Math.min(b.top , box.top);\n box.right = Math.max(b.right , box.right);\n box.bottom = Math.max(b.bottom , box.bottom);\n }\n box.width = box.right - box.left;\n box.height = box.bottom - box.top;\n return box;\n }\n return range.getBoundingClientRect();\n }", "function supportRangeBounds() {\r\n var r, testElement, rangeBounds, rangeHeight, support = false;\r\n\r\n if (doc.createRange) {\r\n r = doc.createRange();\r\n if (r.getBoundingClientRect) {\r\n testElement = doc.createElement('boundtest');\r\n testElement.style.height = \"123px\";\r\n testElement.style.display = \"block\";\r\n doc.body.appendChild(testElement);\r\n\r\n r.selectNode(testElement);\r\n rangeBounds = r.getBoundingClientRect();\r\n rangeHeight = rangeBounds.height;\r\n\r\n if (rangeHeight === 123) {\r\n support = true;\r\n }\r\n doc.body.removeChild(testElement);\r\n }\r\n }\r\n\r\n return support;\r\n }", "function supportRangeBounds() {\r\n var r, testElement, rangeBounds, rangeHeight, support = false;\r\n\r\n if (doc.createRange) {\r\n r = doc.createRange();\r\n if (r.getBoundingClientRect) {\r\n testElement = doc.createElement('boundtest');\r\n testElement.style.height = \"123px\";\r\n testElement.style.display = \"block\";\r\n doc.body.appendChild(testElement);\r\n\r\n r.selectNode(testElement);\r\n rangeBounds = r.getBoundingClientRect();\r\n rangeHeight = rangeBounds.height;\r\n\r\n if (rangeHeight === 123) {\r\n support = true;\r\n }\r\n doc.body.removeChild(testElement);\r\n }\r\n }\r\n\r\n return support;\r\n }", "function getRangeBoundingClientRect(range) {\n // \"Return a DOMRect object describing the smallest rectangle that includes\n // the first rectangle in list and all of the remaining rectangles of which\n // the height or width is not zero.\"\n // http://www.w3.org/TR/cssom-view/#dom-range-getboundingclientrect\n var rects = getRangeClientRects(range);\n var top = 0;\n var right = 0;\n var bottom = 0;\n var left = 0;\n\n if (rects.length) {\n // If the first rectangle has 0 width, we use the second, this is needed\n // because Chrome renders a 0 width rectangle when the selection contains\n // a line break.\n if (rects.length > 1 && rects[0].width === 0) {\n var _rects$ = rects[1];\n top = _rects$.top;\n right = _rects$.right;\n bottom = _rects$.bottom;\n left = _rects$.left;\n } else {\n var _rects$2 = rects[0];\n top = _rects$2.top;\n right = _rects$2.right;\n bottom = _rects$2.bottom;\n left = _rects$2.left;\n }\n\n for (var ii = 1; ii < rects.length; ii++) {\n var rect = rects[ii];\n if (rect.height !== 0 && rect.width !== 0) {\n top = Math.min(top, rect.top);\n right = Math.max(right, rect.right);\n bottom = Math.max(bottom, rect.bottom);\n left = Math.min(left, rect.left);\n }\n }\n }\n\n return {\n top: top,\n right: right,\n bottom: bottom,\n left: left,\n width: right - left,\n height: bottom - top\n };\n}", "function getRangeBoundingClientRect(range) {\n // \"Return a DOMRect object describing the smallest rectangle that includes\n // the first rectangle in list and all of the remaining rectangles of which\n // the height or width is not zero.\"\n // http://www.w3.org/TR/cssom-view/#dom-range-getboundingclientrect\n var rects = getRangeClientRects(range);\n var top = 0;\n var right = 0;\n var bottom = 0;\n var left = 0;\n\n if (rects.length) {\n // If the first rectangle has 0 width, we use the second, this is needed\n // because Chrome renders a 0 width rectangle when the selection contains\n // a line break.\n if (rects.length > 1 && rects[0].width === 0) {\n var _rects$ = rects[1];\n top = _rects$.top;\n right = _rects$.right;\n bottom = _rects$.bottom;\n left = _rects$.left;\n } else {\n var _rects$2 = rects[0];\n top = _rects$2.top;\n right = _rects$2.right;\n bottom = _rects$2.bottom;\n left = _rects$2.left;\n }\n\n for (var ii = 1; ii < rects.length; ii++) {\n var rect = rects[ii];\n if (rect.height !== 0 && rect.width !== 0) {\n top = Math.min(top, rect.top);\n right = Math.max(right, rect.right);\n bottom = Math.max(bottom, rect.bottom);\n left = Math.min(left, rect.left);\n }\n }\n }\n\n return {\n top: top,\n right: right,\n bottom: bottom,\n left: left,\n width: right - left,\n height: bottom - top\n };\n}", "function getRangeBoundingClientRect(range) {\n // \"Return a DOMRect object describing the smallest rectangle that includes\n // the first rectangle in list and all of the remaining rectangles of which\n // the height or width is not zero.\"\n // http://www.w3.org/TR/cssom-view/#dom-range-getboundingclientrect\n var rects = getRangeClientRects(range);\n var top = 0;\n var right = 0;\n var bottom = 0;\n var left = 0;\n\n if (rects.length) {\n // If the first rectangle has 0 width, we use the second, this is needed\n // because Chrome renders a 0 width rectangle when the selection contains\n // a line break.\n if (rects.length > 1 && rects[0].width === 0) {\n var _rects$ = rects[1];\n top = _rects$.top;\n right = _rects$.right;\n bottom = _rects$.bottom;\n left = _rects$.left;\n } else {\n var _rects$2 = rects[0];\n top = _rects$2.top;\n right = _rects$2.right;\n bottom = _rects$2.bottom;\n left = _rects$2.left;\n }\n\n for (var ii = 1; ii < rects.length; ii++) {\n var rect = rects[ii];\n if (rect.height !== 0 && rect.width !== 0) {\n top = Math.min(top, rect.top);\n right = Math.max(right, rect.right);\n bottom = Math.max(bottom, rect.bottom);\n left = Math.min(left, rect.left);\n }\n }\n }\n\n return {\n top: top,\n right: right,\n bottom: bottom,\n left: left,\n width: right - left,\n height: bottom - top\n };\n}", "function getRangeBoundingClientRect(range) {\n // \"Return a DOMRect object describing the smallest rectangle that includes\n // the first rectangle in list and all of the remaining rectangles of which\n // the height or width is not zero.\"\n // http://www.w3.org/TR/cssom-view/#dom-range-getboundingclientrect\n var rects = getRangeClientRects(range);\n var top = 0;\n var right = 0;\n var bottom = 0;\n var left = 0;\n\n if (rects.length) {\n // If the first rectangle has 0 width, we use the second, this is needed\n // because Chrome renders a 0 width rectangle when the selection contains\n // a line break.\n if (rects.length > 1 && rects[0].width === 0) {\n var _rects$ = rects[1];\n top = _rects$.top;\n right = _rects$.right;\n bottom = _rects$.bottom;\n left = _rects$.left;\n } else {\n var _rects$2 = rects[0];\n top = _rects$2.top;\n right = _rects$2.right;\n bottom = _rects$2.bottom;\n left = _rects$2.left;\n }\n\n for (var ii = 1; ii < rects.length; ii++) {\n var rect = rects[ii];\n if (rect.height !== 0 && rect.width !== 0) {\n top = Math.min(top, rect.top);\n right = Math.max(right, rect.right);\n bottom = Math.max(bottom, rect.bottom);\n left = Math.min(left, rect.left);\n }\n }\n }\n\n return {\n top: top,\n right: right,\n bottom: bottom,\n left: left,\n width: right - left,\n height: bottom - top\n };\n}", "function getRangeBoundingClientRect(range) {\n // \"Return a DOMRect object describing the smallest rectangle that includes\n // the first rectangle in list and all of the remaining rectangles of which\n // the height or width is not zero.\"\n // http://www.w3.org/TR/cssom-view/#dom-range-getboundingclientrect\n var rects = getRangeClientRects(range);\n var top = 0;\n var right = 0;\n var bottom = 0;\n var left = 0;\n\n if (rects.length) {\n // If the first rectangle has 0 width, we use the second, this is needed\n // because Chrome renders a 0 width rectangle when the selection contains\n // a line break.\n if (rects.length > 1 && rects[0].width === 0) {\n var _rects$ = rects[1];\n top = _rects$.top;\n right = _rects$.right;\n bottom = _rects$.bottom;\n left = _rects$.left;\n } else {\n var _rects$2 = rects[0];\n top = _rects$2.top;\n right = _rects$2.right;\n bottom = _rects$2.bottom;\n left = _rects$2.left;\n }\n\n for (var ii = 1; ii < rects.length; ii++) {\n var rect = rects[ii];\n if (rect.height !== 0 && rect.width !== 0) {\n top = Math.min(top, rect.top);\n right = Math.max(right, rect.right);\n bottom = Math.max(bottom, rect.bottom);\n left = Math.min(left, rect.left);\n }\n }\n }\n\n return {\n top: top,\n right: right,\n bottom: bottom,\n left: left,\n width: right - left,\n height: bottom - top\n };\n}", "function getRangeBoundingClientRect(range) {\n // \"Return a DOMRect object describing the smallest rectangle that includes\n // the first rectangle in list and all of the remaining rectangles of which\n // the height or width is not zero.\"\n // http://www.w3.org/TR/cssom-view/#dom-range-getboundingclientrect\n var rects = getRangeClientRects(range);\n var top = 0;\n var right = 0;\n var bottom = 0;\n var left = 0;\n\n if (rects.length) {\n // If the first rectangle has 0 width, we use the second, this is needed\n // because Chrome renders a 0 width rectangle when the selection contains\n // a line break.\n if (rects.length > 1 && rects[0].width === 0) {\n var _rects$ = rects[1];\n top = _rects$.top;\n right = _rects$.right;\n bottom = _rects$.bottom;\n left = _rects$.left;\n } else {\n var _rects$2 = rects[0];\n top = _rects$2.top;\n right = _rects$2.right;\n bottom = _rects$2.bottom;\n left = _rects$2.left;\n }\n\n for (var ii = 1; ii < rects.length; ii++) {\n var rect = rects[ii];\n if (rect.height !== 0 && rect.width !== 0) {\n top = Math.min(top, rect.top);\n right = Math.max(right, rect.right);\n bottom = Math.max(bottom, rect.bottom);\n left = Math.min(left, rect.left);\n }\n }\n }\n\n return {\n top: top,\n right: right,\n bottom: bottom,\n left: left,\n width: right - left,\n height: bottom - top\n };\n}", "function getRangeBoundingClientRect(range) {\n // \"Return a DOMRect object describing the smallest rectangle that includes\n // the first rectangle in list and all of the remaining rectangles of which\n // the height or width is not zero.\"\n // http://www.w3.org/TR/cssom-view/#dom-range-getboundingclientrect\n var rects = getRangeClientRects(range);\n var top = 0;\n var right = 0;\n var bottom = 0;\n var left = 0;\n\n if (rects.length) {\n // If the first rectangle has 0 width, we use the second, this is needed\n // because Chrome renders a 0 width rectangle when the selection contains\n // a line break.\n if (rects.length > 1 && rects[0].width === 0) {\n var _rects$ = rects[1];\n top = _rects$.top;\n right = _rects$.right;\n bottom = _rects$.bottom;\n left = _rects$.left;\n } else {\n var _rects$2 = rects[0];\n top = _rects$2.top;\n right = _rects$2.right;\n bottom = _rects$2.bottom;\n left = _rects$2.left;\n }\n\n for (var ii = 1; ii < rects.length; ii++) {\n var rect = rects[ii];\n if (rect.height !== 0 && rect.width !== 0) {\n top = Math.min(top, rect.top);\n right = Math.max(right, rect.right);\n bottom = Math.max(bottom, rect.bottom);\n left = Math.min(left, rect.left);\n }\n }\n }\n\n return {\n top: top,\n right: right,\n bottom: bottom,\n left: left,\n width: right - left,\n height: bottom - top\n };\n}", "function getRangeBoundingClientRect(range) {\n // \"Return a DOMRect object describing the smallest rectangle that includes\n // the first rectangle in list and all of the remaining rectangles of which\n // the height or width is not zero.\"\n // http://www.w3.org/TR/cssom-view/#dom-range-getboundingclientrect\n var rects = getRangeClientRects(range);\n var top = 0;\n var right = 0;\n var bottom = 0;\n var left = 0;\n\n if (rects.length) {\n // If the first rectangle has 0 width, we use the second, this is needed\n // because Chrome renders a 0 width rectangle when the selection contains\n // a line break.\n if (rects.length > 1 && rects[0].width === 0) {\n var _rects$ = rects[1];\n top = _rects$.top;\n right = _rects$.right;\n bottom = _rects$.bottom;\n left = _rects$.left;\n } else {\n var _rects$2 = rects[0];\n top = _rects$2.top;\n right = _rects$2.right;\n bottom = _rects$2.bottom;\n left = _rects$2.left;\n }\n\n for (var ii = 1; ii < rects.length; ii++) {\n var rect = rects[ii];\n if (rect.height !== 0 && rect.width !== 0) {\n top = Math.min(top, rect.top);\n right = Math.max(right, rect.right);\n bottom = Math.max(bottom, rect.bottom);\n left = Math.min(left, rect.left);\n }\n }\n }\n\n return {\n top: top,\n right: right,\n bottom: bottom,\n left: left,\n width: right - left,\n height: bottom - top\n };\n}", "function getRangeBoundingClientRect(range) {\n // \"Return a DOMRect object describing the smallest rectangle that includes\n // the first rectangle in list and all of the remaining rectangles of which\n // the height or width is not zero.\"\n // http://www.w3.org/TR/cssom-view/#dom-range-getboundingclientrect\n var rects = getRangeClientRects(range);\n var top = 0;\n var right = 0;\n var bottom = 0;\n var left = 0;\n\n if (rects.length) {\n // If the first rectangle has 0 width, we use the second, this is needed\n // because Chrome renders a 0 width rectangle when the selection contains\n // a line break.\n if (rects.length > 1 && rects[0].width === 0) {\n var _rects$ = rects[1];\n top = _rects$.top;\n right = _rects$.right;\n bottom = _rects$.bottom;\n left = _rects$.left;\n } else {\n var _rects$2 = rects[0];\n top = _rects$2.top;\n right = _rects$2.right;\n bottom = _rects$2.bottom;\n left = _rects$2.left;\n }\n\n for (var ii = 1; ii < rects.length; ii++) {\n var rect = rects[ii];\n if (rect.height !== 0 && rect.width !== 0) {\n top = Math.min(top, rect.top);\n right = Math.max(right, rect.right);\n bottom = Math.max(bottom, rect.bottom);\n left = Math.min(left, rect.left);\n }\n }\n }\n\n return {\n top: top,\n right: right,\n bottom: bottom,\n left: left,\n width: right - left,\n height: bottom - top\n };\n}", "function actuallyGetRangeBoundingRect(range) {\n // XXX: to be revised when this Chrome bug is fixed:\n // https://bugs.chromium.org/p/chromium/issues/detail?id=612459\n if (microsoft || browser.chrome) {\n // Workaround browser bugs: IE and Chrome would sometimes\n // return 0 or 1-width rectangles before or after the main\n // one. https://github.com/telerik/kendo/issues/4674\n\n // Actually Chrome 50 got worse, since the rectangles can now have the width of a\n // full character, making it hard to tell whether it's a bogus rectangle or valid\n // selection location. The workaround is to ignore rectangles that fall on the\n // previous line. https://github.com/telerik/kendo/issues/5740\n var rectangles = range.getClientRects(), box = {\n top : Infinity,\n right : -Infinity,\n bottom : -Infinity,\n left : Infinity\n }, done = false;\n for (var i = 0; i < rectangles.length; ++i) {\n var b = rectangles[i];\n if (b.width <= 1 || b.bottom === prevLineBottom) {\n continue; // bogus rectangle\n }\n box.left = Math.min(b.left , box.left);\n box.top = Math.min(b.top , box.top);\n box.right = Math.max(b.right , box.right);\n box.bottom = Math.max(b.bottom , box.bottom);\n done = true;\n }\n if (!done) {\n return range.getBoundingClientRect();\n }\n box.width = box.right - box.left;\n box.height = box.bottom - box.top;\n return box;\n }\n return range.getBoundingClientRect();\n }", "function actuallyGetRangeBoundingRect(range) {\n // XXX: to be revised when this Chrome bug is fixed:\n // https://bugs.chromium.org/p/chromium/issues/detail?id=612459\n if (microsoft || browser.chrome) {\n // Workaround browser bugs: IE and Chrome would sometimes\n // return 0 or 1-width rectangles before or after the main\n // one. https://github.com/telerik/kendo/issues/4674\n\n // Actually Chrome 50 got worse, since the rectangles can now have the width of a\n // full character, making it hard to tell whether it's a bogus rectangle or valid\n // selection location. The workaround is to ignore rectangles that fall on the\n // previous line. https://github.com/telerik/kendo/issues/5740\n var rectangles = range.getClientRects(), box = {\n top : Infinity,\n right : -Infinity,\n bottom : -Infinity,\n left : Infinity\n }, done = false;\n for (var i = 0; i < rectangles.length; ++i) {\n var b = rectangles[i];\n if (b.width <= 1 || b.bottom === prevLineBottom) {\n continue; // bogus rectangle\n }\n box.left = Math.min(b.left , box.left);\n box.top = Math.min(b.top , box.top);\n box.right = Math.max(b.right , box.right);\n box.bottom = Math.max(b.bottom , box.bottom);\n done = true;\n }\n if (!done) {\n return range.getBoundingClientRect();\n }\n box.width = box.right - box.left;\n box.height = box.bottom - box.top;\n return box;\n }\n return range.getBoundingClientRect();\n }", "function supportRangeBounds() {\n var r, testElement, rangeBounds, rangeHeight, support = false;\n\n if (doc.createRange) {\n r = doc.createRange();\n if (r.getBoundingClientRect) {\n testElement = doc.createElement('boundtest');\n testElement.style.height = \"123px\";\n testElement.style.display = \"block\";\n doc.body.appendChild(testElement);\n\n r.selectNode(testElement);\n rangeBounds = r.getBoundingClientRect();\n rangeHeight = rangeBounds.height;\n\n if (rangeHeight === 123) {\n support = true;\n }\n doc.body.removeChild(testElement);\n }\n }\n\n return support;\n }", "function supportRangeBounds() {\n var r, testElement, rangeBounds, rangeHeight, support = false;\n\n if (doc.createRange) {\n r = doc.createRange();\n if (r.getBoundingClientRect) {\n testElement = doc.createElement('boundtest');\n testElement.style.height = \"123px\";\n testElement.style.display = \"block\";\n doc.body.appendChild(testElement);\n\n r.selectNode(testElement);\n rangeBounds = r.getBoundingClientRect();\n rangeHeight = rangeBounds.height;\n\n if (rangeHeight === 123) {\n support = true;\n }\n doc.body.removeChild(testElement);\n }\n }\n\n return support;\n }", "function BoundingBoxRect() { }", "function getRangeClientRectsChrome(range){var tempRange=range.cloneRange();var clientRects=[];for(var ancestor=range.endContainer;ancestor!=null;ancestor=ancestor.parentNode){// If we've climbed up to the common ancestor, we can now use the\r\n\t// original start point and stop climbing the tree.\r\n\tvar atCommonAncestor=ancestor===range.commonAncestorContainer;if(atCommonAncestor){tempRange.setStart(range.startContainer,range.startOffset);}else{tempRange.setStart(tempRange.endContainer,0);}var rects=Array.from(tempRange.getClientRects());clientRects.push(rects);if(atCommonAncestor){var _ref;clientRects.reverse();return(_ref=[]).concat.apply(_ref,clientRects);}tempRange.setEndBefore(ancestor);}true?true?invariant(false,'Found an unexpected detached subtree when getting range client rects.'):invariant(false):void 0;}", "function getClippingBBox(bounds) {\n return [[bounds.xmin, bounds.ymin],\n [bounds.xmin, bounds.ymax],\n [bounds.xmax, bounds.ymax],\n [bounds.xmax, bounds.ymin]];\n }", "function getRangeClientRectsChrome(range) {\n var tempRange = range.cloneRange();\n var clientRects = [];\n\n for (var ancestor = range.endContainer; ancestor != null; ancestor = ancestor.parentNode) {\n // If we've climbed up to the common ancestor, we can now use the\n // original start point and stop climbing the tree.\n var atCommonAncestor = ancestor === range.commonAncestorContainer;\n if (atCommonAncestor) {\n tempRange.setStart(range.startContainer, range.startOffset);\n } else {\n tempRange.setStart(tempRange.endContainer, 0);\n }\n var rects = Array.from(tempRange.getClientRects());\n clientRects.push(rects);\n if (atCommonAncestor) {\n var _ref;\n\n clientRects.reverse();\n return (_ref = []).concat.apply(_ref, clientRects);\n }\n tempRange.setEndBefore(ancestor);\n }\n\n true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Found an unexpected detached subtree when getting range client rects.') : invariant(false) : void 0;\n}", "function getRangeClientRectsChrome(range) {\n var tempRange = range.cloneRange();\n var clientRects = [];\n\n for (var ancestor = range.endContainer; ancestor != null; ancestor = ancestor.parentNode) {\n // If we've climbed up to the common ancestor, we can now use the\n // original start point and stop climbing the tree.\n var atCommonAncestor = ancestor === range.commonAncestorContainer;\n if (atCommonAncestor) {\n tempRange.setStart(range.startContainer, range.startOffset);\n } else {\n tempRange.setStart(tempRange.endContainer, 0);\n }\n var rects = Array.from(tempRange.getClientRects());\n clientRects.push(rects);\n if (atCommonAncestor) {\n var _ref;\n\n clientRects.reverse();\n return (_ref = []).concat.apply(_ref, clientRects);\n }\n tempRange.setEndBefore(ancestor);\n }\n\n true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Found an unexpected detached subtree when getting range client rects.') : invariant(false) : void 0;\n}", "function getRangeClientRectsChrome(range) {\n var tempRange = range.cloneRange();\n var clientRects = [];\n\n for (var ancestor = range.endContainer; ancestor != null; ancestor = ancestor.parentNode) {\n // If we've climbed up to the common ancestor, we can now use the\n // original start point and stop climbing the tree.\n var atCommonAncestor = ancestor === range.commonAncestorContainer;\n if (atCommonAncestor) {\n tempRange.setStart(range.startContainer, range.startOffset);\n } else {\n tempRange.setStart(tempRange.endContainer, 0);\n }\n var rects = Array.from(tempRange.getClientRects());\n clientRects.push(rects);\n if (atCommonAncestor) {\n var _ref;\n\n clientRects.reverse();\n return (_ref = []).concat.apply(_ref, clientRects);\n }\n tempRange.setEndBefore(ancestor);\n }\n\n true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Found an unexpected detached subtree when getting range client rects.') : invariant(false) : void 0;\n}", "function getRangeClientRectsChrome(range) {\n var tempRange = range.cloneRange();\n var clientRects = [];\n\n for (var ancestor = range.endContainer; ancestor != null; ancestor = ancestor.parentNode) {\n // If we've climbed up to the common ancestor, we can now use the\n // original start point and stop climbing the tree.\n var atCommonAncestor = ancestor === range.commonAncestorContainer;\n if (atCommonAncestor) {\n tempRange.setStart(range.startContainer, range.startOffset);\n } else {\n tempRange.setStart(tempRange.endContainer, 0);\n }\n var rects = Array.from(tempRange.getClientRects());\n clientRects.push(rects);\n if (atCommonAncestor) {\n var _ref;\n\n clientRects.reverse();\n return (_ref = []).concat.apply(_ref, clientRects);\n }\n tempRange.setEndBefore(ancestor);\n }\n\n true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Found an unexpected detached subtree when getting range client rects.') : invariant(false) : void 0;\n}", "function getRangeClientRectsChrome(range) {\n var tempRange = range.cloneRange();\n var clientRects = [];\n\n for (var ancestor = range.endContainer; ancestor != null; ancestor = ancestor.parentNode) {\n // If we've climbed up to the common ancestor, we can now use the\n // original start point and stop climbing the tree.\n var atCommonAncestor = ancestor === range.commonAncestorContainer;\n if (atCommonAncestor) {\n tempRange.setStart(range.startContainer, range.startOffset);\n } else {\n tempRange.setStart(tempRange.endContainer, 0);\n }\n var rects = Array.from(tempRange.getClientRects());\n clientRects.push(rects);\n if (atCommonAncestor) {\n var _ref;\n\n clientRects.reverse();\n return (_ref = []).concat.apply(_ref, clientRects);\n }\n tempRange.setEndBefore(ancestor);\n }\n\n true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Found an unexpected detached subtree when getting range client rects.') : invariant(false) : void 0;\n}", "function getRangeClientRectsChrome(range) {\n var tempRange = range.cloneRange();\n var clientRects = [];\n\n for (var ancestor = range.endContainer; ancestor != null; ancestor = ancestor.parentNode) {\n // If we've climbed up to the common ancestor, we can now use the\n // original start point and stop climbing the tree.\n var atCommonAncestor = ancestor === range.commonAncestorContainer;\n if (atCommonAncestor) {\n tempRange.setStart(range.startContainer, range.startOffset);\n } else {\n tempRange.setStart(tempRange.endContainer, 0);\n }\n var rects = Array.from(tempRange.getClientRects());\n clientRects.push(rects);\n if (atCommonAncestor) {\n var _ref;\n\n clientRects.reverse();\n return (_ref = []).concat.apply(_ref, clientRects);\n }\n tempRange.setEndBefore(ancestor);\n }\n\n true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Found an unexpected detached subtree when getting range client rects.') : invariant(false) : void 0;\n}", "function getRangeClientRectsChrome(range) {\n var tempRange = range.cloneRange();\n var clientRects = [];\n\n for (var ancestor = range.endContainer; ancestor != null; ancestor = ancestor.parentNode) {\n // If we've climbed up to the common ancestor, we can now use the\n // original start point and stop climbing the tree.\n var atCommonAncestor = ancestor === range.commonAncestorContainer;\n if (atCommonAncestor) {\n tempRange.setStart(range.startContainer, range.startOffset);\n } else {\n tempRange.setStart(tempRange.endContainer, 0);\n }\n var rects = Array.from(tempRange.getClientRects());\n clientRects.push(rects);\n if (atCommonAncestor) {\n var _ref;\n\n clientRects.reverse();\n return (_ref = []).concat.apply(_ref, clientRects);\n }\n tempRange.setEndBefore(ancestor);\n }\n\n true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Found an unexpected detached subtree when getting range client rects.') : invariant(false) : void 0;\n}", "function getRangeBoundingClientRect(range) {\n\t // \"Return a DOMRect object describing the smallest rectangle that includes\n\t // the first rectangle in list and all of the remaining rectangles of which\n\t // the height or width is not zero.\"\n\t // http://www.w3.org/TR/cssom-view/#dom-range-getboundingclientrect\n\t var rects = getRangeClientRects(range);\n\t var top = 0;\n\t var right = 0;\n\t var bottom = 0;\n\t var left = 0;\n\n\t if (rects.length) {\n\t var _rects$ = rects[0];\n\t top = _rects$.top;\n\t right = _rects$.right;\n\t bottom = _rects$.bottom;\n\t left = _rects$.left;\n\n\t for (var ii = 1; ii < rects.length; ii++) {\n\t var rect = rects[ii];\n\t if (rect.height !== 0 || rect.width !== 0) {\n\t top = Math.min(top, rect.top);\n\t right = Math.max(right, rect.right);\n\t bottom = Math.max(bottom, rect.bottom);\n\t left = Math.min(left, rect.left);\n\t }\n\t }\n\t }\n\n\t return {\n\t top: top,\n\t right: right,\n\t bottom: bottom,\n\t left: left,\n\t width: right - left,\n\t height: bottom - top\n\t };\n\t}", "function getRangeClientRectsChrome(range) {\n var tempRange = range.cloneRange();\n var clientRects = [];\n\n for (var ancestor = range.endContainer; ancestor != null; ancestor = ancestor.parentNode) {\n // If we've climbed up to the common ancestor, we can now use the\n // original start point and stop climbing the tree.\n var atCommonAncestor = ancestor === range.commonAncestorContainer;\n if (atCommonAncestor) {\n tempRange.setStart(range.startContainer, range.startOffset);\n } else {\n tempRange.setStart(tempRange.endContainer, 0);\n }\n var rects = Array.from(tempRange.getClientRects());\n clientRects.push(rects);\n if (atCommonAncestor) {\n var _ref;\n\n clientRects.reverse();\n return (_ref = []).concat.apply(_ref, clientRects);\n }\n tempRange.setEndBefore(ancestor);\n }\n\n true ? true ? invariant(false, 'Found an unexpected detached subtree when getting range client rects.') : undefined : undefined;\n}", "function mergeRectOffsets(rects) {\n return rects.reduce((previousRect, rect) => {\n if (previousRect == null) {\n return rect;\n }\n\n return {\n top: previousRect.top + rect.top,\n left: previousRect.left + rect.left,\n width: previousRect.width,\n height: previousRect.height,\n bottom: previousRect.bottom + rect.bottom,\n right: previousRect.right + rect.right,\n };\n });\n} // Calculate a boundingClientRect for a node relative to boundaryWindow,", "function _getBounds ( collection, bounds ) {\n var clipGroupElems, i, j;\n\n if ( collection.typename != 'GroupItem' ) { // ����� ��������� ������� �����������\n return collection.geometricBounds;\n }\n if ( collection.clipped ) { // ������ � ������ => ���� �����\n clipGroupElems = collection.pathItems;\n\n for ( i = 0; i < clipGroupElems.length; i++ ) {\n if ( clipGroupElems[ i ].clipping ) {\n if ( bounds == '' ) {\n bounds = clipGroupElems[ i ].geometricBounds;\n continue;\n }\n bounds = _compareBounds ( clipGroupElems[ i ], bounds );\n }\n }\n return bounds;\n }\n\n // ������ ��� ����������� ����� => ���� �� ��������� ������\n for ( j = 0; j < collection.pageItems.length; j++ ) {\n\n var el = collection.pageItems [ j ];\n\n if ( el.typename != 'GroupItem' ) { // ����� pageItem ����� ������\n if ( bounds == '' ) {\n bounds = el.geometricBounds;\n continue;\n }\n bounds = _compareBounds ( el, bounds );\n }\n\n if ( el.typename == 'GroupItem' && el.clipped ) { // ������ � ������ => ���� �����\n clipGroupElems = el.pathItems;\n for ( i = 0; i < clipGroupElems.length; i++ ) {\n if ( clipGroupElems[ i ].clipping ) {\n if ( bounds == '' ) {\n bounds = clipGroupElems[ i ].geometricBounds;\n continue;\n }\n bounds = _compareBounds ( clipGroupElems[ i ], bounds );\n }\n }\n continue;\n }\n\n if ( el.typename == 'GroupItem' && !el.groupItems && !el.clipped ) { // ������ ��� ����� � ��� �����\n if ( bounds == '' ) {\n bounds = el.geometricBounds;\n// bounds = getBoundsExtend ( el.pageItems, bounds );\n continue;\n }\n bounds = _compareBounds ( el.geometricBounds, bounds );\n continue;\n }\n\n if ( el.typename == 'GroupItem' && el.groupItems ) { // ������ ��� �����, �� � �������� => ��������\n for ( var l = 0; l < el.pageItems.length; l++ ) {\n /* if ( bounds == '' ) {\n bounds = getBoundsExtend ( el.pageItems[l], '' );\n }*/\n bounds = getBoundsExtend ( el.pageItems[ l ], bounds );\n }\n continue;\n }\n }\n return bounds;\n\n // �������� � ������� ����� ������� geometricBounds ��������\n function _compareBounds ( elem, boundsToCompare ) {\n var elemBounds = elem.geometricBounds;\n elemBounds[ 0 ] < boundsToCompare[ 0 ] ? boundsToCompare[ 0 ] = elemBounds[ 0 ] : '';\n elemBounds[ 1 ] > boundsToCompare[ 1 ] ? boundsToCompare[ 1 ] = elemBounds[ 1 ] : '';\n elemBounds[ 2 ] > boundsToCompare[ 2 ] ? boundsToCompare[ 2 ] = elemBounds[ 2 ] : '';\n elemBounds[ 3 ] < boundsToCompare[ 3 ] ? boundsToCompare[ 3 ] = elemBounds[ 3 ] : '';\n return boundsToCompare;\n }\n }", "function getRangeClientRectsChrome(range) {\n var tempRange = range.cloneRange();\n var clientRects = [];\n\n for (var ancestor = range.endContainer; ancestor != null; ancestor = ancestor.parentNode) {\n // If we've climbed up to the common ancestor, we can now use the\n // original start point and stop climbing the tree.\n var atCommonAncestor = ancestor === range.commonAncestorContainer;\n if (atCommonAncestor) {\n tempRange.setStart(range.startContainer, range.startOffset);\n } else {\n tempRange.setStart(tempRange.endContainer, 0);\n }\n var rects = Array.from(tempRange.getClientRects());\n clientRects.push(rects);\n if (atCommonAncestor) {\n var _ref;\n\n clientRects.reverse();\n return (_ref = []).concat.apply(_ref, clientRects);\n }\n tempRange.setEndBefore(ancestor);\n }\n\n !false ? 'development' !== 'production' ? invariant(false, 'Found an unexpected detached subtree when getting range client rects.') : invariant(false) : void 0;\n}", "rectifyBBox (bbox) {\n // horizontal top\n if (bbox[0].y != bbox[1].y) {\n let ymin = Math.min(bbox[0].y, bbox[1].y)\n bbox[0].y = ymin\n bbox[1].y = ymin\n }\n\n // horizontal bottom\n if (bbox[3].y != bbox[2].y) {\n let ymax = Math.max(bbox[3].y, bbox[2].y)\n bbox[3].y = ymax\n bbox[2].y = ymax\n }\n\n // vertical right\n if (bbox[1].x != bbox[2].x) {\n let xmax = Math.max(bbox[1].x, bbox[2].x)\n bbox[1].x = xmax\n bbox[2].x = xmax\n }\n\n // vertical left\n if (bbox[0].x != bbox[3].x) {\n let xmin = Math.min(bbox[0].x, bbox[3].x)\n bbox[0].x = xmin\n bbox[3].x = xmin\n }\n\n return bbox\n }", "getBounds() {}", "function getRangeClientRectsChrome(range) {\n\t var tempRange = range.cloneRange();\n\t var clientRects = [];\n\n\t for (var ancestor = range.endContainer; ancestor != null; ancestor = ancestor.parentNode) {\n\t // If we've climbed up to the common ancestor, we can now use the\n\t // original start point and stop climbing the tree.\n\t var atCommonAncestor = ancestor === range.commonAncestorContainer;\n\t if (atCommonAncestor) {\n\t tempRange.setStart(range.startContainer, range.startOffset);\n\t } else {\n\t tempRange.setStart(tempRange.endContainer, 0);\n\t }\n\t var rects = Array.from(tempRange.getClientRects());\n\t clientRects.push(rects);\n\t if (atCommonAncestor) {\n\t var _ref;\n\n\t clientRects.reverse();\n\t return (_ref = []).concat.apply(_ref, clientRects);\n\t }\n\t tempRange.setEndBefore(ancestor);\n\t }\n\n\t true ? false ? invariant(false, 'Found an unexpected detached subtree when getting range client rects.') : invariant(false) : void 0;\n\t}", "get bounds () {\n const xMin = Math.min.apply(null, this.pointArr.map(pt => pt.x))\n const yMin = Math.min.apply(null, this.pointArr.map(pt => pt.y))\n const xMax = Math.max.apply(null, this.pointArr.map(pt => pt.x))\n const yMax = Math.max.apply(null, this.pointArr.map(pt => pt.y))\n\n return {\n x: xMin,\n y: yMin,\n width: xMax - xMin,\n height: yMax - yMax\n }\n }", "getRects() {\n if (!this.moving) { return this.clientRects; }\n else { return this.DOMcontainer.getBoundingClientRect(); }\n }", "bounds() {\n const _bounds = new HRect(this.rect);\n _bounds.offsetTo(0, 0);\n return _bounds;\n }", "bbox() {\n var maxX = -Infinity;\n var maxY = -Infinity;\n var minX = Infinity;\n var minY = Infinity;\n this.forEach(function (el) {\n maxX = Math.max(el[0], maxX);\n maxY = Math.max(el[1], maxY);\n minX = Math.min(el[0], minX);\n minY = Math.min(el[1], minY);\n });\n return {\n x: minX,\n y: minY,\n width: maxX - minX,\n height: maxY - minY\n };\n }", "function bounds() {\n return {\n start: conductor.displayStart(),\n end: conductor.displayEnd(),\n domain: conductor.domain().key\n };\n }", "get bounds() { return this._bounds; }", "get bounds() {}", "_calculateBounds() {\n // FILL IN//\n }", "get boundsValue() {}", "calc_range() {\n let z = this.zoom / this.drug.z\n let zk = (1 / z - 1) / 2\n\n let range = this.y_range.slice()\n let delta = range[0] - range[1]\n range[0] = range[0] + delta * zk\n range[1] = range[1] - delta * zk\n\n return range\n }", "function getBounds(bounds){\n\t var bbox = [];\n\t\n\t bbox.push(parseFloat(bounds.attrib[\"minlon\"]));\n\t bbox.push(parseFloat(bounds.attrib[\"minlat\"]));\n\t bbox.push(parseFloat(bounds.attrib[\"maxlon\"]));\n\t bbox.push(parseFloat(bounds.attrib[\"maxlat\"]));\n\t\n\t return bbox;\n\t}", "function makeRangeBox(lon0, lat0, lon1, lat1) {\n\t var dlon4 = (lon1 - lon0) / 4;\n\t\n\t // TODO is this enough to handle ALL cases?\n\t // -- this makes scaling less precise than using d3.geo.graticule\n\t // as great circles can overshoot the boundary\n\t // (that's not a big deal I think)\n\t return {\n\t type: 'Polygon',\n\t coordinates: [\n\t [ [lon0, lat0],\n\t [lon0, lat1],\n\t [lon0 + dlon4, lat1],\n\t [lon0 + 2 * dlon4, lat1],\n\t [lon0 + 3 * dlon4, lat1],\n\t [lon1, lat1],\n\t [lon1, lat0],\n\t [lon1 - dlon4, lat0],\n\t [lon1 - 2 * dlon4, lat0],\n\t [lon1 - 3 * dlon4, lat0],\n\t [lon0, lat0] ]\n\t ]\n\t };\n\t}", "function makeRangeBox(lon0, lat0, lon1, lat1) {\n\t var dlon4 = (lon1 - lon0) / 4;\n\t\n\t // TODO is this enough to handle ALL cases?\n\t // -- this makes scaling less precise than using d3.geo.graticule\n\t // as great circles can overshoot the boundary\n\t // (that's not a big deal I think)\n\t return {\n\t type: 'Polygon',\n\t coordinates: [\n\t [ [lon0, lat0],\n\t [lon0, lat1],\n\t [lon0 + dlon4, lat1],\n\t [lon0 + 2 * dlon4, lat1],\n\t [lon0 + 3 * dlon4, lat1],\n\t [lon1, lat1],\n\t [lon1, lat0],\n\t [lon1 - dlon4, lat0],\n\t [lon1 - 2 * dlon4, lat0],\n\t [lon1 - 3 * dlon4, lat0],\n\t [lon0, lat0] ]\n\t ]\n\t };\n\t}", "getMapInnerBounds() {\n const mb = this.getMap()\n .getDiv()\n .getBoundingClientRect();\n\n let mib = {\n top: mb.top,\n right: mb.right,\n bottom: mb.bottom,\n left: mb.left\n };\n\n mib.width = mib.right - mib.left;\n mib.height = mib.bottom - mib.top;\n return mib;\n }", "function getBounds() {\n let body = d3.select('body');\n let bounds = body.node().getBoundingClientRect();\n\n let bound = {height: bounds.height, width: bounds.width, margin:\n {top: 50, right: 30, bottom: 30, left: 100}};\n\n bound.height -= 100; // because of header\n bound.width -= (bound.margin.left + bound.margin.right);\n bound.height -= (bound.margin.top + bound.margin.bottom);\n\n return bound;\n}", "get getBoundingClientRects() {\n if (!this._boundingClientRects) {\n const innerBox = this._innerBoxHelper.nativeElement.getBoundingClientRect();\n const clientRect = this.element.getBoundingClientRect();\n this._boundingClientRects = {\n clientRect,\n innerWidth: innerBox.width,\n innerHeight: innerBox.height,\n scrollBarWidth: clientRect.width - innerBox.width,\n scrollBarHeight: clientRect.height - innerBox.height,\n };\n const resetCurrentBox = () => this._boundingClientRects = undefined;\n if (this._isScrolling) {\n this.scrolling.pipe(filter(scrolling => scrolling === 0), take(1)).subscribe(resetCurrentBox);\n }\n else {\n requestAnimationFrame(resetCurrentBox);\n }\n }\n return this._boundingClientRects;\n }", "_getNarrowedViewportRect() {\n // We recalculate the viewport rect here ourselves, rather than using the ViewportRuler,\n // because we want to use the `clientWidth` and `clientHeight` as the base. The difference\n // being that the client properties don't include the scrollbar, as opposed to `innerWidth`\n // and `innerHeight` that do. This is necessary, because the overlay container uses\n // 100% `width` and `height` which don't include the scrollbar either.\n const width = this._document.documentElement.clientWidth;\n const height = this._document.documentElement.clientHeight;\n const scrollPosition = this._viewportRuler.getViewportScrollPosition();\n return {\n top: scrollPosition.top + this._viewportMargin,\n left: scrollPosition.left + this._viewportMargin,\n right: scrollPosition.left + width - this._viewportMargin,\n bottom: scrollPosition.top + height - this._viewportMargin,\n width: width - (2 * this._viewportMargin),\n height: height - (2 * this._viewportMargin),\n };\n }", "function getPixelRange() {\r\n\t\t$this = $['mapsettings'].element;\r\n\t\tvar xstart = 0;\r\n\t\tvar ystart = 0;\r\n\t\tif($['mapsettings'].initLeft<0) xstart = Math.abs($['mapsettings'].initLeft);\r\n\t\tif($['mapsettings'].initTop<0) ystart = Math.abs($['mapsettings'].initTop);\r\n\t\txstart = getFirstXPosInRange(xstart);\r\n\t\t// Makes sure that ystart values are multiples of 256 and start before viewport\r\n\t\tif(ystart%256!=0) ystart=((parseInt(ystart/256))-1)*256;\r\n\t\tvar xend = $this.innerWidth() - $['mapsettings'].initLeft;\r\n\t\tvar yend = $this.innerHeight() - $['mapsettings'].initTop;\r\n\t\treturn {\r\n\t\t\t\"start\": {\r\n\t\t\t\t\"x\": xstart,\r\n\t\t\t\t\"y\": ystart\r\n\t\t\t},\r\n\t\t\t\"end\": {\r\n\t\t\t\t\"x\": xend,\r\n\t\t\t\t\"y\": yend\r\n\t\t\t}\r\n\t\t};\r\n\t}", "function currentBounds(){var cntr=element?element.parent():null;var parent=cntr?cntr.parent():null;return parent?self.clientRect(parent):null;}", "_getRange() {\n const that = this;\n\n if (that.logarithmicScale) {\n that._range = that._drawMax - that._drawMin;\n return;\n }\n\n if (that.scaleType === 'floatingPoint') {\n that._range = (that._drawMax - that._drawMin).toString();\n }\n else {\n that._range = new JQX.Utilities.BigNumber(that._drawMax).subtract(that._drawMin).toString();\n }\n }", "_updateBoundingRect() {\n this._elBoundingRect = this.$el.getBoundingClientRect();\n\n // this has been introduced in 6c8234bb83d2df3e56f1b21a0caea4e4ef657eb4 and\n // breaks a lot of things... respecify the behavior when\n // normalizeCoordinates === false, because is not related to the given\n // element (this.$el) as implemented.\n // (the only app that depends on this option is probably coloop, so check it)\n // this._elBoundingRect = {\n // top: 0,\n // bottom: 0,\n // left: 0,\n // right: 0,\n // width: window.innerWidth,\n // height: window.innerHeight,\n // };\n }", "getBounds(){\n let rect = new Rectangle()\n\t\trect.setRect(this.x, this.y, this.size, this.size)\n\t\treturn rect\n }", "getBounds(){\n let rect = new Rectangle()\n\t\trect.setRect(this.x, this.y, this.size, this.size)\n\t\treturn rect\n }", "function itemBoundsDiff(item) {\r\r var itemVB = item.visibleBounds,\r itemVW = itemVB[2] - itemVB[0],\r itemVH = itemVB[1] - itemVB[3],\r\r itemGB = item.geometricBounds,\r itemGW = itemGB[2] - itemGB[0],\r itemGH = itemGB[1] - itemGB[3],\r\r deltaX = itemVW - itemGW,\r deltaY = itemVH - itemGH,\r\r diff = {\r deltaX: deltaX,\r deltaY: deltaY\r };\r\r return diff;\r}", "function computeAlternateBoundingBox(range) {\r\n\r\n\t\t// If the end of selection isn't at offset 0 into an element node (rather than a text node), then we just return the\r\n\t\t// original matching rectangle.\r\n\t\tif ((range.endOffset !== 0) && (range.endContainer.nodeType !== Node.ELEMENT_NODE)) {\r\n\t\t\tvar rect = range.getBoundingClientRect();\r\n\t\t\tvar mutableRect = {\r\n\t\t\t\ttop : rect.top,\r\n\t\t\t\tbottom : rect.bottom,\r\n\t\t\t\tleft : rect.left,\r\n\t\t\t\tright : rect.right,\r\n\t\t\t\twidth : rect.width,\r\n\t\t\t\theight : rect.height\r\n\t\t\t};\r\n\t\t\treturn mutableRect;\r\n\t\t}\r\n\r\n\t\t// This is the one we don't want.\r\n\t\tvar endElementRect = null;\r\n\t\ttry {\r\n\t\t\tendElementRect = range.endContainer.getBoundingClientRect();\r\n\t\t} catch(ex) {\r\n\t\t\tconsole.warn(\"Couldn't get a bounding client rect for our end element, maybe it's a text node.\");\r\n\t\t}\r\n\r\n\t\t// We look for a rectangle matching our end element, and if we find it, we don't copy it to our list to keep.\r\n\t\t// You'd think we could just grab the last element in range.getClientRects() here and trim that one, which might be\r\n\t\t// true, but the spec makes no claim that these are returned in order, so I don't want torely on that.\r\n\t\t// We keep track if we remove a rectangle, as we're only trying to remove one for the trailnig element. If there are\r\n\t\t// more than one matching rectangle, we want to keep all but one of them.\r\n\t\tvar foundEnd = false;\r\n\t\tvar keptRects = [];\r\n\t\tvar initialRects = range.getClientRects();\r\n\t\tfor (var i = 0; i < initialRects.length; i++) {\r\n\t\t\tif (rectanglesEqual(endElementRect, initialRects[i]) && !foundEnd) {\r\n\t\t\t\tfoundEnd = true;\r\n\t\t\t\tconsole.log(\"Omitting empty trailing selection element from preview.\");\r\n\t\t\t} else {\r\n\t\t\t\tkeptRects.push(initialRects[i]);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Now compute our new bounding box and return that.\r\n\t\tif (keptRects.length == 0)\r\n\t\t\treturn range.getBoundingClientRect();\r\n\t\tif (keptRects.length == 1)\r\n\t\t\treturn keptRects[0];\r\n\r\n\t\tvar rect = keptRects[0];\r\n\t\tfor (var i = 1; i < keptRects.length; i++) {\r\n\t\t\trect = unionRectangles(rect, keptRects[i]);\r\n\t\t}\r\n\r\n\t\treturn rect;\r\n\t}", "function getVisibleBounds(object) {\n var bounds, clippedItem;\n if (object.typename == \"GroupItem\") {\n // if the object is clipped\n if (object.clipped) {\n // check all sub objects to find the clipping path\n for (var i = 0; i < object.pageItems.length; i++) {\n if (object.pageItems[i].clipping) {\n clippedItem = object.pageItems[i];\n break;\n } else if (object.pageItems[i].typename == \"CompoundPathItem\") {\n if (object.pageItems[i].pathItems[0].clipping) {\n clippedItem = object.pageItems[i];\n break;\n }\n } else {\n clippedItem = object.pageItems[i];\n break;\n }\n }\n bounds = clippedItem.geometricBounds;\n } else {\n // if the object is not clipped\n var subObjectBounds;\n var allBoundPoints = [[], [], [], []];\n // get the bounds of every object in the group\n for (var i = 0; i < object.pageItems.length; i++) {\n subObjectBounds = getVisibleBounds(object.pageItems[i]);\n allBoundPoints[0].push(subObjectBounds[0]);\n allBoundPoints[1].push(subObjectBounds[1]);\n allBoundPoints[2].push(subObjectBounds[2]);\n allBoundPoints[3].push(subObjectBounds[3]);\n }\n // determine the groups bounds from it sub object bound points\n bounds = [\n Math.min.apply(Math, allBoundPoints[0]),\n Math.max.apply(Math, allBoundPoints[1]),\n Math.max.apply(Math, allBoundPoints[2]),\n Math.min.apply(Math, allBoundPoints[3]),\n ];\n }\n } else {\n bounds = object.geometricBounds;\n }\n return bounds;\n}", "function getVisibleBounds(object) {\n var bounds, clippedItem;\n if (object.typename == \"GroupItem\") {\n // if the object is clipped\n if (object.clipped) {\n // check all sub objects to find the clipping path\n for (var i = 0; i < object.pageItems.length; i++) {\n if (object.pageItems[i].clipping) {\n clippedItem = object.pageItems[i];\n break;\n } else if (object.pageItems[i].typename == \"CompoundPathItem\") {\n if (object.pageItems[i].pathItems[0].clipping) {\n clippedItem = object.pageItems[i];\n break;\n }\n } else {\n clippedItem = object.pageItems[i];\n break;\n }\n }\n bounds = clippedItem.geometricBounds;\n } else {\n // if the object is not clipped\n var subObjectBounds;\n var allBoundPoints = [[], [], [], []];\n // get the bounds of every object in the group\n for (var i = 0; i < object.pageItems.length; i++) {\n subObjectBounds = getVisibleBounds(object.pageItems[i]);\n allBoundPoints[0].push(subObjectBounds[0]);\n allBoundPoints[1].push(subObjectBounds[1]);\n allBoundPoints[2].push(subObjectBounds[2]);\n allBoundPoints[3].push(subObjectBounds[3]);\n }\n // determine the groups bounds from it sub object bound points\n bounds = [\n Math.min.apply(Math, allBoundPoints[0]),\n Math.max.apply(Math, allBoundPoints[1]),\n Math.max.apply(Math, allBoundPoints[2]),\n Math.min.apply(Math, allBoundPoints[3]),\n ];\n }\n } else {\n bounds = object.geometricBounds;\n }\n return bounds;\n}", "function drawBounds(bounds) {\n var boundsGroup = doc.groupItems.add();\n boundsGroup.name = \"BOUNDS\";\n var topLeft = drawBoundMark([\n [bounds[0], bounds[1] - 10],\n [bounds[0], bounds[1]],\n [bounds[0] + 10, bounds[1]],\n ]);\n topLeft.moveToEnd(boundsGroup);\n var topRight = drawBoundMark([\n [bounds[2], bounds[1] - 10],\n [bounds[2], bounds[1]],\n [bounds[2] - 10, bounds[1]],\n ]);\n topRight.moveToEnd(boundsGroup);\n var bottomLeft = drawBoundMark([\n [bounds[0], bounds[3] + 10],\n [bounds[0], bounds[3]],\n [bounds[0] + 10, bounds[3]],\n ]);\n bottomLeft.moveToEnd(boundsGroup);\n var bottomRight = drawBoundMark([\n [bounds[2], bounds[3] + 10],\n [bounds[2], bounds[3]],\n [bounds[2] - 10, bounds[3]],\n ]);\n bottomRight.moveToEnd(boundsGroup);\n}", "function rectangle_zoom(pos) {\n\tif (! ('x' in pos && 'y' in pos && 'width' in pos && 'height' in pos) || typeof pos.x == 'undefined' || typeof pos.y == 'undefined' || typeof pos.width == 'undefined' || typeof pos.height == 'undefined' ||\n\t(pos.width < 10 && pos.height < 10)) {\n\t\t$(\"selection-box\").hide();\n\t\tzoom_vals = {};\n\t\treturn;\n\t}\n\t\n\tvar $container = $('#canvas');\n\tvar loc = {\t\n\t\t'start1': pos.x - margin.left - $container.position().left,\n\t\t'end1': pos.x + pos.width - margin.left - $container.position().left,\n\t\t'start2': pos.y - margin.top - $container.position().top,\n\t\t'end2': pos.y + pos.height - margin.top - $container.position().top\n\t};\n\t\n\tvar nloc = {\n\t\t'start1': parseInt( scales.xback( loc.start1 ) ),\n\t\t'end1': parseInt( scales.xback( loc.end1 ) ),\n\t\t'start2': parseInt( scales.yback( loc.start2 ) ),\n\t\t'end2': parseInt( scales.yback( loc.end2 ) )\n\t};\n\tif (nloc.start1 > nloc.end1) {\n\t\tvar s1 = nloc.start1;\n\t\tnloc.start1 = nloc.end1;\n\t\tnloc.end1 = nloc.start1;\n\t}\n\tif (nloc.start2 > nloc.end2) {\n\t\tvar s2 = nloc.start2;\n\t\tnloc.start2 = nloc.end2;\n\t\tnloc.end2 = s2;\n\t}\n\t\n\t// Check limits\n\tvar max1 = cached_genomes.genomes[ get_par( 'sp1' ) ].max_pnum_display;\n\tvar max2 = cached_genomes.genomes[ get_par( 'sp2' ) ].max_pnum_display;\n\tif ( nloc.start1 < 0 ) { nloc.start1 = 0; }\n\tif ( nloc.start2 < 0 ) { nloc.start2 = 0; }\n\tif ( nloc.end1 > max1) { nloc.end1 = max1; }\n\tif ( nloc.end2 > max2) { nloc.end2 = max2; }\n\t\n\t// Update coordinates\n\tzoom_vals = nloc;\n}", "getBounds() {\n throw \"Abstract method\" \n }", "computeDomainsFromBounds (bounds) {\n var xmin = bounds[0][0]\n var xmax = bounds[1][0]\n var ymin = bounds[0][1]\n var ymax = bounds[1][1]\n var xRange = xmax - xmin\n var yRange = ymax - ymin\n\n const { options } = this.transitive\n\n var paddingFactor = (options && options.paddingFactor)\n ? options.paddingFactor\n : 0.1\n\n var margins = this.getMargins()\n\n var usableHeight = this.height - margins.top - margins.bottom\n var usableWidth = this.width - margins.left - margins.right\n var displayAspect = this.width / this.height\n var usableDisplayAspect = usableWidth / usableHeight\n var graphAspect = xRange / (yRange === 0 ? -Infinity : yRange)\n\n var padding\n var dispX1, dispX2, dispY1, dispY2\n var dispXRange, dispYRange\n\n if (usableDisplayAspect > graphAspect) { // y-axis is limiting\n padding = paddingFactor * yRange\n dispY1 = ymin - padding\n dispY2 = ymax + padding\n dispYRange = yRange + 2 * padding\n var addedYRange = (this.height / usableHeight * dispYRange) - dispYRange\n if (margins.top > 0 || margins.bottom > 0) {\n dispY1 -= margins.bottom / (margins.bottom + margins.top) * addedYRange\n dispY2 += margins.top / (margins.bottom + margins.top) * addedYRange\n }\n dispXRange = (dispY2 - dispY1) * displayAspect\n var xOffset = (margins.left - margins.right) / this.width\n var xMidpoint = (xmax + xmin - dispXRange * xOffset) / 2\n dispX1 = xMidpoint - dispXRange / 2\n dispX2 = xMidpoint + dispXRange / 2\n } else { // x-axis limiting\n padding = paddingFactor * xRange\n dispX1 = xmin - padding\n dispX2 = xmax + padding\n dispXRange = xRange + 2 * padding\n var addedXRange = (this.width / usableWidth * dispXRange) - dispXRange\n if (margins.left > 0 || margins.right > 0) {\n dispX1 -= margins.left / (margins.left + margins.right) * addedXRange\n dispX2 += margins.right / (margins.left + margins.right) * addedXRange\n }\n\n dispYRange = (dispX2 - dispX1) / displayAspect\n var yOffset = (margins.bottom - margins.top) / this.height\n var yMidpoint = (ymax + ymin - dispYRange * yOffset) / 2\n dispY1 = yMidpoint - dispYRange / 2\n dispY2 = yMidpoint + dispYRange / 2\n }\n\n return [\n [dispX1, dispX2],\n [dispY1, dispY2]\n ]\n }", "function clientToWinRTRect(e) {\n var zoomFactor = document.documentElement.msContentZoomFactor;\n return {\n x: e.pageX,\n y: e.pageY,\n width: 80,\n height: 80\n };\n }", "get SUPPORT_RANGE_BOUNDS() {\n 'use strict';\n\n var value = testRangeBounds(document);\n Object.defineProperty(FEATURES, 'SUPPORT_RANGE_BOUNDS', { value: value });\n return value;\n }", "get SUPPORT_RANGE_BOUNDS() {\n 'use strict';\n\n var value = testRangeBounds(document);\n Object.defineProperty(FEATURES, 'SUPPORT_RANGE_BOUNDS', { value: value });\n return value;\n }", "get SUPPORT_RANGE_BOUNDS() {\n 'use strict';\n\n var value = testRangeBounds(document);\n Object.defineProperty(FEATURES, 'SUPPORT_RANGE_BOUNDS', { value: value });\n return value;\n }", "get bounds() {\r\n\t\treturn {\r\n\t\t\tx: this.origin.x * (this.tileSize + this.spacing),\r\n\t\t\ty: this.origin.y * (this.tileSize + this.spacing),\r\n\t\t\tw: this.w * (this.tileSize + this.spacing) - this.spacing,\r\n\t\t\th: this.h * (this.tileSize + this.spacing) - this.spacing\r\n\t\t};\r\n\t}", "function computeAlternateBoundingBox(range) {\n \n // If the end of selection isn't at offset 0 into an element node (rather than a text node), then we just return the\n // original matching rectangle.\n if ((range.endOffset !== 0) && (range.endContainer.nodeType !== Node.ELEMENT_NODE)) {\n var rect = range.getBoundingClientRect();\n var mutableRect = {\n top: rect.top,\n bottom: rect.bottom,\n left: rect.left,\n right: rect.right,\n width: rect.width,\n height: rect.height\n };\n return mutableRect;\n }\n\n // This is the one we don't want.\n var endElementRect = null;\n try {\n endElementRect = range.endContainer.getBoundingClientRect();\n }\n catch(ex) {\n console.warn(\"Couldn't get a bounding client rect for our end element, maybe it's a text node.\");\n }\n\n // We look for a rectangle matching our end element, and if we find it, we don't copy it to our list to keep.\n // You'd think we could just grab the last element in range.getClientRects() here and trim that one, which might be\n // true, but the spec makes no claim that these are returned in order, so I don't want torely on that.\n // We keep track if we remove a rectangle, as we're only trying to remove one for the trailnig element. If there are\n // more than one matching rectangle, we want to keep all but one of them.\n var foundEnd = false;\n var keptRects = [];\n var initialRects = range.getClientRects();\n for (var i = 0; i < initialRects.length; i++) {\n if (rectanglesEqual(endElementRect, initialRects[i]) && !foundEnd) {\n foundEnd = true;\n console.log(\"Omitting empty trailing selection element from preview.\");\n }\n else {\n keptRects.push(initialRects[i]);\n }\n }\n\n // Now compute our new bounding box and return that.\n if (keptRects.length == 0) return range.getBoundingClientRect();\n if (keptRects.length == 1) return keptRects[0];\n\n var rect = keptRects[0];\n for (var i = 1; i < keptRects.length; i++) {\n rect = unionRectangles(rect, keptRects[i]);\n }\n\n return rect;\n }", "function normBounds( bounds ) {\n\n\t\tfor ( var i = ticks.length; i >= 0; i-- ) {\n\t\t\tif ( bounds[0] + unit / 2 >= ticks[i] ) {\n\t\t\t\tbounds[0] = ticks[i] - 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tfor ( var i = 0; i <= ticks.length; i++ ) {\n\t\t\tif ( bounds[1] - unit / 2 <= ticks[i] ) {\n\t\t\t\tbounds[1] = ticks[i] + 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn bounds;\n\t}", "function getActualBoundingClientRect(node) {\n var boundingRect = node.getBoundingClientRect(); // The original object returned by getBoundingClientRect is immutable, so we clone it\n // We can't use extend because the properties are not considered part of the object by hasOwnProperty in IE9\n\n var rect = {};\n\n for (var k in boundingRect) {\n rect[k] = boundingRect[k];\n }\n\n if (node.ownerDocument !== document) {\n var _frameElement = node.ownerDocument.defaultView.frameElement;\n\n if (_frameElement) {\n var frameRect = getActualBoundingClientRect(_frameElement);\n rect.top += frameRect.top;\n rect.bottom += frameRect.top;\n rect.left += frameRect.left;\n rect.right += frameRect.left;\n }\n }\n\n return rect;\n }", "function get_bounds(){\n\t\t\t\t\n\t\t\t\treturn {\n\t\t\t\t\t\n\t\t\t\t\tsw_lat : map.getBounds().getSouthWest().lat(),\n\t\t\t\t\t\n\t\t\t\t\tsw_lng : map.getBounds().getSouthWest().lng(),\n\t\t\t\t\t\n\t\t\t\t\tne_lat : map.getBounds().getNorthEast().lat(),\n\t\t\t\t\t\n\t\t\t\t\tne_lng : map.getBounds().getNorthEast().lng()\n\t\t\t\t\n\t\t\t\t};\n\t\t\t\n\t\t\t}", "function getBoundingRectLocs (center, grid) {\n var jQueryDoc = $(window.document),\n jQH = jQueryDoc.height(),\n jQW = jQueryDoc.width(),\n R = jQH/jQW,\n size = (grid ||.002);\n\n center.latitude = Math.round(center.latitude/(2*size))*(2*size);\n center.longitude = Math.round(center.longitude/(2*size/R))*(2*size/R);\n\n return [\n center.latitude + size,\n center.longitude - size/R,\n center.latitude - size,\n center.longitude + size/R\n ];\n\n }", "getBounds() {\n return new Rectangle(new Point(this.x, this.y), new Vector(0, 0));\n }", "function getBoundingBox () {\n let boundingBox = map.getBounds()\n xmin = parseFloat(boundingBox._sw.lng)\n ymin = parseFloat(boundingBox._sw.lat)\n xmax = parseFloat(boundingBox._ne.lng)\n ymax = parseFloat(boundingBox._ne.lat)\n\n //console.log(`${xmin}, ${ymin}, ${xmax}, ${ymax}`)\n}", "function getBoundingBox(selectables) {\n const box = {\n top: Infinity,\n left: Infinity,\n bottom: -Infinity,\n right: -Infinity,\n width: 0,\n height: 0,\n };\n selectables.forEach(s => {\n box.top = Math.min(box.top, s.metrics.clientRect.top);\n box.left = Math.min(box.left, s.metrics.clientRect.left);\n box.bottom = Math.max(box.bottom, s.metrics.clientRect.bottom);\n box.right = Math.max(box.right, s.metrics.clientRect.right);\n });\n return Object.assign({}, box, { width: box.right - box.left, height: box.bottom - box.top });\n }", "function _getActualBoundingClientRect(node) {\n var boundingRect = node.getBoundingClientRect(); // The original object returned by getBoundingClientRect is immutable, so we clone it\n // We can't use extend because the properties are not considered part of the object by hasOwnProperty in IE9\n\n var rect = {};\n\n for (var k in boundingRect) {\n rect[k] = boundingRect[k];\n }\n\n try {\n if (node.ownerDocument !== document) {\n var frameElement = node.ownerDocument.defaultView.frameElement;\n\n if (frameElement) {\n var frameRect = _getActualBoundingClientRect(frameElement);\n\n rect.top += frameRect.top;\n rect.bottom += frameRect.top;\n rect.left += frameRect.left;\n rect.right += frameRect.left;\n }\n }\n } catch (err) {// Ignore \"Access is denied\" in IE11/Edge\n }\n\n return rect;\n }", "calculateBounds() {\n var minX = Infinity;\n var maxX = -Infinity;\n var minY = Infinity;\n var maxY = -Infinity;\n if (this.graphicsData.length) {\n var shape = null;\n var x = 0;\n var y = 0;\n var w = 0;\n var h = 0;\n for (var i = 0; i < this.graphicsData.length; i++) {\n var data = this.graphicsData[i];\n var type = data.type;\n var lineWidth = data.lineStyle ? data.lineStyle.width : 0;\n shape = data.shape;\n if (type === ShapeSettings_1.ShapeSettings.SHAPES.RECT || type === ShapeSettings_1.ShapeSettings.SHAPES.RREC) {\n x = shape.x - (lineWidth / 2);\n y = shape.y - (lineWidth / 2);\n w = shape.width + lineWidth;\n h = shape.height + lineWidth;\n minX = x < minX ? x : minX;\n maxX = x + w > maxX ? x + w : maxX;\n minY = y < minY ? y : minY;\n maxY = y + h > maxY ? y + h : maxY;\n }\n else if (type === ShapeSettings_1.ShapeSettings.SHAPES.CIRC) {\n x = shape.x;\n y = shape.y;\n w = shape.radius + (lineWidth / 2);\n h = shape.radius + (lineWidth / 2);\n minX = x - w < minX ? x - w : minX;\n maxX = x + w > maxX ? x + w : maxX;\n minY = y - h < minY ? y - h : minY;\n maxY = y + h > maxY ? y + h : maxY;\n }\n else if (type === ShapeSettings_1.ShapeSettings.SHAPES.ELIP) {\n x = shape.x;\n y = shape.y;\n w = shape.width + (lineWidth / 2);\n h = shape.height + (lineWidth / 2);\n minX = x - w < minX ? x - w : minX;\n maxX = x + w > maxX ? x + w : maxX;\n minY = y - h < minY ? y - h : minY;\n maxY = y + h > maxY ? y + h : maxY;\n }\n else {\n // POLY\n var points = shape.points;\n var x2 = 0;\n var y2 = 0;\n var dx = 0;\n var dy = 0;\n var rw = 0;\n var rh = 0;\n var cx = 0;\n var cy = 0;\n for (var j = 0; j + 2 < points.length; j += 2) {\n x = points[j];\n y = points[j + 1];\n x2 = points[j + 2];\n y2 = points[j + 3];\n dx = Math.abs(x2 - x);\n dy = Math.abs(y2 - y);\n h = lineWidth;\n w = Math.sqrt((dx * dx) + (dy * dy));\n if (w < 1e-9) {\n continue;\n }\n rw = ((h / w * dy) + dx) / 2;\n rh = ((h / w * dx) + dy) / 2;\n cx = (x2 + x) / 2;\n cy = (y2 + y) / 2;\n minX = cx - rw < minX ? cx - rw : minX;\n maxX = cx + rw > maxX ? cx + rw : maxX;\n minY = cy - rh < minY ? cy - rh : minY;\n maxY = cy + rh > maxY ? cy + rh : maxY;\n }\n }\n }\n }\n else {\n minX = 0;\n maxX = 0;\n minY = 0;\n maxY = 0;\n }\n var padding = this.boundsPadding;\n this._bounds.minX = minX - padding;\n this._bounds.maxX = maxX + padding;\n this._bounds.minY = minY - padding;\n this._bounds.maxY = maxY + padding;\n }", "getMapInnerBounds() {\n const mb = this.getMap().getDiv().getBoundingClientRect();\n const mib = {\n top: mb.top + this._opts.edgeOffset.top,\n right: mb.right - this._opts.edgeOffset.right,\n bottom: mb.bottom - this._opts.edgeOffset.bottom,\n left: mb.left + this._opts.edgeOffset.left\n };\n mib.width = mib.right - mib.left;\n mib.height = mib.bottom - mib.top;\n return mib;\n }", "function getWindowBoundaries() {\n\tconst { pageXOffset, pageYOffset } = getWindowScrollPosition();\n\tconst { width, height } = getWindowSize();\n\tconst xMin = pageXOffset;\n\tconst xMax = pageXOffset + width;\n\tconst yMin = pageYOffset;\n\tconst yMax = pageYOffset + height;\n\treturn { xMin, xMax, yMin, yMax };\n}", "function myGetBounds(myPage, myDocument)\n{\n var array = new Array()\n var item = 0;\n with (myDocument.documentPreferences)\n {\n var myPageHeight = pageHeight;\n var myPageWidth = pageWidth;\n }\n\n with(myPage.marginPreferences)\n {\n var myX1 = left;\n var myY1 = top;\n var myY2 = bottom;\n var myX2 = right;\n }\n\n array[item++] = myY1;\n array[item++] = myX1;\n array[item++] = myPageHeight - myY2;\n array[item++] = myPageWidth - myX2;\n\n return array;\n}", "_computeRects(props) {\n var {\n highlight,\n offsetParent\n } = props; // Get the set of rectangles that covers the range's text, relative to\n // the offset parent.\n\n var clientRects = getClientRectsForTextInRange(highlight.domRange);\n var offsetParentRect = offsetParent.getBoundingClientRect();\n var relativeRects = clientRects.map(rect => getRelativeRect(rect, offsetParentRect));\n return relativeRects;\n }", "function getBoundariesFor(obj) {\r\n\t\treturn {\r\n\t\t\ttop: obj.center.y - (obj.size.height / 2.5),\r\n\t\t\tbottom: obj.center.y + (obj.size.height / 2.5),\r\n\t\t\tleft: obj.center.x - (obj.size.width / 2.5),\r\n\t\t\tright: obj.center.x + (obj.size.width / 2.5)\r\n\t\t};\r\n\t}", "get localBounds() {}", "get localBounds() {\n return {\n x: this.x, //I changed this, it was \"x: 0,\"\n y: this.y, //I changed this, it was \"y: 0,\"\n width: this.width,\n height: this.height\n } \n }", "get rects() {\n return this.layers\n .filter(layer => layer.active)\n .map(layer => this.getLayerRects(layer)).reduce((cur, prev) => {\n return prev.concat(cur);\n }, []);\n }", "function getActualBoundingClientRect(node) {\n var boundingRect = node.getBoundingClientRect();\n\n // The original object returned by getBoundingClientRect is immutable, so we clone it\n // We can't use extend because the properties are not considered part of the object by hasOwnProperty in IE9\n var rect = {};\n for (var k in boundingRect) {\n rect[k] = boundingRect[k];\n }\n\n if (node.ownerDocument !== document) {\n var _frameElement = node.ownerDocument.defaultView.frameElement;\n if (_frameElement) {\n var frameRect = getActualBoundingClientRect(_frameElement);\n rect.top += frameRect.top;\n rect.bottom += frameRect.top;\n rect.left += frameRect.left;\n rect.right += frameRect.left;\n }\n }\n\n return rect;\n}", "function getActualBoundingClientRect(node) {\n var boundingRect = node.getBoundingClientRect();\n\n // The original object returned by getBoundingClientRect is immutable, so we clone it\n // We can't use extend because the properties are not considered part of the object by hasOwnProperty in IE9\n var rect = {};\n for (var k in boundingRect) {\n rect[k] = boundingRect[k];\n }\n\n if (node.ownerDocument !== document) {\n var _frameElement = node.ownerDocument.defaultView.frameElement;\n if (_frameElement) {\n var frameRect = getActualBoundingClientRect(_frameElement);\n rect.top += frameRect.top;\n rect.bottom += frameRect.top;\n rect.left += frameRect.left;\n rect.right += frameRect.left;\n }\n }\n\n return rect;\n}", "function getActualBoundingClientRect(node) {\n var boundingRect = node.getBoundingClientRect();\n\n // The original object returned by getBoundingClientRect is immutable, so we clone it\n // We can't use extend because the properties are not considered part of the object by hasOwnProperty in IE9\n var rect = {};\n for (var k in boundingRect) {\n rect[k] = boundingRect[k];\n }\n\n if (node.ownerDocument !== document) {\n var _frameElement = node.ownerDocument.defaultView.frameElement;\n if (_frameElement) {\n var frameRect = getActualBoundingClientRect(_frameElement);\n rect.top += frameRect.top;\n rect.bottom += frameRect.top;\n rect.left += frameRect.left;\n rect.right += frameRect.left;\n }\n }\n\n return rect;\n}", "function getActualBoundingClientRect(node) {\n var boundingRect = node.getBoundingClientRect();\n\n // The original object returned by getBoundingClientRect is immutable, so we clone it\n // We can't use extend because the properties are not considered part of the object by hasOwnProperty in IE9\n var rect = {};\n for (var k in boundingRect) {\n rect[k] = boundingRect[k];\n }\n\n if (node.ownerDocument !== document) {\n var _frameElement = node.ownerDocument.defaultView.frameElement;\n if (_frameElement) {\n var frameRect = getActualBoundingClientRect(_frameElement);\n rect.top += frameRect.top;\n rect.bottom += frameRect.top;\n rect.left += frameRect.left;\n rect.right += frameRect.left;\n }\n }\n\n return rect;\n}", "function getActualBoundingClientRect(node) {\n var boundingRect = node.getBoundingClientRect();\n\n // The original object returned by getBoundingClientRect is immutable, so we clone it\n // We can't use extend because the properties are not considered part of the object by hasOwnProperty in IE9\n var rect = {};\n for (var k in boundingRect) {\n rect[k] = boundingRect[k];\n }\n\n if (node.ownerDocument !== document) {\n var _frameElement = node.ownerDocument.defaultView.frameElement;\n if (_frameElement) {\n var frameRect = getActualBoundingClientRect(_frameElement);\n rect.top += frameRect.top;\n rect.bottom += frameRect.top;\n rect.left += frameRect.left;\n rect.right += frameRect.left;\n }\n }\n\n return rect;\n}", "function getActualBoundingClientRect(node) {\n var boundingRect = node.getBoundingClientRect();\n\n // The original object returned by getBoundingClientRect is immutable, so we clone it\n // We can't use extend because the properties are not considered part of the object by hasOwnProperty in IE9\n var rect = {};\n for (var k in boundingRect) {\n rect[k] = boundingRect[k];\n }\n\n if (node.ownerDocument !== document) {\n var _frameElement = node.ownerDocument.defaultView.frameElement;\n if (_frameElement) {\n var frameRect = getActualBoundingClientRect(_frameElement);\n rect.top += frameRect.top;\n rect.bottom += frameRect.top;\n rect.left += frameRect.left;\n rect.right += frameRect.left;\n }\n }\n\n return rect;\n}", "function getActualBoundingClientRect(node) {\n var boundingRect = node.getBoundingClientRect();\n\n // The original object returned by getBoundingClientRect is immutable, so we clone it\n // We can't use extend because the properties are not considered part of the object by hasOwnProperty in IE9\n var rect = {};\n for (var k in boundingRect) {\n rect[k] = boundingRect[k];\n }\n\n if (node.ownerDocument !== document) {\n var _frameElement = node.ownerDocument.defaultView.frameElement;\n if (_frameElement) {\n var frameRect = getActualBoundingClientRect(_frameElement);\n rect.top += frameRect.top;\n rect.bottom += frameRect.top;\n rect.left += frameRect.left;\n rect.right += frameRect.left;\n }\n }\n\n return rect;\n}", "function getActualBoundingClientRect(node) {\n var boundingRect = node.getBoundingClientRect();\n\n // The original object returned by getBoundingClientRect is immutable, so we clone it\n // We can't use extend because the properties are not considered part of the object by hasOwnProperty in IE9\n var rect = {};\n for (var k in boundingRect) {\n rect[k] = boundingRect[k];\n }\n\n if (node.ownerDocument !== document) {\n var _frameElement = node.ownerDocument.defaultView.frameElement;\n if (_frameElement) {\n var frameRect = getActualBoundingClientRect(_frameElement);\n rect.top += frameRect.top;\n rect.bottom += frameRect.top;\n rect.left += frameRect.left;\n rect.right += frameRect.left;\n }\n }\n\n return rect;\n}", "function getActualBoundingClientRect(node) {\n var boundingRect = node.getBoundingClientRect();\n\n // The original object returned by getBoundingClientRect is immutable, so we clone it\n // We can't use extend because the properties are not considered part of the object by hasOwnProperty in IE9\n var rect = {};\n for (var k in boundingRect) {\n rect[k] = boundingRect[k];\n }\n\n if (node.ownerDocument !== document) {\n var _frameElement = node.ownerDocument.defaultView.frameElement;\n if (_frameElement) {\n var frameRect = getActualBoundingClientRect(_frameElement);\n rect.top += frameRect.top;\n rect.bottom += frameRect.top;\n rect.left += frameRect.left;\n rect.right += frameRect.left;\n }\n }\n\n return rect;\n}", "function getActualBoundingClientRect(node) {\n var boundingRect = node.getBoundingClientRect();\n\n // The original object returned by getBoundingClientRect is immutable, so we clone it\n // We can't use extend because the properties are not considered part of the object by hasOwnProperty in IE9\n var rect = {};\n for (var k in boundingRect) {\n rect[k] = boundingRect[k];\n }\n\n if (node.ownerDocument !== document) {\n var _frameElement = node.ownerDocument.defaultView.frameElement;\n if (_frameElement) {\n var frameRect = getActualBoundingClientRect(_frameElement);\n rect.top += frameRect.top;\n rect.bottom += frameRect.top;\n rect.left += frameRect.left;\n rect.right += frameRect.left;\n }\n }\n\n return rect;\n}", "function getActualBoundingClientRect(node) {\n var boundingRect = node.getBoundingClientRect();\n\n // The original object returned by getBoundingClientRect is immutable, so we clone it\n // We can't use extend because the properties are not considered part of the object by hasOwnProperty in IE9\n var rect = {};\n for (var k in boundingRect) {\n rect[k] = boundingRect[k];\n }\n\n if (node.ownerDocument !== document) {\n var _frameElement = node.ownerDocument.defaultView.frameElement;\n if (_frameElement) {\n var frameRect = getActualBoundingClientRect(_frameElement);\n rect.top += frameRect.top;\n rect.bottom += frameRect.top;\n rect.left += frameRect.left;\n rect.right += frameRect.left;\n }\n }\n\n return rect;\n}" ]
[ "0.6960293", "0.68528867", "0.67470604", "0.6737133", "0.6737133", "0.6730641", "0.6730641", "0.6730641", "0.6730641", "0.6730641", "0.6730641", "0.6730641", "0.6730641", "0.6730641", "0.6724661", "0.6724661", "0.6669039", "0.6669039", "0.66471195", "0.6547397", "0.65430623", "0.64956623", "0.64956623", "0.64956623", "0.64956623", "0.64956623", "0.64956623", "0.64956623", "0.64786124", "0.64727306", "0.6459753", "0.64350355", "0.64217997", "0.64076585", "0.63721865", "0.6356843", "0.6337342", "0.6310628", "0.62918043", "0.6265392", "0.62568337", "0.6240474", "0.6205932", "0.6193452", "0.61578", "0.61337286", "0.6106779", "0.6081154", "0.6072176", "0.60638785", "0.60529745", "0.6044845", "0.60346955", "0.6030771", "0.60236025", "0.60229075", "0.60146445", "0.6010552", "0.6010552", "0.600953", "0.6006393", "0.59919643", "0.59919643", "0.5986899", "0.5986323", "0.59839875", "0.5983299", "0.59832835", "0.59783816", "0.59783816", "0.59783816", "0.59754485", "0.5942512", "0.5941193", "0.5932591", "0.59317124", "0.5929432", "0.5927369", "0.5919328", "0.5907437", "0.59021246", "0.58992916", "0.58968943", "0.5885353", "0.58821315", "0.58743584", "0.58495975", "0.5845171", "0.58451045", "0.5815596", "0.58140945", "0.58140945", "0.58140945", "0.58140945", "0.58140945", "0.58140945", "0.58140945", "0.58140945", "0.58140945", "0.58140945", "0.58140945" ]
0.0
-1
Coverts a box from "div" coords to another coordinate system. Context may be "window", "page", "div", or "local"./null.
function fromCoordSystem(cm, coords, context) { if (context == "div") { return coords } var left = coords.left, top = coords.top; // First move into "page" coordinate system if (context == "page") { left -= pageScrollX(); top -= pageScrollY(); } else if (context == "local" || !context) { var localBox = cm.display.sizer.getBoundingClientRect(); left += localBox.left; top += localBox.top; } var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect(); return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fromCoordSystem(cm, coords, context) {\n if (context == \"div\") return coords;\n var left = coords.left, top = coords.top;\n // First move into \"page\" coordinate system\n if (context == \"page\") {\n left -= pageScrollX();\n top -= pageScrollY();\n } else if (context == \"local\" || !context) {\n var localBox = getRect(cm.display.sizer);\n left += localBox.left;\n top += localBox.top;\n }\n\n var lineSpaceBox = getRect(cm.display.lineSpace);\n return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top};\n }", "function fromCoordSystem(cm, coords, context) {\n if (context == \"div\") return coords;\n var left = coords.left, top = coords.top;\n // First move into \"page\" coordinate system\n if (context == \"page\") {\n left -= pageScrollX();\n top -= pageScrollY();\n } else if (context == \"local\" || !context) {\n var localBox = getRect(cm.display.sizer);\n left += localBox.left;\n top += localBox.top;\n }\n\n var lineSpaceBox = getRect(cm.display.lineSpace);\n return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top};\n }", "function fromCoordSystem(cm, coords, context) {\n if (context == \"div\") return coords;\n var left = coords.left, top = coords.top;\n // First move into \"page\" coordinate system\n if (context == \"page\") {\n left -= pageScrollX();\n top -= pageScrollY();\n } else if (context == \"local\" || !context) {\n var localBox = getRect(cm.display.sizer);\n left += localBox.left;\n top += localBox.top;\n }\n\n var lineSpaceBox = getRect(cm.display.lineSpace);\n return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top};\n }", "function fromCoordSystem(cm, coords, context) {\n if (context == \"div\") return coords;\n var left = coords.left, top = coords.top;\n // First move into \"page\" coordinate system\n if (context == \"page\") {\n left -= pageScrollX();\n top -= pageScrollY();\n } else if (context == \"local\" || !context) {\n var localBox = getRect(cm.display.sizer);\n left += localBox.left;\n top += localBox.top;\n }\n\n var lineSpaceBox = getRect(cm.display.lineSpace);\n return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top};\n }", "function intoCoordSystem(cm, lineObj, rect, context, includeWidgets) {\n if (!includeWidgets) {\n var height = widgetTopHeight(lineObj);\n rect.top += height;\n rect.bottom += height;\n }\n\n if (context == \"line\") {\n return rect;\n }\n\n if (!context) {\n context = \"local\";\n }\n\n var yOff = _heightAtLine(lineObj);\n\n if (context == \"local\") {\n yOff += paddingTop(cm.display);\n } else {\n yOff -= cm.display.viewOffset;\n }\n\n if (context == \"page\" || context == \"window\") {\n var lOff = cm.display.lineSpace.getBoundingClientRect();\n yOff += lOff.top + (context == \"window\" ? 0 : pageScrollY());\n var xOff = lOff.left + (context == \"window\" ? 0 : pageScrollX());\n rect.left += xOff;\n rect.right += xOff;\n }\n\n rect.top += yOff;\n rect.bottom += yOff;\n return rect;\n } // Coverts a box from \"div\" coords to another coordinate system.", "function fromCoordSystem(cm, coords, context) {\n\t\t if (context == \"div\") return coords;\n\t\t var left = coords.left, top = coords.top;\n\t\t // First move into \"page\" coordinate system\n\t\t if (context == \"page\") {\n\t\t left -= pageScrollX();\n\t\t top -= pageScrollY();\n\t\t } else if (context == \"local\" || !context) {\n\t\t var localBox = cm.display.sizer.getBoundingClientRect();\n\t\t left += localBox.left;\n\t\t top += localBox.top;\n\t\t }\n\t\t\n\t\t var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\n\t\t return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top};\n\t\t }", "function fromCoordSystem(cm, coords, context) {\n\t\t if (context == \"div\") { return coords }\n\t\t var left = coords.left, top = coords.top;\n\t\t // First move into \"page\" coordinate system\n\t\t if (context == \"page\") {\n\t\t left -= pageScrollX(doc(cm));\n\t\t top -= pageScrollY(doc(cm));\n\t\t } else if (context == \"local\" || !context) {\n\t\t var localBox = cm.display.sizer.getBoundingClientRect();\n\t\t left += localBox.left;\n\t\t top += localBox.top;\n\t\t }\n\n\t\t var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\n\t\t return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}\n\t\t }", "function fromCoordSystem(cm, coords, context) {\n if (context == \"div\") return coords;\n var left = coords.left, top = coords.top;\n // First move into \"page\" coordinate system\n if (context == \"page\") {\n left -= pageScrollX();\n top -= pageScrollY();\n } else if (context == \"local\" || !context) {\n var localBox = cm.display.sizer.getBoundingClientRect();\n left += localBox.left;\n top += localBox.top;\n }\n\n var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\n return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top};\n }", "function fromCoordSystem(cm, coords, context) {\n if (context == \"div\") return coords;\n var left = coords.left, top = coords.top;\n // First move into \"page\" coordinate system\n if (context == \"page\") {\n left -= pageScrollX();\n top -= pageScrollY();\n } else if (context == \"local\" || !context) {\n var localBox = cm.display.sizer.getBoundingClientRect();\n left += localBox.left;\n top += localBox.top;\n }\n\n var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\n return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top};\n }", "function fromCoordSystem(cm, coords, context) {\n if (context == \"div\") return coords;\n var left = coords.left, top = coords.top;\n // First move into \"page\" coordinate system\n if (context == \"page\") {\n left -= pageScrollX();\n top -= pageScrollY();\n } else if (context == \"local\" || !context) {\n var localBox = cm.display.sizer.getBoundingClientRect();\n left += localBox.left;\n top += localBox.top;\n }\n\n var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\n return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top};\n }", "function fromCoordSystem(cm, coords, context) {\n if (context == \"div\") return coords;\n var left = coords.left, top = coords.top;\n // First move into \"page\" coordinate system\n if (context == \"page\") {\n left -= pageScrollX();\n top -= pageScrollY();\n } else if (context == \"local\" || !context) {\n var localBox = cm.display.sizer.getBoundingClientRect();\n left += localBox.left;\n top += localBox.top;\n }\n\n var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\n return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top};\n }", "function fromCoordSystem(cm, coords, context) {\n if (context == \"div\") return coords;\n var left = coords.left, top = coords.top;\n // First move into \"page\" coordinate system\n if (context == \"page\") {\n left -= pageScrollX();\n top -= pageScrollY();\n } else if (context == \"local\" || !context) {\n var localBox = cm.display.sizer.getBoundingClientRect();\n left += localBox.left;\n top += localBox.top;\n }\n\n var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\n return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top};\n }", "function fromCoordSystem(cm, coords, context) {\n if (context == \"div\") return coords;\n var left = coords.left, top = coords.top;\n // First move into \"page\" coordinate system\n if (context == \"page\") {\n left -= pageScrollX();\n top -= pageScrollY();\n } else if (context == \"local\" || !context) {\n var localBox = cm.display.sizer.getBoundingClientRect();\n left += localBox.left;\n top += localBox.top;\n }\n\n var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\n return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top};\n }", "function fromCoordSystem(cm, coords, context) {\n if (context == \"div\") return coords;\n var left = coords.left, top = coords.top;\n // First move into \"page\" coordinate system\n if (context == \"page\") {\n left -= pageScrollX();\n top -= pageScrollY();\n } else if (context == \"local\" || !context) {\n var localBox = cm.display.sizer.getBoundingClientRect();\n left += localBox.left;\n top += localBox.top;\n }\n\n var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\n return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top};\n }", "function fromCoordSystem(cm, coords, context) {\n if (context == \"div\") return coords;\n var left = coords.left, top = coords.top;\n // First move into \"page\" coordinate system\n if (context == \"page\") {\n left -= pageScrollX();\n top -= pageScrollY();\n } else if (context == \"local\" || !context) {\n var localBox = cm.display.sizer.getBoundingClientRect();\n left += localBox.left;\n top += localBox.top;\n }\n\n var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\n return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top};\n }", "function fromCoordSystem(cm, coords, context) {\r\n if (context == \"div\") return coords;\r\n var left = coords.left, top = coords.top;\r\n // First move into \"page\" coordinate system\r\n if (context == \"page\") {\r\n left -= pageScrollX();\r\n top -= pageScrollY();\r\n } else if (context == \"local\" || !context) {\r\n var localBox = cm.display.sizer.getBoundingClientRect();\r\n left += localBox.left;\r\n top += localBox.top;\r\n }\r\n\r\n var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\r\n return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top};\r\n }", "function fromCoordSystem(cm, coords, context) {\n\t if (context == \"div\") return coords;\n\t var left = coords.left, top = coords.top;\n\t // First move into \"page\" coordinate system\n\t if (context == \"page\") {\n\t left -= pageScrollX();\n\t top -= pageScrollY();\n\t } else if (context == \"local\" || !context) {\n\t var localBox = cm.display.sizer.getBoundingClientRect();\n\t left += localBox.left;\n\t top += localBox.top;\n\t }\n\t\n\t var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\n\t return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top};\n\t }", "function fromCoordSystem(cm, coords, context) {\n if (context == \"div\") { return coords }\n var left = coords.left, top = coords.top;\n // First move into \"page\" coordinate system\n if (context == \"page\") {\n left -= pageScrollX(doc(cm));\n top -= pageScrollY(doc(cm));\n } else if (context == \"local\" || !context) {\n var localBox = cm.display.sizer.getBoundingClientRect();\n left += localBox.left;\n top += localBox.top;\n }\n\n var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\n return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}\n }", "function fromCoordSystem(cm, coords, context) {\n if (context == \"div\") { return coords }\n var left = coords.left, top = coords.top;\n // First move into \"page\" coordinate system\n if (context == \"page\") {\n left -= pageScrollX(doc(cm));\n top -= pageScrollY(doc(cm));\n } else if (context == \"local\" || !context) {\n var localBox = cm.display.sizer.getBoundingClientRect();\n left += localBox.left;\n top += localBox.top;\n }\n\n var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\n return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}\n }", "function fromCoordSystem(cm, coords, context) {\n\t if (context == \"div\") return coords;\n\t var left = coords.left, top = coords.top;\n\t // First move into \"page\" coordinate system\n\t if (context == \"page\") {\n\t left -= pageScrollX();\n\t top -= pageScrollY();\n\t } else if (context == \"local\" || !context) {\n\t var localBox = cm.display.sizer.getBoundingClientRect();\n\t left += localBox.left;\n\t top += localBox.top;\n\t }\n\n\t var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\n\t return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top};\n\t }", "function fromCoordSystem(cm, coords, context) {\n\t if (context == \"div\") return coords;\n\t var left = coords.left, top = coords.top;\n\t // First move into \"page\" coordinate system\n\t if (context == \"page\") {\n\t left -= pageScrollX();\n\t top -= pageScrollY();\n\t } else if (context == \"local\" || !context) {\n\t var localBox = cm.display.sizer.getBoundingClientRect();\n\t left += localBox.left;\n\t top += localBox.top;\n\t }\n\n\t var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\n\t return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top};\n\t }", "function fromCoordSystem(cm, coords, context) {\n if (context == \"div\") { return coords }\n var left = coords.left, top = coords.top;\n // First move into \"page\" coordinate system\n if (context == \"page\") {\n left -= pageScrollX();\n top -= pageScrollY();\n } else if (context == \"local\" || !context) {\n var localBox = cm.display.sizer.getBoundingClientRect();\n left += localBox.left;\n top += localBox.top;\n }\n\n var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\n return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}\n}", "function fromCoordSystem(cm, coords, context) {\n if (context == \"div\") { return coords }\n var left = coords.left, top = coords.top;\n // First move into \"page\" coordinate system\n if (context == \"page\") {\n left -= pageScrollX();\n top -= pageScrollY();\n } else if (context == \"local\" || !context) {\n var localBox = cm.display.sizer.getBoundingClientRect();\n left += localBox.left;\n top += localBox.top;\n }\n\n var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\n return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}\n}", "function fromCoordSystem(cm, coords, context) {\n if (context == \"div\") { return coords }\n var left = coords.left, top = coords.top;\n // First move into \"page\" coordinate system\n if (context == \"page\") {\n left -= pageScrollX();\n top -= pageScrollY();\n } else if (context == \"local\" || !context) {\n var localBox = cm.display.sizer.getBoundingClientRect();\n left += localBox.left;\n top += localBox.top;\n }\n\n var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\n return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}\n}", "function fromCoordSystem(cm, coords, context) {\n if (context == \"div\") { return coords }\n var left = coords.left, top = coords.top;\n // First move into \"page\" coordinate system\n if (context == \"page\") {\n left -= pageScrollX();\n top -= pageScrollY();\n } else if (context == \"local\" || !context) {\n var localBox = cm.display.sizer.getBoundingClientRect();\n left += localBox.left;\n top += localBox.top;\n }\n\n var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\n return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}\n}", "function fromCoordSystem(cm, coords, context) {\n if (context == \"div\") { return coords }\n var left = coords.left, top = coords.top;\n // First move into \"page\" coordinate system\n if (context == \"page\") {\n left -= pageScrollX();\n top -= pageScrollY();\n } else if (context == \"local\" || !context) {\n var localBox = cm.display.sizer.getBoundingClientRect();\n left += localBox.left;\n top += localBox.top;\n }\n\n var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\n return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}\n}", "function fromCoordSystem(cm, coords, context) {\n if (context == \"div\") { return coords }\n var left = coords.left, top = coords.top;\n // First move into \"page\" coordinate system\n if (context == \"page\") {\n left -= pageScrollX();\n top -= pageScrollY();\n } else if (context == \"local\" || !context) {\n var localBox = cm.display.sizer.getBoundingClientRect();\n left += localBox.left;\n top += localBox.top;\n }\n\n var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\n return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}\n}", "function fromCoordSystem(cm, coords, context) {\n if (context == \"div\") { return coords }\n var left = coords.left, top = coords.top;\n // First move into \"page\" coordinate system\n if (context == \"page\") {\n left -= pageScrollX();\n top -= pageScrollY();\n } else if (context == \"local\" || !context) {\n var localBox = cm.display.sizer.getBoundingClientRect();\n left += localBox.left;\n top += localBox.top;\n }\n\n var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\n return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}\n}", "function fromCoordSystem(cm, coords, context) {\n if (context == \"div\") { return coords }\n var left = coords.left, top = coords.top;\n // First move into \"page\" coordinate system\n if (context == \"page\") {\n left -= pageScrollX();\n top -= pageScrollY();\n } else if (context == \"local\" || !context) {\n var localBox = cm.display.sizer.getBoundingClientRect();\n left += localBox.left;\n top += localBox.top;\n }\n\n var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\n return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}\n}", "function fromCoordSystem(cm, coords, context) {\n if (context == \"div\") { return coords }\n var left = coords.left, top = coords.top;\n // First move into \"page\" coordinate system\n if (context == \"page\") {\n left -= pageScrollX();\n top -= pageScrollY();\n } else if (context == \"local\" || !context) {\n var localBox = cm.display.sizer.getBoundingClientRect();\n left += localBox.left;\n top += localBox.top;\n }\n\n var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\n return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}\n}", "function fromCoordSystem(cm, coords, context) {\n if (context == \"div\") { return coords }\n var left = coords.left, top = coords.top;\n // First move into \"page\" coordinate system\n if (context == \"page\") {\n left -= pageScrollX();\n top -= pageScrollY();\n } else if (context == \"local\" || !context) {\n var localBox = cm.display.sizer.getBoundingClientRect();\n left += localBox.left;\n top += localBox.top;\n }\n\n var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\n return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}\n}", "function fromCoordSystem(cm, coords, context) {\n if (context == \"div\") { return coords }\n var left = coords.left, top = coords.top;\n // First move into \"page\" coordinate system\n if (context == \"page\") {\n left -= pageScrollX();\n top -= pageScrollY();\n } else if (context == \"local\" || !context) {\n var localBox = cm.display.sizer.getBoundingClientRect();\n left += localBox.left;\n top += localBox.top;\n }\n\n var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\n return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}\n}", "function fromCoordSystem(cm, coords, context) {\r\n if (context == \"div\") { return coords }\r\n var left = coords.left, top = coords.top;\r\n // First move into \"page\" coordinate system\r\n if (context == \"page\") {\r\n left -= pageScrollX();\r\n top -= pageScrollY();\r\n } else if (context == \"local\" || !context) {\r\n var localBox = cm.display.sizer.getBoundingClientRect();\r\n left += localBox.left;\r\n top += localBox.top;\r\n }\r\n\r\n var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\r\n return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}\r\n}", "function fromCoordSystem(cm, coords, context) {\n if (context == \"div\") { return coords }\n var left = coords.left, top = coords.top\n // First move into \"page\" coordinate system\n if (context == \"page\") {\n left -= pageScrollX()\n top -= pageScrollY()\n } else if (context == \"local\" || !context) {\n var localBox = cm.display.sizer.getBoundingClientRect()\n left += localBox.left\n top += localBox.top\n }\n\n var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect()\n return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}\n}", "function fromCoordSystem(cm, coords, context) {\n if (context == \"div\") { return coords }\n var left = coords.left, top = coords.top\n // First move into \"page\" coordinate system\n if (context == \"page\") {\n left -= pageScrollX()\n top -= pageScrollY()\n } else if (context == \"local\" || !context) {\n var localBox = cm.display.sizer.getBoundingClientRect()\n left += localBox.left\n top += localBox.top\n }\n\n var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect()\n return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}\n}", "function fromCoordSystem(cm, coords, context) {\n if (context == \"div\") {\n return coords;\n }\n\n var left = coords.left,\n top = coords.top; // First move into \"page\" coordinate system\n\n if (context == \"page\") {\n left -= pageScrollX();\n top -= pageScrollY();\n } else if (context == \"local\" || !context) {\n var localBox = cm.display.sizer.getBoundingClientRect();\n left += localBox.left;\n top += localBox.top;\n }\n\n var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\n return {\n left: left - lineSpaceBox.left,\n top: top - lineSpaceBox.top\n };\n }", "function BoxPosition(obj) {\n // Either a BoxPosition was passed in and we need to copy it, or a StyleBox\n // was passed in and we need to copy the results of 'getBoundingClientRect'\n // as the object returned is readonly. All co-ordinate values are in reference\n // to the viewport origin (top left).\n var lh, height, width, top;\n\n if (obj.div) {\n height = obj.div.offsetHeight;\n width = obj.div.offsetWidth;\n top = obj.div.offsetTop;\n var rects = (rects = obj.div.childNodes) && (rects = rects[0]) && rects.getClientRects && rects.getClientRects();\n obj = obj.div.getBoundingClientRect(); // In certain cases the outter div will be slightly larger then the sum of\n // the inner div's lines. This could be due to bold text, etc, on some platforms.\n // In this case we should get the average line height and use that. This will\n // result in the desired behaviour.\n\n lh = rects ? Math.max(rects[0] && rects[0].height || 0, obj.height / rects.length) : 0;\n }\n\n this.left = obj.left;\n this.right = obj.right;\n this.top = obj.top || top;\n this.height = obj.height || height;\n this.bottom = obj.bottom || top + (obj.height || height);\n this.width = obj.width || width;\n this.lineHeight = lh !== undefined ? lh : obj.lineHeight;\n } // Move the box along a particular axis. Optionally pass in an amount to move", "function BoxPosition(obj) {\n // Either a BoxPosition was passed in and we need to copy it, or a StyleBox\n // was passed in and we need to copy the results of 'getBoundingClientRect'\n // as the object returned is readonly. All co-ordinate values are in reference\n // to the viewport origin (top left).\n var lh, height, width, top;\n if (obj.div) {\n height = obj.div.offsetHeight;\n width = obj.div.offsetWidth;\n top = obj.div.offsetTop;\n\n var rects = (rects = obj.div.childNodes) && (rects = rects[0]) &&\n rects.getClientRects && rects.getClientRects();\n obj = obj.div.getBoundingClientRect();\n // In certain cases the outter div will be slightly larger then the sum of\n // the inner div's lines. This could be due to bold text, etc, on some platforms.\n // In this case we should get the average line height and use that. This will\n // result in the desired behaviour.\n lh = rects ? Math.max((rects[0] && rects[0].height) || 0, obj.height / rects.length)\n : 0;\n\n }\n this.left = obj.left;\n this.right = obj.right;\n this.top = obj.top || top;\n this.height = obj.height || height;\n this.bottom = obj.bottom || (top + (obj.height || height));\n this.width = obj.width || width;\n this.lineHeight = lh !== undefined ? lh : obj.lineHeight;\n}", "function BoxPosition(obj) {\n // Either a BoxPosition was passed in and we need to copy it, or a StyleBox\n // was passed in and we need to copy the results of 'getBoundingClientRect'\n // as the object returned is readonly. All co-ordinate values are in reference\n // to the viewport origin (top left).\n var lh, height, width, top;\n if (obj.div) {\n height = obj.div.offsetHeight;\n width = obj.div.offsetWidth;\n top = obj.div.offsetTop;\n\n var rects = (rects = obj.div.childNodes) && (rects = rects[0]) &&\n rects.getClientRects && rects.getClientRects();\n obj = obj.div.getBoundingClientRect();\n // In certain cases the outter div will be slightly larger then the sum of\n // the inner div's lines. This could be due to bold text, etc, on some platforms.\n // In this case we should get the average line height and use that. This will\n // result in the desired behaviour.\n lh = rects ? Math.max((rects[0] && rects[0].height) || 0, obj.height / rects.length)\n : 0;\n\n }\n this.left = obj.left;\n this.right = obj.right;\n this.top = obj.top || top;\n this.height = obj.height || height;\n this.bottom = obj.bottom || (top + (obj.height || height));\n this.width = obj.width || width;\n this.lineHeight = lh !== undefined ? lh : obj.lineHeight;\n}", "function BoxPosition(obj) {\n // Either a BoxPosition was passed in and we need to copy it, or a StyleBox\n // was passed in and we need to copy the results of 'getBoundingClientRect'\n // as the object returned is readonly. All co-ordinate values are in reference\n // to the viewport origin (top left).\n var lh, height, width, top;\n if (obj.div) {\n height = obj.div.offsetHeight;\n width = obj.div.offsetWidth;\n top = obj.div.offsetTop;\n\n var rects = (rects = obj.div.childNodes) && (rects = rects[0]) &&\n rects.getClientRects && rects.getClientRects();\n obj = obj.div.getBoundingClientRect();\n // In certain cases the outter div will be slightly larger then the sum of\n // the inner div's lines. This could be due to bold text, etc, on some platforms.\n // In this case we should get the average line height and use that. This will\n // result in the desired behaviour.\n lh = rects ? Math.max((rects[0] && rects[0].height) || 0, obj.height / rects.length)\n : 0;\n\n }\n this.left = obj.left;\n this.right = obj.right;\n this.top = obj.top || top;\n this.height = obj.height || height;\n this.bottom = obj.bottom || (top + (obj.height || height));\n this.width = obj.width || width;\n this.lineHeight = lh !== undefined ? lh : obj.lineHeight;\n}", "function placeDiv(div, x, y) {\n\t// div.x = Math.round(x*CELL);\n\t// div.y = Math.round(y*CELL);\n\tdiv.css({\n\t\tleft: units(x),\n\t\ttop: units(y),\n\t});\n\treturn div;\n}", "function BoxPosition(obj) {\n // Either a BoxPosition was passed in and we need to copy it, or a StyleBox\n // was passed in and we need to copy the results of 'getBoundingClientRect'\n // as the object returned is readonly. All co-ordinate values are in reference\n // to the viewport origin (top left).\n var lh, height, width, top;\n if (obj.div) {\n height = obj.div.offsetHeight;\n width = obj.div.offsetWidth;\n top = obj.div.offsetTop;\n\n var rects =\n (rects = obj.div.childNodes) &&\n (rects = rects[0]) &&\n rects.getClientRects &&\n rects.getClientRects();\n obj = obj.div.getBoundingClientRect();\n // In certain cases the outter div will be slightly larger then the sum of\n // the inner div's lines. This could be due to bold text, etc, on some platforms.\n // In this case we should get the average line height and use that. This will\n // result in the desired behaviour.\n lh = rects\n ? Math.max(\n (rects[0] && rects[0].height) || 0,\n obj.height / rects.length\n )\n : 0;\n }\n this.left = obj.left;\n this.right = obj.right;\n this.top = obj.top || top;\n this.height = obj.height || height;\n this.bottom = obj.bottom || top + (obj.height || height);\n this.width = obj.width || width;\n this.lineHeight = lh !== undefined ? lh : obj.lineHeight;\n }", "function BoxPosition(obj) {\n var isIE8 = (/MSIE\\s8\\.0/).test(navigator.userAgent);\n\n // Either a BoxPosition was passed in and we need to copy it, or a StyleBox\n // was passed in and we need to copy the results of 'getBoundingClientRect'\n // as the object returned is readonly. All co-ordinate values are in reference\n // to the viewport origin (top left).\n var lh, height, width, top;\n if (obj.div) {\n height = obj.div.offsetHeight;\n width = obj.div.offsetWidth;\n top = obj.div.offsetTop;\n\n var rects = (rects = obj.div.childNodes) && (rects = rects[0]) &&\n rects.getClientRects && rects.getClientRects();\n obj = obj.div.getBoundingClientRect();\n // In certain cases the outter div will be slightly larger then the sum of\n // the inner div's lines. This could be due to bold text, etc, on some platforms.\n // In this case we should get the average line height and use that. This will\n // result in the desired behaviour.\n lh = rects ? Math.max((rects[0] && rects[0].height) || 0, obj.height / rects.length)\n : 0;\n\n }\n this.left = obj.left;\n this.right = obj.right;\n this.top = obj.top || top;\n this.height = obj.height || height;\n this.bottom = obj.bottom || (top + (obj.height || height));\n this.width = obj.width || width;\n this.lineHeight = lh !== undefined ? lh : obj.lineHeight;\n\n if (isIE8 && !this.lineHeight) {\n this.lineHeight = 13;\n }\n }", "function BoxPosition(obj) {\n var isIE8 = (/MSIE\\s8\\.0/).test(navigator.userAgent);\n\n // Either a BoxPosition was passed in and we need to copy it, or a StyleBox\n // was passed in and we need to copy the results of 'getBoundingClientRect'\n // as the object returned is readonly. All co-ordinate values are in reference\n // to the viewport origin (top left).\n var lh, height, width, top;\n if (obj.div) {\n height = obj.div.offsetHeight;\n width = obj.div.offsetWidth;\n top = obj.div.offsetTop;\n\n var rects = (rects = obj.div.childNodes) && (rects = rects[0]) &&\n rects.getClientRects && rects.getClientRects();\n obj = obj.div.getBoundingClientRect();\n // In certain cases the outter div will be slightly larger then the sum of\n // the inner div's lines. This could be due to bold text, etc, on some platforms.\n // In this case we should get the average line height and use that. This will\n // result in the desired behaviour.\n lh = rects ? Math.max((rects[0] && rects[0].height) || 0, obj.height / rects.length)\n : 0;\n\n }\n this.left = obj.left;\n this.right = obj.right;\n this.top = obj.top || top;\n this.height = obj.height || height;\n this.bottom = obj.bottom || (top + (obj.height || height));\n this.width = obj.width || width;\n this.lineHeight = lh !== undefined ? lh : obj.lineHeight;\n\n if (isIE8 && !this.lineHeight) {\n this.lineHeight = 13;\n }\n }", "function BoxPosition(obj) {\n var isIE8 = (/MSIE\\s8\\.0/).test(navigator.userAgent);\n\n // Either a BoxPosition was passed in and we need to copy it, or a StyleBox\n // was passed in and we need to copy the results of 'getBoundingClientRect'\n // as the object returned is readonly. All co-ordinate values are in reference\n // to the viewport origin (top left).\n var lh, height, width, top;\n if (obj.div) {\n height = obj.div.offsetHeight;\n width = obj.div.offsetWidth;\n top = obj.div.offsetTop;\n\n var rects = (rects = obj.div.childNodes) && (rects = rects[0]) &&\n rects.getClientRects && rects.getClientRects();\n obj = obj.div.getBoundingClientRect();\n // In certain cases the outter div will be slightly larger then the sum of\n // the inner div's lines. This could be due to bold text, etc, on some platforms.\n // In this case we should get the average line height and use that. This will\n // result in the desired behaviour.\n lh = rects ? Math.max((rects[0] && rects[0].height) || 0, obj.height / rects.length)\n : 0;\n\n }\n this.left = obj.left;\n this.right = obj.right;\n this.top = obj.top || top;\n this.height = obj.height || height;\n this.bottom = obj.bottom || (top + (obj.height || height));\n this.width = obj.width || width;\n this.lineHeight = lh !== undefined ? lh : obj.lineHeight;\n\n if (isIE8 && !this.lineHeight) {\n this.lineHeight = 13;\n }\n }", "function BoxPosition(obj) {\n var isIE8 = (/MSIE\\s8\\.0/).test(navigator.userAgent);\n\n // Either a BoxPosition was passed in and we need to copy it, or a StyleBox\n // was passed in and we need to copy the results of 'getBoundingClientRect'\n // as the object returned is readonly. All co-ordinate values are in reference\n // to the viewport origin (top left).\n var lh, height, width, top;\n if (obj.div) {\n height = obj.div.offsetHeight;\n width = obj.div.offsetWidth;\n top = obj.div.offsetTop;\n\n var rects = (rects = obj.div.childNodes) && (rects = rects[0]) &&\n rects.getClientRects && rects.getClientRects();\n obj = obj.div.getBoundingClientRect();\n // In certain cases the outter div will be slightly larger then the sum of\n // the inner div's lines. This could be due to bold text, etc, on some platforms.\n // In this case we should get the average line height and use that. This will\n // result in the desired behaviour.\n lh = rects ? Math.max((rects[0] && rects[0].height) || 0, obj.height / rects.length)\n : 0;\n\n }\n this.left = obj.left;\n this.right = obj.right;\n this.top = obj.top || top;\n this.height = obj.height || height;\n this.bottom = obj.bottom || (top + (obj.height || height));\n this.width = obj.width || width;\n this.lineHeight = lh !== undefined ? lh : obj.lineHeight;\n\n if (isIE8 && !this.lineHeight) {\n this.lineHeight = 13;\n }\n }", "function BoxPosition(obj) {\n var isIE8 = (/MSIE\\s8\\.0/).test(navigator.userAgent);\n\n // Either a BoxPosition was passed in and we need to copy it, or a StyleBox\n // was passed in and we need to copy the results of 'getBoundingClientRect'\n // as the object returned is readonly. All co-ordinate values are in reference\n // to the viewport origin (top left).\n var lh, height, width, top;\n if (obj.div) {\n height = obj.div.offsetHeight;\n width = obj.div.offsetWidth;\n top = obj.div.offsetTop;\n\n var rects = (rects = obj.div.childNodes) && (rects = rects[0]) &&\n rects.getClientRects && rects.getClientRects();\n obj = obj.div.getBoundingClientRect();\n // In certain cases the outter div will be slightly larger then the sum of\n // the inner div's lines. This could be due to bold text, etc, on some platforms.\n // In this case we should get the average line height and use that. This will\n // result in the desired behaviour.\n lh = rects ? Math.max((rects[0] && rects[0].height) || 0, obj.height / rects.length)\n : 0;\n\n }\n this.left = obj.left;\n this.right = obj.right;\n this.top = obj.top || top;\n this.height = obj.height || height;\n this.bottom = obj.bottom || (top + (obj.height || height));\n this.width = obj.width || width;\n this.lineHeight = lh !== undefined ? lh : obj.lineHeight;\n\n if (isIE8 && !this.lineHeight) {\n this.lineHeight = 13;\n }\n }", "function BoxPosition(obj) {\n var isIE8 = (/MSIE\\s8\\.0/).test(navigator.userAgent);\n\n // Either a BoxPosition was passed in and we need to copy it, or a StyleBox\n // was passed in and we need to copy the results of 'getBoundingClientRect'\n // as the object returned is readonly. All co-ordinate values are in reference\n // to the viewport origin (top left).\n var lh, height, width, top;\n if (obj.div) {\n height = obj.div.offsetHeight;\n width = obj.div.offsetWidth;\n top = obj.div.offsetTop;\n\n var rects = (rects = obj.div.childNodes) && (rects = rects[0]) &&\n rects.getClientRects && rects.getClientRects();\n obj = obj.div.getBoundingClientRect();\n // In certain cases the outter div will be slightly larger then the sum of\n // the inner div's lines. This could be due to bold text, etc, on some platforms.\n // In this case we should get the average line height and use that. This will\n // result in the desired behaviour.\n lh = rects ? Math.max((rects[0] && rects[0].height) || 0, obj.height / rects.length)\n : 0;\n\n }\n this.left = obj.left;\n this.right = obj.right;\n this.top = obj.top || top;\n this.height = obj.height || height;\n this.bottom = obj.bottom || (top + (obj.height || height));\n this.width = obj.width || width;\n this.lineHeight = lh !== undefined ? lh : obj.lineHeight;\n\n if (isIE8 && !this.lineHeight) {\n this.lineHeight = 13;\n }\n}", "function BoxPosition(obj) {\n var isIE8 = (/MSIE\\s8\\.0/).test(navigator.userAgent);\n\n // Either a BoxPosition was passed in and we need to copy it, or a StyleBox\n // was passed in and we need to copy the results of 'getBoundingClientRect'\n // as the object returned is readonly. All co-ordinate values are in reference\n // to the viewport origin (top left).\n var lh, height, width, top;\n if (obj.div) {\n height = obj.div.offsetHeight;\n width = obj.div.offsetWidth;\n top = obj.div.offsetTop;\n\n var rects = (rects = obj.div.childNodes) && (rects = rects[0]) &&\n rects.getClientRects && rects.getClientRects();\n obj = obj.div.getBoundingClientRect();\n // In certain cases the outter div will be slightly larger then the sum of\n // the inner div's lines. This could be due to bold text, etc, on some platforms.\n // In this case we should get the average line height and use that. This will\n // result in the desired behaviour.\n lh = rects ? Math.max((rects[0] && rects[0].height) || 0, obj.height / rects.length)\n : 0;\n\n }\n this.left = obj.left;\n this.right = obj.right;\n this.top = obj.top || top;\n this.height = obj.height || height;\n this.bottom = obj.bottom || (top + (obj.height || height));\n this.width = obj.width || width;\n this.lineHeight = lh !== undefined ? lh : obj.lineHeight;\n\n if (isIE8 && !this.lineHeight) {\n this.lineHeight = 13;\n }\n}", "function positionDivToCursor(e,divId) {\n\t\n\tvar mousex = e.clientX;\n\tvar mousey = e.clientY;\n\tvar innerHeight = window.innerHeight;\n\t\n\t// Adjust Y for IE\n\tif (globalBrowser != \"ie\")\n\t\tmousey = parseInt(mousey) + 15;\n\t\n\t// Adjust height\n\tif ((parseInt(mousey) + globalContextHeight) > innerHeight)\n\t\tmousey = mousey - globalContextHeight;\n\t\n\t// Set coordinates for context menu and display\n\tdocument.getElementById(divId).style.left = mousex + 'px';\n\tdocument.getElementById(divId).style.top = mousey + 'px';\n\tdocument.getElementById(divId).style.visibility = 'visible';\n\tdocument.getElementById(divId).style.display = '';\n}", "function intoCoordSystem(cm, lineObj, rect, context) {\n if (lineObj.widgets) for (var i = 0; i < lineObj.widgets.length; ++i) if (lineObj.widgets[i].above) {\n var size = widgetHeight(lineObj.widgets[i]);\n rect.top += size; rect.bottom += size;\n }\n if (context == \"line\") return rect;\n if (!context) context = \"local\";\n var yOff = heightAtLine(cm, lineObj);\n if (context == \"local\") yOff += paddingTop(cm.display);\n else yOff -= cm.display.viewOffset;\n if (context == \"page\" || context == \"window\") {\n var lOff = getRect(cm.display.lineSpace);\n yOff += lOff.top + (context == \"window\" ? 0 : pageScrollY());\n var xOff = lOff.left + (context == \"window\" ? 0 : pageScrollX());\n rect.left += xOff; rect.right += xOff;\n }\n rect.top += yOff; rect.bottom += yOff;\n return rect;\n }", "function intoCoordSystem(cm, lineObj, rect, context) {\n if (lineObj.widgets) for (var i = 0; i < lineObj.widgets.length; ++i) if (lineObj.widgets[i].above) {\n var size = widgetHeight(lineObj.widgets[i]);\n rect.top += size; rect.bottom += size;\n }\n if (context == \"line\") return rect;\n if (!context) context = \"local\";\n var yOff = heightAtLine(cm, lineObj);\n if (context == \"local\") yOff += paddingTop(cm.display);\n else yOff -= cm.display.viewOffset;\n if (context == \"page\" || context == \"window\") {\n var lOff = getRect(cm.display.lineSpace);\n yOff += lOff.top + (context == \"window\" ? 0 : pageScrollY());\n var xOff = lOff.left + (context == \"window\" ? 0 : pageScrollX());\n rect.left += xOff; rect.right += xOff;\n }\n rect.top += yOff; rect.bottom += yOff;\n return rect;\n }", "function intoCoordSystem(cm, lineObj, rect, context) {\n if (lineObj.widgets) for (var i = 0; i < lineObj.widgets.length; ++i) if (lineObj.widgets[i].above) {\n var size = widgetHeight(lineObj.widgets[i]);\n rect.top += size; rect.bottom += size;\n }\n if (context == \"line\") return rect;\n if (!context) context = \"local\";\n var yOff = heightAtLine(cm, lineObj);\n if (context == \"local\") yOff += paddingTop(cm.display);\n else yOff -= cm.display.viewOffset;\n if (context == \"page\" || context == \"window\") {\n var lOff = getRect(cm.display.lineSpace);\n yOff += lOff.top + (context == \"window\" ? 0 : pageScrollY());\n var xOff = lOff.left + (context == \"window\" ? 0 : pageScrollX());\n rect.left += xOff; rect.right += xOff;\n }\n rect.top += yOff; rect.bottom += yOff;\n return rect;\n }", "function intoCoordSystem(cm, lineObj, rect, context) {\n if (lineObj.widgets) for (var i = 0; i < lineObj.widgets.length; ++i) if (lineObj.widgets[i].above) {\n var size = widgetHeight(lineObj.widgets[i]);\n rect.top += size; rect.bottom += size;\n }\n if (context == \"line\") return rect;\n if (!context) context = \"local\";\n var yOff = heightAtLine(cm, lineObj);\n if (context == \"local\") yOff += paddingTop(cm.display);\n else yOff -= cm.display.viewOffset;\n if (context == \"page\" || context == \"window\") {\n var lOff = getRect(cm.display.lineSpace);\n yOff += lOff.top + (context == \"window\" ? 0 : pageScrollY());\n var xOff = lOff.left + (context == \"window\" ? 0 : pageScrollX());\n rect.left += xOff; rect.right += xOff;\n }\n rect.top += yOff; rect.bottom += yOff;\n return rect;\n }", "function copyBoxInto(box, originBox) {\n copyAxisInto(box.x, originBox.x);\n copyAxisInto(box.y, originBox.y);\n}", "function intoCoordSystem(cm, lineObj, rect, context) {\n if (lineObj.widgets) for (var i = 0; i < lineObj.widgets.length; ++i) if (lineObj.widgets[i].above) {\n var size = widgetHeight(lineObj.widgets[i]);\n rect.top += size; rect.bottom += size;\n }\n if (context == \"line\") return rect;\n if (!context) context = \"local\";\n var yOff = heightAtLine(cm, lineObj);\n if (context != \"local\") yOff -= cm.display.viewOffset;\n if (context == \"page\") {\n var lOff = cm.display.lineSpace.getBoundingClientRect();\n yOff += lOff.top + (window.pageYOffset || (document.documentElement || document.body).scrollTop);\n var xOff = lOff.left + (window.pageXOffset || (document.documentElement || document.body).scrollLeft);\n rect.left += xOff; rect.right += xOff;\n }\n rect.top += yOff; rect.bottom += yOff;\n return rect;\n }", "function intoCoordSystem(cm, lineObj, rect, context) {\n if (lineObj.widgets) for (var i = 0; i < lineObj.widgets.length; ++i) if (lineObj.widgets[i].above) {\n var size = widgetHeight(lineObj.widgets[i]);\n rect.top += size; rect.bottom += size;\n }\n if (context == \"line\") return rect;\n if (!context) context = \"local\";\n var yOff = heightAtLine(cm, lineObj);\n if (context != \"local\") yOff -= cm.display.viewOffset;\n if (context == \"page\") {\n var lOff = cm.display.lineSpace.getBoundingClientRect();\n yOff += lOff.top + (window.pageYOffset || (document.documentElement || document.body).scrollTop);\n var xOff = lOff.left + (window.pageXOffset || (document.documentElement || document.body).scrollLeft);\n rect.left += xOff; rect.right += xOff;\n }\n rect.top += yOff; rect.bottom += yOff;\n return rect;\n }", "function intoCoordSystem(cm, lineObj, rect, context) {\n if (lineObj.widgets) for (var i = 0; i < lineObj.widgets.length; ++i) if (lineObj.widgets[i].above) {\n var size = widgetHeight(lineObj.widgets[i]);\n rect.top += size; rect.bottom += size;\n }\n if (context == \"line\") return rect;\n if (!context) context = \"local\";\n var yOff = heightAtLine(cm, lineObj);\n if (context != \"local\") yOff -= cm.display.viewOffset;\n if (context == \"page\") {\n var lOff = cm.display.lineSpace.getBoundingClientRect();\n yOff += lOff.top + (window.pageYOffset || (document.documentElement || document.body).scrollTop);\n var xOff = lOff.left + (window.pageXOffset || (document.documentElement || document.body).scrollLeft);\n rect.left += xOff; rect.right += xOff;\n }\n rect.top += yOff; rect.bottom += yOff;\n return rect;\n }", "function getBox(o) {\n return {\n xMin: o.position.x,\n xMax: o.position.x + o.width,\n yMin: o.position.y,\n yMax: o.position.y + o.height\n };\n }", "function getBox(o) {\n return {\n xMin: o.position.x,\n xMax: o.position.x + o.width,\n yMin: o.position.y,\n yMax: o.position.y + o.height\n };\n }", "function drawBoxwh(x1,y1, width, height, color)\r\n{\t\r\n\t//set position to be relative\r\n\tx1 = x1 - world_coords.x;\r\n\ty1 = y1 - world_coords.y;\r\n\t\r\n\t//fix y\r\n\ty1 = window.height - y1;\r\n\t\r\n\t//draw\r\n\tif(squareOnScreen(x1, y1, width, height))\r\n\t{\r\n\t\tcontext.beginPath();\r\n\t\tcontext.strokeStyle = color;\r\n\t\tcontext.strokeRect(x1,y1,width,-height);\r\n\t\tcontext.stroke();\r\n\t\tcontext.closePath();\r\n\t}\r\n}", "positionDiv() {\n const point = this.getProjection().fromLatLngToDivPixel(this.latlng);\n if (point) {\n this.div.style.left = `${point.x}px`;\n this.div.style.top = `${point.y}px`;\n }\n }", "function renderBox(context, frame, options) {\n const { fill, stroke } = options || {};\n const locs = locsFrameTrans(\n [[-1, -1], [1, -1], [1, 1], [-1, 1]], \n frame,\n identityFrame\n );\n context.beginPath();\n context.moveTo(...locs[0]);\n [1, 2, 3, 0].forEach(i => context.lineTo(...locs[i]));\n if (fill) { context.fill(); }\n if (stroke) { context.stroke(); }\n}", "function mouseCoordsToElem(div,mouseEvent){//y coords not verified \n //var div=document.getElementById(divId);\n var documentCoords=findDocumentCoords(mouseEvent);\n var div0 = div.getBoundingClientRect();\n var x=documentCoords.x- div0.left - window.pageXOffset;\n //var x=documentCoords.x-(div0.left+document.body.scrollLeft);\n var y=documentCoords.y- div0.top - window.pageYOffset;\n return{\n x:x,\n y:y//y coords not verified \n };\n}", "merge(box) {\n let x = Math.min(this.x, box.x);\n let y = Math.min(this.y, box.y);\n let width = Math.max(this.x + this.width, box.x + box.width) - x;\n let height = Math.max(this.y + this.height, box.y + box.height) - y;\n return new Box_Box(x, y, width, height);\n }", "function setBox(/*DomNode*/ node, /*Number?*/ l, /*Number?*/ t, /*Number?*/ w, /*Number?*/ h, /*String?*/ u){\n\t\t// summary:\n\t\t//\t\tsets width/height/left/top in the current (native) box-model\n\t\t//\t\tdimensions. Uses the unit passed in u.\n\t\t// node:\n\t\t//\t\tDOM Node reference. Id string not supported for performance\n\t\t//\t\treasons.\n\t\t// l:\n\t\t//\t\tleft offset from parent.\n\t\t// t:\n\t\t//\t\ttop offset from parent.\n\t\t// w:\n\t\t//\t\twidth in current box model.\n\t\t// h:\n\t\t//\t\twidth in current box model.\n\t\t// u:\n\t\t//\t\tunit measure to use for other measures. Defaults to \"px\".\n\t\tu = u || \"px\";\n\t\tvar s = node.style;\n\t\tif(!isNaN(l)){\n\t\t\ts.left = l + u;\n\t\t}\n\t\tif(!isNaN(t)){\n\t\t\ts.top = t + u;\n\t\t}\n\t\tif(w >= 0){\n\t\t\ts.width = w + u;\n\t\t}\n\t\tif(h >= 0){\n\t\t\ts.height = h + u;\n\t\t}\n\t}", "function setCoordinates(divId, containerId, x, y) {\n const div = document.getElementById(divId);\n\n div.style.position = 'absolute';\n div.style.left = x - div.offsetWidth/2 + 'px';\n div.style.top = y - div.offsetHeight/2 + 'px';\n}", "getWorldHitbox() {\n\t\tvar worldPoint = this.convertCoordinates();\n\t\tvar diff = this.getWidth() - this.getHeight();\n\t\treturn new Hitbox(worldPoint.x + diff/2, worldPoint.y, this.getWidth() - 7 - diff, this.getHeight() - 7);\n\t}", "worldToScreen(x, y) {\n if (y === undefined) {\n y = x.y;\n x = x.x;\n }\n\n let M = this.ctx.getTransform();\n\n let ret = {\n x: x * M.a + y * M.c + M.e,\n y: x * M.b + y * M.d + M.f,\n };\n\n return ret;\n }", "function boundingBox( jqNode, jqGraph, box ) {\n var v = jqNode.offset();\n var graphOffset = jqGraph.offset();\n var top = v.top - graphOffset.top;\n var left = v.left - graphOffset.left;\n box = box || {};\n box.top = top;\n box.left = left;\n box.right = left + jqNode.width();\n box.bottom = top + jqNode.height();\n return box;\n }", "function _(e){var i=q(w);e.within={element:i,isWindow:true,offset:i.offset()||{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:i.width(),height:i.height()};e.collisionPosition={marginLeft:0,marginTop:0};return e;}", "function _(e){var i=q(w);e.within={element:i,isWindow:true,offset:i.offset()||{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:i.width(),height:i.height()};e.collisionPosition={marginLeft:0,marginTop:0};return e;}", "function _(e){var f=q(w);e.within={element:f,isWindow:true,offset:f.offset()||{left:0,top:0},scrollLeft:f.scrollLeft(),scrollTop:f.scrollTop(),width:f.width(),height:f.height()};e.collisionPosition={marginLeft:0,marginTop:0};return e;}", "function getDivCenter(obj) {\n var pos = new esri.geometry.Point();\n pos.spatialReference = map.spatialReference;\n // divHeight = obj.style.height;\n // divWidth = obj.style.width;\n // pos.y = parseInt(divHeight.substr(0, divHeight.length)) / 2;\n // pos.x = parseInt(divWidth.substr(0, divWidth.length)) / 2;\n pos.y = obj.offsetHeight / 2;\n pos.x = obj.offsetWidth / 2;\n return pos;\n}", "setBoxCoords(_id, _coords) {\n const [x, y, w, h] = _coords;\n this.setStyle(_id, 'left', `${x}px`);\n this.setStyle(_id, 'top', `${y}px`);\n this.setStyle(_id, 'width', `${w}px`);\n this.setStyle(_id, 'height', `${h}px`);\n }", "setBoxCoords(_id, _coords) {\n const [x, y, w, h] = _coords;\n this.setStyle(_id, 'left', `${x}px`);\n this.setStyle(_id, 'top', `${y}px`);\n this.setStyle(_id, 'width', `${w}px`);\n this.setStyle(_id, 'height', `${h}px`);\n }", "function boxToBox(box1, box2) {\n var bb1 = box1.getBoundingBox();\n var bb2 = box2.getBoundingBox();\n \n var dx = box1.getPos().posX - box2.getPos().posX;\n var dy = box1.getPos().posX - box2.getPos().posY;\n \n var w = bb1.width/2 + bb2.width/2;\n var h = bb1.height/2 + bb2.height/2;\n \n if(Math.abs(dx) <= w && Math.abs(dy) <= h)\n return true;\n }", "function setBoxPosition (x, y){\n gsap.to('.center-box', 0.1, {x, y, ease: \"slow(0.7, 0.7, false)\"})\n gsap.to('.float', 0.1, {x: -(x/2), y: -(y/2), ease: 'slow(0.7, 0.7, false)'})\n}", "updatePosition(sqr) {\n\t\tif(sqr.x > window.innerWidth - sqr.width) sqr.x = window.innerWidth - sqr.width;\n\t\tif(sqr.x < sqr.width) sqr.x = sqr.width;\n\t\tif(sqr.y > window.innerHeight - sqr.height) sqr.y = window.innerHeight - sqr.height;\n\t\tif(sqr.y < sqr.height) sqr.y = sqr.height;\t\t\n\t\tsqr.div.style.left = sqr.x + \"px\";\n\t\tsqr.div.style.top = sqr.y + \"px\";\n\t}", "function createDivContainer(id,frm,zValue) {\r\n\tid = (id || 'overDiv'), frm = (frm || o3_frame), zValue = (zValue || 1000);\r\n\tvar objRef, divContainer = layerReference(id);\r\n\r\n\tif (divContainer == null) {\r\n\t\tif (olNs4) {\r\n\t\t\tdivContainer = frm.document.layers[id] = new Layer(window.innerWidth, frm);\r\n\t\t\tobjRef = divContainer;\r\n\t\t} else {\r\n\t\t\tvar body = (olIe4 ? frm.document.all.tags('BODY')[0] : frm.document.getElementsByTagName(\"BODY\")[0]);\r\n\t\t\tif (olIe4&&!document.getElementById) {\r\n\t\t\t\tbody.insertAdjacentHTML(\"beforeEnd\",'<div id=\"'+id+'\"></div>');\r\n\t\t\t\tdivContainer=layerReference(id);\r\n\t\t\t} else {\r\n\t\t\t\tdivContainer = frm.document.createElement(\"DIV\");\r\n\t\t\t\tdivContainer.id = id;\r\n\t\t\t\tbody.appendChild(divContainer);\r\n\t\t\t}\r\n\t\t\tobjRef = divContainer.style;\r\n\t\t}\r\n\r\n\t\tobjRef.position = 'absolute';\r\n\t\tobjRef.visibility = 'hidden';\r\n\t\tobjRef.zIndex = zValue;\r\n\t\tif (olIe4&&!olOp) objRef.left = objRef.top = '0px';\r\n\t\telse objRef.left = objRef.top = -10000 + (!olNs4 ? 'px' : 0);\r\n\t}\r\n\r\n\treturn divContainer;\r\n}", "function AssignPosition(divEl, width) {\n\tif(self.pageYOffset) {\n\t\trX = self.pageXOffset;\n\t\trY = self.pageYOffset;\n\t\t}\n\telse if(document.documentElement && document.documentElement.scrollTop) {\n\t\trX = document.documentElement.scrollLeft;\n\t\trY = document.documentElement.scrollTop;\n\t\t}\n\telse if(document.body) {\n\t\trX = document.body.scrollLeft;\n\t\trY = document.body.scrollTop;\n\t\t}\n\tif(document.all) {\n\t\tcX += rX; \n\t\tcY += rY;\n\t\t}\n\t// position verschieben wenn zu weit rechts\n\tvar iw = window.getWinWidth();\n\tif (iw-width<cX) {\n\t\tcX = iw-width;\n\t\t};\n\t// position verschieben wenn zu weit rechts\n\tdivEl.style.left = (cX+10) + \"px\";\n\tdivEl.style.top = (cY+10) + \"px\";\n\t}", "function box(x,y,width,height){\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n}", "function putInWindow(frame, width, height) {\n return {\n type: 'root',\n width,\n height,\n children: [\n { \n type: 'window',\n worldMatrix: [\n [width/2, 0, width/2],\n [0, -height/2, height/2],\n [0, 0, 1],\n ],\n },\n frame,\n ]\n };\n}", "screenToWorld(x, y) {\n if (y === undefined) {\n y = x.y;\n x = x.x;\n }\n\n let M = this.ctx.getTransform().invertSelf();\n\n let ret = {\n x: x * M.a + y * M.c + M.e,\n y: x * M.b + y * M.d + M.f,\n };\n\n return ret;\n }", "function pointToRect (point) {\n return { left: point.x, top: point.y, \n right: point.x, bottom: point.y };\n }", "function getPosition(_ref2) {\n var width = _ref2.width,\n height = _ref2.height;\n var x = 0;\n var y = 0;\n\n if (width) {\n if (window.outerWidth) {\n x = Math.round((window.outerWidth - width) / 2) + window.screenX;\n } else if (window.screen.width) {\n x = Math.round((window.screen.width - width) / 2);\n }\n }\n\n if (height) {\n if (window.outerHeight) {\n y = Math.round((window.outerHeight - height) / 2) + window.screenY;\n } else if (window.screen.height) {\n y = Math.round((window.screen.height - height) / 2);\n }\n }\n\n return {\n x: x,\n y: y\n };\n}" ]
[ "0.6558659", "0.6558659", "0.6558659", "0.6558659", "0.64615387", "0.6410469", "0.6360999", "0.63595706", "0.63595706", "0.63595706", "0.63595706", "0.63595706", "0.63595706", "0.63595706", "0.63595706", "0.63592327", "0.6344733", "0.63308084", "0.63308084", "0.6330061", "0.6330061", "0.6317762", "0.6317762", "0.6317762", "0.6317762", "0.6317762", "0.6317762", "0.6317762", "0.6317762", "0.6317762", "0.6317762", "0.6317762", "0.6311638", "0.6306436", "0.6306436", "0.629727", "0.59168136", "0.59149575", "0.59149575", "0.59149575", "0.5909235", "0.58939624", "0.5837376", "0.5837376", "0.5837376", "0.5837376", "0.5837376", "0.5808832", "0.5808832", "0.5675465", "0.5587471", "0.5587471", "0.5587471", "0.5587471", "0.55605733", "0.5434099", "0.5434099", "0.5434099", "0.5408589", "0.5382025", "0.52914464", "0.52563965", "0.5234361", "0.52004206", "0.5196952", "0.5190217", "0.51224214", "0.5077467", "0.50623167", "0.5058592", "0.5056027", "0.5056027", "0.5043355", "0.5027206", "0.4975505", "0.4975505", "0.49742863", "0.4972964", "0.49715397", "0.49588695", "0.49562097", "0.49523243", "0.49205968", "0.49071872", "0.4898976", "0.48926798" ]
0.633558
31
Returns a box for a given cursor position, which may have an 'other' property containing the position of the secondary cursor on a bidi boundary. A cursor Pos(line, char, "before") is on the same visual line as `char 1` and after `char 1` in writing order of `char 1` A cursor Pos(line, char, "after") is on the same visual line as `char` and before `char` in writing order of `char` Examples (uppercase letters are RTL, lowercase are LTR): Pos(0, 1, ...) before after ab a|b a|b aB a|B aB| Ab |Ab A|b AB B|A B|A Every position after the last character on a line is considered to stick to the last character on the line.
function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) { lineObj = lineObj || getLine(cm.doc, pos.line); if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); } function get(ch, right) { var m = measureCharPrepared(cm, preparedMeasure, ch, right ? "right" : "left", varHeight); if (right) { m.left = m.right; } else { m.right = m.left; } return intoCoordSystem(cm, lineObj, m, context) } var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky; if (ch >= lineObj.text.length) { ch = lineObj.text.length; sticky = "before"; } else if (ch <= 0) { ch = 0; sticky = "after"; } if (!order) { return get(sticky == "before" ? ch - 1 : ch, sticky == "before") } function getBidi(ch, partPos, invert) { var part = order[partPos], right = part.level == 1; return get(invert ? ch - 1 : ch, right != invert) } var partPos = getBidiPartAt(order, ch, sticky); var other = bidiOther; var val = getBidi(ch, partPos, sticky == "before"); if (other != null) { val.other = getBidi(ch, other, sticky != "before"); } return val }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n}", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n}", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n}", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n}", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n}", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n}", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n}", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n}", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n}", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n}", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = (part.level % 2) != 0;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n}", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line)\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj) }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight)\n if (right) { m.left = m.right; } else { m.right = m.left }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length\n sticky = \"before\"\n } else if (ch <= 0) {\n ch = 0\n sticky = \"after\"\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = (part.level % 2) != 0\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky)\n var other = bidiOther\n var val = getBidi(ch, partPos, sticky == \"before\")\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\") }\n return val\n}", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line)\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj) }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight)\n if (right) { m.left = m.right; } else { m.right = m.left }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n function getBidi(ch, partPos) {\n var part = order[partPos], right = part.level % 2\n if (ch == bidiLeft(part) && partPos && part.level < order[partPos - 1].level) {\n part = order[--partPos]\n ch = bidiRight(part) - (part.level % 2 ? 0 : 1)\n right = true\n } else if (ch == bidiRight(part) && partPos < order.length - 1 && part.level < order[partPos + 1].level) {\n part = order[++partPos]\n ch = bidiLeft(part) - part.level % 2\n right = false\n }\n if (right && ch == part.to && ch > part.from) { return get(ch - 1) }\n return get(ch, right)\n }\n var order = getOrder(lineObj), ch = pos.ch\n if (!order) { return get(ch) }\n var partPos = getBidiPartAt(order, ch)\n var val = getBidi(ch, partPos)\n if (bidiOther != null) { val.other = getBidi(ch, bidiOther) }\n return val\n}", "function _cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n\n if (!preparedMeasure) {\n preparedMeasure = prepareMeasureForLine(cm, lineObj);\n }\n\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n\n if (right) {\n m.left = m.right;\n } else {\n m.right = m.left;\n }\n\n return intoCoordSystem(cm, lineObj, m, context);\n }\n\n var order = getOrder(lineObj, cm.doc.direction),\n ch = pos.ch,\n sticky = pos.sticky;\n\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n\n if (!order) {\n return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\");\n }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos],\n right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert);\n }\n\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n\n if (other != null) {\n val.other = getBidi(ch, other, sticky != \"before\");\n }\n\n return val;\n } // Used to cheaply estimate the coordinates for a position. Used for", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) preparedMeasure = prepareMeasureForLine(cm, lineObj);\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) m.left = m.right; else m.right = m.left;\n return intoCoordSystem(cm, lineObj, m, context);\n }\n function getBidi(ch, partPos) {\n var part = order[partPos], right = part.level % 2;\n if (ch == bidiLeft(part) && partPos && part.level < order[partPos - 1].level) {\n part = order[--partPos];\n ch = bidiRight(part) - (part.level % 2 ? 0 : 1);\n right = true;\n } else if (ch == bidiRight(part) && partPos < order.length - 1 && part.level < order[partPos + 1].level) {\n part = order[++partPos];\n ch = bidiLeft(part) - part.level % 2;\n right = false;\n }\n if (right && ch == part.to && ch > part.from) return get(ch - 1);\n return get(ch, right);\n }\n var order = getOrder(lineObj), ch = pos.ch;\n if (!order) return get(ch);\n var partPos = getBidiPartAt(order, ch);\n var val = getBidi(ch, partPos);\n if (bidiOther != null) val.other = getBidi(ch, bidiOther);\n return val;\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) preparedMeasure = prepareMeasureForLine(cm, lineObj);\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) m.left = m.right; else m.right = m.left;\n return intoCoordSystem(cm, lineObj, m, context);\n }\n function getBidi(ch, partPos) {\n var part = order[partPos], right = part.level % 2;\n if (ch == bidiLeft(part) && partPos && part.level < order[partPos - 1].level) {\n part = order[--partPos];\n ch = bidiRight(part) - (part.level % 2 ? 0 : 1);\n right = true;\n } else if (ch == bidiRight(part) && partPos < order.length - 1 && part.level < order[partPos + 1].level) {\n part = order[++partPos];\n ch = bidiLeft(part) - part.level % 2;\n right = false;\n }\n if (right && ch == part.to && ch > part.from) return get(ch - 1);\n return get(ch, right);\n }\n var order = getOrder(lineObj), ch = pos.ch;\n if (!order) return get(ch);\n var partPos = getBidiPartAt(order, ch);\n var val = getBidi(ch, partPos);\n if (bidiOther != null) val.other = getBidi(ch, bidiOther);\n return val;\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) preparedMeasure = prepareMeasureForLine(cm, lineObj);\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) m.left = m.right; else m.right = m.left;\n return intoCoordSystem(cm, lineObj, m, context);\n }\n function getBidi(ch, partPos) {\n var part = order[partPos], right = part.level % 2;\n if (ch == bidiLeft(part) && partPos && part.level < order[partPos - 1].level) {\n part = order[--partPos];\n ch = bidiRight(part) - (part.level % 2 ? 0 : 1);\n right = true;\n } else if (ch == bidiRight(part) && partPos < order.length - 1 && part.level < order[partPos + 1].level) {\n part = order[++partPos];\n ch = bidiLeft(part) - part.level % 2;\n right = false;\n }\n if (right && ch == part.to && ch > part.from) return get(ch - 1);\n return get(ch, right);\n }\n var order = getOrder(lineObj), ch = pos.ch;\n if (!order) return get(ch);\n var partPos = getBidiPartAt(order, ch);\n var val = getBidi(ch, partPos);\n if (bidiOther != null) val.other = getBidi(ch, bidiOther);\n return val;\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) preparedMeasure = prepareMeasureForLine(cm, lineObj);\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) m.left = m.right; else m.right = m.left;\n return intoCoordSystem(cm, lineObj, m, context);\n }\n function getBidi(ch, partPos) {\n var part = order[partPos], right = part.level % 2;\n if (ch == bidiLeft(part) && partPos && part.level < order[partPos - 1].level) {\n part = order[--partPos];\n ch = bidiRight(part) - (part.level % 2 ? 0 : 1);\n right = true;\n } else if (ch == bidiRight(part) && partPos < order.length - 1 && part.level < order[partPos + 1].level) {\n part = order[++partPos];\n ch = bidiLeft(part) - part.level % 2;\n right = false;\n }\n if (right && ch == part.to && ch > part.from) return get(ch - 1);\n return get(ch, right);\n }\n var order = getOrder(lineObj), ch = pos.ch;\n if (!order) return get(ch);\n var partPos = getBidiPartAt(order, ch);\n var val = getBidi(ch, partPos);\n if (bidiOther != null) val.other = getBidi(ch, bidiOther);\n return val;\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) preparedMeasure = prepareMeasureForLine(cm, lineObj);\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) m.left = m.right; else m.right = m.left;\n return intoCoordSystem(cm, lineObj, m, context);\n }\n function getBidi(ch, partPos) {\n var part = order[partPos], right = part.level % 2;\n if (ch == bidiLeft(part) && partPos && part.level < order[partPos - 1].level) {\n part = order[--partPos];\n ch = bidiRight(part) - (part.level % 2 ? 0 : 1);\n right = true;\n } else if (ch == bidiRight(part) && partPos < order.length - 1 && part.level < order[partPos + 1].level) {\n part = order[++partPos];\n ch = bidiLeft(part) - part.level % 2;\n right = false;\n }\n if (right && ch == part.to && ch > part.from) return get(ch - 1);\n return get(ch, right);\n }\n var order = getOrder(lineObj), ch = pos.ch;\n if (!order) return get(ch);\n var partPos = getBidiPartAt(order, ch);\n var val = getBidi(ch, partPos);\n if (bidiOther != null) val.other = getBidi(ch, bidiOther);\n return val;\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) preparedMeasure = prepareMeasureForLine(cm, lineObj);\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) m.left = m.right; else m.right = m.left;\n return intoCoordSystem(cm, lineObj, m, context);\n }\n function getBidi(ch, partPos) {\n var part = order[partPos], right = part.level % 2;\n if (ch == bidiLeft(part) && partPos && part.level < order[partPos - 1].level) {\n part = order[--partPos];\n ch = bidiRight(part) - (part.level % 2 ? 0 : 1);\n right = true;\n } else if (ch == bidiRight(part) && partPos < order.length - 1 && part.level < order[partPos + 1].level) {\n part = order[++partPos];\n ch = bidiLeft(part) - part.level % 2;\n right = false;\n }\n if (right && ch == part.to && ch > part.from) return get(ch - 1);\n return get(ch, right);\n }\n var order = getOrder(lineObj), ch = pos.ch;\n if (!order) return get(ch);\n var partPos = getBidiPartAt(order, ch);\n var val = getBidi(ch, partPos);\n if (bidiOther != null) val.other = getBidi(ch, bidiOther);\n return val;\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) preparedMeasure = prepareMeasureForLine(cm, lineObj);\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) m.left = m.right; else m.right = m.left;\n return intoCoordSystem(cm, lineObj, m, context);\n }\n function getBidi(ch, partPos) {\n var part = order[partPos], right = part.level % 2;\n if (ch == bidiLeft(part) && partPos && part.level < order[partPos - 1].level) {\n part = order[--partPos];\n ch = bidiRight(part) - (part.level % 2 ? 0 : 1);\n right = true;\n } else if (ch == bidiRight(part) && partPos < order.length - 1 && part.level < order[partPos + 1].level) {\n part = order[++partPos];\n ch = bidiLeft(part) - part.level % 2;\n right = false;\n }\n if (right && ch == part.to && ch > part.from) return get(ch - 1);\n return get(ch, right);\n }\n var order = getOrder(lineObj), ch = pos.ch;\n if (!order) return get(ch);\n var partPos = getBidiPartAt(order, ch);\n var val = getBidi(ch, partPos);\n if (bidiOther != null) val.other = getBidi(ch, bidiOther);\n return val;\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) preparedMeasure = prepareMeasureForLine(cm, lineObj);\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) m.left = m.right; else m.right = m.left;\n return intoCoordSystem(cm, lineObj, m, context);\n }\n function getBidi(ch, partPos) {\n var part = order[partPos], right = part.level % 2;\n if (ch == bidiLeft(part) && partPos && part.level < order[partPos - 1].level) {\n part = order[--partPos];\n ch = bidiRight(part) - (part.level % 2 ? 0 : 1);\n right = true;\n } else if (ch == bidiRight(part) && partPos < order.length - 1 && part.level < order[partPos + 1].level) {\n part = order[++partPos];\n ch = bidiLeft(part) - part.level % 2;\n right = false;\n }\n if (right && ch == part.to && ch > part.from) return get(ch - 1);\n return get(ch, right);\n }\n var order = getOrder(lineObj), ch = pos.ch;\n if (!order) return get(ch);\n var partPos = getBidiPartAt(order, ch);\n var val = getBidi(ch, partPos);\n if (bidiOther != null) val.other = getBidi(ch, bidiOther);\n return val;\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\r\n lineObj = lineObj || getLine(cm.doc, pos.line);\r\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\r\n function get(ch, right) {\r\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\r\n if (right) { m.left = m.right; } else { m.right = m.left; }\r\n return intoCoordSystem(cm, lineObj, m, context)\r\n }\r\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\r\n if (ch >= lineObj.text.length) {\r\n ch = lineObj.text.length;\r\n sticky = \"before\";\r\n } else if (ch <= 0) {\r\n ch = 0;\r\n sticky = \"after\";\r\n }\r\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\r\n\r\n function getBidi(ch, partPos, invert) {\r\n var part = order[partPos], right = part.level == 1;\r\n return get(invert ? ch - 1 : ch, right != invert)\r\n }\r\n var partPos = getBidiPartAt(order, ch, sticky);\r\n var other = bidiOther;\r\n var val = getBidi(ch, partPos, sticky == \"before\");\r\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\r\n return val\r\n}", "renderCursorAt(position, textType) {\n let adjH = 0;\n let adjY = 0;\n if (!this.updatedMetrics) {\n this._calculateBlockIndex();\n }\n const group = this.context.openGroup();\n group.id = 'inlineCursor';\n const h = this.fontSize;\n if (this.blocks.length <= position || position < 0) {\n svgHelpers.renderCursor(group, this.startX, this.startY - h, h);\n this.context.closeGroup();\n return;\n }\n const block = this.blocks[position];\n adjH = block.symbolType === SuiInlineText.symbolTypes.GLYPH ? h / 2 : h;\n // For glyph, add y adj back to the cursor since it's not a glyph\n adjY = block.symbolType === SuiInlineText.symbolTypes.GLYPH ? block.y - this._glyphOffset(block) :\n block.y;\n if (typeof(textType) === 'number' && textType !== SuiInlineText.textTypes.normal) {\n const ratio = textType !== SuiInlineText.textTypes.normal ? VF.ChordSymbol.superSubRatio : 1.0;\n adjH = adjH * ratio;\n if (textType !== block.textType) {\n if (textType === SuiInlineText.textTypes.superScript) {\n adjY -= h / 2;\n } else {\n adjY += h / 2;\n }\n }\n }\n svgHelpers.renderCursor(group, block.x + block.width, adjY - (adjH * block.scale), adjH * block.scale);\n this.context.closeGroup();\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n\t\t lineObj = lineObj || getLine(cm.doc, pos.line);\n\t\t if (!preparedMeasure) preparedMeasure = prepareMeasureForLine(cm, lineObj);\n\t\t function get(ch, right) {\n\t\t var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n\t\t if (right) m.left = m.right; else m.right = m.left;\n\t\t return intoCoordSystem(cm, lineObj, m, context);\n\t\t }\n\t\t function getBidi(ch, partPos) {\n\t\t var part = order[partPos], right = part.level % 2;\n\t\t if (ch == bidiLeft(part) && partPos && part.level < order[partPos - 1].level) {\n\t\t part = order[--partPos];\n\t\t ch = bidiRight(part) - (part.level % 2 ? 0 : 1);\n\t\t right = true;\n\t\t } else if (ch == bidiRight(part) && partPos < order.length - 1 && part.level < order[partPos + 1].level) {\n\t\t part = order[++partPos];\n\t\t ch = bidiLeft(part) - part.level % 2;\n\t\t right = false;\n\t\t }\n\t\t if (right && ch == part.to && ch > part.from) return get(ch - 1);\n\t\t return get(ch, right);\n\t\t }\n\t\t var order = getOrder(lineObj), ch = pos.ch;\n\t\t if (!order) return get(ch);\n\t\t var partPos = getBidiPartAt(order, ch);\n\t\t var val = getBidi(ch, partPos);\n\t\t if (bidiOther != null) val.other = getBidi(ch, bidiOther);\n\t\t return val;\n\t\t }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n\t\t lineObj = lineObj || getLine(cm.doc, pos.line);\n\t\t if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n\t\t function get(ch, right) {\n\t\t var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n\t\t if (right) { m.left = m.right; } else { m.right = m.left; }\n\t\t return intoCoordSystem(cm, lineObj, m, context)\n\t\t }\n\t\t var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n\t\t if (ch >= lineObj.text.length) {\n\t\t ch = lineObj.text.length;\n\t\t sticky = \"before\";\n\t\t } else if (ch <= 0) {\n\t\t ch = 0;\n\t\t sticky = \"after\";\n\t\t }\n\t\t if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n\t\t function getBidi(ch, partPos, invert) {\n\t\t var part = order[partPos], right = part.level == 1;\n\t\t return get(invert ? ch - 1 : ch, right != invert)\n\t\t }\n\t\t var partPos = getBidiPartAt(order, ch, sticky);\n\t\t var other = bidiOther;\n\t\t var val = getBidi(ch, partPos, sticky == \"before\");\n\t\t if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n\t\t return val\n\t\t }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\r\n lineObj = lineObj || getLine(cm.doc, pos.line);\r\n if (!preparedMeasure) preparedMeasure = prepareMeasureForLine(cm, lineObj);\r\n function get(ch, right) {\r\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\r\n if (right) m.left = m.right; else m.right = m.left;\r\n return intoCoordSystem(cm, lineObj, m, context);\r\n }\r\n function getBidi(ch, partPos) {\r\n var part = order[partPos], right = part.level % 2;\r\n if (ch == bidiLeft(part) && partPos && part.level < order[partPos - 1].level) {\r\n part = order[--partPos];\r\n ch = bidiRight(part) - (part.level % 2 ? 0 : 1);\r\n right = true;\r\n } else if (ch == bidiRight(part) && partPos < order.length - 1 && part.level < order[partPos + 1].level) {\r\n part = order[++partPos];\r\n ch = bidiLeft(part) - part.level % 2;\r\n right = false;\r\n }\r\n if (right && ch == part.to && ch > part.from) return get(ch - 1);\r\n return get(ch, right);\r\n }\r\n var order = getOrder(lineObj), ch = pos.ch;\r\n if (!order) return get(ch);\r\n var partPos = getBidiPartAt(order, ch);\r\n var val = getBidi(ch, partPos);\r\n if (bidiOther != null) val.other = getBidi(ch, bidiOther);\r\n return val;\r\n }", "static cursor(pos, assoc = 0, bidiLevel, goalColumn) {\n return SelectionRange.create(pos, pos, (assoc == 0 ? 0 : assoc < 0 ? 4 /* RangeFlag.AssocBefore */ : 8 /* RangeFlag.AssocAfter */) |\n (bidiLevel == null ? 3 : Math.min(2, bidiLevel)) |\n ((goalColumn !== null && goalColumn !== void 0 ? goalColumn : 33554431 /* RangeFlag.NoGoalColumn */) << 5 /* RangeFlag.GoalColumnOffset */));\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n\t lineObj = lineObj || getLine(cm.doc, pos.line);\n\t if (!preparedMeasure) preparedMeasure = prepareMeasureForLine(cm, lineObj);\n\t function get(ch, right) {\n\t var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n\t if (right) m.left = m.right; else m.right = m.left;\n\t return intoCoordSystem(cm, lineObj, m, context);\n\t }\n\t function getBidi(ch, partPos) {\n\t var part = order[partPos], right = part.level % 2;\n\t if (ch == bidiLeft(part) && partPos && part.level < order[partPos - 1].level) {\n\t part = order[--partPos];\n\t ch = bidiRight(part) - (part.level % 2 ? 0 : 1);\n\t right = true;\n\t } else if (ch == bidiRight(part) && partPos < order.length - 1 && part.level < order[partPos + 1].level) {\n\t part = order[++partPos];\n\t ch = bidiLeft(part) - part.level % 2;\n\t right = false;\n\t }\n\t if (right && ch == part.to && ch > part.from) return get(ch - 1);\n\t return get(ch, right);\n\t }\n\t var order = getOrder(lineObj), ch = pos.ch;\n\t if (!order) return get(ch);\n\t var partPos = getBidiPartAt(order, ch);\n\t var val = getBidi(ch, partPos);\n\t if (bidiOther != null) val.other = getBidi(ch, bidiOther);\n\t return val;\n\t }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n\t lineObj = lineObj || getLine(cm.doc, pos.line);\n\t if (!preparedMeasure) preparedMeasure = prepareMeasureForLine(cm, lineObj);\n\t function get(ch, right) {\n\t var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n\t if (right) m.left = m.right; else m.right = m.left;\n\t return intoCoordSystem(cm, lineObj, m, context);\n\t }\n\t function getBidi(ch, partPos) {\n\t var part = order[partPos], right = part.level % 2;\n\t if (ch == bidiLeft(part) && partPos && part.level < order[partPos - 1].level) {\n\t part = order[--partPos];\n\t ch = bidiRight(part) - (part.level % 2 ? 0 : 1);\n\t right = true;\n\t } else if (ch == bidiRight(part) && partPos < order.length - 1 && part.level < order[partPos + 1].level) {\n\t part = order[++partPos];\n\t ch = bidiLeft(part) - part.level % 2;\n\t right = false;\n\t }\n\t if (right && ch == part.to && ch > part.from) return get(ch - 1);\n\t return get(ch, right);\n\t }\n\t var order = getOrder(lineObj), ch = pos.ch;\n\t if (!order) return get(ch);\n\t var partPos = getBidiPartAt(order, ch);\n\t var val = getBidi(ch, partPos);\n\t if (bidiOther != null) val.other = getBidi(ch, bidiOther);\n\t return val;\n\t }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n\t lineObj = lineObj || getLine(cm.doc, pos.line);\n\t if (!preparedMeasure) preparedMeasure = prepareMeasureForLine(cm, lineObj);\n\t function get(ch, right) {\n\t var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n\t if (right) m.left = m.right; else m.right = m.left;\n\t return intoCoordSystem(cm, lineObj, m, context);\n\t }\n\t function getBidi(ch, partPos) {\n\t var part = order[partPos], right = part.level % 2;\n\t if (ch == bidiLeft(part) && partPos && part.level < order[partPos - 1].level) {\n\t part = order[--partPos];\n\t ch = bidiRight(part) - (part.level % 2 ? 0 : 1);\n\t right = true;\n\t } else if (ch == bidiRight(part) && partPos < order.length - 1 && part.level < order[partPos + 1].level) {\n\t part = order[++partPos];\n\t ch = bidiLeft(part) - part.level % 2;\n\t right = false;\n\t }\n\t if (right && ch == part.to && ch > part.from) return get(ch - 1);\n\t return get(ch, right);\n\t }\n\t var order = getOrder(lineObj), ch = pos.ch;\n\t if (!order) return get(ch);\n\t var partPos = getBidiPartAt(order, ch);\n\t var val = getBidi(ch, partPos);\n\t if (bidiOther != null) val.other = getBidi(ch, bidiOther);\n\t return val;\n\t }", "function posCursor(obj) {\n\tobj = getObj(obj);\n\n var cursor = -1;\n\n if (document.selection && (document.selection != 'undefined')) {\n var _range = document.selection.createRange();\n var contador = 0;\n while (_range.move('character', -1)) contador ++;\n cursor = contador;\n } else if (obj.selectionStart >= 0) cursor = obj.selectionStart;\n\n return cursor;\n}", "function Cursor (position, selectionEnd) {\n this.position = position;\n this.selectionEnd = selectionEnd;\n }", "function Cursor (position, selectionEnd) {\n this.position = position;\n this.selectionEnd = selectionEnd;\n }", "getCursor(state$1, from = 0, to) {\n let st = state$1.doc ? state$1 : state.EditorState.create({ doc: state$1 });\n if (to == null)\n to = st.doc.length;\n return this.regexp ? regexpCursor(this, st, from, to) : stringCursor(this, st, from, to);\n }", "function postBoxGetCursor(input)\n{\n\tvar result = {start: 0, end: 0};\n\tif (input.setSelectionRange)\n\t{\n\t\tresult.start= input.selectionStart;\n\t\tresult.end = input.selectionEnd;\n\t} else if (!document.selection)\n\t{\n\t\treturn false;\n\t} else if (document.selection && document.selection.createRange)\n\t{\n\t\tvar range = document.selection.createRange();\n\t\tvar stored_range = range.duplicate();\n\t\tstored_range.moveToElementText(input);\n\t\tstored_range.setEndPoint('EndToEnd', range);\n\t\tresult.start = stored_range.text.length - range.text.length;\n\t\tresult.end = result.start + range.text.length;\n\t}\n\treturn result;\n}", "function cursorPosition(star, en, zon){\r\nvar textarea = document.getElementById(zon);\r\ntextarea.focus();\r\n\r\nvar selection_range = document.selection.createRange().duplicate();\r\n\r\nif (selection_range.parentElement() == textarea) { // Check that the selection is actually in our textarea\r\n// Create three ranges, one containing all the text before the selection,\r\n// one containing all the text in the selection (this already exists), and one containing all\r\n// the text after the selection.\r\nvar before_range = document.body.createTextRange();\r\nbefore_range.moveToElementText(textarea); // Selects all the text\r\nbefore_range.setEndPoint(\"EndToStart\", selection_range); // Moves the end where we need it\r\n\r\nvar after_range = document.body.createTextRange();\r\nafter_range.moveToElementText(textarea); // Selects all the text\r\nafter_range.setEndPoint(\"StartToEnd\", selection_range); // Moves the start where we need it\r\n\r\nvar before_finished = false, selection_finished = false, after_finished = false;\r\nvar before_text, untrimmed_before_text, selection_text, untrimmed_selection_text, after_text, untrimmed_after_text;\r\n\r\n// Load the text values we need to compare\r\nbefore_text = untrimmed_before_text = before_range.text;\r\nselection_text = untrimmed_selection_text = selection_range.text;\r\nafter_text = untrimmed_after_text = after_range.text;\r\n\r\n// Check each range for trimmed newlines by shrinking the range by 1 character and seeing\r\n// if the text property has changed. If it has not changed then we know that IE has trimmed\r\n// a \\r\\n from the end.\r\ndo {\r\nif (!before_finished) {\r\nif (before_range.compareEndPoints(\"StartToEnd\", before_range) == 0) {\r\nbefore_finished = true;\r\n} else {\r\nbefore_range.moveEnd(\"character\", -1)\r\nif (before_range.text == before_text) {\r\nuntrimmed_before_text += \"\\n\";\r\n} else {\r\nbefore_finished = true;\r\n}\r\n}\r\n}\r\nif (!selection_finished) {\r\nif (selection_range.compareEndPoints(\"StartToEnd\", selection_range) == 0) {\r\nselection_finished = true;\r\n} else {\r\nselection_range.moveEnd(\"character\", -1)\r\nif (selection_range.text == selection_text) {\r\nuntrimmed_selection_text += \"\\r\\n\";\r\n} else {\r\nselection_finished = true;\r\n}\r\n}\r\n}\r\nif (!after_finished) {\r\nif (after_range.compareEndPoints(\"StartToEnd\", after_range) == 0) {\r\nafter_finished = true;\r\n} else {\r\nafter_range.moveEnd(\"character\", -1)\r\nif (after_range.text == after_text) {\r\nuntrimmed_after_text += \"\\r\\n\";\r\n} else {\r\nafter_finished = true;\r\n}\r\n}\r\n}\r\n\r\n} while ((!before_finished || !selection_finished || !after_finished));\r\n\r\n// ** END Untrimmed success test\r\n\r\n// Define into an array the start, and end of selected text, and the final text\r\nvar re = new Array();\r\nre['startPos'] = untrimmed_before_text.length;\r\nre['endPos'] = re['startPos'] + untrimmed_selection_text.length;\r\nre['final_text'] = untrimmed_before_text +star+ untrimmed_selection_text +en+ untrimmed_after_text;\r\n\r\n return re;\r\n}\r\n}", "function cursor_box_size() { return { x: 10, y: 10 }; }", "function posFromMouse(cm, e, liberal, forRect) {\n\t\t var display = cm.display;\n\t\t if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n\t\t var x, y, space = display.lineSpace.getBoundingClientRect();\n\t\t // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n\t\t try { x = e.clientX - space.left; y = e.clientY - space.top; }\n\t\t catch (e$1) { return null }\n\t\t var coords = coordsChar(cm, x, y), line;\n\t\t if (forRect && coords.xRel > 0 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n\t\t var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n\t\t coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n\t\t }\n\t\t return coords\n\t\t }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal) {\n var target = e_target(e);\n if (target == display.scrollbarH || target == display.scrollbarV ||\n target == display.scrollbarFiller || target == display.gutterFiller) return null;\n }\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null; }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords;\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal) {\n var target = e_target(e);\n if (target == display.scrollbarH || target == display.scrollbarV ||\n target == display.scrollbarFiller || target == display.gutterFiller) return null;\n }\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null; }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords;\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal) {\n var target = e_target(e);\n if (target == display.scrollbarH || target == display.scrollbarV ||\n target == display.scrollbarFiller || target == display.gutterFiller) return null;\n }\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null; }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords;\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal) {\n var target = e_target(e);\n if (target == display.scrollbarH || target == display.scrollbarV ||\n target == display.scrollbarFiller || target == display.gutterFiller) return null;\n }\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null; }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords;\n }", "function posFromMouse(cm, e, liberal, forRect) {\n\t\t var display = cm.display;\n\t\t if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") return null;\n\t\t\n\t\t var x, y, space = display.lineSpace.getBoundingClientRect();\n\t\t // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n\t\t try { x = e.clientX - space.left; y = e.clientY - space.top; }\n\t\t catch (e) { return null; }\n\t\t var coords = coordsChar(cm, x, y), line;\n\t\t if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n\t\t var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n\t\t coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n\t\t }\n\t\t return coords;\n\t\t }", "function posFromMouse(cm, e, liberal, forRect) {\r\n var display = cm.display;\r\n if (!liberal) {\r\n var target = e_target(e);\r\n if (target == display.scrollbarH || target == display.scrollbarV ||\r\n target == display.scrollbarFiller || target == display.gutterFiller) return null;\r\n }\r\n var x, y, space = display.lineSpace.getBoundingClientRect();\r\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\r\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\r\n catch (e) { return null; }\r\n var coords = coordsChar(cm, x, y), line;\r\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\r\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\r\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\r\n }\r\n return coords;\r\n }", "function cursorIndex() {\r\n var current = selection.createRange(),\r\n diff = current.duplicate();\r\n\r\n diff.moveToElementText(this);\r\n diff.setEndPoint('EndToEnd', current);\r\n\r\n return diff.text.length - current.text.length;\r\n }", "function posFromMouse(cm, e, liberal, forRect) {\n\t var display = cm.display;\n\t if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") return null;\n\n\t var x, y, space = display.lineSpace.getBoundingClientRect();\n\t // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n\t try { x = e.clientX - space.left; y = e.clientY - space.top; }\n\t catch (e) { return null; }\n\t var coords = coordsChar(cm, x, y), line;\n\t if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n\t var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n\t coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n\t }\n\t return coords;\n\t }", "function posFromMouse(cm, e, liberal, forRect) {\n\t var display = cm.display;\n\t if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") return null;\n\n\t var x, y, space = display.lineSpace.getBoundingClientRect();\n\t // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n\t try { x = e.clientX - space.left; y = e.clientY - space.top; }\n\t catch (e) { return null; }\n\t var coords = coordsChar(cm, x, y), line;\n\t if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n\t var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n\t coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n\t }\n\t return coords;\n\t }", "function posFromMouse(cm, e, liberal, forRect) {\n\t var display = cm.display;\n\t if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") return null;\n\t\n\t var x, y, space = display.lineSpace.getBoundingClientRect();\n\t // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n\t try { x = e.clientX - space.left; y = e.clientY - space.top; }\n\t catch (e) { return null; }\n\t var coords = coordsChar(cm, x, y), line;\n\t if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n\t var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n\t coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n\t }\n\t return coords;\n\t }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"not-content\") == \"true\") return null;\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null; }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords;\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"not-content\") == \"true\") return null;\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null; }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords;\n }", "function clipCursorToContent(cm, cur) {\n var vim = cm.state.vim;\n var includeLineBreak = vim.insertMode || vim.visualMode;\n var line = Math.min(Math.max(cm.firstLine(), cur.line), cm.lastLine() );\n var maxCh = lineLength(cm, line) - 1 + !!includeLineBreak;\n var ch = Math.min(Math.max(0, cur.ch), maxCh);\n return Pos(line, ch);\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel > 0 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel > 0 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e$1) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel > 0 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e$1) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel > 0 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e$1) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel > 0 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e$1) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel > 0 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e$1) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel > 0 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e$1) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel > 0 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e$1) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel > 0 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") return null;\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null; }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords;\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") return null;\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null; }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords;\n }", "coordsForChar(pos) {\n this.readMeasured();\n return this.docView.coordsForChar(pos);\n }", "function deriveCursorForDocument(paramMouseX, paramMouseY, paramDocument) {\r\n\r\n\t// Calculate line and column number based on mouse position\r\n\tvar currow = Math.floor((mouseY - PADDING_TOP)/FONT_HEIGHT);\r\n\tvar curcol = Math.floor((mouseX - PADDING_LEFT)/FONT_WIDTH);\r\n\t\r\n\t// Perform sanity check on calculated values:\r\n\t// If the calculated line is below the last line, then set cursor at last character in document\r\n\tif (currow > paramDocument.getDocumentLength()-1) {\r\n\t\tcurrow = paramDocument.getDocumentLength()-1;\r\n\t\tcurcol = paramDocument.getLineLength( paramDocument.getDocumentLength() );\r\n\t}\r\n\t// If the calculated cursor is beyond the first or last character in a line, \r\n\t// then set the cursor to the first or last character, respectively\r\n\telse {\t\t\r\n\t\tif ( curcol < 0 ) curcol = 0;\r\n\t\tif ( curcol > paramDocument.getLineLength(currow) ) curcol = paramDocument.getLineLength(currow);\r\n\t}\r\n\t\r\n\t// Before we move the cursor there, make sure that the line isn't locked\r\n\tif( paramDocument.getLineLockingUser( currow ) != null ){\r\n\t\talert(\"Another user is currently on line \"+currow+\", and it is locked.\");\r\n\t\treturn;\r\n\t}\r\n\t\r\n\t// Store the calculated values\r\n\tsetCursor(currow,curcol);\r\n}", "cursorAt(pos, side = 0, mode = 0) {\n let scope = CachedNode.get(this) || this.topNode;\n let cursor = new TreeCursor(scope);\n cursor.moveTo(pos, side);\n CachedNode.set(this, cursor._tree);\n return cursor;\n }", "function getPositionRect(position) {\n if (!position) {\n return null;\n }\n var range = createRange_1.default(position);\n // 1) try to get rect using range.getBoundingClientRect()\n var rect = range.getBoundingClientRect && normalizeRect(range.getBoundingClientRect());\n if (rect) {\n return rect;\n }\n // 2) try to get rect using range.getClientRects\n position = position.normalize();\n var rects = range.getClientRects && range.getClientRects();\n rect = rects && rects.length == 1 && normalizeRect(rects[0]);\n if (rect) {\n return rect;\n }\n // 3) if node is text node, try inserting a SPAN and get the rect of SPAN for others\n if (position.node.nodeType == 3 /* Text */) {\n var span = document.createElement('SPAN');\n span.innerHTML = '\\u200b';\n range = createRange_1.default(position);\n range.insertNode(span);\n rect = span.getBoundingClientRect && normalizeRect(span.getBoundingClientRect());\n span.parentNode.removeChild(span);\n if (rect) {\n return rect;\n }\n }\n // 4) try getBoundingClientRect on element\n var element = position.element;\n if (element && element.getBoundingClientRect) {\n rect = normalizeRect(element.getBoundingClientRect());\n if (rect) {\n return rect;\n }\n }\n return null;\n}", "function posFromMouse(cm, e, liberal, forRect) {\r\n var display = cm.display;\r\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\r\n\r\n var x, y, space = display.lineSpace.getBoundingClientRect();\r\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\r\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\r\n catch (e) { return null }\r\n var coords = coordsChar(cm, x, y), line;\r\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\r\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\r\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\r\n }\r\n return coords\r\n}", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") {\n return null;\n }\n\n var x,\n y,\n space = display.lineSpace.getBoundingClientRect(); // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n\n try {\n x = e.clientX - space.left;\n y = e.clientY - space.top;\n } catch (e) {\n return null;\n }\n\n var coords = _coordsChar(cm, x, y),\n line;\n\n if (forRect && coords.xRel > 0 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n\n return coords;\n } // Find the view element corresponding to a given line. Return null", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n}", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n}", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n}", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n}", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n}", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n}", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n}" ]
[ "0.61579114", "0.61579114", "0.61579114", "0.61579114", "0.61579114", "0.61579114", "0.61579114", "0.61579114", "0.61579114", "0.61579114", "0.61518496", "0.6137645", "0.6125479", "0.609435", "0.6078191", "0.6078191", "0.6078191", "0.6078191", "0.6078191", "0.6078191", "0.6078191", "0.6078191", "0.6076416", "0.60623133", "0.6031724", "0.6026745", "0.59932244", "0.594697", "0.58736295", "0.58736295", "0.58736295", "0.58442664", "0.55966485", "0.55966485", "0.5560021", "0.5484602", "0.5475618", "0.5374772", "0.53182316", "0.5311731", "0.5311731", "0.5311731", "0.5311731", "0.53040683", "0.529307", "0.52820617", "0.52723527", "0.52723527", "0.5263007", "0.5259102", "0.5259102", "0.5259102", "0.5259102", "0.5259102", "0.5259102", "0.5259102", "0.5259102", "0.52563536", "0.52563536", "0.52558565", "0.5254401", "0.5254401", "0.52471733", "0.52471733", "0.52471733", "0.52471733", "0.52471733", "0.52471733", "0.52471733", "0.5244461", "0.5244461", "0.5242172", "0.5229466", "0.52242917", "0.51875466", "0.5183944", "0.5182158", "0.5179532", "0.5179532", "0.5179532", "0.5179532", "0.5179532", "0.5179532", "0.5179532" ]
0.6194518
11
Used to cheaply estimate the coordinates for a position. Used for intermediate scroll updates.
function estimateCoords(cm, pos) { var left = 0; pos = clipPos(cm.doc, pos); if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; } var lineObj = getLine(cm.doc, pos.line); var top = heightAtLine(lineObj) + paddingTop(cm.display); return {left: left, right: left, top: top, bottom: top + lineObj.height} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function calculate_coordinates () {\n\t }", "coordinates () {\n return this._position.coordinates()\n }", "function calcPos() {\n\t\t// Current coordinates\n\t\tvar coords = sphoords.getCoordinates();\n\t\tvar coords_deg = sphoords.getCoordinatesInDegrees();\n\n\t\t// Corresponding position on the sphere\n\t\treturn {\n\t\t\t\tx: radius * Math.cos(coords.latitude) * Math.sin(coords.longitude),\n\t\t\t\ty: radius * Math.cos(coords.latitude) * Math.cos(coords.longitude),\n\t\t\t\tz: radius * Math.sin(coords.latitude),\n\t\t\t\tlong: coords_deg.longitude,\n\t\t\t\tlat: coords_deg.latitude,\n\t\t\t\torientation: sphoords.getScreenOrientation()\n\t\t\t};\n\t}", "function estimateCoords(cm, pos) {\n\t var left = 0, pos = clipPos(cm.doc, pos);\n\t if (!cm.options.lineWrapping) left = charWidth(cm.display) * pos.ch;\n\t var lineObj = getLine(cm.doc, pos.line);\n\t var top = heightAtLine(lineObj) + paddingTop(cm.display);\n\t return {left: left, right: left, top: top, bottom: top + lineObj.height};\n\t }", "function estimateCoords(cm, pos) {\n\t var left = 0, pos = clipPos(cm.doc, pos);\n\t if (!cm.options.lineWrapping) left = charWidth(cm.display) * pos.ch;\n\t var lineObj = getLine(cm.doc, pos.line);\n\t var top = heightAtLine(lineObj) + paddingTop(cm.display);\n\t return {left: left, right: left, top: top, bottom: top + lineObj.height};\n\t }", "function estimateCoords(cm, pos) {\n\t var left = 0, pos = clipPos(cm.doc, pos);\n\t if (!cm.options.lineWrapping) left = charWidth(cm.display) * pos.ch;\n\t var lineObj = getLine(cm.doc, pos.line);\n\t var top = heightAtLine(lineObj) + paddingTop(cm.display);\n\t return {left: left, right: left, top: top, bottom: top + lineObj.height};\n\t }", "function estimateCoords(cm, pos) {\n\t\t var left = 0, pos = clipPos(cm.doc, pos);\n\t\t if (!cm.options.lineWrapping) left = charWidth(cm.display) * pos.ch;\n\t\t var lineObj = getLine(cm.doc, pos.line);\n\t\t var top = heightAtLine(lineObj) + paddingTop(cm.display);\n\t\t return {left: left, right: left, top: top, bottom: top + lineObj.height};\n\t\t }", "function estimateCoords(cm, pos) {\n\t\t var left = 0;\n\t\t pos = clipPos(cm.doc, pos);\n\t\t if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; }\n\t\t var lineObj = getLine(cm.doc, pos.line);\n\t\t var top = heightAtLine(lineObj) + paddingTop(cm.display);\n\t\t return {left: left, right: left, top: top, bottom: top + lineObj.height}\n\t\t }", "posAtCoords(coords) {\n return posAtCoords(this, coords);\n }", "function getCoords () {\n return {\n x: 10,\n y: 22\n }\n }", "get _positionRect() {\n if (!this._positionRectMemo && this.positionTarget) {\n this._positionRectMemo = this.positionTarget.getBoundingClientRect();\n }\n\n return this._positionRectMemo;\n }", "getPosition() {\n\t\t\tconst {overrides} = this.impl;\n\t\t\tif (overrides !== undefined) {\n\t\t\t\treturn overrides.getPosition(this);\n\t\t\t}\n\n\t\t\tconst index = this.getIndex();\n\t\t\tconst cached = this.indexTracker.cachedPositions.get(index.valueOf());\n\t\t\tif (cached !== undefined) {\n\t\t\t\treturn cached;\n\t\t\t}\n\n\t\t\tconst pos = {\n\t\t\t\tline: this.currLine,\n\t\t\t\tcolumn: this.currColumn,\n\t\t\t};\n\t\t\tthis.indexTracker.setPositionIndex(pos, index);\n\t\t\treturn pos;\n\t\t}", "function estimateCoords(cm, pos) {\n var left = 0, pos = clipPos(cm.doc, pos);\n if (!cm.options.lineWrapping) left = charWidth(cm.display) * pos.ch;\n var lineObj = getLine(cm.doc, pos.line);\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\n return {left: left, right: left, top: top, bottom: top + lineObj.height};\n }", "function estimateCoords(cm, pos) {\n var left = 0, pos = clipPos(cm.doc, pos);\n if (!cm.options.lineWrapping) left = charWidth(cm.display) * pos.ch;\n var lineObj = getLine(cm.doc, pos.line);\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\n return {left: left, right: left, top: top, bottom: top + lineObj.height};\n }", "function estimateCoords(cm, pos) {\n var left = 0, pos = clipPos(cm.doc, pos);\n if (!cm.options.lineWrapping) left = charWidth(cm.display) * pos.ch;\n var lineObj = getLine(cm.doc, pos.line);\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\n return {left: left, right: left, top: top, bottom: top + lineObj.height};\n }", "function estimateCoords(cm, pos) {\n var left = 0, pos = clipPos(cm.doc, pos);\n if (!cm.options.lineWrapping) left = charWidth(cm.display) * pos.ch;\n var lineObj = getLine(cm.doc, pos.line);\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\n return {left: left, right: left, top: top, bottom: top + lineObj.height};\n }", "function estimateCoords(cm, pos) {\n var left = 0, pos = clipPos(cm.doc, pos);\n if (!cm.options.lineWrapping) left = charWidth(cm.display) * pos.ch;\n var lineObj = getLine(cm.doc, pos.line);\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\n return {left: left, right: left, top: top, bottom: top + lineObj.height};\n }", "function estimateCoords(cm, pos) {\n var left = 0, pos = clipPos(cm.doc, pos);\n if (!cm.options.lineWrapping) left = charWidth(cm.display) * pos.ch;\n var lineObj = getLine(cm.doc, pos.line);\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\n return {left: left, right: left, top: top, bottom: top + lineObj.height};\n }", "function estimateCoords(cm, pos) {\n var left = 0, pos = clipPos(cm.doc, pos);\n if (!cm.options.lineWrapping) left = charWidth(cm.display) * pos.ch;\n var lineObj = getLine(cm.doc, pos.line);\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\n return {left: left, right: left, top: top, bottom: top + lineObj.height};\n }", "function estimateCoords(cm, pos) {\n var left = 0, pos = clipPos(cm.doc, pos);\n if (!cm.options.lineWrapping) left = charWidth(cm.display) * pos.ch;\n var lineObj = getLine(cm.doc, pos.line);\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\n return {left: left, right: left, top: top, bottom: top + lineObj.height};\n }", "function estimateCoords(cm, pos) {\r\n var left = 0, pos = clipPos(cm.doc, pos);\r\n if (!cm.options.lineWrapping) left = charWidth(cm.display) * pos.ch;\r\n var lineObj = getLine(cm.doc, pos.line);\r\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\r\n return {left: left, right: left, top: top, bottom: top + lineObj.height};\r\n }", "function estimateCoords(cm, pos) {\n var left = 0\n pos = clipPos(cm.doc, pos)\n if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch }\n var lineObj = getLine(cm.doc, pos.line)\n var top = heightAtLine(lineObj) + paddingTop(cm.display)\n return {left: left, right: left, top: top, bottom: top + lineObj.height}\n}", "function estimateCoords(cm, pos) {\n var left = 0\n pos = clipPos(cm.doc, pos)\n if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch }\n var lineObj = getLine(cm.doc, pos.line)\n var top = heightAtLine(lineObj) + paddingTop(cm.display)\n return {left: left, right: left, top: top, bottom: top + lineObj.height}\n}", "function estimateCoords(cm, pos) {\r\n var left = 0;\r\n pos = clipPos(cm.doc, pos);\r\n if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; }\r\n var lineObj = getLine(cm.doc, pos.line);\r\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\r\n return {left: left, right: left, top: top, bottom: top + lineObj.height}\r\n}", "function estimateCoords(cm, pos) {\n var left = 0;\n pos = clipPos(cm.doc, pos);\n if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; }\n var lineObj = getLine(cm.doc, pos.line);\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\n return {left: left, right: left, top: top, bottom: top + lineObj.height}\n}", "function estimateCoords(cm, pos) {\n var left = 0;\n pos = clipPos(cm.doc, pos);\n if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; }\n var lineObj = getLine(cm.doc, pos.line);\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\n return {left: left, right: left, top: top, bottom: top + lineObj.height}\n}", "function estimateCoords(cm, pos) {\n var left = 0;\n pos = clipPos(cm.doc, pos);\n if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; }\n var lineObj = getLine(cm.doc, pos.line);\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\n return {left: left, right: left, top: top, bottom: top + lineObj.height}\n}", "function estimateCoords(cm, pos) {\n var left = 0;\n pos = clipPos(cm.doc, pos);\n if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; }\n var lineObj = getLine(cm.doc, pos.line);\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\n return {left: left, right: left, top: top, bottom: top + lineObj.height}\n}", "function estimateCoords(cm, pos) {\n var left = 0;\n pos = clipPos(cm.doc, pos);\n if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; }\n var lineObj = getLine(cm.doc, pos.line);\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\n return {left: left, right: left, top: top, bottom: top + lineObj.height}\n}", "function estimateCoords(cm, pos) {\n var left = 0;\n pos = clipPos(cm.doc, pos);\n if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; }\n var lineObj = getLine(cm.doc, pos.line);\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\n return {left: left, right: left, top: top, bottom: top + lineObj.height}\n}", "function estimateCoords(cm, pos) {\n var left = 0;\n pos = clipPos(cm.doc, pos);\n if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; }\n var lineObj = getLine(cm.doc, pos.line);\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\n return {left: left, right: left, top: top, bottom: top + lineObj.height}\n}", "function estimateCoords(cm, pos) {\n var left = 0;\n pos = clipPos(cm.doc, pos);\n if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; }\n var lineObj = getLine(cm.doc, pos.line);\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\n return {left: left, right: left, top: top, bottom: top + lineObj.height}\n}", "function estimateCoords(cm, pos) {\n var left = 0;\n pos = clipPos(cm.doc, pos);\n if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; }\n var lineObj = getLine(cm.doc, pos.line);\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\n return {left: left, right: left, top: top, bottom: top + lineObj.height}\n}", "function estimateCoords(cm, pos) {\n var left = 0;\n pos = clipPos(cm.doc, pos);\n if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; }\n var lineObj = getLine(cm.doc, pos.line);\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\n return {left: left, right: left, top: top, bottom: top + lineObj.height}\n}", "function estimateCoords(cm, pos) {\n var left = 0;\n pos = clipPos(cm.doc, pos);\n if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; }\n var lineObj = getLine(cm.doc, pos.line);\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\n return {left: left, right: left, top: top, bottom: top + lineObj.height}\n}", "get position() {\n\t\t\treturn {x: this.x, y: this.y};\n\t\t}", "function getCoordinates(el) {\n\txCor = (el.getBoundingClientRect()).x;\n\tyCor = (el.getBoundingClientRect()).y;\n\tCoor = [(xCor + window.scrollX), (yCor + window.scrollY)];\n\tconsole.log(Coor);\n\tconsole.log(el.getBoundingClientRect());\n\treturn Coor;\n}", "function getRealPosition( index ) {\n var stage = app.getDrawStage();\n return { 'x': stage.offset().x + index.x / stage.scale().x,\n 'y': stage.offset().y + index.y / stage.scale().y };\n }", "_coord(arr) {\n var a = arr[0], d = arr[1], b = arr[2];\n var sum, pos = [0, 0];\n sum = a + d + b;\n if (sum !== 0) {\n a /= sum;\n d /= sum;\n b /= sum;\n pos[0] = corners[0][0] * a + corners[1][0] * d + corners[2][0] * b;\n pos[1] = corners[0][1] * a + corners[1][1] * d + corners[2][1] * b;\n }\n return pos;\n }", "calculatePositions() {\n this.x1 = this.from.getCenterX()\n this.y1 = this.from.getCenterY()\n this.x2 = this.to.getCenterX()\n this.y2 = this.to.getCenterY()\n }", "function _calcCoords() {\n // use the first element jQuery finds\n var el = jQuery(_element)[0],\n coords = {};\n coords.t = KingToolz.getTop(el) - _padding;\n coords.r = KingToolz.getRight(el) + _padding;\n coords.b = KingToolz.getBottom(el) + _padding;\n coords.l = KingToolz.getLeft(el) - _padding;\n coords.w = KingToolz.getWidth(el) + _padding * 2;\n coords.h = KingToolz.getHeight(el) + _padding * 2;\n return coords;\n }", "getScrollPosition() {\n if (this.supportsScrolling()) {\n return [this.window.pageXOffset, this.window.pageYOffset];\n }\n else {\n return [0, 0];\n }\n }", "getScrollPosition() {\n if (this.supportsScrolling()) {\n return [this.window.pageXOffset, this.window.pageYOffset];\n }\n else {\n return [0, 0];\n }\n }", "getScrollPosition() {\n if (this.supportsScrolling()) {\n return [this.window.pageXOffset, this.window.pageYOffset];\n }\n else {\n return [0, 0];\n }\n }", "getScrollPosition() {\n if (this.supportsScrolling()) {\n return [this.window.pageXOffset, this.window.pageYOffset];\n }\n else {\n return [0, 0];\n }\n }", "getScrollPosition() {\n if (this.supportsScrolling()) {\n return [this.window.pageXOffset, this.window.pageYOffset];\n }\n else {\n return [0, 0];\n }\n }", "getPosition(pos) {\n //getBoundingClientRect() renvoie la taille du canvas et sa position par rapport au viewport.\n const canvas = this.canvas.getBoundingClientRect();\n const x = (pos.x - canvas.left) / (canvas.right - canvas.left) * this.canvas.width; //récupère la position exacte de la souris (position X)\n const y = (pos.y - canvas.top) / (canvas.bottom - canvas.top) * this.canvas.height;\n return {\n x,\n y\n };\n }", "calculateCellsPosition(x, y) {\n let position = {};\n\n position.x = (Cell.config.cellSize + Cell.config.cellMargin) * x;\n position.y = (Cell.config.cellSize + Cell.config.cellMargin) * y;\n\n return position;\n }", "getScrollPosition() {\n if (this.supportsScrolling()) {\n return [this.window.pageXOffset, this.window.pageYOffset];\n } else {\n return [0, 0];\n }\n }", "function getXYPosition(image) {\n\tconst { top, left, bottom, right } = image.getBoundingClientRect();\n\tconst { pageXOffset, pageYOffset } = window;\n return {\n top: top + pageYOffset,\n left: left + pageXOffset,\n bottom: bottom + pageYOffset,\n right: right + pageXOffset\n };\n}", "calculatePosition() {\n const x = (this.mCornerRTF.x + this.mCornerLBB.x) * 0.5;\n const y = (this.mCornerRTF.y + this.mCornerLBB.y) * 0.5;\n const z = (this.mCornerRTF.z + this.mCornerLBB.z) * 0.5;\n const position = new THREE.Vector3(x, y, z);\n\n return position;\n }", "computeCoords() {\n this.distanceFromEarthCenter = bv3.length(this.position)\n this.distanceFromEarthSurface = this.distanceFromEarthCenter - 6378\n\n this.lat = radians2degrees(Math.asin(-this.position[1] / this.distanceFromEarthCenter))\n\n\n const posAtEquator = [this.position[0], 0, this.position[2]]\n\n\n const distanceFromEarthCenterAtEquator = bv3.length(posAtEquator)\n const l90 = radians2degrees(Math.asin(-this.position[0] / distanceFromEarthCenterAtEquator))\n\n\n if (this.position[0] > 0 != this.position[2] > 0) {\n if (this.position[0] > 0) {\n //CCconsole.log(\"c1\")\n this.lon = l90;\n } else {\n //CCconsole.log(\"c2\")\n this.lon = 180 - l90;\n }\n } else {\n if (this.position[0] > 0) {\n //CCconsole.log(\"c3\")\n this.lon = -180 - l90;\n } else {\n //CCconsole.log(\"c4\")\n this.lon = l90;\n }\n }\n\n \n }", "_computePositionOnScreen(position, result) {\n return SceneTransforms.wgs84ToWindowCoordinates(this.scene, position, result);\n }", "function getCoords(elem) {\r\n var box = elem.getBoundingClientRect();\r\n return {\r\n top: box.top + pageYOffset,\r\n left: box.left + pageXOffset\r\n };\r\n }", "function getCoords() {\n return {\n x: 10,\n y: 22\n };\n}", "pos() {\n if (this.is_vertex()) {\n return this.position;\n } else {\n return this.offset;\n }\n }", "function getCoordinates(a) {\n var b = a.position(),\n c = {\n x: b.left + a.width() / 2,\n y: b.top + a.height() / 2\n };\n return c\n }", "function getCoords(elem){\n let box = elem.getBoundingClientRect();\n return {\n top: box.top + pageYOffset,\n left: box.left + pageXOffset,\n width: box.width\n }\n }", "function getCoords(elem){\n let box = elem.getBoundingClientRect();\n return {\n top: box.top + pageYOffset,\n left: box.left + pageXOffset,\n width: box.width\n }\n }", "function _getPos(elem) {\n const bbox = elem.getBoundingClientRect();\n return {\n x: bbox.left,\n y: bbox.top,\n bbox\n };\n}", "function getPos() {\n\t\treturn _this.position;\n\t}", "function offset() {\n //technically, vX.pos works too and I should probably use whatever I built here, but I have jQuery instead.\n if (window.Ext)\n return Ext.get(elem).getXY();\n if (window.jQuery) {\n var pos = jQuery(elem).offset();\n return [pos.left, pos.top];\n }\n if (window.vx) { //vx support\n var pos = vx.pos(elem);\n return [pos.l, pos.t];\n }\n return [0, 0];\n }", "function getCoords(ev) {\n var x, y, w, h, el;\n // ignore browsers without pageX for now\n if (ev.pageX == null)\n return;\n x = ev.pageX;\n y = ev.pageY;\n el = self.element;\n // should probably check offsetParent\n // but this is more portable\n while (el && el !== self.document.documentElement) {\n x -= el.offsetLeft;\n y -= el.offsetTop;\n el = 'offsetParent' in el\n ? el.offsetParent\n : el.parentNode;\n }\n // convert to cols/rows\n w = self.element.clientWidth;\n h = self.element.clientHeight;\n x = Math.ceil((x / w) * self.cols);\n y = Math.ceil((y / h) * self.rows);\n // be sure to avoid sending\n // bad positions to the program\n if (x < 0)\n x = 0;\n if (x > self.cols)\n x = self.cols;\n if (y < 0)\n y = 0;\n if (y > self.rows)\n y = self.rows;\n // xterm sends raw bytes and\n // starts at 32 (SP) for each.\n x += 32;\n y += 32;\n return {\n x: x,\n y: y,\n type: 'wheel'\n };\n }", "_positionFromMouseEvent(event, element, mouseService) {\n const coords = mouseService.getCoords(event, element, this._bufferService.cols, this._bufferService.rows);\n if (!coords) {\n return;\n }\n return { x: coords[0], y: coords[1] + this._bufferService.buffer.ydisp };\n }", "function determineDrawPos(){\n let pos ={\n x: 0,\n y: 0\n }\n arms.forEach(function(index){\n let indexPos = findXY(index.radius,degToRad(index.direction))\n\n pos.x += indexPos.x\n\n pos.y += indexPos.y\n })\n\n return pos\n}", "getPos() {\n return this.positions;\n }", "function storeposition() {\n if (calc < points) {\n numx.push(x);\n numy.push(y);\n calc += 1;\n } else {\n numx.splice(0, 1);\n numy.splice(0, 1);\n calc -= 1;\n }\n}", "function _getPos(elem) {\n var bbox = elem.getBoundingClientRect();\n return {\n x: bbox.left,\n y: bbox.top,\n bbox: bbox\n };\n}", "function getCoords(e) {\t\t\n\t\treturn { x: e.pageX - theCanvas.offsetLeft, y: e.pageY - theCanvas.offsetTop };\n\t }", "function getPosition(el) {\n var xPosition = 0;\n var yPosition = 0;\n \n while (el) {\n if (el.tagName == \"BODY\") {\n // deal with browser quirks with body/window/document and page scroll\n var xScrollPos = el.scrollLeft || document.documentElement.scrollLeft;\n var yScrollPos = el.scrollTop || document.documentElement.scrollTop;\n \n xPosition += (el.offsetLeft - xScrollPos + el.clientLeft);\n yPosition += (el.offsetTop - yScrollPos + el.clientTop);\n } else {\n xPosition += (el.offsetLeft - el.scrollLeft + el.clientLeft);\n yPosition += (el.offsetTop - el.scrollTop + el.clientTop);\n }\n \n el = el.offsetParent;\n }\n console.log('gp: xpos:', xPosition);\n return {\n x: xPosition,\n y: yPosition\n };\n }", "get position() {\n return {x: this.x, y: this.y}\n }", "function getLocation(x, y) {\n return {\n x: (x - canvas.getBoundingClientRect().left) > 0 ? (x - canvas.getBoundingClientRect().left) : 0,\n y: (y - canvas.getBoundingClientRect().top) > 0 ? (y - canvas.getBoundingClientRect().top) : 0,\n }\n}", "getLocation(x, y) {\n return [Math.floor(x / CELL.WIDTH), Math.floor(y / CELL.HEIGHT)];\n }", "static getCoords(t, c, p) {\r\n\t\tlet m = MathTools.matMul(t.t, [\r\n\t\t\t[p.x],\r\n\t\t\t[p.y],\r\n\t\t\t[1]\r\n\t\t])\r\n\t\tm[0][0] += (t.x - c.x)\r\n\t\tm[1][0] += (t.y - c.y)\r\n\t\tm = MathTools.matMul(c.t, m)\r\n\t\treturn {\r\n\t\t\tx: m[0][0]+window.innerWidth/2,\r\n\t\t\ty: window.innerHeight - (m[1][0]+window.innerHeight/2)\r\n\t\t}\r\n\t}", "function determinePosition(x, y) {\n return new Point(x, y);\n}", "function get_xy(el) {\n\tvar box = el.getBoundingClientRect();\n\treturn {\n\t\tx: box.left,\n\t\ty: box.top\n\t};\n}", "function getCoords(elem) {\n\t\tvar elemCoords = elem.getBoundingClientRect();\n\n\t\treturn {\n\t\t\ttop: elemCoords.top + pageYOffset,\n\t\t\tleft: elemCoords.left + pageXOffset\n\t\t};\n\t}", "function getUpdatedPos(x, y, M) {\n var W = x*M[6] + y*M[7] + M[8];\n var X = x*M[0]/W + y*M[1]/W + M[2]/W;\n var Y = x*M[3]/W + y*M[4]/W + M[5]/W;\n return [X, Y];\n}", "get position() {\n return {\n x: this.x,\n y: this.y\n };\n }", "function getPos(obj) {\n\t\tvar offsets = obj.offset();\n\t\tobjHeight = obj.height();\n\t\tobjWidth = obj.width();\n\t\texcldH = objHeight / 3; //Caculating 10% height\n\t\t(top = offsets.top),\n\t\t\t(left = offsets.left),\n\t\t\t(bottom = top + objHeight),\n\t\t\t(right = left + objWidth);\n\t}", "function _cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n\n if (!preparedMeasure) {\n preparedMeasure = prepareMeasureForLine(cm, lineObj);\n }\n\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n\n if (right) {\n m.left = m.right;\n } else {\n m.right = m.left;\n }\n\n return intoCoordSystem(cm, lineObj, m, context);\n }\n\n var order = getOrder(lineObj, cm.doc.direction),\n ch = pos.ch,\n sticky = pos.sticky;\n\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n\n if (!order) {\n return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\");\n }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos],\n right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert);\n }\n\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n\n if (other != null) {\n val.other = getBidi(ch, other, sticky != \"before\");\n }\n\n return val;\n } // Used to cheaply estimate the coordinates for a position. Used for", "getCenterPosition() {\n\t\tlet center = this.getCenter();\n\t\treturn {\n\t\t\tx: this.x + center.x,\n\t\t\ty: this.y + center.y\n\t\t};\n\t}", "positionpx(j, m, i, n, spec) {\n var height, left, top, width;\n left = 0;\n top = 0;\n width = 0;\n height = 0;\n [left, top, width, height] = this.position(j, m, i, n, spec, this.wscale, this.hscale);\n return [width * this.wpx / 100, height * this.hpx / 100];\n }", "getAbsolutePosition(size) {\n if (this.position !== undefined) {\n if (this.unitMode === 'Absolute') {\n return this.position;\n }\n else {\n return {\n x: this.position.x * size.width, y: this.position.y * size.height\n };\n }\n }\n return undefined;\n }" ]
[ "0.69225216", "0.6853562", "0.6800712", "0.670349", "0.670349", "0.670349", "0.6692505", "0.6686151", "0.6673038", "0.6643865", "0.66430914", "0.6631961", "0.6619071", "0.6619071", "0.6619071", "0.6619071", "0.6619071", "0.6619071", "0.6619071", "0.6619071", "0.66069835", "0.6556247", "0.6556247", "0.6545137", "0.6539435", "0.6539435", "0.6539435", "0.6539435", "0.6539435", "0.6539435", "0.6539435", "0.6539435", "0.6539435", "0.6539435", "0.6539435", "0.65181077", "0.64927346", "0.64584523", "0.64360946", "0.642684", "0.6426238", "0.64172304", "0.64172304", "0.64172304", "0.64172304", "0.64172304", "0.6415063", "0.6404233", "0.6398827", "0.63708735", "0.6369789", "0.63479644", "0.63473356", "0.6321087", "0.6309051", "0.63016635", "0.6300546", "0.6293177", "0.6293177", "0.62888926", "0.628404", "0.6274897", "0.6274173", "0.6256622", "0.62562835", "0.6241177", "0.6236705", "0.62315565", "0.62313116", "0.62122566", "0.6211203", "0.6199348", "0.6196512", "0.6188729", "0.61863667", "0.6178335", "0.61682874", "0.61635906", "0.6153152", "0.6143588", "0.6135367", "0.61328", "0.6131274", "0.61286724" ]
0.660359
34
Positions returned by coordsChar contain some extra information. xRel is the relative x position of the input coordinates compared to the found position (so xRel > 0 means the coordinates are to the right of the character position, for example). When outside is true, that means the coordinates lie outside the line's vertical range.
function PosWithInfo(line, ch, sticky, outside, xRel) { var pos = Pos(line, ch, sticky); pos.xRel = xRel; if (outside) { pos.outside = outside; } return pos }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function PosWithInfo(line, ch, sticky, outside, xRel) {\n var pos = Pos(line, ch, sticky);\n pos.xRel = xRel;\n\n if (outside) {\n pos.outside = outside;\n }\n\n return pos;\n } // Compute the character position closest to the given coordinates.", "function coordsChar(cm, x, y) {\n var doc = cm.view.doc;\n y += cm.display.viewOffset;\n if (y < 0) return {line: 0, ch: 0, outside: true};\n var lineNo = lineAtHeight(doc, y);\n if (lineNo >= doc.size) return {line: doc.size - 1, ch: getLine(doc, doc.size - 1).text.length};\n if (x < 0) x = 0;\n\n for (;;) {\n var lineObj = getLine(doc, lineNo);\n var found = coordsCharInner(cm, lineObj, lineNo, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find();\n if (merged && found.ch >= mergedPos.from.ch)\n lineNo = mergedPos.to.line;\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.view.doc;\n y += cm.display.viewOffset;\n if (y < 0) return {line: 0, ch: 0, outside: true};\n var lineNo = lineAtHeight(doc, y);\n if (lineNo >= doc.size) return {line: doc.size - 1, ch: getLine(doc, doc.size - 1).text.length};\n if (x < 0) x = 0;\n\n for (;;) {\n var lineObj = getLine(doc, lineNo);\n var found = coordsCharInner(cm, lineObj, lineNo, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find();\n if (merged && found.ch >= mergedPos.from.ch)\n lineNo = mergedPos.to.line;\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.view.doc;\n y += cm.display.viewOffset;\n if (y < 0) return {line: 0, ch: 0, outside: true};\n var lineNo = lineAtHeight(doc, y);\n if (lineNo >= doc.size) return {line: doc.size - 1, ch: getLine(doc, doc.size - 1).text.length};\n if (x < 0) x = 0;\n\n for (;;) {\n var lineObj = getLine(doc, lineNo);\n var found = coordsCharInner(cm, lineObj, lineNo, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find();\n if (merged && found.ch >= mergedPos.from.ch)\n lineNo = mergedPos.to.line;\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n\t\t var doc = cm.doc;\n\t\t y += cm.display.viewOffset;\n\t\t if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n\t\t var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n\t\t if (lineN > last)\n\t\t return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n\t\t if (x < 0) x = 0;\n\t\t\n\t\t var lineObj = getLine(doc, lineN);\n\t\t for (;;) {\n\t\t var found = coordsCharInner(cm, lineObj, lineN, x, y);\n\t\t var merged = collapsedSpanAtEnd(lineObj);\n\t\t var mergedPos = merged && merged.find(0, true);\n\t\t if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n\t\t lineN = lineNo(lineObj = mergedPos.to.line);\n\t\t else\n\t\t return found;\n\t\t }\n\t\t }", "function PosWithInfo(line, ch, outside, xRel) {\n var pos = Pos(line, ch);\n pos.xRel = xRel;\n if (outside) pos.outside = true;\n return pos;\n }", "function PosWithInfo(line, ch, outside, xRel) {\n var pos = Pos(line, ch);\n pos.xRel = xRel;\n if (outside) pos.outside = true;\n return pos;\n }", "function PosWithInfo(line, ch, outside, xRel) {\n var pos = Pos(line, ch);\n pos.xRel = xRel;\n if (outside) pos.outside = true;\n return pos;\n }", "function PosWithInfo(line, ch, outside, xRel) {\n var pos = Pos(line, ch);\n pos.xRel = xRel;\n if (outside) pos.outside = true;\n return pos;\n }", "function PosWithInfo(line, ch, outside, xRel) {\n var pos = Pos(line, ch);\n pos.xRel = xRel;\n if (outside) pos.outside = true;\n return pos;\n }", "function PosWithInfo(line, ch, outside, xRel) {\n var pos = Pos(line, ch);\n pos.xRel = xRel;\n if (outside) pos.outside = true;\n return pos;\n }", "function PosWithInfo(line, ch, outside, xRel) {\n var pos = Pos(line, ch);\n pos.xRel = xRel;\n if (outside) pos.outside = true;\n return pos;\n }", "function PosWithInfo(line, ch, outside, xRel) {\n var pos = Pos(line, ch);\n pos.xRel = xRel;\n if (outside) pos.outside = true;\n return pos;\n }", "function PosWithInfo(line, ch, outside, xRel) {\r\n var pos = Pos(line, ch);\r\n pos.xRel = xRel;\r\n if (outside) pos.outside = true;\r\n return pos;\r\n }", "function PosWithInfo(line, ch, outside, xRel) {\n\t\t var pos = Pos(line, ch);\n\t\t pos.xRel = xRel;\n\t\t if (outside) pos.outside = true;\n\t\t return pos;\n\t\t }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n var lineNo = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineNo > last)\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n if (x < 0) x = 0;\n\n for (;;) {\n var lineObj = getLine(doc, lineNo);\n var found = coordsCharInner(cm, lineObj, lineNo, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find();\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n lineNo = mergedPos.to.line;\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n var lineNo = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineNo > last)\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n if (x < 0) x = 0;\n\n for (;;) {\n var lineObj = getLine(doc, lineNo);\n var found = coordsCharInner(cm, lineObj, lineNo, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find();\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n lineNo = mergedPos.to.line;\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n var lineNo = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineNo > last)\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n if (x < 0) x = 0;\n\n for (;;) {\n var lineObj = getLine(doc, lineNo);\n var found = coordsCharInner(cm, lineObj, lineNo, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find();\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n lineNo = mergedPos.to.line;\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n var lineNo = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineNo > last)\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n if (x < 0) x = 0;\n\n for (;;) {\n var lineObj = getLine(doc, lineNo);\n var found = coordsCharInner(cm, lineObj, lineNo, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find();\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n lineNo = mergedPos.to.line;\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n if (x < 0) x = 0;\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n lineN = lineNo(lineObj = mergedPos.to.line);\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n if (x < 0) x = 0;\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n lineN = lineNo(lineObj = mergedPos.to.line);\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n if (x < 0) x = 0;\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n lineN = lineNo(lineObj = mergedPos.to.line);\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n if (x < 0) x = 0;\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n lineN = lineNo(lineObj = mergedPos.to.line);\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n if (x < 0) x = 0;\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n lineN = lineNo(lineObj = mergedPos.to.line);\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n if (x < 0) x = 0;\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n lineN = lineNo(lineObj = mergedPos.to.line);\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n if (x < 0) x = 0;\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n lineN = lineNo(lineObj = mergedPos.to.line);\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n if (x < 0) x = 0;\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n lineN = lineNo(lineObj = mergedPos.to.line);\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n\t var doc = cm.doc;\n\t y += cm.display.viewOffset;\n\t if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n\t var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n\t if (lineN > last)\n\t return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n\t if (x < 0) x = 0;\n\t\n\t var lineObj = getLine(doc, lineN);\n\t for (;;) {\n\t var found = coordsCharInner(cm, lineObj, lineN, x, y);\n\t var merged = collapsedSpanAtEnd(lineObj);\n\t var mergedPos = merged && merged.find(0, true);\n\t if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n\t lineN = lineNo(lineObj = mergedPos.to.line);\n\t else\n\t return found;\n\t }\n\t }", "function coordsChar(cm, x, y) {\n\t var doc = cm.doc;\n\t y += cm.display.viewOffset;\n\t if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n\t var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n\t if (lineN > last)\n\t return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n\t if (x < 0) x = 0;\n\n\t var lineObj = getLine(doc, lineN);\n\t for (;;) {\n\t var found = coordsCharInner(cm, lineObj, lineN, x, y);\n\t var merged = collapsedSpanAtEnd(lineObj);\n\t var mergedPos = merged && merged.find(0, true);\n\t if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n\t lineN = lineNo(lineObj = mergedPos.to.line);\n\t else\n\t return found;\n\t }\n\t }", "function coordsChar(cm, x, y) {\n\t var doc = cm.doc;\n\t y += cm.display.viewOffset;\n\t if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n\t var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n\t if (lineN > last)\n\t return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n\t if (x < 0) x = 0;\n\n\t var lineObj = getLine(doc, lineN);\n\t for (;;) {\n\t var found = coordsCharInner(cm, lineObj, lineN, x, y);\n\t var merged = collapsedSpanAtEnd(lineObj);\n\t var mergedPos = merged && merged.find(0, true);\n\t if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n\t lineN = lineNo(lineObj = mergedPos.to.line);\n\t else\n\t return found;\n\t }\n\t }", "function coordsChar(cm, x, y) {\n\t\t var doc = cm.doc;\n\t\t y += cm.display.viewOffset;\n\t\t if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) }\n\t\t var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n\t\t if (lineN > last)\n\t\t { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) }\n\t\t if (x < 0) { x = 0; }\n\n\t\t var lineObj = getLine(doc, lineN);\n\t\t for (;;) {\n\t\t var found = coordsCharInner(cm, lineObj, lineN, x, y);\n\t\t var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));\n\t\t if (!collapsed) { return found }\n\t\t var rangeEnd = collapsed.find(1);\n\t\t if (rangeEnd.line == lineN) { return rangeEnd }\n\t\t lineObj = getLine(doc, lineN = rangeEnd.line);\n\t\t }\n\t\t }", "function PosWithInfo(line, ch, outside, xRel) {\n var pos = Pos(line, ch)\n pos.xRel = xRel\n if (outside) { pos.outside = true }\n return pos\n}", "function PosWithInfo(line, ch, outside, xRel) {\n\t var pos = Pos(line, ch);\n\t pos.xRel = xRel;\n\t if (outside) pos.outside = true;\n\t return pos;\n\t }", "function PosWithInfo(line, ch, outside, xRel) {\n\t var pos = Pos(line, ch);\n\t pos.xRel = xRel;\n\t if (outside) pos.outside = true;\n\t return pos;\n\t }", "function PosWithInfo(line, ch, outside, xRel) {\n\t var pos = Pos(line, ch);\n\t pos.xRel = xRel;\n\t if (outside) pos.outside = true;\n\t return pos;\n\t }", "function coordsChar(cm, x, y) {\r\n var doc = cm.doc;\r\n y += cm.display.viewOffset;\r\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\r\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\r\n if (lineN > last)\r\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\r\n if (x < 0) x = 0;\r\n\r\n var lineObj = getLine(doc, lineN);\r\n for (;;) {\r\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\r\n var merged = collapsedSpanAtEnd(lineObj);\r\n var mergedPos = merged && merged.find(0, true);\r\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\r\n lineN = lineNo(lineObj = mergedPos.to.line);\r\n else\r\n return found;\r\n }\r\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc\n y += cm.display.viewOffset\n if (y < 0) { return PosWithInfo(doc.first, 0, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1) }\n if (x < 0) { x = 0 }\n\n var lineObj = getLine(doc, lineN)\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y)\n var merged = collapsedSpanAtEnd(lineObj)\n var mergedPos = merged && merged.find(0, true)\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n { lineN = lineNo(lineObj = mergedPos.to.line) }\n else\n { return found }\n }\n}", "function coordsChar(cm, x, y) {\n var doc = cm.doc\n y += cm.display.viewOffset\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0 }\n\n var lineObj = getLine(doc, lineN)\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y)\n var merged = collapsedSpanAtEnd(lineObj)\n var mergedPos = merged && merged.find(0, true)\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n { lineN = lineNo(lineObj = mergedPos.to.line) }\n else\n { return found }\n }\n}", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function _coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n\n if (y < 0) {\n return PosWithInfo(doc.first, 0, null, -1, -1);\n }\n\n var lineN = _lineAtHeight(doc, y),\n last = doc.first + doc.size - 1;\n\n if (lineN > last) {\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1);\n }\n\n if (x < 0) {\n x = 0;\n }\n\n var lineObj = getLine(doc, lineN);\n\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));\n\n if (!collapsed) {\n return found;\n }\n\n var rangeEnd = collapsed.find(1);\n\n if (rangeEnd.line == lineN) {\n return rangeEnd;\n }\n\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n { lineN = lineNo(lineObj = mergedPos.to.line); }\n else\n { return found }\n }\n}", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n { lineN = lineNo(lineObj = mergedPos.to.line); }\n else\n { return found }\n }\n}", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n { lineN = lineNo(lineObj = mergedPos.to.line); }\n else\n { return found }\n }\n}", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n { lineN = lineNo(lineObj = mergedPos.to.line); }\n else\n { return found }\n }\n}", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n { lineN = lineNo(lineObj = mergedPos.to.line); }\n else\n { return found }\n }\n}", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n { lineN = lineNo(lineObj = mergedPos.to.line); }\n else\n { return found }\n }\n}", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n { lineN = lineNo(lineObj = mergedPos.to.line); }\n else\n { return found }\n }\n}", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n { lineN = lineNo(lineObj = mergedPos.to.line); }\n else\n { return found }\n }\n}", "function coordsChar(x, y) {\n if (y < 0) y = 0;\n var th = textHeight(), cw = charWidth(), heightPos = displayOffset + Math.floor(y / th);\n var lineNo = lineAtHeight(doc, heightPos);\n if (lineNo >= doc.size) return {line: doc.size - 1, ch: getLine(doc.size - 1).text.length};\n var lineObj = getLine(lineNo), text = lineObj.text;\n var tw = options.lineWrapping, innerOff = tw ? heightPos - heightAtLine(doc, lineNo) : 0;\n if (x <= 0 && innerOff == 0) return {line: lineNo, ch: 0};\n function getX(len) {\n var sp = measureLine(lineObj, len);\n if (tw) {\n var off = Math.round(sp.top / th);\n return Math.max(0, sp.left + (off - innerOff) * scroller.clientWidth);\n }\n return sp.left;\n }\n var from = 0, fromX = 0, to = text.length, toX;\n // Guess a suitable upper bound for our search.\n var estimated = Math.min(to, Math.ceil((x + innerOff * scroller.clientWidth * .9) / cw));\n for (;;) {\n var estX = getX(estimated);\n if (estX <= x && estimated < to) estimated = Math.min(to, Math.ceil(estimated * 1.2));\n else {toX = estX; to = estimated; break;}\n }\n if (x > toX) return {line: lineNo, ch: to};\n // Try to guess a suitable lower bound as well.\n estimated = Math.floor(to * 0.8); estX = getX(estimated);\n if (estX < x) {from = estimated; fromX = estX;}\n // Do a binary search between these bounds.\n for (;;) {\n if (to - from <= 1) return {line: lineNo, ch: (toX - x > x - fromX) ? from : to};\n var middle = Math.ceil((from + to) / 2), middleX = getX(middle);\n if (middleX > x) {to = middle; toX = middleX;}\n else {from = middle; fromX = middleX;}\n }\n }", "function coordsChar(cm, x, y) {\r\n var doc = cm.doc;\r\n y += cm.display.viewOffset;\r\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\r\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\r\n if (lineN > last)\r\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\r\n if (x < 0) { x = 0; }\r\n\r\n var lineObj = getLine(doc, lineN);\r\n for (;;) {\r\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\r\n var merged = collapsedSpanAtEnd(lineObj);\r\n var mergedPos = merged && merged.find(0, true);\r\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\r\n { lineN = lineNo(lineObj = mergedPos.to.line); }\r\n else\r\n { return found }\r\n }\r\n}", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n}", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n}", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n}", "function coordsChar(x, y) {\n if (y < 0) y = 0;\n var th = textHeight(), cw = charWidth(), heightPos = displayOffset + Math.floor(y / th);\n var lineNo = lineAtHeight(doc, heightPos);\n if (lineNo >= doc.size) return {line: doc.size - 1, ch: getLine(doc.size - 1).text.length};\n var lineObj = getLine(lineNo), text = lineObj.text;\n var tw = options.lineWrapping, innerOff = tw ? heightPos - heightAtLine(doc, lineNo) : 0;\n if (x <= 0 && innerOff == 0) return {line: lineNo, ch: 0};\n function getX(len) {\n var sp = measureLine(lineObj, len);\n if (tw) {\n var off = Math.round(sp.top / th);\n return Math.max(0, sp.left + (off - innerOff) * scroller.clientWidth);\n }\n return sp.left;\n }\n var from = 0, fromX = 0, to = text.length, toX;\n // Guess a suitable upper bound for our search.\n var estimated = Math.min(to, Math.ceil((x + innerOff * scroller.clientWidth * .9) / cw));\n for (;;) {\n var estX = getX(estimated);\n if (estX <= x && estimated < to) estimated = Math.min(to, Math.ceil(estimated * 1.2));\n else {toX = estX; to = estimated; break;}\n }\n if (x > toX) return {line: lineNo, ch: to};\n // Try to guess a suitable lower bound as well.\n estimated = Math.floor(to * 0.8); estX = getX(estimated);\n if (estX < x) {from = estimated; fromX = estX;}\n // Do a binary search between these bounds.\n for (;;) {\n if (to - from <= 1) return {line: lineNo, ch: (toX - x > x - fromX) ? from : to};\n var middle = Math.ceil((from + to) / 2), middleX = getX(middle);\n if (middleX > x) {to = middle; toX = middleX;}\n else {from = middle; fromX = middleX;}\n }\n }", "function coordsChar(x, y) {\n if (y < 0) y = 0;\n var th = textHeight(), cw = charWidth(), heightPos = displayOffset + Math.floor(y / th);\n var lineNo = lineAtHeight(doc, heightPos);\n if (lineNo >= doc.size) return {line: doc.size - 1, ch: getLine(doc.size - 1).text.length};\n var lineObj = getLine(lineNo), text = lineObj.text;\n var tw = options.lineWrapping, innerOff = tw ? heightPos - heightAtLine(doc, lineNo) : 0;\n if (x <= 0 && innerOff == 0) return {line: lineNo, ch: 0};\n function getX(len) {\n var sp = measureLine(lineObj, len);\n if (tw) {\n var off = Math.round(sp.top / th);\n return Math.max(0, sp.left + (off - innerOff) * scroller.clientWidth);\n }\n return sp.left;\n }\n var from = 0, fromX = 0, to = text.length, toX;\n // Guess a suitable upper bound for our search.\n var estimated = Math.min(to, Math.ceil((x + innerOff * scroller.clientWidth * .9) / cw));\n for (;;) {\n var estX = getX(estimated);\n if (estX <= x && estimated < to) estimated = Math.min(to, Math.ceil(estimated * 1.2));\n else {toX = estX; to = estimated; break;}\n }\n if (x > toX) return {line: lineNo, ch: to};\n // Try to guess a suitable lower bound as well.\n estimated = Math.floor(to * 0.8); estX = getX(estimated);\n if (estX < x) {from = estimated; fromX = estX;}\n // Do a binary search between these bounds.\n for (;;) {\n if (to - from <= 1) return {line: lineNo, ch: (toX - x > x - fromX) ? from : to};\n var middle = Math.ceil((from + to) / 2), middleX = getX(middle);\n if (middleX > x) {to = middle; toX = middleX;}\n else {from = middle; fromX = middleX;}\n }\n }", "function coordsChar(x, y) {\n if (y < 0) y = 0;\n var th = textHeight(), cw = charWidth(), heightPos = displayOffset + Math.floor(y / th);\n var lineNo = lineAtHeight(doc, heightPos);\n if (lineNo >= doc.size) return {line: doc.size - 1, ch: getLine(doc.size - 1).text.length};\n var lineObj = getLine(lineNo), text = lineObj.text;\n var tw = options.lineWrapping, innerOff = tw ? heightPos - heightAtLine(doc, lineNo) : 0;\n if (x <= 0 && innerOff == 0) return {line: lineNo, ch: 0};\n function getX(len) {\n var sp = measureLine(lineObj, len);\n if (tw) {\n var off = Math.round(sp.top / th);\n return Math.max(0, sp.left + (off - innerOff) * scroller.clientWidth);\n }\n return sp.left;\n }\n var from = 0, fromX = 0, to = text.length, toX;\n // Guess a suitable upper bound for our search.\n var estimated = Math.min(to, Math.ceil((x + innerOff * scroller.clientWidth * .9) / cw));\n for (;;) {\n var estX = getX(estimated);\n if (estX <= x && estimated < to) estimated = Math.min(to, Math.ceil(estimated * 1.2));\n else {toX = estX; to = estimated; break;}\n }\n if (x > toX) return {line: lineNo, ch: to};\n // Try to guess a suitable lower bound as well.\n estimated = Math.floor(to * 0.8); estX = getX(estimated);\n if (estX < x) {from = estimated; fromX = estX;}\n // Do a binary search between these bounds.\n for (;;) {\n if (to - from <= 1) return {line: lineNo, ch: (toX - x > x - fromX) ? from : to};\n var middle = Math.ceil((from + to) / 2), middleX = getX(middle);\n if (middleX > x) {to = middle; toX = middleX;}\n else {from = middle; fromX = middleX;}\n }\n }", "function getCoordinates(charPosX, charPosY, move = \"next\") {\n console.log(move, {\n x: charPosX / MAP_CELL_SIZE,\n y: charPosY / MAP_CELL_SIZE,\n });\n const x = Math.floor(charPosX / MAP_CELL_SIZE);\n const y = Math.floor(charPosY / MAP_CELL_SIZE);\n //console.log(\"CURRENT\", { x, y });\n return { x, y };\n}", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n\t\t lineObj = lineObj || getLine(cm.doc, pos.line);\n\t\t if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n\t\t function get(ch, right) {\n\t\t var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n\t\t if (right) { m.left = m.right; } else { m.right = m.left; }\n\t\t return intoCoordSystem(cm, lineObj, m, context)\n\t\t }\n\t\t var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n\t\t if (ch >= lineObj.text.length) {\n\t\t ch = lineObj.text.length;\n\t\t sticky = \"before\";\n\t\t } else if (ch <= 0) {\n\t\t ch = 0;\n\t\t sticky = \"after\";\n\t\t }\n\t\t if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n\t\t function getBidi(ch, partPos, invert) {\n\t\t var part = order[partPos], right = part.level == 1;\n\t\t return get(invert ? ch - 1 : ch, right != invert)\n\t\t }\n\t\t var partPos = getBidiPartAt(order, ch, sticky);\n\t\t var other = bidiOther;\n\t\t var val = getBidi(ch, partPos, sticky == \"before\");\n\t\t if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n\t\t return val\n\t\t }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n}", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n}", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n}", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n}", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n}", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n}", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n}", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n}", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n}", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n}" ]
[ "0.6486872", "0.6368994", "0.6368994", "0.6368994", "0.6334459", "0.63261276", "0.63261276", "0.63261276", "0.63261276", "0.63261276", "0.63261276", "0.63261276", "0.63261276", "0.6316018", "0.6310313", "0.6298065", "0.6298065", "0.6298065", "0.6298065", "0.6284752", "0.6284752", "0.6284752", "0.6284752", "0.6284752", "0.6284752", "0.6284752", "0.6284752", "0.62706953", "0.62571037", "0.62571037", "0.6248856", "0.6244667", "0.62417066", "0.62417066", "0.62417066", "0.623642", "0.621232", "0.6194243", "0.6178525", "0.6178525", "0.6178525", "0.6178525", "0.6178525", "0.6178525", "0.6178525", "0.6178525", "0.6178525", "0.6178525", "0.6178525", "0.6178525", "0.61731863", "0.61639345", "0.61639345", "0.61639345", "0.61639345", "0.61639345", "0.6141541", "0.6141541", "0.6141541", "0.6141541", "0.6141541", "0.6141541", "0.6141541", "0.6141541", "0.61331975", "0.611658", "0.60689443", "0.60689443", "0.60689443", "0.60659045", "0.60659045", "0.60659045", "0.6053347", "0.59212714", "0.5904358", "0.5904358", "0.5904358", "0.5904358", "0.5904358", "0.5904358", "0.5904358", "0.5904358", "0.5904358", "0.5904358", "0.5904358", "0.5904358", "0.5904358", "0.5904358", "0.5904358", "0.5904358", "0.5904358", "0.58786154", "0.58786154", "0.58786154", "0.58786154", "0.58786154", "0.58786154", "0.58786154", "0.58786154", "0.58786154", "0.58786154" ]
0.0
-1
Compute the character position closest to the given coordinates. Input must be lineSpacelocal ("div" coordinate system).
function coordsChar(cm, x, y) { var doc = cm.doc; y += cm.display.viewOffset; if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) } var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1; if (lineN > last) { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) } if (x < 0) { x = 0; } var lineObj = getLine(doc, lineN); for (;;) { var found = coordsCharInner(cm, lineObj, lineN, x, y); var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0)); if (!collapsed) { return found } var rangeEnd = collapsed.find(1); if (rangeEnd.line == lineN) { return rangeEnd } lineObj = getLine(doc, lineN = rangeEnd.line); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function PosWithInfo(line, ch, sticky, outside, xRel) {\n var pos = Pos(line, ch, sticky);\n pos.xRel = xRel;\n\n if (outside) {\n pos.outside = outside;\n }\n\n return pos;\n } // Compute the character position closest to the given coordinates.", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n var lineNo = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineNo > last)\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n if (x < 0) x = 0;\n\n for (;;) {\n var lineObj = getLine(doc, lineNo);\n var found = coordsCharInner(cm, lineObj, lineNo, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find();\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n lineNo = mergedPos.to.line;\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n var lineNo = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineNo > last)\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n if (x < 0) x = 0;\n\n for (;;) {\n var lineObj = getLine(doc, lineNo);\n var found = coordsCharInner(cm, lineObj, lineNo, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find();\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n lineNo = mergedPos.to.line;\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n var lineNo = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineNo > last)\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n if (x < 0) x = 0;\n\n for (;;) {\n var lineObj = getLine(doc, lineNo);\n var found = coordsCharInner(cm, lineObj, lineNo, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find();\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n lineNo = mergedPos.to.line;\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n var lineNo = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineNo > last)\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n if (x < 0) x = 0;\n\n for (;;) {\n var lineObj = getLine(doc, lineNo);\n var found = coordsCharInner(cm, lineObj, lineNo, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find();\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n lineNo = mergedPos.to.line;\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n if (x < 0) x = 0;\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n lineN = lineNo(lineObj = mergedPos.to.line);\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n if (x < 0) x = 0;\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n lineN = lineNo(lineObj = mergedPos.to.line);\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n if (x < 0) x = 0;\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n lineN = lineNo(lineObj = mergedPos.to.line);\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n if (x < 0) x = 0;\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n lineN = lineNo(lineObj = mergedPos.to.line);\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n if (x < 0) x = 0;\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n lineN = lineNo(lineObj = mergedPos.to.line);\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n if (x < 0) x = 0;\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n lineN = lineNo(lineObj = mergedPos.to.line);\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n if (x < 0) x = 0;\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n lineN = lineNo(lineObj = mergedPos.to.line);\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n if (x < 0) x = 0;\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n lineN = lineNo(lineObj = mergedPos.to.line);\n else\n return found;\n }\n }", "function closestXY(line, mx, my) {\n x0 = line.x0;\n y0 = line.y0;\n x1 = line.x1;\n y1 = line.y1;\n dx = x1 - x0;\n dy = y1 - y0;\n var t = ((mx - x0) * dx + (my - y0) * dy) / (dx * dx + dy * dy);\n t = Math.max(0, Math.min(1, t));\n var x = lerp(x0, x1, t);\n var y = lerp(y0, y1, t);\n if (line === lines[2]) {\n var d0 = Math.sqrt((x - line.x0) * (x - line.x0) + (y - line.y0) * (y - line.y0));\n var d1 = Math.sqrt((line.x1 - x) * (line.x1 - x) + (line.y1 - y) * (line.y1 - y));\n if (d0 < d1) {\n return {\n x: x0,\n y: y0\n }\n } else {\n return {\n x: x1,\n y: y1\n }\n }\n } else {\n return ({\n x: x,\n y: y\n });\n }\n}", "function nearestPointOnLine( x, y, x1, y1, x2, y2 ) {\n let vx = x2 - x1,\n vy = y2 - y1,\n ux = x1 - x,\n uy = y1 - y,\n vu = vx * ux + vy * uy,\n vv = vx * vx + vy * vy,\n t = -vu / vv\n return { t, x: t * x2 + ( 1 - t ) * x1, y: t * y2 + ( 1 - t ) * y1 }\n}", "function coordsChar(cm, x, y) {\n\t var doc = cm.doc;\n\t y += cm.display.viewOffset;\n\t if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n\t var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n\t if (lineN > last)\n\t return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n\t if (x < 0) x = 0;\n\t\n\t var lineObj = getLine(doc, lineN);\n\t for (;;) {\n\t var found = coordsCharInner(cm, lineObj, lineN, x, y);\n\t var merged = collapsedSpanAtEnd(lineObj);\n\t var mergedPos = merged && merged.find(0, true);\n\t if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n\t lineN = lineNo(lineObj = mergedPos.to.line);\n\t else\n\t return found;\n\t }\n\t }", "function coordsChar(cm, x, y) {\n\t var doc = cm.doc;\n\t y += cm.display.viewOffset;\n\t if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n\t var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n\t if (lineN > last)\n\t return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n\t if (x < 0) x = 0;\n\n\t var lineObj = getLine(doc, lineN);\n\t for (;;) {\n\t var found = coordsCharInner(cm, lineObj, lineN, x, y);\n\t var merged = collapsedSpanAtEnd(lineObj);\n\t var mergedPos = merged && merged.find(0, true);\n\t if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n\t lineN = lineNo(lineObj = mergedPos.to.line);\n\t else\n\t return found;\n\t }\n\t }", "function coordsChar(cm, x, y) {\n\t var doc = cm.doc;\n\t y += cm.display.viewOffset;\n\t if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n\t var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n\t if (lineN > last)\n\t return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n\t if (x < 0) x = 0;\n\n\t var lineObj = getLine(doc, lineN);\n\t for (;;) {\n\t var found = coordsCharInner(cm, lineObj, lineN, x, y);\n\t var merged = collapsedSpanAtEnd(lineObj);\n\t var mergedPos = merged && merged.find(0, true);\n\t if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n\t lineN = lineNo(lineObj = mergedPos.to.line);\n\t else\n\t return found;\n\t }\n\t }", "function coordsChar(cm, x, y) {\n\t\t var doc = cm.doc;\n\t\t y += cm.display.viewOffset;\n\t\t if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n\t\t var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n\t\t if (lineN > last)\n\t\t return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n\t\t if (x < 0) x = 0;\n\t\t\n\t\t var lineObj = getLine(doc, lineN);\n\t\t for (;;) {\n\t\t var found = coordsCharInner(cm, lineObj, lineN, x, y);\n\t\t var merged = collapsedSpanAtEnd(lineObj);\n\t\t var mergedPos = merged && merged.find(0, true);\n\t\t if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n\t\t lineN = lineNo(lineObj = mergedPos.to.line);\n\t\t else\n\t\t return found;\n\t\t }\n\t\t }", "function coordsChar(cm, x, y) {\r\n var doc = cm.doc;\r\n y += cm.display.viewOffset;\r\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\r\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\r\n if (lineN > last)\r\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\r\n if (x < 0) x = 0;\r\n\r\n var lineObj = getLine(doc, lineN);\r\n for (;;) {\r\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\r\n var merged = collapsedSpanAtEnd(lineObj);\r\n var mergedPos = merged && merged.find(0, true);\r\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\r\n lineN = lineNo(lineObj = mergedPos.to.line);\r\n else\r\n return found;\r\n }\r\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc\n y += cm.display.viewOffset\n if (y < 0) { return PosWithInfo(doc.first, 0, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1) }\n if (x < 0) { x = 0 }\n\n var lineObj = getLine(doc, lineN)\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y)\n var merged = collapsedSpanAtEnd(lineObj)\n var mergedPos = merged && merged.find(0, true)\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n { lineN = lineNo(lineObj = mergedPos.to.line) }\n else\n { return found }\n }\n}", "function coordsChar(cm, x, y) {\n var doc = cm.doc\n y += cm.display.viewOffset\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0 }\n\n var lineObj = getLine(doc, lineN)\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y)\n var merged = collapsedSpanAtEnd(lineObj)\n var mergedPos = merged && merged.find(0, true)\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n { lineN = lineNo(lineObj = mergedPos.to.line) }\n else\n { return found }\n }\n}", "function coordsChar(cm, x, y) {\n var doc = cm.view.doc;\n y += cm.display.viewOffset;\n if (y < 0) return {line: 0, ch: 0, outside: true};\n var lineNo = lineAtHeight(doc, y);\n if (lineNo >= doc.size) return {line: doc.size - 1, ch: getLine(doc, doc.size - 1).text.length};\n if (x < 0) x = 0;\n\n for (;;) {\n var lineObj = getLine(doc, lineNo);\n var found = coordsCharInner(cm, lineObj, lineNo, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find();\n if (merged && found.ch >= mergedPos.from.ch)\n lineNo = mergedPos.to.line;\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.view.doc;\n y += cm.display.viewOffset;\n if (y < 0) return {line: 0, ch: 0, outside: true};\n var lineNo = lineAtHeight(doc, y);\n if (lineNo >= doc.size) return {line: doc.size - 1, ch: getLine(doc, doc.size - 1).text.length};\n if (x < 0) x = 0;\n\n for (;;) {\n var lineObj = getLine(doc, lineNo);\n var found = coordsCharInner(cm, lineObj, lineNo, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find();\n if (merged && found.ch >= mergedPos.from.ch)\n lineNo = mergedPos.to.line;\n else\n return found;\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.view.doc;\n y += cm.display.viewOffset;\n if (y < 0) return {line: 0, ch: 0, outside: true};\n var lineNo = lineAtHeight(doc, y);\n if (lineNo >= doc.size) return {line: doc.size - 1, ch: getLine(doc, doc.size - 1).text.length};\n if (x < 0) x = 0;\n\n for (;;) {\n var lineObj = getLine(doc, lineNo);\n var found = coordsCharInner(cm, lineObj, lineNo, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find();\n if (merged && found.ch >= mergedPos.from.ch)\n lineNo = mergedPos.to.line;\n else\n return found;\n }\n }", "function coordsChar(x, y) {\n if (y < 0) y = 0;\n var th = textHeight(), cw = charWidth(), heightPos = displayOffset + Math.floor(y / th);\n var lineNo = lineAtHeight(doc, heightPos);\n if (lineNo >= doc.size) return {line: doc.size - 1, ch: getLine(doc.size - 1).text.length};\n var lineObj = getLine(lineNo), text = lineObj.text;\n var tw = options.lineWrapping, innerOff = tw ? heightPos - heightAtLine(doc, lineNo) : 0;\n if (x <= 0 && innerOff == 0) return {line: lineNo, ch: 0};\n function getX(len) {\n var sp = measureLine(lineObj, len);\n if (tw) {\n var off = Math.round(sp.top / th);\n return Math.max(0, sp.left + (off - innerOff) * scroller.clientWidth);\n }\n return sp.left;\n }\n var from = 0, fromX = 0, to = text.length, toX;\n // Guess a suitable upper bound for our search.\n var estimated = Math.min(to, Math.ceil((x + innerOff * scroller.clientWidth * .9) / cw));\n for (;;) {\n var estX = getX(estimated);\n if (estX <= x && estimated < to) estimated = Math.min(to, Math.ceil(estimated * 1.2));\n else {toX = estX; to = estimated; break;}\n }\n if (x > toX) return {line: lineNo, ch: to};\n // Try to guess a suitable lower bound as well.\n estimated = Math.floor(to * 0.8); estX = getX(estimated);\n if (estX < x) {from = estimated; fromX = estX;}\n // Do a binary search between these bounds.\n for (;;) {\n if (to - from <= 1) return {line: lineNo, ch: (toX - x > x - fromX) ? from : to};\n var middle = Math.ceil((from + to) / 2), middleX = getX(middle);\n if (middleX > x) {to = middle; toX = middleX;}\n else {from = middle; fromX = middleX;}\n }\n }", "function coordsChar(x, y) {\n if (y < 0) y = 0;\n var th = textHeight(), cw = charWidth(), heightPos = displayOffset + Math.floor(y / th);\n var lineNo = lineAtHeight(doc, heightPos);\n if (lineNo >= doc.size) return {line: doc.size - 1, ch: getLine(doc.size - 1).text.length};\n var lineObj = getLine(lineNo), text = lineObj.text;\n var tw = options.lineWrapping, innerOff = tw ? heightPos - heightAtLine(doc, lineNo) : 0;\n if (x <= 0 && innerOff == 0) return {line: lineNo, ch: 0};\n function getX(len) {\n var sp = measureLine(lineObj, len);\n if (tw) {\n var off = Math.round(sp.top / th);\n return Math.max(0, sp.left + (off - innerOff) * scroller.clientWidth);\n }\n return sp.left;\n }\n var from = 0, fromX = 0, to = text.length, toX;\n // Guess a suitable upper bound for our search.\n var estimated = Math.min(to, Math.ceil((x + innerOff * scroller.clientWidth * .9) / cw));\n for (;;) {\n var estX = getX(estimated);\n if (estX <= x && estimated < to) estimated = Math.min(to, Math.ceil(estimated * 1.2));\n else {toX = estX; to = estimated; break;}\n }\n if (x > toX) return {line: lineNo, ch: to};\n // Try to guess a suitable lower bound as well.\n estimated = Math.floor(to * 0.8); estX = getX(estimated);\n if (estX < x) {from = estimated; fromX = estX;}\n // Do a binary search between these bounds.\n for (;;) {\n if (to - from <= 1) return {line: lineNo, ch: (toX - x > x - fromX) ? from : to};\n var middle = Math.ceil((from + to) / 2), middleX = getX(middle);\n if (middleX > x) {to = middle; toX = middleX;}\n else {from = middle; fromX = middleX;}\n }\n }", "function coordsChar(x, y) {\n if (y < 0) y = 0;\n var th = textHeight(), cw = charWidth(), heightPos = displayOffset + Math.floor(y / th);\n var lineNo = lineAtHeight(doc, heightPos);\n if (lineNo >= doc.size) return {line: doc.size - 1, ch: getLine(doc.size - 1).text.length};\n var lineObj = getLine(lineNo), text = lineObj.text;\n var tw = options.lineWrapping, innerOff = tw ? heightPos - heightAtLine(doc, lineNo) : 0;\n if (x <= 0 && innerOff == 0) return {line: lineNo, ch: 0};\n function getX(len) {\n var sp = measureLine(lineObj, len);\n if (tw) {\n var off = Math.round(sp.top / th);\n return Math.max(0, sp.left + (off - innerOff) * scroller.clientWidth);\n }\n return sp.left;\n }\n var from = 0, fromX = 0, to = text.length, toX;\n // Guess a suitable upper bound for our search.\n var estimated = Math.min(to, Math.ceil((x + innerOff * scroller.clientWidth * .9) / cw));\n for (;;) {\n var estX = getX(estimated);\n if (estX <= x && estimated < to) estimated = Math.min(to, Math.ceil(estimated * 1.2));\n else {toX = estX; to = estimated; break;}\n }\n if (x > toX) return {line: lineNo, ch: to};\n // Try to guess a suitable lower bound as well.\n estimated = Math.floor(to * 0.8); estX = getX(estimated);\n if (estX < x) {from = estimated; fromX = estX;}\n // Do a binary search between these bounds.\n for (;;) {\n if (to - from <= 1) return {line: lineNo, ch: (toX - x > x - fromX) ? from : to};\n var middle = Math.ceil((from + to) / 2), middleX = getX(middle);\n if (middleX > x) {to = middle; toX = middleX;}\n else {from = middle; fromX = middleX;}\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n { lineN = lineNo(lineObj = mergedPos.to.line); }\n else\n { return found }\n }\n}", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n { lineN = lineNo(lineObj = mergedPos.to.line); }\n else\n { return found }\n }\n}", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n { lineN = lineNo(lineObj = mergedPos.to.line); }\n else\n { return found }\n }\n}", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n { lineN = lineNo(lineObj = mergedPos.to.line); }\n else\n { return found }\n }\n}", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n { lineN = lineNo(lineObj = mergedPos.to.line); }\n else\n { return found }\n }\n}", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n { lineN = lineNo(lineObj = mergedPos.to.line); }\n else\n { return found }\n }\n}", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n { lineN = lineNo(lineObj = mergedPos.to.line); }\n else\n { return found }\n }\n}", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n { lineN = lineNo(lineObj = mergedPos.to.line); }\n else\n { return found }\n }\n}", "function _coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n\n if (y < 0) {\n return PosWithInfo(doc.first, 0, null, -1, -1);\n }\n\n var lineN = _lineAtHeight(doc, y),\n last = doc.first + doc.size - 1;\n\n if (lineN > last) {\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1);\n }\n\n if (x < 0) {\n x = 0;\n }\n\n var lineObj = getLine(doc, lineN);\n\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));\n\n if (!collapsed) {\n return found;\n }\n\n var rangeEnd = collapsed.find(1);\n\n if (rangeEnd.line == lineN) {\n return rangeEnd;\n }\n\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\r\n var doc = cm.doc;\r\n y += cm.display.viewOffset;\r\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\r\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\r\n if (lineN > last)\r\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\r\n if (x < 0) { x = 0; }\r\n\r\n var lineObj = getLine(doc, lineN);\r\n for (;;) {\r\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\r\n var merged = collapsedSpanAtEnd(lineObj);\r\n var mergedPos = merged && merged.find(0, true);\r\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\r\n { lineN = lineNo(lineObj = mergedPos.to.line); }\r\n else\r\n { return found }\r\n }\r\n}", "function coordsChar(x, y) {\n if (y < 0) y = 0;\n var th = textHeight(), cw = charWidth(), heightPos = displayOffset + Math.floor(y / th);\n var lineNo = lineAtHeight(doc, heightPos);\n if (lineNo >= doc.size) return {line: doc.size - 1, ch: getLine(doc.size - 1).text.length};\n var lineObj = getLine(lineNo), text = lineObj.text;\n var tw = options.lineWrapping, innerOff = tw ? heightPos - heightAtLine(doc, lineNo) : 0;\n if (x <= 0 && innerOff == 0) return {line: lineNo, ch: 0};\n function getX(len) {\n var sp = measureLine(lineObj, len);\n if (tw) {\n var off = Math.round(sp.top / th);\n return Math.max(0, sp.left + (off - innerOff) * scroller.clientWidth);\n }\n return sp.left;\n }\n var from = 0, fromX = 0, to = text.length, toX;\n // Guess a suitable upper bound for our search.\n var estimated = Math.min(to, Math.ceil((x + innerOff * scroller.clientWidth * .9) / cw));\n for (;;) {\n var estX = getX(estimated);\n if (estX <= x && estimated < to) estimated = Math.min(to, Math.ceil(estimated * 1.2));\n else {toX = estX; to = estimated; break;}\n }\n if (x > toX) return {line: lineNo, ch: to};\n // Try to guess a suitable lower bound as well.\n estimated = Math.floor(to * 0.8); estX = getX(estimated);\n if (estX < x) {from = estimated; fromX = estX;}\n // Do a binary search between these bounds.\n for (;;) {\n if (to - from <= 1) return {line: lineNo, ch: (toX - x > x - fromX) ? from : to};\n var middle = Math.ceil((from + to) / 2), middleX = getX(middle);\n if (middleX > x) {to = middle; toX = middleX;}\n else {from = middle; fromX = middleX;}\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }", "function coordsChar(cm, x, y) {\n\t\t var doc = cm.doc;\n\t\t y += cm.display.viewOffset;\n\t\t if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) }\n\t\t var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n\t\t if (lineN > last)\n\t\t { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) }\n\t\t if (x < 0) { x = 0; }\n\n\t\t var lineObj = getLine(doc, lineN);\n\t\t for (;;) {\n\t\t var found = coordsCharInner(cm, lineObj, lineN, x, y);\n\t\t var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));\n\t\t if (!collapsed) { return found }\n\t\t var rangeEnd = collapsed.find(1);\n\t\t if (rangeEnd.line == lineN) { return rangeEnd }\n\t\t lineObj = getLine(doc, lineN = rangeEnd.line);\n\t\t }\n\t\t }", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n}", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n}", "function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n}", "function distance_to_point(x, y) {\r\n\treturn Math.sqrt(Math.pow(character.real_x - x, 2) + Math.pow(character.real_y - y, 2));\r\n}", "function distance_to_point(x, y) {\n return Math.sqrt(Math.pow(character.real_x - x, 2) + Math.pow(character.real_y - y, 2));\n}", "function _cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n\n if (!preparedMeasure) {\n preparedMeasure = prepareMeasureForLine(cm, lineObj);\n }\n\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n\n if (right) {\n m.left = m.right;\n } else {\n m.right = m.left;\n }\n\n return intoCoordSystem(cm, lineObj, m, context);\n }\n\n var order = getOrder(lineObj, cm.doc.direction),\n ch = pos.ch,\n sticky = pos.sticky;\n\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n\n if (!order) {\n return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\");\n }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos],\n right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert);\n }\n\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n\n if (other != null) {\n val.other = getBidi(ch, other, sticky != \"before\");\n }\n\n return val;\n } // Used to cheaply estimate the coordinates for a position. Used for", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n }", "function nearestIndex(xpos) {\r\n var begin = 0;\r\n var fin = g_linedata.length - 1;\r\n var middle;\r\n while (begin < fin) {\r\n middle = Math.floor((begin + fin) / 2);\r\n if (g_linedata[middle][0] < xpos) begin = middle + 1;\r\n else fin = middle;\r\n }\r\n var nearest = 0;\r\n if (fin != 0) nearest = xpos - g_linedata[fin - 1][0] < g_linedata[fin][0] - xpos ? fin - 1 : fin;\r\n return nearest;\r\n }", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line)\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj) }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight)\n if (right) { m.left = m.right; } else { m.right = m.left }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length\n sticky = \"before\"\n } else if (ch <= 0) {\n ch = 0\n sticky = \"after\"\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = (part.level % 2) != 0\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky)\n var other = bidiOther\n var val = getBidi(ch, partPos, sticky == \"before\")\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\") }\n return val\n}", "function findNearestGridlineValue(position) {\n\tif ((position % gridlineSpacing) > gridlineSpacing / 2) {\n\t\treturn position - (position % gridlineSpacing) + gridlineSpacing\n\t} else {\n\t\treturn position - (position % gridlineSpacing)\n\t}\n}", "function position(line_r, line_s, point){\n\treturn Math.sign((line_s.x - line_r.x)*(point.y - line_r.y) - (line_s.y - line_r.y)*(point.x - line_r.x));\t\n}", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n}", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n}", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n}", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n}", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n}", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n}", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n}", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n}", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n}", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n}", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = (part.level % 2) != 0;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n}", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\r\n lineObj = lineObj || getLine(cm.doc, pos.line);\r\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\r\n function get(ch, right) {\r\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\r\n if (right) { m.left = m.right; } else { m.right = m.left; }\r\n return intoCoordSystem(cm, lineObj, m, context)\r\n }\r\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\r\n if (ch >= lineObj.text.length) {\r\n ch = lineObj.text.length;\r\n sticky = \"before\";\r\n } else if (ch <= 0) {\r\n ch = 0;\r\n sticky = \"after\";\r\n }\r\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\r\n\r\n function getBidi(ch, partPos, invert) {\r\n var part = order[partPos], right = part.level == 1;\r\n return get(invert ? ch - 1 : ch, right != invert)\r\n }\r\n var partPos = getBidiPartAt(order, ch, sticky);\r\n var other = bidiOther;\r\n var val = getBidi(ch, partPos, sticky == \"before\");\r\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\r\n return val\r\n}", "function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n\t\t lineObj = lineObj || getLine(cm.doc, pos.line);\n\t\t if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n\t\t function get(ch, right) {\n\t\t var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n\t\t if (right) { m.left = m.right; } else { m.right = m.left; }\n\t\t return intoCoordSystem(cm, lineObj, m, context)\n\t\t }\n\t\t var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n\t\t if (ch >= lineObj.text.length) {\n\t\t ch = lineObj.text.length;\n\t\t sticky = \"before\";\n\t\t } else if (ch <= 0) {\n\t\t ch = 0;\n\t\t sticky = \"after\";\n\t\t }\n\t\t if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n\t\t function getBidi(ch, partPos, invert) {\n\t\t var part = order[partPos], right = part.level == 1;\n\t\t return get(invert ? ch - 1 : ch, right != invert)\n\t\t }\n\t\t var partPos = getBidiPartAt(order, ch, sticky);\n\t\t var other = bidiOther;\n\t\t var val = getBidi(ch, partPos, sticky == \"before\");\n\t\t if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n\t\t return val\n\t\t }", "function cmpClosest(a, b, c) {\n var ret = a.line - c.line\n if (ret) { return ret; }\n if (a.ch <= c.ch && c.ch <= b.ch) { return 0; }\n if (Math.abs(a.ch - c.ch) < Math.abs(b.ch - c.ch)) { return a.ch - c.ch; }\n return b.ch - c.ch;\n }", "function estimateCoords(cm, pos) {\n var left = 0;\n pos = clipPos(cm.doc, pos);\n if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; }\n var lineObj = getLine(cm.doc, pos.line);\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\n return {left: left, right: left, top: top, bottom: top + lineObj.height}\n }", "function estimateCoords(cm, pos) {\n var left = 0;\n pos = clipPos(cm.doc, pos);\n if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; }\n var lineObj = getLine(cm.doc, pos.line);\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\n return {left: left, right: left, top: top, bottom: top + lineObj.height}\n }", "function estimateCoords(cm, pos) {\n var left = 0;\n pos = clipPos(cm.doc, pos);\n if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; }\n var lineObj = getLine(cm.doc, pos.line);\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\n return {left: left, right: left, top: top, bottom: top + lineObj.height}\n }" ]
[ "0.71382034", "0.6260421", "0.6260421", "0.6260421", "0.6260421", "0.62046796", "0.62046796", "0.62046796", "0.62046796", "0.62046796", "0.62046796", "0.62046796", "0.62046796", "0.61931807", "0.61761427", "0.6175584", "0.6170042", "0.6170042", "0.6162834", "0.6151725", "0.61306554", "0.61191237", "0.6119019", "0.6119019", "0.6119019", "0.6098747", "0.6098747", "0.6098747", "0.6097881", "0.6097881", "0.6097881", "0.6097881", "0.6097881", "0.6097881", "0.6097881", "0.6097881", "0.6097463", "0.6084693", "0.60501575", "0.6032924", "0.6032924", "0.6032924", "0.6032924", "0.6032924", "0.6030617", "0.5994098", "0.5994098", "0.5994098", "0.5936549", "0.5924828", "0.59245765", "0.5903338", "0.5903338", "0.5903338", "0.5903338", "0.5903338", "0.5903338", "0.5903338", "0.5903338", "0.5903338", "0.5903338", "0.5903338", "0.5903338", "0.5903338", "0.5903338", "0.5903338", "0.5903338", "0.5903338", "0.58937496", "0.5873283", "0.58621234", "0.58590347", "0.58515716", "0.58515716", "0.58515716", "0.58515716", "0.58515716", "0.58515716", "0.58515716", "0.58515716", "0.58515716", "0.58515716", "0.585078", "0.5808877", "0.5803279", "0.5795654", "0.5731409", "0.5731409", "0.5731409" ]
0.60480213
48
Returns true if the given side of a box is after the given coordinates, in toptobottom, lefttoright order.
function boxIsAfter(box, x, y, left) { return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function boxIsAfter(box, x, y, left) {\n\t\t return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x\n\t\t }", "function boxIsAfter(box, x, y, left) {\n return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x;\n }", "function boxIsAfter(box, x, y, left) {\n return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x\n}", "function boxIsAfter(box, x, y, left) {\n return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x\n}", "function boxIsAfter(box, x, y, left) {\n return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x\n}", "function boxIsAfter(box, x, y, left) {\n return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x\n}", "function boxIsAfter(box, x, y, left) {\n return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x\n}", "function boxIsAfter(box, x, y, left) {\n return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x\n}", "function boxIsAfter(box, x, y, left) {\n return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x\n}", "function boxIsAfter(box, x, y, left) {\n return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x\n}", "function boxIsAfter(box, x, y, left) {\n return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x\n}", "function boxIsAfter(box, x, y, left) {\n return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x\n}", "function boxIsAfter(box, x, y, left) {\r\n return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x\r\n}", "isAfter(point, another) {\n return Point.compare(point, another) === 1;\n }", "isAfter(point, another) {\n return Point.compare(point, another) === 1;\n }", "contains(aPoint)\n {\n let top = new Point()\n\t top.setPoint(this.x + this.size / 2, this.y)\n let right = new Point()\n\t right.setPoint(this.x + this.size, this.y + this.size / 2)\n let bottom = new Point()\n\t bottom.setPoint(this.x + this.size / 2, this.y + this.size)\n let left = new Point()\n\t left.setPoint(this.x, this.y + this.size / 2)\n\n return this.toRightOf(top, right, aPoint)\n && this.toRightOf(right, bottom, aPoint)\n && this.toRightOf(bottom, left, aPoint)\n && this.toRightOf(left, top, aPoint)\n }", "contains(x, y) {\n return x > this.left && x < this.right && y > this.top && y < this.bot;\n }", "inBoundary(mouseCoordinates){\n if (this.x <= mouseCoordinates.x && this.y<=mouseCoordinates.y) {\n const boxEdgeX = this.x + this.width;\n const boxEdgeY = this.y + this.height;\n if (mouseCoordinates.x <= boxEdgeX && mouseCoordinates.y <= boxEdgeY) {\n return true;\n }\n }\n return false;\n }", "collidedBy(obj) {\n if (obj.left > this.right ||\n obj.top > this.bottom ||\n obj.right < this.left ||\n obj.bottom < this.top)\n return false;\n \n return true;\n }", "function is_at_edge(pos) {\n var board = get_board();\n\n if (pos.x > (board.length-1) || pos.x < 0 ||\n pos.y > (board[0].length-1) || pos.y < 0) {\n return true;\n }\n return false;\n}", "contains(x, y) {\n return x < this.right && x > this.left && y < this.bottom && y > this.top;\n }", "inside(x, y) {\n let box = this.bbox();\n return x > box.x && y > box.y && x < box.x + box.width && y < box.y + box.height;\n }", "function _inBox(point,box) {\n return box && point[0] >= box[0][0] && point[0] <= box[1][0] && point[1] >= box[0][1] && point[1] <= box[1][1];\n }", "function in_box(x, y, box) {\n return x >= box.x && x <= box.x + box.w && y >= box.y && y <= box.y + box.h;\n }", "function isRectAOutsideRectB(a, b) {\n if (a.left > b.left + b.width) return true; // to the right\n if (a.left + a.width < b.left) return true; // to the left\n if (a.top > b.top + b.height) return true; // below\n if (a.top + a.height < b.top) return true; // above\n return false;\n }", "function inRect(x, y, left, top, right, bottom) {\n\t\tif ((x > left) && (x < right) && (y > top) && (y < bottom)) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "function check_top_left_bottom_right(row, col, color) {\n let count = 1\n let temp_row = row\n let temp_col = col\n while (row > 0 && col > 0) {\n let $next_cell = get_cell(--row, --col)\n if ($next_cell.css('backgroundColor') == color) {\n count += 1\n }\n else {\n break\n }\n }\n row = temp_row\n col = temp_col\n while (row < that.row && col < that.col) {\n let $up_cell = get_cell(++row, ++col)\n if ($up_cell.css('backgroundColor') == color) {\n count += 1\n }\n else {\n break\n }\n }\n if (count >= 4) {\n return true\n }\n return false\n }", "overlaps(box) {\n return (this.x < box.x + box.w) && (this.x + this.w > box.x)\n && (this.y < box.y + box.h) && (this.y + this.h > box.y);\n }", "function isAtRight() {\n\t\treturn current.some((index) => (currentPosition + index + 1) % width === 0);\n\t}", "function isNodeAfter(node1, node2) {\n return !!(node1 &&\n node2 &&\n (node2.compareDocumentPosition(node1) & 4 /* Following */) ==\n 4 /* Following */);\n}", "function inBorder(position){\n return position.x>=0 && position.y >=0 && position.x < COLS && position.y < ROWS;\n}", "isMoveStraight(args){\n if ((args[0] - args[1] == this.basicMoveObj.y) && (args[2] - args[3] == this.basicMoveObj.x)) {\n return true\n } else {\n return false\n }\n }", "function isAtRight() {\r\n return current.some((index) => (currentPosition + index + 1) % width === 0);\r\n }", "function middleInside( a, b ) {\n\n\t\tlet p = a,\n\t\t\tinside = false;\n\t\tconst px = ( a.x + b.x ) / 2,\n\t\t\tpy = ( a.y + b.y ) / 2;\n\t\tdo {\n\n\t\t\tif ( ( ( p.y > py ) !== ( p.next.y > py ) ) && p.next.y !== p.y &&\n\t\t\t\t\t( px < ( p.next.x - p.x ) * ( py - p.y ) / ( p.next.y - p.y ) + p.x ) )\n\t\t\t\tinside = ! inside;\n\t\t\tp = p.next;\n\n\t\t} while ( p !== a );\n\n\t\treturn inside;\n\n\t}", "function isAtRight() {\r\n return current.some((index) => (currentPosition + index + 1) % width === 0);\r\n}", "function inbox(point_x, point_y, box_x, box_y, box_width, box_height) {\n return (point_x >= box_x && point_x <= box_x + box_width && point_y >= box_y && point_y <= box_y + box_height);\n}", "function biggerThanNeighbors(arr, position) {\n\n if (arr[position] > arr[position - 1] && arr[position] > arr[position + 1]) {\n return true;\n }\n return false;\n}", "function isAtRight() {\r\n return current.some(index => (currentPosition + index + 1) % width === 0)\r\n}", "function hasGreaterBottomGap (hitbox1, hitbox2) {\n const topGap = hitbox2.y + hitbox2.height - hitbox1.y;\n const rightGap = hitbox1.x + hitbox1.width - hitbox2.x;\n const bottomGap = hitbox1.y + hitbox1.height - hitbox2.y;\n const leftGap = hitbox2.x + hitbox2.width - hitbox1.x;\n\n return bottomGap > topGap && bottomGap > rightGap && bottomGap > leftGap;\n}", "function ShouldSnap(hitbox_before, hitbox_after, hitbox_obj)\n{\n var upper_before = hitbox_before[0];\n var bottom_before = hitbox_before[1];\n\n var upper_after = hitbox_after[0];\n var bottom_after = hitbox_after[1];\n\n var upper_obj = hitbox_obj[0];\n var bottom_obj = hitbox_obj[1];\n\n var eq_thres = 0.0001;\n var y_eq1 = Math.abs(bottom_before[1] - upper_obj[1]) <= 0.0001;\n var y_eq2 = Math.abs(bottom_after[1] - upper_obj[1]) <= 0.0001;\n\n // First determine if original y is above\n if((bottom_before[1] > upper_obj[1] || y_eq1) && (bottom_after[1] < upper_obj[1] || y_eq2))\n {\n // Then ensure that the x's line up\n if(upper_after[0] <= bottom_obj[0] && bottom_after[0] >= upper_obj[0])\n {\n return true;\n }\n }\n\n return false;\n}", "function onTopOf(obj) {\n\t\treturn (!(this.x + this.boundingBox.left >= obj.x + obj.boundingBox.right ||\n\t\t\tthis.x + this.boundingBox.right <= obj.x + obj.boundingBox.left) &&\n\t\tthis.y + this.boundingBox.bottom === obj.y + obj.boundingBox.top);\n\t}", "playerIsOutSideOfContainer(nextTop, nextLeft) {\n let isOutSide = false;\n if (nextTop > 340 || nextTop < 10 || nextLeft > 550 || nextLeft < 10) {\n isOutSide = true;\n }\n return isOutSide;\n }", "function pa(e,t,a,n){return!(e.bottom<=a)&&(e.top>a||(n?e.left:e.right)>t)}", "function middleInside( a, b ) {\n\n\tlet p = a,\n\t\tinside = false;\n\tconst px = ( a.x + b.x ) / 2,\n\t\tpy = ( a.y + b.y ) / 2;\n\tdo {\n\n\t\tif ( ( ( p.y > py ) !== ( p.next.y > py ) ) && p.next.y !== p.y &&\n\t\t\t( px < ( p.next.x - p.x ) * ( py - p.y ) / ( p.next.y - p.y ) + p.x ) )\n\t\t\tinside = ! inside;\n\t\tp = p.next;\n\n\t} while ( p !== a );\n\n\treturn inside;\n\n}", "static middleInside(a, b) {\n var p = a, inside = false, px = (a.x + b.x) / 2, py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&\n (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x)) {\n inside = !inside;\n }\n p = p.next;\n } while (p !== a);\n return inside;\n }", "contains(point) {\n if(!point) return false;\n // Iterate over _edges_\n let windingNumber = 0;\n for(let i = 0; i < this.vertices.length; ++i) {\n const start = this.vertices[i];\n const end = this.vertices[i + 1] || this.vertices[0];\n const edge = new Edge(start, end);\n\n if(edge.crosses(point.y)) {\n if(edge.isLeftOf(point)) {\n // Downward edge\n windingNumber++;\n } else {\n // Upward edge\n windingNumber--;\n }\n }\n }\n\n return windingNumber > 0;\n }", "contains(x, y) {\n let coords = this.getBoundingBox();\n return (x > coords.x && x < coords.x+coords.width && y > coords.y && y < coords.y+coords.height);\n }", "function middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&\n (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}", "function middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&\n (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}", "function middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&\n (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}", "function middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&\n (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}", "function middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&\n (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}", "function middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&\n (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}", "function middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&\n (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}", "function middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&\n (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}", "function middleInside(a, b) {\n\t var p = a,\n\t inside = false,\n\t px = (a.x + b.x) / 2,\n\t py = (a.y + b.y) / 2;\n\t do {\n\t if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&\n\t (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n\t { inside = !inside; }\n\t p = p.next;\n\t } while (p !== a);\n\n\t return inside;\n\t}", "checkBorders(nextLeft, nextTop) {\n const gameContainer = this.getContainerSize();\n const playerSize = this.getPlayerSize();\n\n if (\n !(nextLeft < 0) &&\n !(nextTop < 0) &&\n !(nextLeft > gameContainer.width - playerSize.width) &&\n !(nextTop > gameContainer.height - playerSize.height)\n ) {\n return true;\n } else return false;\n }", "function middleInside(a, b) {\n\t var p = a,\n\t inside = false,\n\t px = (a.x + b.x) / 2,\n\t py = (a.y + b.y) / 2;\n\t do {\n\t if (((p.y > py) !== (p.next.y > py)) && (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n\t inside = !inside;\n\t p = p.next;\n\t } while (p !== a);\n\n\t return inside;\n\t}", "function middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}", "function middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}", "function middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}", "function middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}", "function middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}", "function middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}", "function middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}", "function middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}", "function middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}", "function middleInside(a, b) {\n\t var p = a,\n\t inside = false,\n\t px = (a.x + b.x) / 2,\n\t py = (a.y + b.y) / 2;\n\t do {\n\t if (((p.y > py) !== (p.next.y > py)) && (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n\t inside = !inside;\n\t p = p.next;\n\t } while (p !== a);\n\t\n\t return inside;\n\t}", "function middleInside(a, b) {\n\t var p = a,\n\t inside = false,\n\t px = (a.x + b.x) / 2,\n\t py = (a.y + b.y) / 2;\n\t do {\n\t if (((p.y > py) !== (p.next.y > py)) && (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n\t inside = !inside;\n\t p = p.next;\n\t } while (p !== a);\n\t\n\t return inside;\n\t}", "function middleInside(a, b) {\n\t var p = a,\n\t inside = false,\n\t px = (a.x + b.x) / 2,\n\t py = (a.y + b.y) / 2;\n\t do {\n\t if (((p.y > py) !== (p.next.y > py)) && (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n\t inside = !inside;\n\t p = p.next;\n\t } while (p !== a);\n\t\n\t return inside;\n\t}", "moveEdge() {\n switch(this.pos.x) {\n\t\t\tcase 0: \n\t\t\t\tthis.liveObj.move(RIGHT);\n\t\t\t\treturn true;\n\t\t\tcase 49: \n\t\t\t\tthis.liveObj.move(LEFT);\n\t\t\t\treturn true;\n\t\t}\n\t\tswitch(this.pos.y) {\n\t\t\tcase 0:\n\t\t\t\tthis.liveObj.move(BOTTOM);\n\t\t\t\treturn true;\n\t\t\tcase 49: \n\t\t\t\tthis.liveObj.move(TOP);\n\t\t\t\treturn true;\n\t\t}\n\n return false;\n }", "function middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}", "isOutside(tetroSquare) {\n // If x index is too left or right.\n if (tetroSquare.xIndex < 0 || tetroSquare.xIndex > SQUARES_IN_WIDTH - 1) {\n return true;\n }\n\n // Note it doesn't check the case that y index is too large, which might be a valid case.\n if (tetroSquare.yIndex < 0) {\n return true;\n }\n\n return false;\n }", "upright () {\n return this.content.height <= this.height &&\n this.content.width > this.width\n }", "function middleInside( a, b ) {\n\n\t\tvar p = a,\n\t\t\tinside = false,\n\t\t\tpx = ( a.x + b.x ) / 2,\n\t\t\tpy = ( a.y + b.y ) / 2;\n\n\t\tdo {\n\n\t\t\tif ( ( ( p.y > py ) !== ( p.next.y > py ) ) && p.next.y !== p.y &&\n\t\t\t\t\t\t\t( px < ( p.next.x - p.x ) * ( py - p.y ) / ( p.next.y - p.y ) + p.x ) ) {\n\n\t\t\t\tinside = ! inside;\n\n\t\t\t}\n\n\t\t\tp = p.next;\n\n\t\t} while ( p !== a );\n\n\t\treturn inside;\n\n\t}", "function middleInside( a, b ) {\n\n\t\tvar p = a,\n\t\t\tinside = false,\n\t\t\tpx = ( a.x + b.x ) / 2,\n\t\t\tpy = ( a.y + b.y ) / 2;\n\n\t\tdo {\n\n\t\t\tif ( ( ( p.y > py ) !== ( p.next.y > py ) ) && p.next.y !== p.y &&\n\t\t\t\t\t\t\t( px < ( p.next.x - p.x ) * ( py - p.y ) / ( p.next.y - p.y ) + p.x ) ) {\n\n\t\t\t\tinside = ! inside;\n\n\t\t\t}\n\n\t\t\tp = p.next;\n\n\t\t} while ( p !== a );\n\n\t\treturn inside;\n\n\t}", "function middleInside( a, b ) {\n\n\t\tvar p = a,\n\t\t\tinside = false,\n\t\t\tpx = ( a.x + b.x ) / 2,\n\t\t\tpy = ( a.y + b.y ) / 2;\n\n\t\tdo {\n\n\t\t\tif ( ( ( p.y > py ) !== ( p.next.y > py ) ) && p.next.y !== p.y &&\n\t\t\t\t\t\t\t( px < ( p.next.x - p.x ) * ( py - p.y ) / ( p.next.y - p.y ) + p.x ) ) {\n\n\t\t\t\tinside = ! inside;\n\n\t\t\t}\n\n\t\t\tp = p.next;\n\n\t\t} while ( p !== a );\n\n\t\treturn inside;\n\n\t}", "isEnd(editor, point, at) {\n var end = Editor.end(editor, at);\n return Point.equals(point, end);\n }", "isEnd(editor, point, at) {\n var end = Editor.end(editor, at);\n return Point.equals(point, end);\n }", "function isInRightColumn(location){\r\n return location%BOARDWIDTH === BOARDWIDTH - 1;\r\n}", "function isOver(box, point) {\n return point.x < box.min.x || point.x > box.max.x ||\n point.y < box.max.y || // controllo che la y del point (dito) sia maggiore di quella della figura\n point.z < box.min.z || point.z > box.max.z ? false : true;\n}", "function check_top_right_bottom_left(row, col, color) {\n let count = 1\n let temp_row = row\n let temp_col = col\n while (row < that.row && col > 0) {\n let $next_cell = get_cell(++row, --col)\n if ($next_cell.css('backgroundColor') == color) {\n count += 1\n }\n else {\n break\n }\n }\n row = temp_row\n col = temp_col\n while (row > 0 && col < that.col) {\n let $up_cell = get_cell(--row, ++col)\n if ($up_cell.css('backgroundColor') == color) {\n count += 1\n }\n else {\n break\n }\n }\n if (count >= 4) {\n return true\n }\n return false\n }", "function checkArea(e, state) {\n var $handle = $(state.handle);\n var offset = $handle.offset();\n var width = $handle.outerWidth();\n var height = $handle.outerHeight();\n var t = e.pageY - offset.top;\n var r = offset.left + width - e.pageX;\n var b = offset.top + height - e.pageY;\n var l = e.pageX - offset.left;\n\n return Math.min(t, r, b, l) > state.options.edge;\n }", "function simpleColCheck(shapeA, shapeB){\n\tif(shapeA.x > shapeB.x+shapeB.width){ // Too far to the right\n\t\treturn false;\n\t}\n\tif(shapeA.y > shapeB.y+shapeB.height){ // Is above it\n\t\treturn false;\n\t}\n\tif(shapeA.x+shapeA.width < shapeB.x){ // Too far to the left\n\t\treturn false;\n\t}\n\tif(shapeA.y+shapeA.height < shapeB.y){ // Is below it\n\t\treturn false;\n\t}\n\treturn true;\n}" ]
[ "0.80230653", "0.7990573", "0.7967614", "0.7967614", "0.7967614", "0.7967614", "0.7967614", "0.7967614", "0.7967614", "0.7967614", "0.7967614", "0.7967614", "0.79146224", "0.62625074", "0.62625074", "0.6129979", "0.605716", "0.5878628", "0.5862407", "0.5801529", "0.57982314", "0.57153076", "0.56941473", "0.56886363", "0.5629706", "0.5626294", "0.5583726", "0.55605805", "0.555572", "0.55455184", "0.55436826", "0.5521186", "0.55135405", "0.5463547", "0.54559904", "0.54521024", "0.5448115", "0.5444718", "0.5439825", "0.54296935", "0.5428763", "0.54158336", "0.5410605", "0.5409528", "0.54082745", "0.53960335", "0.5389116", "0.5386044", "0.5386044", "0.5386044", "0.5386044", "0.5386044", "0.5386044", "0.5386044", "0.5386044", "0.5379403", "0.5377086", "0.53723973", "0.5371481", "0.5371481", "0.5371481", "0.5371481", "0.5371481", "0.5371481", "0.5371481", "0.5371481", "0.5371481", "0.53705525", "0.53705525", "0.53705525", "0.5366654", "0.53634125", "0.5356821", "0.53491986", "0.53428084", "0.53428084", "0.53428084", "0.53418916", "0.53418916", "0.5338072", "0.5337422", "0.5334087", "0.5333807", "0.5331108" ]
0.8012587
12
Compute the default text height.
function textHeight(display) { if (display.cachedTextHeight != null) { return display.cachedTextHeight } if (measureText == null) { measureText = elt("pre", null, "CodeMirror-line-like"); // Measure a bunch of lines, for browsers that compute // fractional heights. for (var i = 0; i < 49; ++i) { measureText.appendChild(document.createTextNode("x")); measureText.appendChild(elt("br")); } measureText.appendChild(document.createTextNode("x")); } removeChildrenAndAdd(display.measure, measureText); var height = measureText.offsetHeight / 50; if (height > 3) { display.cachedTextHeight = height; } removeChildren(display.measure); return height || 1 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function textHeight(display) {\n if (display.cachedTextHeight != null) {\n return display.cachedTextHeight;\n }\n\n if (measureText == null) {\n measureText = elt(\"pre\", null, \"CodeMirror-line-like\"); // Measure a bunch of lines, for browsers that compute\n // fractional heights.\n\n for (var i = 0; i < 49; ++i) {\n measureText.appendChild(document.createTextNode(\"x\"));\n measureText.appendChild(elt(\"br\"));\n }\n\n measureText.appendChild(document.createTextNode(\"x\"));\n }\n\n removeChildrenAndAdd(display.measure, measureText);\n var height = measureText.offsetHeight / 50;\n\n if (height > 3) {\n display.cachedTextHeight = height;\n }\n\n removeChildren(display.measure);\n return height || 1;\n } // Compute the default character width.", "get defaultLineHeight() { return this.viewState.heightOracle.lineHeight; }", "function getHeight() {\n\tvar height = document.getElementById(\"clientText\").clientHeight - PADDING_PX;\n\theight = height * PX_TO_INCH * INCH_TO_METER * METER_TO_CM;\n\treturn height.toFixed(2);\n}", "fontHeight () {\n return this.koofScreenY > 0 ? 16 * this.koofScreenY : 16;\n }", "function textHeight(display) {\n\t\t if (display.cachedTextHeight != null) { return display.cachedTextHeight }\n\t\t if (measureText == null) {\n\t\t measureText = elt(\"pre\", null, \"CodeMirror-line-like\");\n\t\t // Measure a bunch of lines, for browsers that compute\n\t\t // fractional heights.\n\t\t for (var i = 0; i < 49; ++i) {\n\t\t measureText.appendChild(document.createTextNode(\"x\"));\n\t\t measureText.appendChild(elt(\"br\"));\n\t\t }\n\t\t measureText.appendChild(document.createTextNode(\"x\"));\n\t\t }\n\t\t removeChildrenAndAdd(display.measure, measureText);\n\t\t var height = measureText.offsetHeight / 50;\n\t\t if (height > 3) { display.cachedTextHeight = height; }\n\t\t removeChildren(display.measure);\n\t\t return height || 1\n\t\t }", "function textHeight(display) {\n if (display.cachedTextHeight != null) { return display.cachedTextHeight }\n if (measureText == null) {\n measureText = elt(\"pre\");\n // Measure a bunch of lines, for browsers that compute\n // fractional heights.\n for (var i = 0; i < 49; ++i) {\n measureText.appendChild(document.createTextNode(\"x\"));\n measureText.appendChild(elt(\"br\"));\n }\n measureText.appendChild(document.createTextNode(\"x\"));\n }\n removeChildrenAndAdd(display.measure, measureText);\n var height = measureText.offsetHeight / 50;\n if (height > 3) { display.cachedTextHeight = height; }\n removeChildren(display.measure);\n return height || 1\n }", "function textHeight(display) {\n if (display.cachedTextHeight != null) { return display.cachedTextHeight }\n if (measureText == null) {\n measureText = elt(\"pre\");\n // Measure a bunch of lines, for browsers that compute\n // fractional heights.\n for (var i = 0; i < 49; ++i) {\n measureText.appendChild(document.createTextNode(\"x\"));\n measureText.appendChild(elt(\"br\"));\n }\n measureText.appendChild(document.createTextNode(\"x\"));\n }\n removeChildrenAndAdd(display.measure, measureText);\n var height = measureText.offsetHeight / 50;\n if (height > 3) { display.cachedTextHeight = height; }\n removeChildren(display.measure);\n return height || 1\n }", "function textHeight(display) {\n if (display.cachedTextHeight != null) { return display.cachedTextHeight }\n if (measureText == null) {\n measureText = elt(\"pre\");\n // Measure a bunch of lines, for browsers that compute\n // fractional heights.\n for (var i = 0; i < 49; ++i) {\n measureText.appendChild(document.createTextNode(\"x\"));\n measureText.appendChild(elt(\"br\"));\n }\n measureText.appendChild(document.createTextNode(\"x\"));\n }\n removeChildrenAndAdd(display.measure, measureText);\n var height = measureText.offsetHeight / 50;\n if (height > 3) { display.cachedTextHeight = height; }\n removeChildren(display.measure);\n return height || 1\n }", "function textHeight(display) {\n if (display.cachedTextHeight != null) { return display.cachedTextHeight }\n if (measureText == null) {\n measureText = elt(\"pre\");\n // Measure a bunch of lines, for browsers that compute\n // fractional heights.\n for (var i = 0; i < 49; ++i) {\n measureText.appendChild(document.createTextNode(\"x\"));\n measureText.appendChild(elt(\"br\"));\n }\n measureText.appendChild(document.createTextNode(\"x\"));\n }\n removeChildrenAndAdd(display.measure, measureText);\n var height = measureText.offsetHeight / 50;\n if (height > 3) { display.cachedTextHeight = height; }\n removeChildren(display.measure);\n return height || 1\n }", "function textHeight(display) {\n if (display.cachedTextHeight != null) { return display.cachedTextHeight }\n if (measureText == null) {\n measureText = elt(\"pre\");\n // Measure a bunch of lines, for browsers that compute\n // fractional heights.\n for (var i = 0; i < 49; ++i) {\n measureText.appendChild(document.createTextNode(\"x\"));\n measureText.appendChild(elt(\"br\"));\n }\n measureText.appendChild(document.createTextNode(\"x\"));\n }\n removeChildrenAndAdd(display.measure, measureText);\n var height = measureText.offsetHeight / 50;\n if (height > 3) { display.cachedTextHeight = height; }\n removeChildren(display.measure);\n return height || 1\n }", "function textHeight(display) {\n if (display.cachedTextHeight != null) return display.cachedTextHeight;\n if (measureText == null) {\n measureText = elt(\"pre\");\n // Measure a bunch of lines, for browsers that compute\n // fractional heights.\n for (var i = 0; i < 49; ++i) {\n measureText.appendChild(document.createTextNode(\"x\"));\n measureText.appendChild(elt(\"br\"));\n }\n measureText.appendChild(document.createTextNode(\"x\"));\n }\n removeChildrenAndAdd(display.measure, measureText);\n var height = measureText.offsetHeight / 50;\n if (height > 3) display.cachedTextHeight = height;\n removeChildren(display.measure);\n return height || 1;\n }", "function textHeight(display) {\n if (display.cachedTextHeight != null) return display.cachedTextHeight;\n if (measureText == null) {\n measureText = elt(\"pre\");\n // Measure a bunch of lines, for browsers that compute\n // fractional heights.\n for (var i = 0; i < 49; ++i) {\n measureText.appendChild(document.createTextNode(\"x\"));\n measureText.appendChild(elt(\"br\"));\n }\n measureText.appendChild(document.createTextNode(\"x\"));\n }\n removeChildrenAndAdd(display.measure, measureText);\n var height = measureText.offsetHeight / 50;\n if (height > 3) display.cachedTextHeight = height;\n removeChildren(display.measure);\n return height || 1;\n }", "function textHeight(display) {\n if (display.cachedTextHeight != null) return display.cachedTextHeight;\n if (measureText == null) {\n measureText = elt(\"pre\");\n // Measure a bunch of lines, for browsers that compute\n // fractional heights.\n for (var i = 0; i < 49; ++i) {\n measureText.appendChild(document.createTextNode(\"x\"));\n measureText.appendChild(elt(\"br\"));\n }\n measureText.appendChild(document.createTextNode(\"x\"));\n }\n removeChildrenAndAdd(display.measure, measureText);\n var height = measureText.offsetHeight / 50;\n if (height > 3) display.cachedTextHeight = height;\n removeChildren(display.measure);\n return height || 1;\n }", "function textHeight(display) {\n if (display.cachedTextHeight != null) return display.cachedTextHeight;\n if (measureText == null) {\n measureText = elt(\"pre\");\n // Measure a bunch of lines, for browsers that compute\n // fractional heights.\n for (var i = 0; i < 49; ++i) {\n measureText.appendChild(document.createTextNode(\"x\"));\n measureText.appendChild(elt(\"br\"));\n }\n measureText.appendChild(document.createTextNode(\"x\"));\n }\n removeChildrenAndAdd(display.measure, measureText);\n var height = measureText.offsetHeight / 50;\n if (height > 3) display.cachedTextHeight = height;\n removeChildren(display.measure);\n return height || 1;\n }", "function textHeight(display) {\n if (display.cachedTextHeight != null) return display.cachedTextHeight;\n if (measureText == null) {\n measureText = elt(\"pre\");\n // Measure a bunch of lines, for browsers that compute\n // fractional heights.\n for (var i = 0; i < 49; ++i) {\n measureText.appendChild(document.createTextNode(\"x\"));\n measureText.appendChild(elt(\"br\"));\n }\n measureText.appendChild(document.createTextNode(\"x\"));\n }\n removeChildrenAndAdd(display.measure, measureText);\n var height = measureText.offsetHeight / 50;\n if (height > 3) display.cachedTextHeight = height;\n removeChildren(display.measure);\n return height || 1;\n }", "function textHeight(display) {\n if (display.cachedTextHeight != null) return display.cachedTextHeight;\n if (measureText == null) {\n measureText = elt(\"pre\");\n // Measure a bunch of lines, for browsers that compute\n // fractional heights.\n for (var i = 0; i < 49; ++i) {\n measureText.appendChild(document.createTextNode(\"x\"));\n measureText.appendChild(elt(\"br\"));\n }\n measureText.appendChild(document.createTextNode(\"x\"));\n }\n removeChildrenAndAdd(display.measure, measureText);\n var height = measureText.offsetHeight / 50;\n if (height > 3) display.cachedTextHeight = height;\n removeChildren(display.measure);\n return height || 1;\n }", "function textHeight(display) {\n if (display.cachedTextHeight != null) return display.cachedTextHeight;\n if (measureText == null) {\n measureText = elt(\"pre\");\n // Measure a bunch of lines, for browsers that compute\n // fractional heights.\n for (var i = 0; i < 49; ++i) {\n measureText.appendChild(document.createTextNode(\"x\"));\n measureText.appendChild(elt(\"br\"));\n }\n measureText.appendChild(document.createTextNode(\"x\"));\n }\n removeChildrenAndAdd(display.measure, measureText);\n var height = measureText.offsetHeight / 50;\n if (height > 3) display.cachedTextHeight = height;\n removeChildren(display.measure);\n return height || 1;\n }", "function textHeight(display) {\n if (display.cachedTextHeight != null) return display.cachedTextHeight;\n if (measureText == null) {\n measureText = elt(\"pre\");\n // Measure a bunch of lines, for browsers that compute\n // fractional heights.\n for (var i = 0; i < 49; ++i) {\n measureText.appendChild(document.createTextNode(\"x\"));\n measureText.appendChild(elt(\"br\"));\n }\n measureText.appendChild(document.createTextNode(\"x\"));\n }\n removeChildrenAndAdd(display.measure, measureText);\n var height = measureText.offsetHeight / 50;\n if (height > 3) display.cachedTextHeight = height;\n removeChildren(display.measure);\n return height || 1;\n }", "max_height() {\n\t\treturn this.rectangle_y_pad + N_WORDS * char_image_dimensions.height + (N_WORDS - 1) * this.height_between_words;\n\t}", "function textHeight(display) {\n\t\t if (display.cachedTextHeight != null) return display.cachedTextHeight;\n\t\t if (measureText == null) {\n\t\t measureText = elt(\"pre\");\n\t\t // Measure a bunch of lines, for browsers that compute\n\t\t // fractional heights.\n\t\t for (var i = 0; i < 49; ++i) {\n\t\t measureText.appendChild(document.createTextNode(\"x\"));\n\t\t measureText.appendChild(elt(\"br\"));\n\t\t }\n\t\t measureText.appendChild(document.createTextNode(\"x\"));\n\t\t }\n\t\t removeChildrenAndAdd(display.measure, measureText);\n\t\t var height = measureText.offsetHeight / 50;\n\t\t if (height > 3) display.cachedTextHeight = height;\n\t\t removeChildren(display.measure);\n\t\t return height || 1;\n\t\t }", "function textHeight(display) {\r\n if (display.cachedTextHeight != null) return display.cachedTextHeight;\r\n if (measureText == null) {\r\n measureText = elt(\"pre\");\r\n // Measure a bunch of lines, for browsers that compute\r\n // fractional heights.\r\n for (var i = 0; i < 49; ++i) {\r\n measureText.appendChild(document.createTextNode(\"x\"));\r\n measureText.appendChild(elt(\"br\"));\r\n }\r\n measureText.appendChild(document.createTextNode(\"x\"));\r\n }\r\n removeChildrenAndAdd(display.measure, measureText);\r\n var height = measureText.offsetHeight / 50;\r\n if (height > 3) display.cachedTextHeight = height;\r\n removeChildren(display.measure);\r\n return height || 1;\r\n }", "function textHeight(display) {\n\t if (display.cachedTextHeight != null) return display.cachedTextHeight;\n\t if (measureText == null) {\n\t measureText = elt(\"pre\");\n\t // Measure a bunch of lines, for browsers that compute\n\t // fractional heights.\n\t for (var i = 0; i < 49; ++i) {\n\t measureText.appendChild(document.createTextNode(\"x\"));\n\t measureText.appendChild(elt(\"br\"));\n\t }\n\t measureText.appendChild(document.createTextNode(\"x\"));\n\t }\n\t removeChildrenAndAdd(display.measure, measureText);\n\t var height = measureText.offsetHeight / 50;\n\t if (height > 3) display.cachedTextHeight = height;\n\t removeChildren(display.measure);\n\t return height || 1;\n\t }", "function textHeight(display) {\n\t if (display.cachedTextHeight != null) return display.cachedTextHeight;\n\t if (measureText == null) {\n\t measureText = elt(\"pre\");\n\t // Measure a bunch of lines, for browsers that compute\n\t // fractional heights.\n\t for (var i = 0; i < 49; ++i) {\n\t measureText.appendChild(document.createTextNode(\"x\"));\n\t measureText.appendChild(elt(\"br\"));\n\t }\n\t measureText.appendChild(document.createTextNode(\"x\"));\n\t }\n\t removeChildrenAndAdd(display.measure, measureText);\n\t var height = measureText.offsetHeight / 50;\n\t if (height > 3) display.cachedTextHeight = height;\n\t removeChildren(display.measure);\n\t return height || 1;\n\t }", "function textHeight(display) {\n\t if (display.cachedTextHeight != null) return display.cachedTextHeight;\n\t if (measureText == null) {\n\t measureText = elt(\"pre\");\n\t // Measure a bunch of lines, for browsers that compute\n\t // fractional heights.\n\t for (var i = 0; i < 49; ++i) {\n\t measureText.appendChild(document.createTextNode(\"x\"));\n\t measureText.appendChild(elt(\"br\"));\n\t }\n\t measureText.appendChild(document.createTextNode(\"x\"));\n\t }\n\t removeChildrenAndAdd(display.measure, measureText);\n\t var height = measureText.offsetHeight / 50;\n\t if (height > 3) display.cachedTextHeight = height;\n\t removeChildren(display.measure);\n\t return height || 1;\n\t }", "function textHeight(display) {\n if (display.cachedTextHeight != null) { return display.cachedTextHeight }\n if (measureText == null) {\n measureText = elt(\"pre\")\n // Measure a bunch of lines, for browsers that compute\n // fractional heights.\n for (var i = 0; i < 49; ++i) {\n measureText.appendChild(document.createTextNode(\"x\"))\n measureText.appendChild(elt(\"br\"))\n }\n measureText.appendChild(document.createTextNode(\"x\"))\n }\n removeChildrenAndAdd(display.measure, measureText)\n var height = measureText.offsetHeight / 50\n if (height > 3) { display.cachedTextHeight = height }\n removeChildren(display.measure)\n return height || 1\n}", "function textHeight(display) {\n if (display.cachedTextHeight != null) { return display.cachedTextHeight }\n if (measureText == null) {\n measureText = elt(\"pre\")\n // Measure a bunch of lines, for browsers that compute\n // fractional heights.\n for (var i = 0; i < 49; ++i) {\n measureText.appendChild(document.createTextNode(\"x\"))\n measureText.appendChild(elt(\"br\"))\n }\n measureText.appendChild(document.createTextNode(\"x\"))\n }\n removeChildrenAndAdd(display.measure, measureText)\n var height = measureText.offsetHeight / 50\n if (height > 3) { display.cachedTextHeight = height }\n removeChildren(display.measure)\n return height || 1\n}", "function textHeight(display) {\r\n if (display.cachedTextHeight != null) { return display.cachedTextHeight }\r\n if (measureText == null) {\r\n measureText = elt(\"pre\");\r\n // Measure a bunch of lines, for browsers that compute\r\n // fractional heights.\r\n for (var i = 0; i < 49; ++i) {\r\n measureText.appendChild(document.createTextNode(\"x\"));\r\n measureText.appendChild(elt(\"br\"));\r\n }\r\n measureText.appendChild(document.createTextNode(\"x\"));\r\n }\r\n removeChildrenAndAdd(display.measure, measureText);\r\n var height = measureText.offsetHeight / 50;\r\n if (height > 3) { display.cachedTextHeight = height; }\r\n removeChildren(display.measure);\r\n return height || 1\r\n}", "function textHeight(display) {\n if (display.cachedTextHeight != null) { return display.cachedTextHeight }\n if (measureText == null) {\n measureText = elt(\"pre\");\n // Measure a bunch of lines, for browsers that compute\n // fractional heights.\n for (var i = 0; i < 49; ++i) {\n measureText.appendChild(document.createTextNode(\"x\"));\n measureText.appendChild(elt(\"br\"));\n }\n measureText.appendChild(document.createTextNode(\"x\"));\n }\n removeChildrenAndAdd(display.measure, measureText);\n var height = measureText.offsetHeight / 50;\n if (height > 3) { display.cachedTextHeight = height; }\n removeChildren(display.measure);\n return height || 1\n}", "function textHeight(display) {\n if (display.cachedTextHeight != null) { return display.cachedTextHeight }\n if (measureText == null) {\n measureText = elt(\"pre\");\n // Measure a bunch of lines, for browsers that compute\n // fractional heights.\n for (var i = 0; i < 49; ++i) {\n measureText.appendChild(document.createTextNode(\"x\"));\n measureText.appendChild(elt(\"br\"));\n }\n measureText.appendChild(document.createTextNode(\"x\"));\n }\n removeChildrenAndAdd(display.measure, measureText);\n var height = measureText.offsetHeight / 50;\n if (height > 3) { display.cachedTextHeight = height; }\n removeChildren(display.measure);\n return height || 1\n}", "function textHeight(display) {\n if (display.cachedTextHeight != null) { return display.cachedTextHeight }\n if (measureText == null) {\n measureText = elt(\"pre\");\n // Measure a bunch of lines, for browsers that compute\n // fractional heights.\n for (var i = 0; i < 49; ++i) {\n measureText.appendChild(document.createTextNode(\"x\"));\n measureText.appendChild(elt(\"br\"));\n }\n measureText.appendChild(document.createTextNode(\"x\"));\n }\n removeChildrenAndAdd(display.measure, measureText);\n var height = measureText.offsetHeight / 50;\n if (height > 3) { display.cachedTextHeight = height; }\n removeChildren(display.measure);\n return height || 1\n}", "function textHeight(display) {\n if (display.cachedTextHeight != null) { return display.cachedTextHeight }\n if (measureText == null) {\n measureText = elt(\"pre\");\n // Measure a bunch of lines, for browsers that compute\n // fractional heights.\n for (var i = 0; i < 49; ++i) {\n measureText.appendChild(document.createTextNode(\"x\"));\n measureText.appendChild(elt(\"br\"));\n }\n measureText.appendChild(document.createTextNode(\"x\"));\n }\n removeChildrenAndAdd(display.measure, measureText);\n var height = measureText.offsetHeight / 50;\n if (height > 3) { display.cachedTextHeight = height; }\n removeChildren(display.measure);\n return height || 1\n}", "function textHeight(display) {\n if (display.cachedTextHeight != null) { return display.cachedTextHeight }\n if (measureText == null) {\n measureText = elt(\"pre\");\n // Measure a bunch of lines, for browsers that compute\n // fractional heights.\n for (var i = 0; i < 49; ++i) {\n measureText.appendChild(document.createTextNode(\"x\"));\n measureText.appendChild(elt(\"br\"));\n }\n measureText.appendChild(document.createTextNode(\"x\"));\n }\n removeChildrenAndAdd(display.measure, measureText);\n var height = measureText.offsetHeight / 50;\n if (height > 3) { display.cachedTextHeight = height; }\n removeChildren(display.measure);\n return height || 1\n}", "function textHeight(display) {\n if (display.cachedTextHeight != null) { return display.cachedTextHeight }\n if (measureText == null) {\n measureText = elt(\"pre\");\n // Measure a bunch of lines, for browsers that compute\n // fractional heights.\n for (var i = 0; i < 49; ++i) {\n measureText.appendChild(document.createTextNode(\"x\"));\n measureText.appendChild(elt(\"br\"));\n }\n measureText.appendChild(document.createTextNode(\"x\"));\n }\n removeChildrenAndAdd(display.measure, measureText);\n var height = measureText.offsetHeight / 50;\n if (height > 3) { display.cachedTextHeight = height; }\n removeChildren(display.measure);\n return height || 1\n}", "function textHeight(display) {\n if (display.cachedTextHeight != null) { return display.cachedTextHeight }\n if (measureText == null) {\n measureText = elt(\"pre\");\n // Measure a bunch of lines, for browsers that compute\n // fractional heights.\n for (var i = 0; i < 49; ++i) {\n measureText.appendChild(document.createTextNode(\"x\"));\n measureText.appendChild(elt(\"br\"));\n }\n measureText.appendChild(document.createTextNode(\"x\"));\n }\n removeChildrenAndAdd(display.measure, measureText);\n var height = measureText.offsetHeight / 50;\n if (height > 3) { display.cachedTextHeight = height; }\n removeChildren(display.measure);\n return height || 1\n}", "function textHeight(display) {\n if (display.cachedTextHeight != null) { return display.cachedTextHeight }\n if (measureText == null) {\n measureText = elt(\"pre\");\n // Measure a bunch of lines, for browsers that compute\n // fractional heights.\n for (var i = 0; i < 49; ++i) {\n measureText.appendChild(document.createTextNode(\"x\"));\n measureText.appendChild(elt(\"br\"));\n }\n measureText.appendChild(document.createTextNode(\"x\"));\n }\n removeChildrenAndAdd(display.measure, measureText);\n var height = measureText.offsetHeight / 50;\n if (height > 3) { display.cachedTextHeight = height; }\n removeChildren(display.measure);\n return height || 1\n}", "function textHeight(display) {\n if (display.cachedTextHeight != null) { return display.cachedTextHeight }\n if (measureText == null) {\n measureText = elt(\"pre\");\n // Measure a bunch of lines, for browsers that compute\n // fractional heights.\n for (var i = 0; i < 49; ++i) {\n measureText.appendChild(document.createTextNode(\"x\"));\n measureText.appendChild(elt(\"br\"));\n }\n measureText.appendChild(document.createTextNode(\"x\"));\n }\n removeChildrenAndAdd(display.measure, measureText);\n var height = measureText.offsetHeight / 50;\n if (height > 3) { display.cachedTextHeight = height; }\n removeChildren(display.measure);\n return height || 1\n}", "function textHeight(display) {\n if (display.cachedTextHeight != null) { return display.cachedTextHeight }\n if (measureText == null) {\n measureText = elt(\"pre\");\n // Measure a bunch of lines, for browsers that compute\n // fractional heights.\n for (var i = 0; i < 49; ++i) {\n measureText.appendChild(document.createTextNode(\"x\"));\n measureText.appendChild(elt(\"br\"));\n }\n measureText.appendChild(document.createTextNode(\"x\"));\n }\n removeChildrenAndAdd(display.measure, measureText);\n var height = measureText.offsetHeight / 50;\n if (height > 3) { display.cachedTextHeight = height; }\n removeChildren(display.measure);\n return height || 1\n}", "function textHeight(display) {\n if (display.cachedTextHeight != null) { return display.cachedTextHeight }\n if (measureText == null) {\n measureText = elt(\"pre\");\n // Measure a bunch of lines, for browsers that compute\n // fractional heights.\n for (var i = 0; i < 49; ++i) {\n measureText.appendChild(document.createTextNode(\"x\"));\n measureText.appendChild(elt(\"br\"));\n }\n measureText.appendChild(document.createTextNode(\"x\"));\n }\n removeChildrenAndAdd(display.measure, measureText);\n var height = measureText.offsetHeight / 50;\n if (height > 3) { display.cachedTextHeight = height; }\n removeChildren(display.measure);\n return height || 1\n}", "function estimateHeight(cm) {\n\t\t var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n\t\t var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n\t\t return function (line) {\n\t\t if (lineIsHidden(cm.doc, line)) { return 0 }\n\n\t\t var widgetsHeight = 0;\n\t\t if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n\t\t if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n\t\t } }\n\n\t\t if (wrapping)\n\t\t { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n\t\t else\n\t\t { return widgetsHeight + th }\n\t\t }\n\t\t }", "function estimateHeight(cm) {\n\t\t var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n\t\t var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n\t\t return function(line) {\n\t\t if (lineIsHidden(cm.doc, line)) return 0;\n\t\t\n\t\t var widgetsHeight = 0;\n\t\t if (line.widgets) for (var i = 0; i < line.widgets.length; i++) {\n\t\t if (line.widgets[i].height) widgetsHeight += line.widgets[i].height;\n\t\t }\n\t\t\n\t\t if (wrapping)\n\t\t return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th;\n\t\t else\n\t\t return widgetsHeight + th;\n\t\t };\n\t\t }", "function animatedTextIconHeight(){\n\t\"use strict\";\n\t\n\tif($j('.animated_icons_with_text').length){\n\t\tvar $icons = $j('.animated_icons_with_text');\n\t\tvar maxHeight;\n\t\t\n\t\t$icons.find('.animated_text p').each(function() {\n\t\t\tmaxHeight = maxHeight > $j(this).height() ? maxHeight : $j(this).height();\n\t\t});\n\t\t\n\t\tif(maxHeight < 155) {\n\t\t\tmaxHeight = 155;\n\t\t\t\n\t\t}\n\t\t$icons.find('.animated_icon_with_text_inner').height(maxHeight);\n\t}\n}", "function textSize(width, height, fontSize, scale) {\n\t var stageWidth = parseInt(width, 10);\n\t var stageHeight = parseInt(height, 10);\n\n\t var bigSide = Math.max(stageWidth, stageHeight);\n\t var smallSide = Math.min(stageWidth, stageHeight);\n\n\t var newHeight = 0.8 * Math.min(smallSide, bigSide * scale);\n\t return Math.round(Math.max(fontSize, newHeight));\n\t}", "_getEmHeight(font) {\n const sp = document.createElement('span')\n sp.style.font = font\n sp.style.display = 'inline'\n sp.textContent = 'Hello world!'\n\n document.body.appendChild(sp)\n const emHeight = sp.offsetHeight\n document.body.removeChild(sp)\n return emHeight\n }", "function estimateHeight(cm) {\n\t var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n\t var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n\t return function(line) {\n\t if (lineIsHidden(cm.doc, line)) return 0;\n\t\n\t var widgetsHeight = 0;\n\t if (line.widgets) for (var i = 0; i < line.widgets.length; i++) {\n\t if (line.widgets[i].height) widgetsHeight += line.widgets[i].height;\n\t }\n\t\n\t if (wrapping)\n\t return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th;\n\t else\n\t return widgetsHeight + th;\n\t };\n\t }", "textSize (style, text, {transform, text_wrap, max_lines, stroke_width = 0, supersample}) {\n // Check cache first\n TextCanvas.cache.text[style] = TextCanvas.cache.text[style] || {};\n if (TextCanvas.cache.text[style][text]) {\n TextCanvas.cache.stats.text_hits++;\n return TextCanvas.cache.text[style][text];\n }\n TextCanvas.cache.stats.text_misses++;\n TextCanvas.cache.text_count++;\n\n // Calc and store in cache\n let dpr = Utils.device_pixel_ratio * supersample;\n let str = this.applyTextTransform(text, transform);\n let ctx = this.context;\n let vertical_buffer = this.vertical_text_buffer * dpr;\n let horizontal_buffer = dpr * (stroke_width + this.horizontal_text_buffer);\n let leading = 2 * dpr; // make configurable and/or use Canvas TextMetrics when available\n let line_height = this.px_size + leading; // px_size already in device pixels\n\n // Parse string into series of lines if it exceeds the text wrapping value or contains line breaks\n let multiline = MultiLine.parse(str, text_wrap, max_lines, line_height, ctx);\n\n // Final dimensions of text\n let height = multiline.height;\n let width = multiline.width;\n let lines = multiline.lines;\n\n let collision_size = [\n width / dpr,\n height / dpr\n ];\n\n let texture_size = [\n width + 2 * horizontal_buffer,\n height + 2 * vertical_buffer\n ];\n\n let logical_size = [\n texture_size[0] / dpr,\n texture_size[1] / dpr,\n ];\n\n // Returns lines (w/per-line info for drawing) and text's overall bounding box + canvas size\n TextCanvas.cache.text[style][text] = {\n lines,\n size: { collision_size, texture_size, logical_size, line_height }\n };\n return TextCanvas.cache.text[style][text];\n }", "function estimateHeight(cm) {\n\t var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n\t var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n\t return function(line) {\n\t if (lineIsHidden(cm.doc, line)) return 0;\n\n\t var widgetsHeight = 0;\n\t if (line.widgets) for (var i = 0; i < line.widgets.length; i++) {\n\t if (line.widgets[i].height) widgetsHeight += line.widgets[i].height;\n\t }\n\n\t if (wrapping)\n\t return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th;\n\t else\n\t return widgetsHeight + th;\n\t };\n\t }", "function estimateHeight(cm) {\n\t var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n\t var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n\t return function(line) {\n\t if (lineIsHidden(cm.doc, line)) return 0;\n\n\t var widgetsHeight = 0;\n\t if (line.widgets) for (var i = 0; i < line.widgets.length; i++) {\n\t if (line.widgets[i].height) widgetsHeight += line.widgets[i].height;\n\t }\n\n\t if (wrapping)\n\t return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th;\n\t else\n\t return widgetsHeight + th;\n\t };\n\t }", "calculateSize(text) {\n\n // Note that we must calculate the text against a span\n // in its entirety - calculating individual characters yields\n // incorrect values.\n return this.calculateCharacterSize(text);\n\n }", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function(line) {\n if (lineIsHidden(cm.doc, line)) return 0;\n\n var widgetsHeight = 0;\n if (line.widgets) for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) widgetsHeight += line.widgets[i].height;\n }\n\n if (wrapping)\n return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th;\n else\n return widgetsHeight + th;\n };\n }", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function(line) {\n if (lineIsHidden(cm.doc, line)) return 0;\n\n var widgetsHeight = 0;\n if (line.widgets) for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) widgetsHeight += line.widgets[i].height;\n }\n\n if (wrapping)\n return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th;\n else\n return widgetsHeight + th;\n };\n }", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function(line) {\n if (lineIsHidden(cm.doc, line)) return 0;\n\n var widgetsHeight = 0;\n if (line.widgets) for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) widgetsHeight += line.widgets[i].height;\n }\n\n if (wrapping)\n return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th;\n else\n return widgetsHeight + th;\n };\n }", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function(line) {\n if (lineIsHidden(cm.doc, line)) return 0;\n\n var widgetsHeight = 0;\n if (line.widgets) for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) widgetsHeight += line.widgets[i].height;\n }\n\n if (wrapping)\n return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th;\n else\n return widgetsHeight + th;\n };\n }", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function(line) {\n if (lineIsHidden(cm.doc, line)) return 0;\n\n var widgetsHeight = 0;\n if (line.widgets) for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) widgetsHeight += line.widgets[i].height;\n }\n\n if (wrapping)\n return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th;\n else\n return widgetsHeight + th;\n };\n }", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function(line) {\n if (lineIsHidden(cm.doc, line)) return 0;\n\n var widgetsHeight = 0;\n if (line.widgets) for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) widgetsHeight += line.widgets[i].height;\n }\n\n if (wrapping)\n return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th;\n else\n return widgetsHeight + th;\n };\n }", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function(line) {\n if (lineIsHidden(cm.doc, line)) return 0;\n\n var widgetsHeight = 0;\n if (line.widgets) for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) widgetsHeight += line.widgets[i].height;\n }\n\n if (wrapping)\n return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th;\n else\n return widgetsHeight + th;\n };\n }", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function(line) {\n if (lineIsHidden(cm.doc, line)) return 0;\n\n var widgetsHeight = 0;\n if (line.widgets) for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) widgetsHeight += line.widgets[i].height;\n }\n\n if (wrapping)\n return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th;\n else\n return widgetsHeight + th;\n };\n }", "function estimateHeight(cm) {\r\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\r\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\r\n return function(line) {\r\n if (lineIsHidden(cm.doc, line)) return 0;\r\n\r\n var widgetsHeight = 0;\r\n if (line.widgets) for (var i = 0; i < line.widgets.length; i++) {\r\n if (line.widgets[i].height) widgetsHeight += line.widgets[i].height;\r\n }\r\n\r\n if (wrapping)\r\n return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th;\r\n else\r\n return widgetsHeight + th;\r\n };\r\n }", "function get_Height(id_txt) { return (document.getElementById(id_txt).offsetHeight); }", "function estimateHeight(cm) {\r\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\r\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\r\n return function (line) {\r\n if (lineIsHidden(cm.doc, line)) { return 0 }\r\n\r\n var widgetsHeight = 0;\r\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\r\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\r\n } }\r\n\r\n if (wrapping)\r\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\r\n else\r\n { return widgetsHeight + th }\r\n }\r\n}", "function estimateHeight(cm) {\n var th = textHeight(cm.display),\n wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) {\n return 0;\n }\n\n var widgetsHeight = 0;\n\n if (line.widgets) {\n for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) {\n widgetsHeight += line.widgets[i].height;\n }\n }\n }\n\n if (wrapping) {\n return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th;\n } else {\n return widgetsHeight + th;\n }\n };\n }", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n }", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n }", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n }", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n }", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n }", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n }", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n }", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n }", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n }", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n }", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n }", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n }", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n }", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n }", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n }", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n }", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n }", "function getLineHeightPx(element){var computed=getComputedStyle(element);var div=document.createElement('div');div.style.fontFamily=computed.fontFamily;div.style.fontSize=computed.fontSize;div.style.fontStyle=computed.fontStyle;div.style.fontWeight=computed.fontWeight;div.style.lineHeight=computed.lineHeight;div.style.position='absolute';div.textContent='M';// forced layout here\r\n\tdocument.body.appendChild(div);var rect=div.getBoundingClientRect();document.body.removeChild(div);return rect.height;}", "function getLineHeight(elem) {\n var lh = computeStyle(elem, 'line-height');\n if (lh == 'normal') {\n // Normal line heights vary from browser to browser. The spec recommends\n // a value between 1.0 and 1.2 of the font size. Using 1.1 to split the diff.\n lh = parseInt(computeStyle(elem, 'font-size'), 10) * 1.2;\n }\n return parseInt(lh, 10);\n }", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n}", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n}", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n}", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n}", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n}", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n}", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n}", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n}", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n}", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n}" ]
[ "0.7177307", "0.69143856", "0.6897133", "0.68873185", "0.68799967", "0.6806309", "0.6806309", "0.6806309", "0.6806309", "0.6806309", "0.6793898", "0.6793898", "0.6793898", "0.6793898", "0.6793898", "0.6793898", "0.6793898", "0.6793898", "0.6777712", "0.672439", "0.67172724", "0.6695328", "0.6695328", "0.6695328", "0.66792613", "0.66792613", "0.6679011", "0.665929", "0.665929", "0.665929", "0.665929", "0.665929", "0.665929", "0.665929", "0.665929", "0.665929", "0.665929", "0.665929", "0.64216936", "0.64174986", "0.6409894", "0.63698053", "0.6360094", "0.63553566", "0.63492256", "0.63442636", "0.63442636", "0.6334983", "0.62916553", "0.62916553", "0.62916553", "0.62916553", "0.62916553", "0.62916553", "0.62916553", "0.62916553", "0.62901723", "0.6285838", "0.62486726", "0.62425315", "0.62395", "0.62395", "0.62395", "0.62395", "0.62395", "0.62395", "0.62395", "0.62395", "0.62395", "0.62395", "0.62395", "0.62395", "0.62395", "0.62395", "0.62395", "0.62395", "0.62395", "0.62393206", "0.6221913", "0.62203246", "0.62203246", "0.62203246", "0.62203246", "0.62203246", "0.62203246", "0.62203246", "0.62203246", "0.62203246", "0.62203246" ]
0.68935585
12
Compute the default character width.
function charWidth(display) { if (display.cachedCharWidth != null) { return display.cachedCharWidth } var anchor = elt("span", "xxxxxxxxxx"); var pre = elt("pre", [anchor], "CodeMirror-line-like"); removeChildrenAndAdd(display.measure, pre); var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10; if (width > 2) { display.cachedCharWidth = width; } return width || 10 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get defaultCharacterWidth() { return this.viewState.heightOracle.charWidth; }", "function charWidth(display) {\n\t\t if (display.cachedCharWidth != null) return display.cachedCharWidth;\n\t\t var anchor = elt(\"span\", \"xxxxxxxxxx\");\n\t\t var pre = elt(\"pre\", [anchor]);\n\t\t removeChildrenAndAdd(display.measure, pre);\n\t\t var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n\t\t if (width > 2) display.cachedCharWidth = width;\n\t\t return width || 10;\n\t\t }", "function charWidth(display) {\n\t\t if (display.cachedCharWidth != null) { return display.cachedCharWidth }\n\t\t var anchor = elt(\"span\", \"xxxxxxxxxx\");\n\t\t var pre = elt(\"pre\", [anchor], \"CodeMirror-line-like\");\n\t\t removeChildrenAndAdd(display.measure, pre);\n\t\t var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n\t\t if (width > 2) { display.cachedCharWidth = width; }\n\t\t return width || 10\n\t\t }", "function charWidth(display) {\n\t if (display.cachedCharWidth != null) return display.cachedCharWidth;\n\t var anchor = elt(\"span\", \"xxxxxxxxxx\");\n\t var pre = elt(\"pre\", [anchor]);\n\t removeChildrenAndAdd(display.measure, pre);\n\t var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n\t if (width > 2) display.cachedCharWidth = width;\n\t return width || 10;\n\t }", "function charWidth(display) {\n\t if (display.cachedCharWidth != null) return display.cachedCharWidth;\n\t var anchor = elt(\"span\", \"xxxxxxxxxx\");\n\t var pre = elt(\"pre\", [anchor]);\n\t removeChildrenAndAdd(display.measure, pre);\n\t var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n\t if (width > 2) display.cachedCharWidth = width;\n\t return width || 10;\n\t }", "function charWidth(display) {\n\t if (display.cachedCharWidth != null) return display.cachedCharWidth;\n\t var anchor = elt(\"span\", \"xxxxxxxxxx\");\n\t var pre = elt(\"pre\", [anchor]);\n\t removeChildrenAndAdd(display.measure, pre);\n\t var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n\t if (width > 2) display.cachedCharWidth = width;\n\t return width || 10;\n\t }", "function charWidth(display) {\n if (display.cachedCharWidth != null) { return display.cachedCharWidth }\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor]);\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) { display.cachedCharWidth = width; }\n return width || 10\n }", "function charWidth(display) {\n if (display.cachedCharWidth != null) { return display.cachedCharWidth }\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor]);\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) { display.cachedCharWidth = width; }\n return width || 10\n }", "function charWidth(display) {\n if (display.cachedCharWidth != null) { return display.cachedCharWidth }\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor]);\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) { display.cachedCharWidth = width; }\n return width || 10\n }", "function charWidth(display) {\n if (display.cachedCharWidth != null) { return display.cachedCharWidth }\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor]);\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) { display.cachedCharWidth = width; }\n return width || 10\n }", "function charWidth(display) {\n if (display.cachedCharWidth != null) { return display.cachedCharWidth }\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor]);\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) { display.cachedCharWidth = width; }\n return width || 10\n }", "function charWidth(display) {\n if (display.cachedCharWidth != null) return display.cachedCharWidth;\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor]);\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) display.cachedCharWidth = width;\n return width || 10;\n }", "function charWidth(display) {\n if (display.cachedCharWidth != null) return display.cachedCharWidth;\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor]);\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) display.cachedCharWidth = width;\n return width || 10;\n }", "function charWidth(display) {\n if (display.cachedCharWidth != null) return display.cachedCharWidth;\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor]);\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) display.cachedCharWidth = width;\n return width || 10;\n }", "function charWidth(display) {\n if (display.cachedCharWidth != null) return display.cachedCharWidth;\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor]);\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) display.cachedCharWidth = width;\n return width || 10;\n }", "function charWidth(display) {\n if (display.cachedCharWidth != null) return display.cachedCharWidth;\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor]);\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) display.cachedCharWidth = width;\n return width || 10;\n }", "function charWidth(display) {\n if (display.cachedCharWidth != null) return display.cachedCharWidth;\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor]);\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) display.cachedCharWidth = width;\n return width || 10;\n }", "function charWidth(display) {\n if (display.cachedCharWidth != null) return display.cachedCharWidth;\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor]);\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) display.cachedCharWidth = width;\n return width || 10;\n }", "function charWidth(display) {\n if (display.cachedCharWidth != null) return display.cachedCharWidth;\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor]);\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) display.cachedCharWidth = width;\n return width || 10;\n }", "function charWidth(display) {\r\n if (display.cachedCharWidth != null) return display.cachedCharWidth;\r\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\r\n var pre = elt(\"pre\", [anchor]);\r\n removeChildrenAndAdd(display.measure, pre);\r\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\r\n if (width > 2) display.cachedCharWidth = width;\r\n return width || 10;\r\n }", "function charWidth(display) {\n if (display.cachedCharWidth != null) { return display.cachedCharWidth }\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor]);\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) { display.cachedCharWidth = width; }\n return width || 10\n}", "function charWidth(display) {\n if (display.cachedCharWidth != null) { return display.cachedCharWidth }\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor]);\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) { display.cachedCharWidth = width; }\n return width || 10\n}", "function charWidth(display) {\n if (display.cachedCharWidth != null) { return display.cachedCharWidth }\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor]);\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) { display.cachedCharWidth = width; }\n return width || 10\n}", "function charWidth(display) {\n if (display.cachedCharWidth != null) { return display.cachedCharWidth }\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor]);\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) { display.cachedCharWidth = width; }\n return width || 10\n}", "function charWidth(display) {\n if (display.cachedCharWidth != null) { return display.cachedCharWidth }\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor]);\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) { display.cachedCharWidth = width; }\n return width || 10\n}", "function charWidth(display) {\n if (display.cachedCharWidth != null) { return display.cachedCharWidth }\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor]);\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) { display.cachedCharWidth = width; }\n return width || 10\n}", "function charWidth(display) {\n if (display.cachedCharWidth != null) { return display.cachedCharWidth }\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor]);\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) { display.cachedCharWidth = width; }\n return width || 10\n}", "function charWidth(display) {\n if (display.cachedCharWidth != null) { return display.cachedCharWidth }\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor]);\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) { display.cachedCharWidth = width; }\n return width || 10\n}", "function charWidth(display) {\n if (display.cachedCharWidth != null) { return display.cachedCharWidth }\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor]);\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) { display.cachedCharWidth = width; }\n return width || 10\n}", "function charWidth(display) {\n if (display.cachedCharWidth != null) { return display.cachedCharWidth }\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor]);\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) { display.cachedCharWidth = width; }\n return width || 10\n}", "function charWidth(display) {\n if (display.cachedCharWidth != null) { return display.cachedCharWidth }\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor]);\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) { display.cachedCharWidth = width; }\n return width || 10\n}", "function charWidth(display) {\n if (display.cachedCharWidth != null) { return display.cachedCharWidth }\n var anchor = elt(\"span\", \"xxxxxxxxxx\")\n var pre = elt(\"pre\", [anchor])\n removeChildrenAndAdd(display.measure, pre)\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10\n if (width > 2) { display.cachedCharWidth = width }\n return width || 10\n}", "function charWidth(display) {\n if (display.cachedCharWidth != null) { return display.cachedCharWidth }\n var anchor = elt(\"span\", \"xxxxxxxxxx\")\n var pre = elt(\"pre\", [anchor])\n removeChildrenAndAdd(display.measure, pre)\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10\n if (width > 2) { display.cachedCharWidth = width }\n return width || 10\n}", "function charWidth(display) {\r\n if (display.cachedCharWidth != null) { return display.cachedCharWidth }\r\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\r\n var pre = elt(\"pre\", [anchor]);\r\n removeChildrenAndAdd(display.measure, pre);\r\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\r\n if (width > 2) { display.cachedCharWidth = width; }\r\n return width || 10\r\n}", "function char2width(chr) {\n // Excel Max Digit Width\n // Info: https://github.com/SheetJS/sheetjs/blob/master/docbits/62_colrow.md\n var MDW = 6;\n return Math.ceil((Math.round((chr * MDW + 5) / MDW * 256)) / 256);\n }", "get characterSize() {}", "function va(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=n(\"span\",\"xxxxxxxxxx\"),r=n(\"pre\",[t]);a(e.measure,r);var f=t.getBoundingClientRect(),o=(f.right-f.left)/10;return o>2&&(e.cachedCharWidth=o),o||10}", "function lettersWidth(s) {\n\tif (s === null || s === undefined || s === \"\")\n\t\treturn 0;\n\tlet cx = 0;\n\tfor (let i = 0; i < s.length; i++) {\n\t\tlet c = s[i];\n\t\tlet cw = textWidth(c) + spacing;\n\t\tcx += cw;\n\t}\n\treturn cx;\n}", "function _c_width() { \n\t\t\t\t\treturn _width + _padding.l + _padding.r; \n\t\t\t\t}", "function charDisplayWidth(c) {\n if (c >= 0x1100 &&\n (c <= 0x115f || c == 0x2329 || c == 0x232a ||\n (c >= 0x2e80 && c <= 0xa4cf && c != 0x303f) || /* CJK ... Yi */\n (c >= 0xac00 && c <= 0xd7a3) || /* Hangul Syllables */\n (c >= 0xf900 && c <= 0xfaff) || /* CJK Compatibility Ideographs */\n (c >= 0xfe10 && c <= 0xfe19) || /* Vertical forms */\n (c >= 0xfe30 && c <= 0xfe6f) || /* CJK Compatibility Forms */\n (c >= 0xff00 && c <= 0xff60) || /* Fullwidth Forms */\n (c >= 0xffe0 && c <= 0xffe6) ||\n (c >= 0x20000 && c <= 0x2fffd) ||\n (c >= 0x30000 && c <= 0x3fffd))) return 2;\n return 1;\n }", "padWidth() {\n let width = this.largestOptionLength();\n\n if (this.argsDescription && this._args.length) {\n if (this.largestArgLength() > width) {\n width = this.largestArgLength();\n }\n }\n\n if (this.commands && this.commands.length) {\n if (this.largestCommandLength() > width) {\n width = this.largestCommandLength();\n }\n }\n\n return width;\n }", "_padToWidth(s, width, c) {\n c = c || \" \";\n while (s.length < width) s += c;\n return s;\n }", "function strWidth(str){\n\t\tif(str.length == 0)return 0;\n\t\t//We need to calculate how long our string will be in pixels\n\t\tvar strWidths = {\" \":9,\"!\":10,\"\\\"\":15,\"#\":17,\"$\":17,\"%\":27,\"&\":22,\"'\":8,\"(\":10,\")\":10,\"*\":12,\"+\":18,\",\":9,\"-\":10,\".\":9,\"/\":9,\"0\":17,\"1\":17,\"2\":17,\"3\":17,\"4\":17,\"5\":17,\"6\":17,\"7\":17,\"8\":17,\"9\":17,\":\":10,\";\":10,\"<\":18,\"=\":18,\">\":18,\"?\":19,\"@\":30,\"A\":22,\"B\":22,\"C\":22,\"D\":22,\"E\":21,\"F\":19,\"G\":24,\"H\":22,\"I\":9,\"J\":17,\"K\":22,\"L\":19,\"M\":25,\"N\":22,\"O\":24,\"P\":21,\"Q\":24,\"R\":22,\"S\":21,\"T\":19,\"U\":22,\"V\":21,\"W\":29,\"X\":21,\"Y\":21,\"Z\":19,\"[\":10,\"]\":10,\"^\":18,\"_\":17,\"`\":10,\"a\":17,\"b\":19,\"c\":17,\"d\":19,\"e\":17,\"f\":10,\"g\":19,\"h\":19,\"i\":9,\"j\":9,\"k\":17,\"l\":9,\"m\":27,\"n\":19,\"o\":19,\"p\":19,\"q\":19,\"r\":12,\"s\":17,\"t\":10,\"u\":19,\"v\":17,\"w\":24,\"x\":17,\"y\":17,\"z\":15,\"{\":12,\"|\":9,\"}\":12,\"~\":18};\n\t\tvar w = 0;\n\t\tfor(var i = 0; i<str.length; i++){\n\t\t\t//If we dont know how wide the char is, set it to 28.5 that is the width of W and no char is wider than that.\n\t\t\tw += fontSize/30*(strWidths[str[i]]?strWidths[str[i]]:28.5);\n\t\t}\n\t\t//This is for the space between the text and the symbol.\n\t\tw += spaceTextIcon;\n\t\treturn w;\n\t}", "function textWidth(text) {\n\tif (!text){\n\t\treturn 0;\n\t}\n\tlen = 0;\n\tfor(i=0; i<text.length;i++) {\n\t\tlen += text.charCodeAt(i) < 128 ? 1 : 2;\n\t}\n\treturn len;\n}", "set characterSize(value) {}", "get width() { return this.#format.width; }", "function charsWidth( character, charsArray ) {\r\n charsArray = charsArray || _TextRangeElementData.charactersWidthForTheProcess;\r\n var counting = charsArray.length;\r\n while ( counting-- > 0 ) {\r\n var charObject = charsArray [ counting ];\r\n if ( charObject.character == character ) {\r\n return charObject.width;\r\n }\r\n }\r\n return 0;\r\n }", "function wcswidth(str, opts) {\n opts = _WIDTH_DEFAULTS; // FIXME\n if (typeof str !== 'string')\n return _width_wcwidth(str, opts);\n var s = 0;\n for (var i = 0; i < str.length; i++) {\n // FIXME: apply patch for high unicode chars (see print_p)\n var n = _width_wcwidth(str.charCodeAt(i), opts);\n if (n < 0)\n return -1;\n s += n;\n }\n return s\n }", "function calcWidthOfText(text) {\n return text.split('').reduce((width, ch, index) => {\n const chCode = text.charCodeAt(index);\n const chLen = map[chCode];\n /** 13px for the width of non-ascii characters */\n return width += chLen ? chLen : (chCode >= 0 && chCode <= 127 ? 0 : 13);\n }, 0) + 3 /** padding */ * 2;\n}", "function computeFontWidthFactor (font) {\n\t var sum = 0;\n\t var digitsum = 0;\n\t var digits = 0;\n\t font.chars.map(function (ch) {\n\t sum += ch.xadvance;\n\t if (ch.id >= 48 && ch.id <= 57) {\n\t digits++;\n\t digitsum += ch.xadvance;\n\t }\n\t });\n\t return digits ? digitsum / digits : sum / font.chars.length;\n\t}", "stringWidth(_string, _length, _elemId, _customStyle) {\n return this.stringSize(_string, _length, _elemId, false, _customStyle)[0];\n }", "function realLength(value) {\n var length = value.indexOf('\\n')\n return width(length === -1 ? value : value.slice(0, length))\n}", "function wcswidth(str, opts) {\n if (typeof str !== 'string') { return wcwidth(str, opts); }\n var s = 0;\n\n for (var i = 0; i < str.length; i++) {\n var n = wcwidth(str.charCodeAt(i), opts);\n if (n < 0) { return -1; }\n s += n;\n }\n\n return s;\n }", "function computeFontWidthFactor (font) {\n var sum = 0;\n var digitsum = 0;\n var digits = 0;\n font.chars.map(function (ch) {\n sum += ch.xadvance;\n if (ch.id >= 48 && ch.id <= 57) {\n digits++;\n digitsum += ch.xadvance;\n }\n });\n return digits ? digitsum / digits : sum / font.chars.length;\n}", "getMaxWidthUnit(){return this.__maxWidthUnit}", "function getWidth() {\n\tvar width = document.getElementById(\"clientText\").clientWidth - PADDING_PX;\n\twidth = width * PX_TO_INCH * INCH_TO_METER * METER_TO_CM;\n\treturn width.toFixed(2);\n}", "function calculateWidthForText(text) {\n if (spacer === undefined) { // on first call only.\n spacer = document.createElement('span'); \n spacer.style.visibility = 'hidden';\n spacer.style.position = 'fixed';\n spacer.style.outline = '0';\n spacer.style.margin = '0';\n spacer.style.padding = '0';\n spacer.style.border = '0';\n spacer.style.left = '0';\n spacer.style.whiteSpace = 'pre';\n spacer.style.fontSize = config.fontSize;\n spacer.style.fontFamily = config.fontFamily;\n spacer.style.fontWeight = 'normal';\n document.body.appendChild(spacer); \n } \n \n // Used to encode an HTML string into a plain text.\n // taken from http://stackoverflow.com/questions/1219860/javascript-jquery-html-encoding\n spacer.innerHTML = String(text).replace(/&/g, '&amp;')\n .replace(/\"/g, '&quot;')\n .replace(/'/g, '&#39;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;');\n return spacer.getBoundingClientRect().right;\n }", "function calculateWidthForText(text) {\n if (spacer === undefined) { // on first call only.\n spacer = document.createElement('span'); \n spacer.style.visibility = 'hidden';\n spacer.style.position = 'fixed';\n spacer.style.outline = '0';\n spacer.style.margin = '0';\n spacer.style.padding = '0';\n spacer.style.border = '0';\n spacer.style.left = '0';\n spacer.style.whiteSpace = 'pre';\n spacer.style.fontSize = config.fontSize;\n spacer.style.fontFamily = config.fontFamily;\n spacer.style.fontWeight = 'normal';\n document.body.appendChild(spacer); \n } \n \n // Used to encode an HTML string into a plain text.\n // taken from http://stackoverflow.com/questions/1219860/javascript-jquery-html-encoding\n spacer.innerHTML = String(text).replace(/&/g, '&amp;')\n .replace(/\"/g, '&quot;')\n .replace(/'/g, '&#39;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;');\n return spacer.getBoundingClientRect().right;\n }", "function calculateWidthForText(text) {\n if (spacer === undefined) { // on first call only.\n spacer = document.createElement('span'); \n spacer.style.visibility = 'hidden';\n spacer.style.position = 'fixed';\n spacer.style.outline = '0';\n spacer.style.margin = '0';\n spacer.style.padding = '0';\n spacer.style.border = '0';\n spacer.style.left = '0';\n spacer.style.whiteSpace = 'pre';\n spacer.style.fontSize = config.fontSize;\n spacer.style.fontFamily = config.fontFamily;\n spacer.style.fontWeight = 'normal';\n document.body.appendChild(spacer); \n } \n \n // Used to encode an HTML string into a plain text.\n // taken from http://stackoverflow.com/questions/1219860/javascript-jquery-html-encoding\n spacer.innerHTML = String(text).replace(/&/g, '&amp;')\n .replace(/\"/g, '&quot;')\n .replace(/'/g, '&#39;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;');\n return spacer.getBoundingClientRect().right;\n }", "function computeCustomizedWidth(){\n\tvar note_div = document.querySelector('#note_div');\n\tvar largeWidth = note_div.offsetWidth;\n\tvar margin = NOTE_MARGIN;\n\t//border = 2px\n\tvar border = window.getComputedStyle(note_div).borderWidth[0];\n\treturn (largeWidth - (2*border))/numOfKey -(2*margin) -1;\n}", "wcwidth(num) {\n return this._activeProvider.wcwidth(num);\n }", "function wcswidth(str, opts) {\n if (typeof str !== 'string') return wcwidth(str, opts)\n\n var s = 0;\n for (var i = 0; i < str.length; i++) {\n var n = wcwidth(str.charCodeAt(i), opts);\n if (n < 0) return -1\n s += n;\n }\n\n return s\n}", "function wcswidth(str, opts) {\n if (typeof str !== 'string') return wcwidth(str, opts)\n\n var s = 0\n for (var i = 0; i < str.length; i++) {\n var n = wcwidth(str.charCodeAt(i), opts)\n if (n < 0) return -1\n s += n\n }\n\n return s\n}", "function wcswidth(str, opts) {\n if (typeof str !== 'string') return wcwidth(str, opts)\n\n var s = 0\n for (var i = 0; i < str.length; i++) {\n var n = wcwidth(str.charCodeAt(i), opts)\n if (n < 0) return -1\n s += n\n }\n\n return s\n}", "function wcswidth(str, opts) {\n if (typeof str !== 'string') return wcwidth(str, opts)\n\n var s = 0\n for (var i = 0; i < str.length; i++) {\n var n = wcwidth(str.charCodeAt(i), opts)\n if (n < 0) return -1\n s += n\n }\n\n return s\n}", "function wcswidth(str, opts) {\n if (typeof str !== 'string') return wcwidth(str, opts)\n\n var s = 0\n for (var i = 0; i < str.length; i++) {\n var n = wcwidth(str.charCodeAt(i), opts)\n if (n < 0) return -1\n s += n\n }\n\n return s\n}", "function get_num_chars() {\n var cursor = self.find('.cursor');\n var cur_width = cursor.width()\n var result = Math.floor(self.width() / cur_width);\n if (haveScrollbars()) {\n // assume that scrollbars are 20px - in my Laptop with \n // Linux/Chrome they are 16px\n var margins = self.innerWidth() - self.width();\n result -= Math.ceil((20 - margins / 2) / (cur_width-1));\n }\n return result;\n }", "get maxWidth() {}", "static getConsoleWidth() {\n const stdout = process.stdout;\n if (stdout && stdout.columns) {\n return stdout.columns;\n }\n return 80;\n }", "calculateCharacterSize(char) {\n if (this._sizes[char]) return this._sizes[char];\n\n var span = this._getTemporarySpan();\n\n // copy over the styles defined for the text ruler so that\n // we can make an accurate measurement\n var ts = this._style;\n\n Object.assign(span.style, {\n letterSpacing: ts.letterSpacing,\n lineHeight : ts.lineHeight,\n fontSize : ts.fontSize,\n fontFamily : ts.fontFamily,\n fontWeight : ts.fontWeight\n });\n\n // set the encoded\n span.innerHTML = encode(char);\n\n var w = span.offsetWidth; // + this._getLetterSpacing();\n var h = span.offsetHeight;\n\n return this._sizes[char] = [w, h];\n }", "get width() {\n // w = width\n return this._w;\n }", "getWidth() {\n return this.content >> 22 /* WIDTH_SHIFT */;\n }", "function getTextWidth(txt) {\n\t\tvar c = document.getElementById(\"forComputationalProcesses\");\n\t\tvar ctx = c.getContext(\"2d\");\n\t\tctx.font = \"13px Open Sans\";\n\n\t\treturn ctx.measureText(txt).width;\n\t}", "function size$1(value) {\n var match = /\\r?\\n|\\r/.exec(value);\n return width(match ? value.slice(0, match.index) : value)\n}", "get width() {\n return this._getOption('width');\n }", "get displayWidth() {\n\t\treturn this.__Internal__Dont__Modify__.dispWidth;\n\t}", "function setw(pStr, pLen, before)\n{\n var browser=navigator.appName;\n var nbSpace = \"&nbsp;\";\n if (browser==\"Microsoft Internet Explorer\")\n {\n nbSpace = \" \"; \n }\n var rStr = pStr;\n var spaceToAdd = 0;\n if (rStr.length > pLen)\n {\n rStr = rStr.substring(0,pLen);\n }\n else\n {\n spaceToAdd = pLen - rStr.length;\n }\n for(j = 0; j < spaceToAdd; j++) \n {\n if(before)\n { \n rStr = nbSpace + rStr;\n }\n else\n {\n rStr = \"\" + rStr + nbSpace;\n }\n }\n return rStr;\n}", "function tabWidth() {\n\t\t\treturn (new Scintilla(context.handle)).Call(\"SCI_GETTABWIDTH\", 0, 0);\n\t\t}", "getMaxWidth(){return this.__maxWidth}", "set minimumWidth(value) { }", "function countChar(val){\n\t\tvar len = val.value.length;\n\t\tif (len >= 600) {\n\t\t\tval.value = val.value.substring(0, 600);\n\t\t}else {\n\t\t\t$('#charNum').text(600 - len);\n\t\t}\n\t}", "function size(value) {\n var match = /\\r?\\n|\\r/.exec(value)\n return width(match ? value.slice(0, match.index) : value)\n}", "calWidth () {\n let len = 0\n this.queue.forEach(message => {\n len += message.content.length * config.default_font_size\n })\n return len\n }", "function computeNewMaxWidth(field, val, previousMax) {\n // Should not be larger than the max width, unless the field name is really long\n var hardCap = Math.max(config.MAX_FIELD_WIDTH, field.length);\n var longest = Math.max(val.toString().length, previousMax, field.length);\n return Math.min(hardCap, longest);\n }", "function visualLength(text)\n\t{\n\t\tvar ruler = document.getElementById(\"ruler\");\n\t\truler.innerHTML = text;\n\t\treturn ruler.offsetWidth;\n\t}", "get preferredWidth() {\n return this.preferredWidthIn;\n }", "get preferredWidth() {\n return this.preferredWidthIn;\n }", "function gettextareawidth() {\n\n $.browser.chrome = /chrome/.test(navigator.userAgent.toLowerCase());\n\n // Return 65 if we're mozilla\n if($.browser.mozilla) {\n return 65;\n }\n\n // Return 57 if we're chrome\n if($.browser.chrome) {\n return 57;\n }\n\n // Default to 65\n return 65;\n }", "function add_zerowidth(wat) {\n\treturn wat.substring(0, 1) + '\\u200B' + wat.substring(1);\n}" ]
[ "0.7920131", "0.7037969", "0.7021818", "0.7021073", "0.7021073", "0.7021073", "0.70129645", "0.70129645", "0.70129645", "0.70129645", "0.70129645", "0.7000035", "0.7000035", "0.7000035", "0.7000035", "0.7000035", "0.7000035", "0.7000035", "0.7000035", "0.6951675", "0.686542", "0.686542", "0.686542", "0.686542", "0.686542", "0.686542", "0.686542", "0.686542", "0.686542", "0.686542", "0.686542", "0.68631214", "0.68631214", "0.6862812", "0.6742799", "0.673329", "0.66327125", "0.6579472", "0.6548624", "0.6529423", "0.65018266", "0.6473127", "0.6369536", "0.63124263", "0.6209663", "0.6120721", "0.6118149", "0.60966456", "0.6080189", "0.6052982", "0.6047463", "0.6031508", "0.6030071", "0.6012051", "0.6009389", "0.6009256", "0.59844244", "0.59844244", "0.59844244", "0.59456944", "0.5900992", "0.59002346", "0.5899201", "0.5899201", "0.5899201", "0.5899201", "0.5866302", "0.5823036", "0.58224964", "0.5813456", "0.5778198", "0.5770765", "0.5768868", "0.5767599", "0.5767326", "0.5753243", "0.57161325", "0.57116467", "0.5705412", "0.5702974", "0.5681436", "0.5679267", "0.5665617", "0.56633264", "0.5656222", "0.5644156", "0.5644156", "0.56362504", "0.5604593" ]
0.6948909
29
Do a bulkread of the DOM positions and sizes needed to draw the view, so that we don't interleave reading and writing to the DOM.
function getDimensions(cm) { var d = cm.display, left = {}, width = {}; var gutterLeft = d.gutters.clientLeft; for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) { var id = cm.display.gutterSpecs[i].className; left[id] = n.offsetLeft + n.clientLeft + gutterLeft; width[id] = n.clientWidth; } return {fixedPos: compensateForHScroll(d), gutterTotalWidth: d.gutters.offsetWidth, gutterLeft: left, gutterWidth: width, wrapperWidth: d.wrapper.clientWidth} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_updateRendering() {\n this._domElement.style.width = this._width + 'px'\n this._domElement.style.height = this._height + 'px'\n this._adjustAll()\n }", "draw() {\n if (this._page !== currentPage) {\n return;\n }\n this.drawRectangles();\n if (!isReady) {\n return;\n }\n // Only used if using text lines.\n if (this._textLines.length > 0) {\n for (var i = 0; i < this._textLines.length; i++) {\n this._textLines[i].draw();\n }\n }\n // Only used if using input panels.\n if (this._inputPanels.length > 0) {\n for (var i = 0; i < this._inputPanels.length; i++) {\n this._inputPanels[i].draw();\n }\n }\n // Only used if using progress bars.\n if (this._progressBars.length > 0) {\n for (var i = 0; i < this._progressBars.length; i++) {\n this._progressBars[i].draw();\n }\n }\n }", "function readDisplay() {\n // delete all arr item\n while (theFullDisplay.length > 0) {\n theFullDisplay.pop();\n }\n for (let i = 0; i < dispSize; i++) {\n theFullDisplay.push(\n document.querySelectorAll(\".digit.pos\" + (i + 1) + \" .segment\")\n );\n }\n}", "function redraw() {\n canvas.width = root.getAttribute('width');\n canvas.height = root.getAttribute('height');\n for (var child = root.firstChild; child; child = child.nextSibling) draw(child);\n }", "function htmlTocanvas() {\n var useHeight = $('.doiView').prop('scrollHeight');\n html2canvas($my_view[0], {\n height: useHeight,\n onrendered: function(canvas) {\n if ($my_view.height() > h) {\n context.drawImage(canvas, 0, 0, $my_view.width(), $my_view.height());\n h = h + getVisible();\n $ionicScrollDelegate.$getByHandle('doiContent').scrollTo(0, h);\n setTimeout(function() {\n htmlTocanvas();\n }, 0)\n } else {\n var imgSrc = canvasEl.toDataURL(\"image/jpeg\");\n postDOIData(imgSrc, canvasEl.width, canvasEl.height)\n }\n }\n });\n\n }", "refresh() {\n this.viewDiv.node().style.top = this._position.y + \"px\";\n this.viewDiv.node().style.left = this._position.x + \"px\";\n }", "function update_canvas_offsets(){\n // Set initial svg canvas offset\n var container = getById('svg_container');\n var top = 0;\n var left = 0;\n do{\n top += container.offsetTop;\n left += container.offsetLeft;\n container = container.offsetParent;\n }\n while(container != null);\n g['x_offset'] = left;\n g['y_offset'] = top;\n}", "draw()\n\t{\n\t\t// if the scrollbar's marker position has changed then the layout must be updated:\n\t\tif (this._scrollbar.markerPos !== this._prevScrollbarMarkerPos)\n\t\t{\n\t\t\tthis._prevScrollbarMarkerPos = this._scrollbar.markerPos;\n\t\t\tthis._needUpdate = true;\n\t\t}\n\n\t\t// draw the decorations:\n\t\tsuper.draw();\n\n\t\t// draw the stimuli:\n\t\tfor (let i = 0; i < this._items.length; ++i)\n\t\t{\n\t\t\tif (this._visual.visibles[i])\n\t\t\t{\n\t\t\t\tconst textStim = this._visual.textStims[i];\n\t\t\t\ttextStim.draw();\n\n\t\t\t\tconst responseStim = this._visual.responseStims[i];\n\t\t\t\tif (responseStim)\n\t\t\t\t{\n\t\t\t\t\tresponseStim.draw();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// draw the scrollbar:\n\t\tthis._scrollbar.draw();\n\t}", "function init() {\n var layout = getFromStorage();\n if (!layout) {\n layout = readDOMLayout();\n saveToStorage();\n return;\n }\n\n // Cycle through the layout making DOM reordering as necissary\n var i, col, DOMLayout;\n DOMLayout = readDOMLayout().slice(0, 4);// just the arrays\n layout = layout.slice(0, 4);// just the arrays\n for (i = 0;i < 4;i++) {\n col = document.getElementById(adfPrefix + 'column_' + (i + 1));\n adjustDOM(layout[i], DOMLayout[i], col);\n }\n }", "function doUpdate() {\n\n\t\t//console.log(myDoc.defaultView);\n\t\tif (myDoc.defaultView === null) {\n\t\t\talert(\"Window is closed!\");\n\t\t\treturn 0;\n\t\t}\n\n\t\tvar noview = 0,\n\t\t\tnoshape = 0,\n\t\t\tnodim = 0,\n\t\t\tcurrview = {};\n\n\t\t// Put all data from JSON editor to theObj\n\t\ttheObj = editor.get();\n\t\t// Check if PART or ASSY object\n\t\tif (theObj.Header.Type === \"part\") {\n\t\t\t// no active now. Waiting coding for assy\n\t\t}\n\t\t// replace parameters by value and evaluate formula\n\t\ttheObj = doDeparam(theObj);\n\t\t// put all coordinates in cartesian\n\t\ttheObj = doCoordonate(theObj);\n\n\t\tdoHatchpattern();\n\n\t\t// Create containers for each view or empty them if exist\n\t\tvar gview = [];\n\t\tfor (noview = 0; noview <= theObj.Views.length - 1; noview += 1) {\n\t\t\tvar svgg = theSvgElement.getElementById('view' + noview);\n\t\t\tif (svgg === null) {\n\t\t\t\tgview.push(document.createElementNS(NSSVG, \"g\"));\n\t\t\t\tgview[gview.length - 1].setAttributeNS(null, \"id\", \"view\" + noview);\n\t\t\t\tgview[gview.length - 1].setAttributeNS(null, \"class\", \"basicview\");\n\t\t\t\ttheSvgElement.appendChild(gview[gview.length - 1]);\n\t\t\t} else {\n\t\t\t\twhile (svgg.firstChild) {\n\t\t\t\t\tsvgg.removeChild(svgg.firstChild);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// draw shape (with fillet at corner if specified)\n\t\tfor (noview = 0; noview <= theObj.Views.length - 1; noview += 1) {\n\t\t\tcurrview = theObj.Views[noview];\n\t\t\tfor (noshape = 0; noshape <= currview.Shapes.length - 1; noshape += 1) {\n\t\t\t\tShape(noshape, currview.Shapes[noshape].Points,\n\t\t\t\t\ttheObj.Header.Scale,\n\t\t\t\t\tcurrview.Header.Origine,\n\t\t\t\t\tcurrview.Shapes[noshape].Fill,\n\t\t\t\t\tnoview,\n\t\t\t\t\ttheObj.Format,\n\t\t\t\t\ttheSvgElement);\n\t\t\t}\n\t\t}\n\n\n\t\t// draw Lines from theSvgElement and view #\n\t\tfor (noview = 0; noview <= theObj.Views.length - 1; noview += 1) {\n\t\t\tdrawLine(noview, theSvgElement, theObj);\n\t\t}\n\n\t\t// draw dimension from the SvgElement (after remove old ones)\n\t\tsvgg = theSvgElement.getElementById('dimension');\n\t\twhile (svgg.firstChild) {\n\t\t\tsvgg.removeChild(svgg.firstChild);\n\t\t}\n\t\tfor (nodim = 0; nodim <= theObj.Dimensions.length - 1; nodim += 1) {\n\t\t\tdrawDimension(theSvgElement, theObj, theObj.Dimensions[nodim]);\n\t\t} // for\n\n\t\t// Change Format (mainly linked with CSS)\n\t\tchangeClasscolor('dim', theObj.Format.Dimensions_color, theObj.Format.shape_thick);\n\n\t\t// draw origin point for each view\n\t\tdrawOrigin();\n\t\tdisplayClassToggle('ptsfillet');\n\t\tdisplayClassToggle('squeleton');\n\n\t\tdisplayNodesinfo();\n\n\t\tpanZoomInstance = svgPanZoom(theSvgElement, {\n\t\t\tzoomEnabled: true,\n\t\t\tcontrolIconsEnabled: false\n\t\t});\n\n\t\treturn 0;\n\t}", "function refresh() {\n mapDOMtoPosition();\n // resetDirty();\n markPeaks();\n }", "function GeneratePage() {\n\tthis.generatedPositions = [];\n\n\t// get the size of our sample div, then remove it, it's served it's purpose\n\tconst div = document.querySelector('[data-o-element-visibility-track]');\n\tif (!div) throw new Error('Demo base div missing');\n\tthis.div = div.getBoundingClientRect();\n\tdiv.parentNode.removeChild(div);\n\n\t// set the body size to be 20% larger than the viewport\n\tthis.body = this.setBodySize(1.2);\n\n\t// calculate a sensible amount of divs to display\n\tconst numDivs = this.numDivs = this.maxDivs();\n\tthis.addDivs(numDivs);\n\n\t// counters\n\tthis.inView = document.getElementsByClassName('inview');\n\n\t// initialise the info box\n\tthis.setupInfo();\n}", "function TNodes_doDOM_StageRefresh( znd ){\n // \n // $('#' + this.Ident).css({\n // 'width':znd.width + 'px',\n // 'height':znd.height + 'px'\n // })\n }", "function restoreDom(all) {\n for (var i = 0; i < all.length; i++) {\n all[i].paintItem();\n if (all[i].children.length) {\n restoreDom(all[i].children);\n }\n }\n }", "_updateDOM() {\n this._updateAttributes();\n this._updateStyles();\n }", "function read_dom(){\n google_eles = [\n document.getElementById('viewport'),\n document.getElementById('body'),\n document.getElementById('footer'),\n document.getElementById('fbar')\n ];\n}", "function drawAll() {\n if (!currentViewExtents) {\n currentViewExtents = timelineController.viewExtents;\n }\n\n // update size of main canvas\n var w = timelineController.width + margin.left + margin.right;\n var e = angular.element(main.canvas);\n main.resize(w);\n\n var s = function(v) {\n return v * main.ratio;\n };\n\n main.ctx.clearRect(0, 0, main.canvas.width, main.canvas.height);\n main.ctx.drawImage(lanes.canvas, 0, 0);\n\n // draw all visible regions\n var startX = absolute(currentViewExtents[0]);\n var endX = absolute(currentViewExtents[1]);\n var viewRegions = getContainedRegions(startX, endX);\n\n var effectiveWidth = 0;\n viewRegions.forEach(function(region) {\n effectiveWidth += region.width;\n });\n\n if (effectiveWidth < timelineController.width) {\n // we had to cap the region generation previously, but moved outside of\n // the generated area, so regenerate regions around the current view\n createRegions();\n viewRegions = getContainedRegions(startX, endX);\n }\n\n viewRegions.forEach(function(region) {\n drawRegion(region);\n\n // calculate the cropping area and offsets needed to place the region\n // in the main canvas\n var sx1 = Math.max(0, startX - region.x);\n var sx2 = Math.min(region.width, endX - region.x);\n var sw = sx2 - sx1;\n var dx = Math.max(0, startX - region.x);\n if (Math.floor(sw) === 0) {\n return;\n }\n\n main.ctx.drawImage(\n region.c.canvas,\n s(sx1), 0, Math.floor(s(sw)), s(height),\n s(margin.left + region.x - startX + sx1), 0, s(sw), s(height));\n });\n }", "function refreshDomObjects() {\n // must update this, as sometimes after finishing page load the position changes, like when dnn adds the toolbar\n ___WEBPACK_IMPORTED_MODULE_0__[\"QuickE\"].bodyOffset = Positioning.getBodyPosition();\n if (___WEBPACK_IMPORTED_MODULE_0__[\"QuickE\"].config.innerBlocks.enable) {\n // get all content-block lists which are empty, or which allow multiple child-items\n var lists = Object(_interfaces_sxc_controller_in_page__WEBPACK_IMPORTED_MODULE_1__[\"$jq\"])(___WEBPACK_IMPORTED_MODULE_0__[\"QeSelectors\"].blocks.cb.listSelector).filter(\":not(.\" + ___WEBPACK_IMPORTED_MODULE_0__[\"QeSelectors\"].blocks.cb.singleItem + \"), :empty\");\n ___WEBPACK_IMPORTED_MODULE_0__[\"QuickE\"].contentBlocks = lists\n .find(___WEBPACK_IMPORTED_MODULE_0__[\"QeSelectors\"].blocks.cb.selector)\n .add(lists);\n }\n if (___WEBPACK_IMPORTED_MODULE_0__[\"QuickE\"].config.modules.enable)\n ___WEBPACK_IMPORTED_MODULE_0__[\"QuickE\"].modules = ___WEBPACK_IMPORTED_MODULE_0__[\"QuickE\"].cachedPanes\n .find(___WEBPACK_IMPORTED_MODULE_0__[\"QeSelectors\"].blocks.mod.selector)\n .add(___WEBPACK_IMPORTED_MODULE_0__[\"QuickE\"].cachedPanes);\n}", "function update() {\n\n\t\tif (root == null) {\n\t\t\treturn\n\t\t}\n\n\t\tlet bounds = element.bounds()\n\t\tlet fontSize = element.css('font-size')\n\t\tlet fontWeight = element.css('font-weight')\n\n\t\tif (measuredWidth == bounds.width &&\n\t\t\tmeasuredHeight == bounds.height &&\n\t\t\tmeasuredFontSize == fontSize &&\n\t\t\tmeasuredFontWeight == fontWeight) {\n\n\t\t\t/*\n\t\t\t * The area did not change thus the lines should remain\n\t\t\t * the same.\n\t\t\t */\n\n\t\t\treturn\n\t\t}\n\n\t\tmeasuredWidth = bounds.width\n\t\tmeasuredHeight = bounds.height\n\t\tmeasuredFontSize = fontSize\n\t\tmeasuredFontWeight = fontWeight\n\n\t\troot.innerHTML = html\n\n\t\telement.toggleClass('multiline', false)\n\n\t\tlet fragment = document.createDocumentFragment()\n\n\t\tbreakNode(root, fragment)\n\t\temptyNode(root)\n\n\t\troot.appendChild(fragment)\n\n\t\telement.toggleClass('multiline', true)\n\n\t\telement.find('.line').each((i, line) => {\n\n\t\t\tline = $(line)\n\t\t\tline.attr('data-nth-line', i + 1);\n\n\t\t\tline.attr('data-text', line.text())\n\n\t\t\tlet others = line.find(':not(.word)')\n\t\t\tline.toggleClass('plain', others.length == 0)\n\t\t\tline.toggleClass('mixed', others.length != 0)\n\n\t\t})\n\n\t\tif (options &&\n\t\t\toptions.onComplete) {\n\t\t\toptions.onComplete(element)\n\t\t}\n\n\t\telement.emit('breaklines/complete', element)\n\t}", "function m(e,t,n){for(var r=0;r<D.length;r++)if(!isFinite(e)||D[r]._index===e){t=isFinite(e)&&r===e?t:Q(D[r]._index);var o=be(D[r],t);if(o){var i=S.getSourcePageSize(D[r]._index,t?t.rotation:0);o.clearRect(0,0,i.width,i.height),n&&w(o,t)}}}", "function drawCanvas() {\n if( drawio.loadedIMG != ''){\n drawio.ctx.drawImage(drawio.loadedIMG, 0, 0);\n }\n for( var i = 0; i < drawio.shapes.length; i++) {\n drawio.shapes[i].render();\n }\n if(drawio.selectedElement) {\n drawio.selectedElement.render();\n }\n }", "render(){\n this.sbh.reportRendering();\n const { init, end, itemsContainer_hg, ghostView_hg, viewport_hg } = this.sbh;\n\n const visibleItems = this.state.items.slice( init, end ).map( ( obj, index )=> {\n return this.props.renderFunc( obj, index );\n } );\n console.log( 'style', { position:'relative', ...this.props.style } );\n return (\n <Scrollbars2 onScrollFrame={this.onScrollFrame} thumbMinSize={30}>\n <div className=\"ghostViewTop\" ref=\"ghostViewTop\" style={{ ...this.ghostStyle }} />\n <div ref=\"itemsContainer\" style={{ position:'relative', ...this.props.style }}\n className={this.props.className} >\n {visibleItems}\n </div>\n <div className=\"ghostViewBottom\" ref=\"ghostViewBottom\" style={{ ...this.ghostStyle }} />\n </Scrollbars2>\n );\n }", "function layout () {\n var rem = docEl.clientWidth * 100 / 750;\n docEl.style.fontSize = rem + 'px';\n }", "recalculateSizes() {\n let elem = ReactDOM.findDOMNode(this).parentNode;\n this.width = elem.offsetWidth - 30;\n this.divHeight = elem.offsetHeight;\n this.height = this.data.length * 60;\n this.barHeight = (this.height - 50) / this.data.length / 2;\n const minSize = Math.min(this.width, this.divHeight);\n this.textSize = minSize / 30;\n }", "function SaveTheView()\n{\n console.log($(\".display-area\")[0].children)\n var z=$(\".display-area\")[0].children.length;\n for(i=0;i<z;i++)\n {\n console.log($(\".display-area\")[0].children[i])\n console.log($(\".display-area\")[0].children[i].attributes.name.value)\n console.log($(\".display-area\")[0].children[i].style.position)\n console.log($(\".display-area\")[0].children[i].style.top)\n console.log($(\".display-area\")[0].children[i].style.left)\n \n shapes.id=$(\".display-area\")[0].children[i].id;\n shapes.type=$(\".display-area\")[0].children[i].attributes.name.value;\n shapes.position=$(\".display-area\")[0].children[i].style.position;\n shapes.left=$(\".display-area\")[0].children[i].style.left;\n shapes.top=$(\".display-area\")[0].children[i].style.top;\n }\n console.log(shapes)\n}", "function _redraw() {\n _self.container.style.left = _pixel.x - (_self.container.clientWidth / 2) + 'px';\n _self.container.style.top = _pixel.y - (_self.container.clientHeight) + 'px';\n }", "refreshRect() {\n\t\tvar posX = this.savedPosX + this.offsetX;\n\t\tvar posY = this.savedPosY + this.offsetY;\n\t\tvar sizeX = this.savedSizeX;\n\t\tvar sizeY = this.savedSizeY;\n\t\t\n\t\t// Calculate actual position and scale\n\t\tvar scale = renko.getWindowScale() * (2 / window.devicePixelRatio);\n\t\tposX = posX - sizeX/2 + renko.appWidth/2;\n\t\tposY = posY - sizeY/2 + renko.appHeight/2;\n\t\tposX *= scale;\n\t\tposY *= scale;\n\t\tsizeX *= scale;\n\t\tsizeY *= scale;\n\t\t\n\t\t// Apply transform\n\t\tthis.style.left = String(posX) + \"px\";\n\t\tthis.style.top = String(posY) + \"px\";\n\t\tthis.style.width = String(sizeX) + \"px\";\n\t\tthis.style.height = String(sizeY) + \"px\";\n\t}", "update() {\n if (!this.renderer.renderingToScreen) {\n return;\n }\n // update children...\n this.updateAccessibleObjects(this.renderer._lastObjectRendered);\n var rect = this.renderer.view.getBoundingClientRect();\n var sx = rect.width / this.renderer.width;\n var sy = rect.height / this.renderer.height;\n var div = this.div;\n div.style.left = (rect.left) + \"px\";\n div.style.top = (rect.top) + \"px\";\n div.style.width = (this.renderer.width) + \"px\";\n div.style.height = (this.renderer.height) + \"px\";\n for (var i = 0; i < this.children.length; i++) {\n var child = this.children[i];\n if (child.renderId !== this.renderId) {\n child._accessibleActive = false;\n UtilsSettings_1.UtilsSettings.removeItems(this.children, i, 1);\n this.div.removeChild(child._accessibleDiv);\n this.pool.push(child._accessibleDiv);\n child._accessibleDiv = null;\n i--;\n if (this.children.length === 0) {\n this.deactivate();\n }\n }\n else {\n // map div to display..\n div = child._accessibleDiv;\n var hitArea = child.hitArea;\n var wt = child.worldTransform;\n if (child.hitArea) {\n div.style.left = ((wt.tx + (hitArea.x * wt.a)) * sx) + \"px\";\n div.style.top = ((wt.ty + (hitArea.y * wt.d)) * sy) + \"px\";\n div.style.width = (hitArea.width * wt.a * sx) + \"px\";\n div.style.height = (hitArea.height * wt.d * sy) + \"px\";\n }\n else {\n hitArea = child.getBounds();\n this.capHitArea(hitArea);\n div.style.left = (hitArea.x * sx) + \"px\";\n div.style.top = (hitArea.y * sy) + \"px\";\n div.style.width = (hitArea.width * sx) + \"px\";\n div.style.height = (hitArea.height * sy) + \"px\";\n // update button titles and hints if they exist and they've changed\n if (div.title !== child.accessibleTitle && child.accessibleTitle !== null) {\n div.title = child.accessibleTitle;\n }\n if (div.getAttribute('aria-label') !== child.accessibleHint\n && child.accessibleHint !== null) {\n div.setAttribute('aria-label', child.accessibleHint);\n }\n }\n }\n }\n // increment the render id..\n this.renderId++;\n }", "static redraw() {\n let i = 0;\n let s = SmartCanvas.collection.length;\n\n for (; i < s; i++) {\n SmartCanvas.collection[i].redraw();\n }\n }", "[positionViews]() {\n\t\tconst self = this;\n\t\tconst viewSize = self[SIZE] === WIDTH ? self.borderWidth() : self.borderHeight();\n\t\tconst altViewSize = self[ALT_SIZE] === WIDTH ? self.borderWidth() : self.borderHeight();\n\t\tconst splitOffset = offsetToPixels(self.splitOffset(), viewSize);\n\n\t\tself[FIRST_VIEW][self[SIZE]](splitOffset)[self[ALT_SIZE]](altViewSize).resize(true);\n\n\t\tself[SECOND_VIEW][self[SIZE]](viewSize - splitOffset)[self[ALT_SIZE]](altViewSize)\n\t\t\t.css(self[SIZE_ORIGIN], splitOffset)\n\t\t\t.css(self[ALT_SIZE_ORIGIN], ZERO_PIXELS)\n\t\t\t.resize(true);\n\t}", "updateChildren(view, pos) {\n let inline = this.node.inlineContent, off = pos;\n let composition = view.composing ? this.localCompositionInfo(view, pos) : null;\n let localComposition = composition && composition.pos > -1 ? composition : null;\n let compositionInChild = composition && composition.pos < 0;\n let updater = new ViewTreeUpdater(this, localComposition && localComposition.node, view);\n iterDeco(this.node, this.innerDeco, (widget, i, insideNode) => {\n if (widget.spec.marks)\n updater.syncToMarks(widget.spec.marks, inline, view);\n else if (widget.type.side >= 0 && !insideNode)\n updater.syncToMarks(i == this.node.childCount ? Mark$1.none : this.node.child(i).marks, inline, view);\n updater.placeWidget(widget, view, off);\n }, (child, outerDeco, innerDeco, i) => {\n updater.syncToMarks(child.marks, inline, view);\n let compIndex;\n if (updater.findNodeMatch(child, outerDeco, innerDeco, i))\n ;\n else if (compositionInChild && view.state.selection.from > off && view.state.selection.to < off + child.nodeSize && (compIndex = updater.findIndexWithChild(composition.node)) > -1 && updater.updateNodeAt(child, outerDeco, innerDeco, compIndex, view))\n ;\n else if (updater.updateNextNode(child, outerDeco, innerDeco, view, i))\n ;\n else {\n updater.addNode(child, outerDeco, innerDeco, view, off);\n }\n off += child.nodeSize;\n });\n updater.syncToMarks([], inline, view);\n if (this.node.isTextblock)\n updater.addTextblockHacks();\n updater.destroyRest();\n if (updater.changed || this.dirty == CONTENT_DIRTY) {\n if (localComposition)\n this.protectLocalComposition(view, localComposition);\n renderDescs(this.contentDOM, this.children, view);\n if (ios)\n iosHacks(this.dom);\n }\n }", "start() {\n this.collectedNodes.length = 0;\n this.visualIndex = 0;\n\n const { rootNode, sizeSet } = this;\n const isShared = this.isSharedViewSet();\n const { nextSize } = sizeSet.getViewSize();\n\n let childElementCount = this.getRenderedChildCount();\n\n while (childElementCount < nextSize) {\n const newNode = this.nodesPool();\n\n if (!isShared || (isShared && sizeSet.isPlaceOn(WORKING_SPACE_BOTTOM))) {\n rootNode.appendChild(newNode);\n } else {\n rootNode.insertBefore(newNode, rootNode.firstChild);\n }\n childElementCount += 1;\n }\n\n const isSharedPlacedOnTop = (isShared && sizeSet.isPlaceOn(WORKING_SPACE_TOP));\n\n while (childElementCount > nextSize) {\n rootNode.removeChild(isSharedPlacedOnTop ? rootNode.firstChild : rootNode.lastChild);\n childElementCount -= 1;\n }\n }", "function rebuildScreenOne() {\n\n // set attributes to start value\n totalRowWidth = 0;\n rowWidths = [];\n\n // get new container width\n containerWidth = getContainerWidth();\n\n // set new rows\n setRows(images);\n\n // get new last row index\n lastRowIndex = getLastRowIndex(images);\n\n // calculate new relative percentage of new rows\n calculateRelativePercentage(images);\n\n // scale\n scaleImages(images);\n\n // delete dots\n deleteDots();\n\n // make new dots\n makeDots();\n\n // check if dot of dotIndex still exists\n checkDotExistence(dotIndex);\n\n // show the content of dot dotIndex\n showContentDot(dotIndex);\n}", "refresh() {\n // Read\n this.percentPosition = this.parseWrapperPosition();\n this.size = this.getContentSize();\n this.position = this.getWrapperPosition();\n\n // Write async so that multiple hotspots can be refreshed at a time without\n // causing layout thrashing.\n this.refreshId = requestAnimationFrame(() => {\n this._removeContentPosition();\n this.setPosition();\n });\n }", "function updateAll() {\n\tdrawAll();\n\tblob.move();\n}", "function refresh() {\n\t\t\tself.getNodePosition();\n\t\t\tself.getViewPortSize();\n\t\t\tcheck(null, {});\n\t\t}", "renderAndAdjust() {\n this.hot.render();\n\n // Dirty workaround to prevent scroll height not adjusting to the table height. Needs refactoring in the future.\n this.hot.view.adjustElementsSize();\n }", "draw() {\n this.setSize();\n this.setSizeBounds();\n this.move();\n this.coordinates = getPlaneCoordinates(this);\n this.gridCoordinates = getGridCoordinates(this);\n }", "update()\n {\n if (!this.renderer.renderingToScreen)\n {\n return;\n }\n\n // update children...\n this.updateAccessibleObjects(this.renderer._lastObjectRendered);\n\n const rect = this.renderer.view.getBoundingClientRect();\n const sx = rect.width / this.renderer.width;\n const sy = rect.height / this.renderer.height;\n\n let div = this.div;\n\n div.style.left = `${rect.left}px`;\n div.style.top = `${rect.top}px`;\n div.style.width = `${this.renderer.width}px`;\n div.style.height = `${this.renderer.height}px`;\n\n for (let i = 0; i < this.children.length; i++)\n {\n const child = this.children[i];\n\n if (child.renderId !== this.renderId)\n {\n child._accessibleActive = false;\n\n core.utils.removeItems(this.children, i, 1);\n this.div.removeChild(child._accessibleDiv);\n this.pool.push(child._accessibleDiv);\n child._accessibleDiv = null;\n\n i--;\n\n if (this.children.length === 0)\n {\n this.deactivate();\n }\n }\n else\n {\n // map div to display..\n div = child._accessibleDiv;\n let hitArea = child.hitArea;\n const wt = child.worldTransform;\n\n if (child.hitArea)\n {\n div.style.left = `${(wt.tx + (hitArea.x * wt.a)) * sx}px`;\n div.style.top = `${(wt.ty + (hitArea.y * wt.d)) * sy}px`;\n\n div.style.width = `${hitArea.width * wt.a * sx}px`;\n div.style.height = `${hitArea.height * wt.d * sy}px`;\n }\n else\n {\n hitArea = child.getBounds();\n\n this.capHitArea(hitArea);\n\n div.style.left = `${hitArea.x * sx}px`;\n div.style.top = `${hitArea.y * sy}px`;\n\n div.style.width = `${hitArea.width * sx}px`;\n div.style.height = `${hitArea.height * sy}px`;\n }\n }\n }\n\n // increment the render id..\n this.renderId++;\n }", "loadElements() {\n\t\tif (this.elementInView()) {\n\t\t\tfor (let i = 0; i < this.elements.length; i++) {\n\t\t\t\twindow.setTimeout(() => {\n\t\t\t\t\tObject.keys(this.options.style).forEach(key => {\n\t\t\t\t\t\tif ([\"scale\", \"rotate\"].includes(key)) {\n\t\t\t\t\t\t\tthis.elements[i].style.transform = this.initialStyles[i].transform;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis.elements[i].style[key] = this.initialStyles[i][key];\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}, this.options.delay * i)\n\n\t\t\t\twindow.setTimeout(() => {\n\t\t\t\t\tthis.elements[i].style.transition = this.initialStyles.transition;\n\t\t\t\t\tthis.elements[i].style.position = this.initialStyles.position;\n\t\t\t\t}, this.options.delay * this.elements.length);\n\t\t\t}\n\t\t\twindow.removeEventListener(\"scroll\", this.loadElements);\n\t\t}\n\t}", "function draw_viewer() {\n canvas.innerHTML = \"\";\n var n = curr_row;\n while(n < data.length && \n n < (curr_row + ROWS_TO_SHOW)) {\n var div = document.createElement(\"div\");\n div.style.width = 8 * IMG_WIDTH + \"px\";\n var h3 = document.createElement(\"span\");\n h3.innerHTML = data[n].timestamp.replace('T', ' ');\n div.appendChild(h3);\n div.appendChild(document.createElement(\"br\"));\n data[n].imageobjs.each(function(imageobj) {\n imageobj.addEventListener(\"click\", function() {\n window.open(imageobj.src);\n }, false);\n div.appendChild(imageobj);\n });\n canvas.appendChild(div); \n n++;\n } \n }", "function layoutUI(sizeObj, scrollObj) {\n //\n }", "function _calculateSize() {\r\n contentWidth = parseInt($(\"#\" + divid).width());\r\n contentHeight = parseInt($(\"#\" + divid).height());\r\n $(\"#\" + divid).remove();\r\n sizeGetCallback(contentOrJQObj, _getLayerPos(clientSize, { Width: contentWidth, Height: contentHeight }));\r\n }", "setPageSize() {\n let height = 0;\n for ( let i = 0; i < this['$content'].rows.all.length; i++ ) {\n height += this['$content'].rows.all[i].size;\n }\n let width = 0;\n for ( let i = 0; i < this['$content'].columns.all.length; i++ ) {\n width += this['$content'].columns.all[i].size;\n }\n this['$container']['$node'].style.width = width + 'px';\n this['$container']['$node'].style.height = height + 'px';\n }", "function updateData() {\n angular.forEach(elements, function (element, id){\n if($(document).find(element).length) {\n data[id] = {\n \"x\": element.offset().left - element.parents('.bpContainer').offset().left,\n \"y\": element.offset().top - element.parents('.bpContainer').offset().top\n }\n }\n else {\n delete elements[id];\n }\n });\n setCoordinates();\n }", "function __zoot_c3d__process_DOM() {\n let containers = document.body.getElementsByTagName('zoot-c3d-root-container');\n for (let i = 0; i < containers.length; i++) {\n __zoot_c3d__process_Component(undefined, containers[i]);\n __zoot_c3d__g_root_containers.push(containers[i]);\n containers[i].zoot_c3d_sync();\n }\n}", "function mapDOMtoPosition() {\n var i;\n var node;\n for (i = 0; i < config.doi.length; i++) {\n node = config.doi[i][\"node\"];\n config.doi[i][\"id\"] = \"doi-\" + i;\n config.doi[i][\"y\"] = node.offsetTop;\n }\n config.doiSnappingPosition = screen.height / 2.5;\n // console.log(config.doi, config.doiSnappingPosition);\n // TODO sort based on offset?\n }", "layout() {\n var d = document.documentElement;\n var oldHeight = d.scrollHeight;\n this.reset()\n this.setOrders()\n this.populateHeights()\n this.setLayout()\n if (autoPosition === true) {\n adjustWindowHeight (oldHeight, d.scrollHeight)\n }\n this.pad()\n }", "applyLayout(){\n let cy = new Cytoscape({\n headless: true,\n elements: makeCyEles( this.elements() ),\n layout: { name: 'grid' },\n styleEnabled: true\n });\n\n let runLayout = () => {\n let layout = cy.layout( _.assign( {}, getCyLayoutOpts(), {\n animate: false,\n randomize: true\n } ) );\n\n let layoutDone = layout.promiseOn('layoutstop');\n\n layout.run();\n\n return layoutDone;\n };\n\n let savePositions = () => Promise.all( this.elements().map( docEl => {\n let el = cy.getElementById( docEl.id() );\n\n return docEl.reposition( _.clone( el.position() ) );\n } ) );\n\n return tryPromise( runLayout ).then( savePositions );\n }", "function draw() {\n\n /*\n * Resize canvas in accordance with size of parent container\n */\n scope.defaultWidth = scope.width;\n scope.width = element[0].clientWidth;\n if (scope.width === 0) {\n scope.width = element[0].parentElement.clientWidth;\n if (scope.width === 0)\n scope.width = scope.defaultWidth; // fallback to passed in width\n }\n\n scope.defaultHeight = scope.height;\n scope.height = element[0].clientHeight;\n if (scope.height === 0) {\n scope.height = element[0].parentElement.clientHeight;\n if (scope.height === 0)\n scope.height = scope.defaultHeight; // fallback to passed in height\n }\n\n svg.attr(D3V.CSS_WIDTH, scope.width)\n .attr(D3V.CSS_HEIGHT, scope.height);\n\n /*\n * clear the elements inside of the directive\n */\n svgGroup.selectAll(SYNTAX.STAR).remove();\n\n var treeData = initNode(scope.vdbEntry);\n\n /*\n * Assign the selection listener to the click event of the svg\n * Call an initial zoom on the svg\n */\n svg.on(D3V.HTML_CLICK, selectionCallback).call(zoomListener);\n\n root = treeData;\n\n // Will call update\n expandCollapseChildCallback(root);\n }", "_updateSize() {\n if (qx.ui.mobile.core.Blocker.ROOT == this.getLayoutParent()) {\n this.getContainerElement().style.top =\n qx.bom.Viewport.getScrollTop() + \"px\";\n this.getContainerElement().style.left =\n qx.bom.Viewport.getScrollLeft() + \"px\";\n this.getContainerElement().style.width =\n qx.bom.Viewport.getWidth() + \"px\";\n this.getContainerElement().style.height =\n qx.bom.Viewport.getHeight() + \"px\";\n } else if (this.getLayoutParent() != null) {\n var dimension = qx.bom.element.Dimension.getSize(\n this.getLayoutParent().getContainerElement()\n );\n\n this.getContainerElement().style.width = dimension.width + \"px\";\n this.getContainerElement().style.height = dimension.height + \"px\";\n }\n }", "function prepareAndStyle(){var viewBoxSize=this.config?this.config.viewBoxSize:config.defaultViewBoxSize;angular.forEach({'fit':'','height':'100%','width':'100%','preserveAspectRatio':'xMidYMid meet','viewBox':this.element.getAttribute('viewBox')||'0 0 '+viewBoxSize+' '+viewBoxSize,'focusable':false// Disable IE11s default behavior to make SVGs focusable\n\t},function(val,attr){this.element.setAttribute(attr,val);},this);}", "drawHTMLBoard() {\r\n for (let column of this.spaces) {\r\n for (let space of column) {\r\n space.drawSVGSpace();\r\n }\r\n }\r\n\t}", "drawHTMLBoard () {\n for (let column of this.spaces) {\n for (let space of column) {\n space.drawSVGSpace();\n }\n }\n }", "render() {\n const { rootNode, sizeSet } = this;\n let visualIndex = this.visualIndex;\n\n if (this.isSharedViewSet() && sizeSet.isPlaceOn(WORKING_SPACE_BOTTOM)) {\n visualIndex += sizeSet.sharedSize.nextSize;\n }\n\n let node = rootNode.childNodes[visualIndex];\n\n if (node.tagName !== this.childNodeType) {\n const newNode = this.nodesPool();\n\n rootNode.replaceChild(newNode, node);\n node = newNode;\n }\n\n this.collectedNodes.push(node);\n this.visualIndex += 1;\n }", "_refreshLayout() {\n const that = this;\n const source = that.rows;\n\n if (that._layoutSuspended) {\n return;\n }\n\n that._visibleRows = null;\n that.__viewRows = null;\n that.__clientSize = null;\n that.__scrollHeight = null;\n that.__scrollWidth = null;\n that.__parentCells = null;\n\n that.$.columnFarContainer.classList.remove('vscroll');\n that.$.columnNearContainer.classList.remove('vscroll');\n\n that.$.scrollView.classList.remove('hscroll');\n that.$.scrollView.classList.remove('vscroll');\n\n that._refreshElementsVisibility();\n that._refreshColumnHeights();\n that._refreshContentHeight();\n\n if (!(source && source.url)) {\n if (!source || source === null || source.length === 0 || that.columns.length === 0) {\n that.$.placeholder.classList.remove('smart-hidden');\n\n that.scrollWidth = 0;\n that.scrollHeight = 0;\n\n return;\n }\n }\n\n if (!that.__columnHeaderHeight) {\n that.__columnHeaderHeight = that.$.columnHeader.offsetHeight;\n }\n\n if (!that.__filterFooterOffsetHeight) {\n that.__filterFooterOffsetHeight = that.$.filterFooter.classList.contains('smart-hidden') ? 0 : that.$.filterFooter.offsetHeight;\n }\n\n const scrollViewOffsetHeight = that._contentHeight - that.__filterFooterOffsetHeight - that.__columnHeaderHeight;\n\n that.$.scrollView.style.height = scrollViewOffsetHeight + 'px';\n that.htmlColumnLastChild.style.height = that.__columnHeaderHeight + 'px';\n\n\n if (that.paging.spinner.enabled && that.paging.enabled) {\n if (!that.pageScroll) {\n const pageScroll = document.createElement('smart-scroll-bar');\n\n pageScroll.orientation = 'vertical';\n pageScroll.style.height = '100%';\n pageScroll.style.width = '100%';\n pageScroll.max = Math.ceil(that.dataSource.length / that.paging.pageSize);\n pageScroll.step = that.paging.spinner.step;\n pageScroll.largeStep = that.paging.spinner.step;\n pageScroll.setAttribute('spinner', '');\n pageScroll.setAttribute('smart-id', 'spinner');\n pageScroll.ownerElement = that;\n\n that.addPropertyBinding('[[paging_spinner_step]]', 'step', pageScroll, that.$.columnHeader);\n\n pageScroll.addEventListener('change', function (event) {\n that.paging.pageIndex = event.detail.value;\n });\n\n that.pageScroll = pageScroll;\n }\n\n that.htmlColumnLastChild.appendChild(that.pageScroll);\n }\n else {\n that.htmlColumnLastChild.innerHTML = '';\n }\n\n that._refreshScrollBars();\n\n }", "function main() { // Static publishing only\n\t\tvar rl = regObjArr.length;\n\t\tfor (var i = 0; i < rl; i++) { // For each registered object element\n\t\t\tvar id = regObjArr[i].id;\n var obj = getElementById(id);\n if (obj) {\n regObjArr[i].width = obj.getAttribute(\"width\") ? obj.getAttribute(\"width\") : \"0\";\n regObjArr[i].height = obj.getAttribute(\"height\") ? obj.getAttribute(\"height\") : \"0\";\n setVisibility(id, true);\n }\n\t\t}\n\t}", "function refreshXYIndexes()\r\n{\r\n // redraw text nodes on the X axis\r\n for (var i = 0; i <= xDivisions; i++)\r\n if (typeof xIndexes[i].getBBox != \"undefined\")\r\n try \r\n {\r\n textWidth = xIndexes[i].getBBox().width;\r\n textHeight = xIndexes[i].getBBox().height;\r\n xIndexes[i].setAttribute(\"x\", i*width/xDivisions - textWidth/2);\r\n xIndexes[i].setAttribute(\"y\", height + 10 + textHeight);\r\n xIndexes[i].setAttribute(\"stroke\", \"black\");\r\n } \r\n catch(e) {}\r\n // redraw text nodes on the Y axis\r\n for (var i = 0; i <= yDivisions; i++)\r\n if (typeof yIndexes[i].getBBox != \"undefined\") \r\n try \r\n {\r\n twidth = yIndexes[i].getBBox().width;\r\n theight = yIndexes[i].getBBox().height;\r\n yIndexes[i].setAttribute(\"y\", height-i*height/yDivisions\r\n +theight/2);\r\n yIndexes[i].setAttribute(\"x\", -10 -twidth);\r\n yIndexes[i].setAttribute(\"stroke\", \"black\");\r\n } \r\n catch(e) {} \r\n}", "function updateDOM() {\n\tvar newTree = render(data);\n\tvar patches = diff(tree, newTree);\n\trootNode = patch(rootNode, patches);\n\ttree = newTree;\n}", "makeDragProxy() {\n // create a div to hold the first five blocks at most\n const div = document.createElement('div');\n div.style.display = 'inline-block';\n div.style.position = 'relative';\n const nodes = this.selectedElements.map(elem => this.layout.nodeFromElement(elem));\n const limit = Math.min(5, nodes.length);\n let x = 0;\n let width = 0;\n let height = 0;\n for (let i = 0; i < limit; i += 1) {\n const node = nodes[i].el;\n const clone = node.cloneNode(true);\n clone.style.position = 'absolute';\n clone.style.left = `${x}px`;\n clone.style.top = `0px`;\n clone.style.transform = null;\n clone.style.opacity = (1 / limit) * (limit - i);\n div.appendChild(clone);\n width += node.clientWidth;\n height = Math.max(height, node.clientHeight);\n x += node.clientWidth;\n }\n div.style.width = `${width}px`;\n div.style.height = `${height}px`;\n return div;\n }", "updateDOM(dom, view) { return false; }", "draw() {\n this._updateWidthHeight();\n\n this.initSvg();\n // bar char\n if (this.keysBar) {\n this.aggregateLabelsByKeys(this.selection, this.keysBar);\n }\n\n if (this.keysX && this.keysY) {\n this.aggregateValuesByKeys(this.selection, this.keysX, this.keysY);\n }\n\n this.barChart.draw();\n // scatterplot\n // this.scatter.draw();\n }", "function drawElements() {\n that.gameArea.paint(that.contex);\n that.food.paint(that.contex, that.gameArea.cellSize);\n that.snake.paint(that.contex, that.gameArea.cellSize);\n }", "_updateRenderedRange() {\n if (!this._viewport) {\n return;\n }\n const renderedRange = this._viewport.getRenderedRange();\n const newRange = { start: renderedRange.start, end: renderedRange.end };\n const viewportSize = this._viewport.getViewportSize();\n const dataLength = this._viewport.getDataLength();\n let scrollOffset = this._viewport.measureScrollOffset();\n let firstVisibleIndex = scrollOffset / this._itemSize;\n // If user scrolls to the bottom of the list and data changes to a smaller list\n if (newRange.end > dataLength) {\n // We have to recalculate the first visible index based on new data length and viewport size.\n const maxVisibleItems = Math.ceil(viewportSize / this._itemSize);\n const newVisibleIndex = Math.max(0, Math.min(firstVisibleIndex, dataLength - maxVisibleItems));\n // If first visible index changed we must update scroll offset to handle start/end buffers\n // Current range must also be adjusted to cover the new position (bottom of new list).\n if (firstVisibleIndex != newVisibleIndex) {\n firstVisibleIndex = newVisibleIndex;\n scrollOffset = newVisibleIndex * this._itemSize;\n newRange.start = Math.floor(firstVisibleIndex);\n }\n newRange.end = Math.max(0, Math.min(dataLength, newRange.start + maxVisibleItems));\n }\n const startBuffer = scrollOffset - newRange.start * this._itemSize;\n if (startBuffer < this._minBufferPx && newRange.start != 0) {\n const expandStart = Math.ceil((this._maxBufferPx - startBuffer) / this._itemSize);\n newRange.start = Math.max(0, newRange.start - expandStart);\n newRange.end = Math.min(dataLength, Math.ceil(firstVisibleIndex + (viewportSize + this._minBufferPx) / this._itemSize));\n }\n else {\n const endBuffer = newRange.end * this._itemSize - (scrollOffset + viewportSize);\n if (endBuffer < this._minBufferPx && newRange.end != dataLength) {\n const expandEnd = Math.ceil((this._maxBufferPx - endBuffer) / this._itemSize);\n if (expandEnd > 0) {\n newRange.end = Math.min(dataLength, newRange.end + expandEnd);\n newRange.start = Math.max(0, Math.floor(firstVisibleIndex - this._minBufferPx / this._itemSize));\n }\n }\n }\n this._viewport.setRenderedRange(newRange);\n this._viewport.setRenderedContentOffset(this._itemSize * newRange.start);\n this._scrolledIndexChange.next(Math.floor(firstVisibleIndex));\n }", "_updatePositions() {\n let direction = this.options.direction;\n let largestHeight = 0;\n if(this.lastIndex === -1)\n return;\n\n if(this.options.onPosition && typeof this.options.onPosition === 'function')\n this.options.onPosition.call();\n\n this.rows.forEach(row => {\n row.forEach(rowItem => {\n let itemBottom = rowItem.position.top + rowItem.item.offsetHeight;\n rowItem.item.style.top = rowItem.position.top + 'px';\n rowItem.item.style[direction] = rowItem.position[direction] + 'px';\n if(largestHeight < itemBottom)\n largestHeight = itemBottom;\n });\n });\n\n this.element.style.height = largestHeight + 'px';\n\n if(this.options.onPositioned && typeof this.options.onPositioned === 'function')\n this.options.onPositioned.call();\n }", "_updateRenderedRange() {\n if (!this._viewport) {\n return;\n }\n const renderedRange = this._viewport.getRenderedRange();\n const newRange = { start: renderedRange.start, end: renderedRange.end };\n const viewportSize = this._viewport.getViewportSize();\n const dataLength = this._viewport.getDataLength();\n let scrollOffset = this._viewport.measureScrollOffset();\n // Prevent NaN as result when dividing by zero.\n let firstVisibleIndex = (this._itemSize > 0) ? scrollOffset / this._itemSize : 0;\n // If user scrolls to the bottom of the list and data changes to a smaller list\n if (newRange.end > dataLength) {\n // We have to recalculate the first visible index based on new data length and viewport size.\n const maxVisibleItems = Math.ceil(viewportSize / this._itemSize);\n const newVisibleIndex = Math.max(0, Math.min(firstVisibleIndex, dataLength - maxVisibleItems));\n // If first visible index changed we must update scroll offset to handle start/end buffers\n // Current range must also be adjusted to cover the new position (bottom of new list).\n if (firstVisibleIndex != newVisibleIndex) {\n firstVisibleIndex = newVisibleIndex;\n scrollOffset = newVisibleIndex * this._itemSize;\n newRange.start = Math.floor(firstVisibleIndex);\n }\n newRange.end = Math.max(0, Math.min(dataLength, newRange.start + maxVisibleItems));\n }\n const startBuffer = scrollOffset - newRange.start * this._itemSize;\n if (startBuffer < this._minBufferPx && newRange.start != 0) {\n const expandStart = Math.ceil((this._maxBufferPx - startBuffer) / this._itemSize);\n newRange.start = Math.max(0, newRange.start - expandStart);\n newRange.end = Math.min(dataLength, Math.ceil(firstVisibleIndex + (viewportSize + this._minBufferPx) / this._itemSize));\n }\n else {\n const endBuffer = newRange.end * this._itemSize - (scrollOffset + viewportSize);\n if (endBuffer < this._minBufferPx && newRange.end != dataLength) {\n const expandEnd = Math.ceil((this._maxBufferPx - endBuffer) / this._itemSize);\n if (expandEnd > 0) {\n newRange.end = Math.min(dataLength, newRange.end + expandEnd);\n newRange.start = Math.max(0, Math.floor(firstVisibleIndex - this._minBufferPx / this._itemSize));\n }\n }\n }\n this._viewport.setRenderedRange(newRange);\n this._viewport.setRenderedContentOffset(this._itemSize * newRange.start);\n this._scrolledIndexChange.next(Math.floor(firstVisibleIndex));\n }", "function draw() {\n\t\t\t// Adjust render settings if we switched to multiple viewports or vice versa\n\t\t\tif (medeactx.frame_flags & medeactx.FRAME_VIEWPORT_UPDATED) {\n\t\t\t\tif (medeactx.GetEnabledViewportCount()>1) {\n\t\t\t\t\tmedeactx.gl.enable(medeactx.gl.SCISSOR_TEST);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tmedeactx.gl.disable(medeactx.gl.SCISSOR_TEST);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Perform rendering\n\t\t\tvar viewports = medeactx.GetViewports();\n\t\t\tfor(var vn = 0; vn < viewports.length; ++vn) {\n\t\t\t\tviewports[vn].Render(medeactx,dtime);\n\t\t\t}\n\t\t}", "function updateMetrics() {\n\n isVwDirty = false;\n DPR = window.devicePixelRatio;\n cssCache = {};\n sizeLengthCache = {};\n\n pf.DPR = DPR || 1;\n\n units.width = Math.max(window.innerWidth || 0, docElem.clientWidth);\n units.height = Math.max(window.innerHeight || 0, docElem.clientHeight);\n\n units.vw = units.width / 100;\n units.vh = units.height / 100;\n\n evalId = [ units.height, units.width, DPR ].join(\"-\");\n\n units.em = pf.getEmValue();\n units.rem = units.em;\n }", "updateTextPosition(blobDOM, x, y, width, height) {\n d3.select(blobDOM.node().parentNode).select(\"foreignObject\")\n .attr(\"x\", x)\n .attr(\"y\", y)\n .attr('width', width)\n .attr(\"height\", height)\n }", "function generate() {\n for (i = 0; i < points.length; i++ ){ \n points[i].offset = $(`ul.layer li#${[i]}`).offset();\n points[i].width = $(`ul.layer li#${[i]}`).width();\n points[i].height = $(`ul.layer li#${[i]}`).height();\n };\n }", "saveDimensions() {\n this.items.forEach((item) => {\n item.update();\n });\n\n // Window width and height without scrollbars.\n this.viewportHeight = window.innerHeight;\n this.viewportWidth = document.documentElement.clientWidth;\n\n return this;\n }", "function update() {\n\t\t\n\t\t// Call measure each time before we update to make sure all our our layout properties are set correctly\n\t\tmeasure();\n\t\t\n\t\t// Layout all of our primary SVG d3.elements.\n\t\tsvg.attr(\"width\", size.measuredWidth).attr(\"height\", size.measuredHeight);\n\t\tbackground.attr(\"width\", size.measuredWidth).attr(\"height\", size.measuredHeight);\n\t\tplot.attr('transform','translate(' + size.left + ',' + size.top + ')')\n\t\t\n\t\tscope.dispatch.apply('updated', viz);\n\t\t\n\t}", "function reLayout() {\n var newHeight, newWidth;\n // Figure out what is limiting the size of our container and resize accordingly\n if ($(\"body\").height() * CANVAS_RATIO > $(\"body\").width()) {\n // Limited by width\n newWidth = $(\"body\").width();\n newHeight = $(\"body\").width() / CANVAS_RATIO;\n } else {\n // Limited by height\n if ($(\"body\").height() < parseInt($(\"#draw-container\").css(\"min-height\"))) {\n newWidth = $(\"#draw-container\").css(\"min-height\") * CANVAS_RATIO;\n newHeight = $(\"#draw-container\").css(\"min-height\");\n } else {\n newWidth = $(\"body\").height() * CANVAS_RATIO;\n newHeight = $(\"body\").height();\n }\n }\n\n $(\"#draw-container\").css({\"width\" : newWidth, \"height\": newHeight});\n $(canvas).css({\"width\": newWidth, \"height\": newHeight});\n\n // Save some info about the canvas for later calculations\n canvas.offsetX = $(canvas).offset()[\"left\"];\n canvas.offsetY = $(canvas).offset()[\"top\"];\n }", "draw() {\n if (!this.layout || typeof this.layout === 'string') {\n return;\n }\n // Calc view dims for the nodes\n this.applyNodeDimensions();\n // Recalc the layout\n const result = this.layout.run(this.graph);\n const result$ = result instanceof rxjs__WEBPACK_IMPORTED_MODULE_7__[\"Observable\"] ? result : Object(rxjs__WEBPACK_IMPORTED_MODULE_7__[\"of\"])(result);\n this.graphSubscription.add(result$.subscribe(graph => {\n this.graph = graph;\n this.tick();\n }));\n if (this.graph.nodes.length === 0) {\n return;\n }\n result$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_8__[\"first\"])()).subscribe(() => this.applyNodeDimensions());\n }", "function updateObjects() {\n st.removeAllChildren();\n currkeys = null;\n\n var uh = c.height/3*2+c.height/4;\n var bh = c.height-uh;\n\n if (mode==0) {\n generateMouse(0,0,c.width,uh);\n } else {\n generateKeyboard(0,0,c.width,uh);\n }\n generateFooter(0,uh,c.width,bh);\n\n st.update();\n}", "function getSizes()\n {\n sizes.field.rows = 3;\n sizes.field.cols = 6;\n\n sizes.desk.height = DOM.parent.offsetHeight / 3;\n sizes.desk.width = properties.coverSize.width * sizes.desk.height / properties.coverSize.height;\n sizes.deskContainer.marginBottom = sizes.desk.width / 2;\n\n sizes.card.height = DOM.parent.offsetHeight / 4.5;\n sizes.card.width = properties.coverSize.width * sizes.card.height / properties.coverSize.height;\n }", "static svgViewport(svg, xOffset,yOffset,width, height, scale) {\n\t\tsvg.setAttributeNS('', 'width', '' + width);\n\t\tsvg.setAttributeNS('', 'height', '' + height);\n\t\tsvg.setAttributeNS('', 'viewBox', ''+xOffset + ' ' + yOffset + ' ' + Math.round(width / scale) + ' ' +\n\t\t\tMath.round(height / scale));\n\t}", "function onPageLoad() {\n // winResize();\n // winScroll();\n }", "_layoutWords() {\n //sort from most popular to least\n this._positions = [];\n this._data['topics'].sort(function(a, b) {\n return b['volume'] - a['volume'];\n });\n\n //add all elements, measure and then calculate optimal position\n this._data['topics'].map((value, index) => {\n this._targetEl.appendChild(value.el);\n setTimeout((item => {\n item.width = item.el.clientWidth;\n item.height = item.el.clientHeight;\n this._setWordPosition(item);\n }).bind(undefined, value), 100);\n return value;\n });\n }", "applyNodeDimensions() {\n if (this.nodeElements && this.nodeElements.length) {\n this.nodeElements.map(elem => {\n const nativeElement = elem.nativeElement;\n const node = this.graph.nodes.find(n => n.id === nativeElement.id);\n if (!node) {\n return;\n }\n // calculate the height\n let dims;\n try {\n dims = nativeElement.getBBox();\n if (!dims.width || !dims.height) {\n return;\n }\n }\n catch (ex) {\n // Skip drawing if element is not displayed - Firefox would throw an error here\n return;\n }\n if (this.nodeHeight) {\n node.dimension.height =\n node.dimension.height && node.meta.forceDimensions ? node.dimension.height : this.nodeHeight;\n }\n else {\n node.dimension.height =\n node.dimension.height && node.meta.forceDimensions ? node.dimension.height : dims.height;\n }\n if (this.nodeMaxHeight) {\n node.dimension.height = Math.max(node.dimension.height, this.nodeMaxHeight);\n }\n if (this.nodeMinHeight) {\n node.dimension.height = Math.min(node.dimension.height, this.nodeMinHeight);\n }\n if (this.nodeWidth) {\n node.dimension.width =\n node.dimension.width && node.meta.forceDimensions ? node.dimension.width : this.nodeWidth;\n }\n else {\n // calculate the width\n if (nativeElement.getElementsByTagName('text').length) {\n let maxTextDims;\n try {\n for (const textElem of nativeElement.getElementsByTagName('text')) {\n const currentBBox = textElem.getBBox();\n if (!maxTextDims) {\n maxTextDims = currentBBox;\n }\n else {\n if (currentBBox.width > maxTextDims.width) {\n maxTextDims.width = currentBBox.width;\n }\n if (currentBBox.height > maxTextDims.height) {\n maxTextDims.height = currentBBox.height;\n }\n }\n }\n }\n catch (ex) {\n // Skip drawing if element is not displayed - Firefox would throw an error here\n return;\n }\n node.dimension.width =\n node.dimension.width && node.meta.forceDimensions ? node.dimension.width : maxTextDims.width + 20;\n }\n else {\n node.dimension.width =\n node.dimension.width && node.meta.forceDimensions ? node.dimension.width : dims.width;\n }\n }\n if (this.nodeMaxWidth) {\n node.dimension.width = Math.max(node.dimension.width, this.nodeMaxWidth);\n }\n if (this.nodeMinWidth) {\n node.dimension.width = Math.min(node.dimension.width, this.nodeMinWidth);\n }\n });\n }\n }", "function refresh() {\n ranArrInd(imgArr.length);\n imgOneEl.src = imgArr[imgInd[0]].path;\n imgTwoEl.src = imgArr[imgInd[1]].path;\n imgThreeEl.src = imgArr[imgInd[2]].path;\n imgOneEl.name = imgArr[imgInd[0]].name;\n imgTwoEl.name = imgArr[imgInd[1]].name;\n imgThreeEl.name = imgArr[imgInd[2]].name;\n imgArr[imgInd[0]].views += 1; //Tracking the number of times the image appears on screen\n imgArr[imgInd[1]].views += 1;\n imgArr[imgInd[2]].views += 1;\n}", "_resizeHandler() {\n\n\t\tconst bounds= this.getBoundingClientRect();\n\n\t\tthis._dimens.width= bounds.width;\n\t\tthis._dimens.height= bounds.width;\n\n\t\tthis._root.querySelector('.wrapper').style.height= `${this._dimens.height}px`;\n\n\t\tfor(let row of this._grid) {\n\n\t\t\tfor(let col of row) {\n\n\t\t\t\tcol.$elem.style.width= (this._dimens.width/this.rows - 10) + 'px';\n\t\t\t\tcol.$elem.style.height= (this._dimens.height/this.cols - 10) + 'px';\n\t\t\t}\n\t\t}\n\t}", "function drawelements() {\n\t// show state\n\tif (showstate) {\n\t\t//eoutstateman.firstChild.nodeValue = \"State \" + state;\n\t\tprintareadraw(eoutstateman,\"State \" + statelist.indexOf(state));\n\t}\n\t\n\t// show scroll\n\tif (showscroll) {\n\t\t//escroll.firstChild.nodeValue = \n\t\t//\t\" sclvel = \" + scrollvelx + \",\" + scrollvely + \" scl = \" + scrollx + \",\" + scrolly;\n\t\tprintareadraw(escroll,\"sclvel = \" + scrollvelx + \",\" + scrollvely + \" scl = \" + scrollx + \",\" + scrolly);\n\t}\n\t\t\n\t// show much stuff\n\tif (showprint) {\n\t\tvar maxsize = 300;\n\t\t// show keystate\n\t\tvar ks = \"keystate = \";\n\t\tvar len = input.keystate.length;\n\t\tvar i;\n\t\tfor (i=0;i<len;++i) {\n\t\t\tif (input.keystate[i])\n\t\t\t\tks += i.toString(16) + \" \";\n\t\t}\n\t\t//eoutkeystate.firstChild.nodeValue = ks;\n\t\tprintareadraw(eoutkeystate,ks);\n\t\t\n\t\t// show input\n\t\t//eoutinputstate.firstChild.nodeValue = \"inputstate = mx \" + input.mx + \" my \" + input.my + \" mbut \" + input.mbut + \" mclick \" + input.mclick + \" key \" + input.key;\n\t\tprintareadraw(eoutinputstate,\"inputstate = mx \" + input.mx + \" my \" + input.my + \" mbut \" + input.mbut + \" mwheel \" + \n\t\tinput.wheelPos + \" mclick0 \" + input.mclick[0] + \" mclick1 \" + input.mclick[1] + \" mclick2 \" + \n\t\tinput.mclick[2] + \" key \" + input.key.toString(16) + \" keybufflen \" + input.keybuff.length);\n\t\t\n\t\t// show inputevents\n\t\tif (inputevents.length > maxsize) {\n\t\t\tinputevents = inputevents.substr(inputevents.length-maxsize,maxsize);\n\t\t}\n\t\t//eoutinputevents.firstChild.nodeValue = inputevents;\n\t\tprintareadraw(eoutinputevents,inputevents);\n\t\t\n\t\t// show logger\n/*\t\tif (logger_str.length > maxsize) {\n//\t\t\tlogger_str = logger_str.substr(logger_str.length-maxsize,maxsize);\n\t\t} */\n\t\t//eoutlogger.outerHTML = \"Howdy!\";\n\t\t//eoutlogger.firstChild.nodeValue = logger_str;\n\t\tif (logmode)\n\t\t\tprintareadraw(eoutlogger,logger_str);\n\t\telse {\n\t\t\tprintareadraw(eoutlogger,\"logger disabled\");\n\t\t\tlogger_str = \"\";\n\t\t}\n\t}\n\t\n\t// show image cache\n/*\tvar str = \"\";\n\tfor (var nam in imagecacher) {\n\t\tstr += \"C[\" + nam + \"] = \" + imagecacher[nam].size+ \",\";\t\n\t} */\n}", "onPaint() {\n const me = this,\n { element, headerContainer, bodyContainer, footerContainer } = me;\n\n if (me.rendered) {\n return;\n }\n\n // apply any responsive configs before rendering columns and rows\n me.updateResponsive(me.width, 0);\n\n let maxDepth = 0;\n\n // Cached, updated on resize. Used by RowManager and by the subgrids upon their render\n me._bodyRectangle = Rectangle.client(me.bodyContainer);\n\n me.eachSubGrid((subGrid) => {\n subGrid.render(me.verticalScroller);\n });\n\n // Note that these are hook methods for features to plug in to. They do not do anything.\n // SubGrids take care of their own rendering.\n me.renderHeader(headerContainer, element);\n me.renderFooter(footerContainer, element);\n\n if (me.autoHeight) {\n me._bodyHeight = me.rowManager.initWithHeight(\n element.offsetHeight - headerContainer.offsetHeight - footerContainer.offsetHeight,\n true\n );\n bodyContainer.style.height = me.bodyHeight + 'px';\n } else {\n me._bodyHeight = me.bodyContainer.offsetHeight;\n me.rowManager.initWithHeight(me._bodyHeight, true);\n }\n\n me.eachSubGrid((subGrid) => {\n if (subGrid.header.maxDepth > maxDepth) {\n maxDepth = subGrid.header.maxDepth;\n }\n });\n\n headerContainer.dataset.maxDepth = maxDepth;\n\n me.fixSizes();\n\n me.renderRows(false);\n\n me.initScroll();\n\n me.initInternalEvents();\n\n me.rendered = true;\n }", "function internal_ui_resize_common()\r\n{\r\n\tgl.canvas.width = gl.canvas.clientWidth * window.devicePixelRatio / ewgl_desktop.subsample;\r\n\tgl.canvas.height = gl.canvas.clientHeight * window.devicePixelRatio / ewgl_desktop.subsample;\r\n\tgl.viewport(0, 0, gl.canvas.width, gl.canvas.height);\r\n}", "function updateMetrics() {\n\n\t\tisVwDirty = false;\n\t\tDPR = window.devicePixelRatio;\n\t\tcssCache = {};\n\t\tsizeLengthCache = {};\n\n\t\tpf.DPR = DPR || 1;\n\n\t\tunits.width = Math.max(window.innerWidth || 0, docElem.clientWidth);\n\t\tunits.height = Math.max(window.innerHeight || 0, docElem.clientHeight);\n\n\t\tunits.vw = units.width / 100;\n\t\tunits.vh = units.height / 100;\n\n\t\tevalId = [ units.height, units.width, DPR ].join(\"-\");\n\n\t\tunits.em = pf.getEmValue();\n\t\tunits.rem = units.em;\n\t}", "function _layout(size, scrollOffset, nested) {\n\t\n\t // Track the number of times the layout-function was executed\n\t this._debug.layoutCount++;\n\t //_log.call(this, 'Layout, scrollOffset: ', scrollOffset, ', particle: ', this._scroll.particle.getPosition1D());\n\t\n\t // Determine start & end\n\t var scrollStart = 0 - Math.max(this.options.extraBoundsSpace[0], 1);\n\t var scrollEnd = size[this._direction] + Math.max(this.options.extraBoundsSpace[1], 1);\n\t if (this.options.paginationMode === PaginationMode.PAGE) {\n\t scrollStart = scrollOffset - this.options.extraBoundsSpace[0];\n\t scrollEnd = scrollOffset + size[this._direction] + this.options.extraBoundsSpace[1];\n\t if ((scrollOffset + size[this._direction]) < 0) {\n\t scrollStart += size[this._direction];\n\t scrollEnd += size[this._direction];\n\t }\n\t else if ((scrollOffset - size[this._direction]) > 0) {\n\t scrollStart -= size[this._direction];\n\t scrollEnd -= size[this._direction];\n\t }\n\t }\n\t if (this.options.layoutAll) {\n\t scrollStart = -1000000;\n\t scrollEnd = 1000000;\n\t }\n\t\n\t // Prepare for layout\n\t var layoutContext = this._nodes.prepareForLayout(\n\t this._viewSequence, // first node to layout\n\t this._nodesById, { // so we can do fast id lookups\n\t size: size,\n\t direction: this._direction,\n\t reverse: this.options.alignment ? true : false,\n\t scrollOffset: this.options.alignment ? (scrollOffset + size[this._direction]) : scrollOffset,\n\t scrollStart: scrollStart,\n\t scrollEnd: scrollEnd\n\t }\n\t );\n\t\n\t // Layout objects\n\t if (this._layout._function) {\n\t this._layout._function(\n\t layoutContext, // context which the layout-function can use\n\t this._layout.options // additional layout-options\n\t );\n\t }\n\t this._scroll.unnormalizedScrollOffset = scrollOffset;\n\t\n\t // Call post-layout function\n\t if (this._postLayout) {\n\t this._postLayout(size, scrollOffset);\n\t }\n\t\n\t // Mark non-invalidated nodes for removal\n\t this._nodes.removeNonInvalidatedNodes(this.options.flowOptions.removeSpec);\n\t\n\t // Check whether the bounds have been reached\n\t //var oldBoundsReached = this._scroll.boundsReached;\n\t _calcBounds.call(this, size, scrollOffset);\n\t //if (oldBoundsReached !== this._scroll.boundsReached) {\n\t // _log.call(this, 'bounds reached changed (', oldBoundsReached, ' != ', this._scroll.boundsReached, ')');\n\t //}\n\t\n\t // Update scroll-to spring\n\t _calcScrollToOffset.call(this, size, scrollOffset);\n\t\n\t // When pagination is enabled, snap to page\n\t _snapToPage.call(this);\n\t\n\t // If the bounds have changed, and the scroll-offset would be different\n\t // than before, then re-layout entirely using the new offset.\n\t var newScrollOffset = _calcScrollOffset.call(this, true);\n\t if (!nested && (newScrollOffset !== scrollOffset)) {\n\t //_log.call(this, 'offset changed, re-layouting... (', scrollOffset, ' != ', newScrollOffset, ')');\n\t return _layout.call(this, size, newScrollOffset, true);\n\t }\n\t\n\t // Normalize scroll offset so that the current viewsequence node is as close to the\n\t // top as possible and the layout function will need to process the least amount\n\t // of renderables.\n\t scrollOffset = _normalizeViewSequence.call(this, size, scrollOffset);\n\t\n\t // Update spring\n\t _updateSpring.call(this);\n\t\n\t // Cleanup any nodes in case of a VirtualViewSequence\n\t this._nodes.removeVirtualViewSequenceNodes();\n\t\n\t // Calculate scroll-length and use that as the true-size (height)\n\t if (this.options.size && (this.options.size[this._direction] === true)) {\n\t var scrollLength = 0;\n\t var node = this._nodes.getStartEnumNode();\n\t while (node) {\n\t if (node._invalidated && node.scrollLength) {\n\t scrollLength += node.scrollLength;\n\t }\n\t node = node._next;\n\t }\n\t this._size = this._size || [0, 0];\n\t this._size[0] = this.options.size[0];\n\t this._size[1] = this.options.size[1];\n\t this._size[this._direction] = scrollLength;\n\t }\n\t\n\t return scrollOffset;\n\t }", "function resizeView() {\n\n navWidth = document.getElementById('vis').clientWidth;\n navHeight = document.getElementById('vis').clientHeight;\n\n}", "update() {\n\n\t\tconst depth = (this.octree !== null) ? this.octree.getDepth() : -1;\n\n\t\tlet level = 0;\n\t\tlet result;\n\n\t\t// Remove existing geometry.\n\t\tthis.dispose();\n\n\t\twhile(level <= depth) {\n\n\t\t\tresult = this.octree.findNodesByLevel(level);\n\n\t\t\tthis.createLineSegments(\n\t\t\t\tresult[Symbol.iterator](),\n\t\t\t\t(typeof result.size === \"number\") ? result.size : result.length\n\t\t\t);\n\n\t\t\t++level;\n\n\t\t}\n\n\t}", "function draw()\n{\n\tvar page = story.getCurrentPage();\n\n\tif(!page.isCorrectSize())\n\t{\n\t\twindowResized();\n\t}\n\n\tpage.draw();\n}", "function runRedraw()\n{\n document.body.style.display='none';\n var h = document.body.offsetHeight;\n document.body.style.display='block';\n}", "function reshapeAndResize(i) {\n try {\n // iterate through the text frames in the page\n for (var s = 0; s < textFrameCount; s++) {\n var page = pages.item(i + 1)\n\n // isolate the value of the current page bounds\n var origionalBounds = pages.item(i + 1).textFrames[s].geometricBounds\n // reset the geometric bounds of the text frame to those of the page bounds\n page.textFrames[s].geometricBounds = page.bounds \n\n // Now that the target characters are availiable to target, reset the relavent attributes, pointSize and fillColor\n // page.textFrames.everyItem().paragraphs.everyItem().characters.everyItem().pointSize = 5\n page.textFrames.everyItem().paragraphs.everyItem().fillColor = myColor \n\n // After the relavent attributes have been changed, reset the geometric bounds of the text frame to \n // the origional bounds\n page.textFrames[s].geometricBounds = origionalBounds\n }\n } catch (err) {\n $.writeln('err: ' + err)\n }\n}", "function _layout(size, scrollOffset, nested) {\n\n\t // Track the number of times the layout-function was executed\n\t this._debug.layoutCount++;\n\t //_log.call(this, 'Layout, scrollOffset: ', scrollOffset, ', particle: ', this._scroll.particle.getPosition1D());\n\n\t // Determine start & end\n\t var scrollStart = 0 - Math.max(this.options.extraBoundsSpace[0], 1);\n\t var scrollEnd = size[this._direction] + Math.max(this.options.extraBoundsSpace[1], 1);\n\t if (this.options.layoutAll) {\n\t scrollStart = -1000000;\n\t scrollEnd = 1000000;\n\t }\n\n\t // Prepare for layout\n\t var layoutContext = this._nodes.prepareForLayout(\n\t this._viewSequence, // first node to layout\n\t this._nodesById, { // so we can do fast id lookups\n\t size: size,\n\t direction: this._direction,\n\t reverse: this.options.alignment ? true : false,\n\t scrollOffset: this.options.alignment ? (scrollOffset + size[this._direction]) : scrollOffset,\n\t scrollStart: scrollStart,\n\t scrollEnd: scrollEnd\n\t }\n\t );\n\n\t // Layout objects\n\t if (this._layout._function) {\n\t this._layout._function(\n\t layoutContext, // context which the layout-function can use\n\t this._layout.options // additional layout-options\n\t );\n\t }\n\n\t // Call post-layout function\n\t if (this._postLayout) {\n\t this._postLayout(size, scrollOffset);\n\t }\n\n\t // Mark non-invalidated nodes for removal\n\t this._nodes.removeNonInvalidatedNodes(this.options.removeSpec);\n\n\t // Check whether the bounds have been reached\n\t _calcBounds.call(this, size, scrollOffset);\n\n\t // Update scroll-to spring\n\t _calcScrollToOffset.call(this, size, scrollOffset);\n\n\t // When pagination is enabled, snap to page\n\t _snapToPage.call(this, size, scrollOffset);\n\n\t // If the bounds have changed, and the scroll-offset would be different\n\t // than before, then re-layout entirely using the new offset.\n\t var newScrollOffset = _calcScrollOffset.call(this, true);\n\t if (!nested && (newScrollOffset !== scrollOffset)) {\n\t //_log.call(this, 'offset changed, re-layouting... (', scrollOffset, ' != ', newScrollOffset, ')');\n\t return _layout.call(this, size, newScrollOffset, true);\n\t }\n\n\t // Normalize scroll offset so that the current viewsequence node is as close to the\n\t // top as possible and the layout function will need to process the least amount\n\t // of renderables.\n\t this._scroll.unnormalizedScrollOffset = scrollOffset;\n\t scrollOffset = _normalizeViewSequence.call(this, size, scrollOffset);\n\n\t // Update spring\n\t _updateSpring.call(this);\n\n\t return scrollOffset;\n\t }", "render () {\n\t\tthis.renderBoard();\n\t\tthis.renderPieces();\n\t\t$writeInnerHTML( this.view.$maxVal, this.model.maxTimes );\n\t\t$writeInnerHTML( this.view.$minVal, this.model.minTimes );\n\t\tthis.view.alocatePieces( this.model.finalPositionsArr, this.model.baseNumber, this.model.getPieceSize(), this.model.gutterSize );\n\t\tthis.toggleBoardLock();\n\t}", "draw({time, deltaTime}) {\n if (this._sketch) {\n this._sketch.draw({time, deltaTime});\n //update smooth scroll\n if (this._expanderEl) {\n this._scrollTo +=\n (this._destScrollTo - this._scrollTo) * 0.1;\n this._sketch.scrollRatio = (this._scrollTo) / (this._expanderHeight - window.innerHeight);\n }\n }\n }", "function draw(){\r\n //Check if visualization is actually shown to screen.\r\n if (document.getElementById(\"vis\").childNodes.length > 2 && data_avail){\r\n var x, nodeX, nodeY;\r\n \r\n //Cycle through existing nodes to see if user is mousing over.\r\n inside = false;\r\n for (x = 0; x < vis_count; x++){\r\n nodeX = node_locations[x][0] + center_adjust;\r\n nodeY = node_locations[x][1];\r\n if(mouseX > nodeX - 25 && mouseX < nodeX + 25 && mouseY < nodeY + 40 && mouseY > nodeY - 25){\r\n enlarge_box(nodeX, nodeY, x);\r\n inside = true;\r\n }\r\n }\r\n if (expanded && !inside){\r\n new_vis();\r\n expanded = false;\r\n }\r\n }\r\n}", "function main() {\n $('.box').css('left', originX - rbx);\n $('.box').css('top', originY + lty);\n $('.box').css('width', rbx - ltx);\n $('.box').css('height', rby - lty);\n\n html2canvas(document.body, {\n allowTaint: true,\n logging: true,\n width: 1484,\n height: 1119,\n onrendered: function(canvas) {\n $('.bg').css('display', 'none');\n $('.box').css('display', 'none');\n var img = new Image();\n img.setAttribute('crossOrigin', 'anonymous');\n img.src = canvas.toDataURL();\n document.body.appendChild(img);\n }\n });\n}", "function displaypathdata() {\n $('#datasize').empty()\n var svg_data = size($('#canvas').html())\n $('#datasize').append(svg_data + \"Byte\")\n}", "_updateContext() {\n const count = this._data.length;\n let i = this._viewContainerRef.length;\n while (i--) {\n let view = this._viewContainerRef.get(i);\n view.context.index = this._renderedRange.start + i;\n view.context.count = count;\n this._updateComputedContextProperties(view.context);\n view.detectChanges();\n }\n }", "drawSubviews() {}", "prepareDocument(document) {\n let imgElemsQuery = \".//*[@src | @srcset]\";\n const ORDERED_NODE_SNAPSHOT_TYPE = 7;\n let imgElemsResult = document.evaluate(imgElemsQuery, document, null, ORDERED_NODE_SNAPSHOT_TYPE);\n for (let i = 0, elem; i < imgElemsResult.snapshotLength; ++i) {\n elem = imgElemsResult.snapshotItem(i);\n this.prepareElement(elem)\n }\n }" ]
[ "0.5897446", "0.58449394", "0.57988375", "0.5757708", "0.57276994", "0.5712541", "0.5673291", "0.5610675", "0.5602419", "0.5594531", "0.5583795", "0.54926413", "0.5485577", "0.5463084", "0.54616827", "0.54176617", "0.54121333", "0.537817", "0.53698725", "0.53656584", "0.53627264", "0.536143", "0.5354848", "0.5350713", "0.53481877", "0.53340167", "0.53289425", "0.532516", "0.53166807", "0.53066766", "0.5302066", "0.5299133", "0.52950335", "0.5289039", "0.5287058", "0.5286445", "0.5284138", "0.5280942", "0.5278296", "0.5270464", "0.5265888", "0.52606", "0.5258229", "0.52502495", "0.52472436", "0.5240381", "0.5239639", "0.523936", "0.5235521", "0.5218704", "0.5205645", "0.51881933", "0.5183334", "0.5182747", "0.517482", "0.5167841", "0.51666", "0.51623064", "0.5161351", "0.5152895", "0.5150208", "0.5147923", "0.5144996", "0.5138348", "0.51317704", "0.51285374", "0.5128483", "0.5127048", "0.5115939", "0.5115747", "0.5114548", "0.5105866", "0.51039505", "0.51033586", "0.5095175", "0.5092893", "0.50893295", "0.5078725", "0.50736743", "0.5069629", "0.50650984", "0.5060986", "0.50578594", "0.5057751", "0.5054328", "0.5052256", "0.5051448", "0.5044248", "0.5042561", "0.50425076", "0.50381696", "0.50350827", "0.50345063", "0.50336105", "0.5032765", "0.5029715", "0.5025074", "0.502377", "0.50237674", "0.5022553", "0.5018599" ]
0.0
-1
Computes display.scroller.scrollLeft + display.gutters.offsetWidth, but using getBoundingClientRect to get a subpixelaccurate result.
function compensateForHScroll(display) { return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get getBoundingClientRects() {\n if (!this._boundingClientRects) {\n const innerBox = this._innerBoxHelper.nativeElement.getBoundingClientRect();\n const clientRect = this.element.getBoundingClientRect();\n this._boundingClientRects = {\n clientRect,\n innerWidth: innerBox.width,\n innerHeight: innerBox.height,\n scrollBarWidth: clientRect.width - innerBox.width,\n scrollBarHeight: clientRect.height - innerBox.height,\n };\n const resetCurrentBox = () => this._boundingClientRects = undefined;\n if (this._isScrolling) {\n this.scrolling.pipe(filter(scrolling => scrolling === 0), take(1)).subscribe(resetCurrentBox);\n }\n else {\n requestAnimationFrame(resetCurrentBox);\n }\n }\n return this._boundingClientRects;\n }", "function getWidth(self) {\r\n return (\r\n parseInt(self.clientWidth) -\r\n parseInt(window.getComputedStyle(self).getPropertyValue(\"padding-left\")) -\r\n parseInt(window.getComputedStyle(self).getPropertyValue(\"padding-right\"))\r\n );\r\n}", "function compensateForHScroll(display) {\n return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left\n}", "function compensateForHScroll(display) {\n return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left\n}", "function compensateForHScroll(display) {\n return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left\n}", "function compensateForHScroll(display) {\n return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left\n}", "function compensateForHScroll(display) {\n return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left\n}", "function compensateForHScroll(display) {\n return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left\n}", "function compensateForHScroll(display) {\n return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left\n}", "function compensateForHScroll(display) {\n return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left\n}", "function compensateForHScroll(display) {\n return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left\n}", "function compensateForHScroll(display) {\n return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left\n}", "function compensateForHScroll(display) {\n return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left\n}", "function compensateForHScroll(display) {\n return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left\n}", "function compensateForHScroll(display) {\n return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left\n}", "calculateWithDif() {\n return (this._$window.innerWidth - this.interactiveDomWidth) / 2;\n }", "function compensateForHScroll(display) {\r\n return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left\r\n}", "function compensateForHScroll(display) {\n return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left;\n }", "function compensateForHScroll(display) {\n return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left;\n }", "function compensateForHScroll(display) {\n return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left;\n }", "function compensateForHScroll(display) {\n return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left;\n }", "function compensateForHScroll(display) {\n return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left;\n }", "function compensateForHScroll(display) {\n return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left;\n }", "function compensateForHScroll(display) {\n return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left;\n }", "function compensateForHScroll(display) {\n return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left;\n }", "function compensateForHScroll(display) {\n\t\t return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left\n\t\t }", "function compensateForHScroll(display) {\n\t\t return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left;\n\t\t }", "function compensateForHScroll(display) {\r\n return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left;\r\n }", "_getWidth() {\n const measurer = this._document.createElement('div');\n measurer.className = 'modal-scrollbar-measure';\n const body = this._document.body;\n body.appendChild(measurer);\n const width = measurer.getBoundingClientRect().width - measurer.clientWidth;\n body.removeChild(measurer);\n return width;\n }", "function compensateForHScroll(display) {\n\t return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left;\n\t }", "function compensateForHScroll(display) {\n\t return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left;\n\t }", "function compensateForHScroll(display) {\n\t return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left;\n\t }", "function getDimensions(cm) {\n var d = cm.display,\n left = {},\n width = {};\n var gutterLeft = d.gutters.clientLeft;\n\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n var id = cm.display.gutterSpecs[i].className;\n left[id] = n.offsetLeft + n.clientLeft + gutterLeft;\n width[id] = n.clientWidth;\n }\n\n return {\n fixedPos: compensateForHScroll(d),\n gutterTotalWidth: d.gutters.offsetWidth,\n gutterLeft: left,\n gutterWidth: width,\n wrapperWidth: d.wrapper.clientWidth\n };\n } // Computes display.scroller.scrollLeft + display.gutters.offsetWidth,", "function xa(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}", "function calculateScrollPos(cm, rect) {\n var display = cm.display, snapMargin = textHeight(cm.display);\n if (rect.top < 0) { rect.top = 0; }\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = displayHeight(cm), result = {};\n if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;\n if (rect.top < screentop) {\n result.scrollTop = atTop ? 0 : rect.top;\n } else if (rect.bottom > screentop + screen) {\n var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);\n if (newTop != screentop) { result.scrollTop = newTop; }\n }\n\n var gutterSpace = cm.options.fixedGutter ? 0 : display.gutters.offsetWidth;\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft - gutterSpace;\n var screenw = displayWidth(cm) - display.gutters.offsetWidth;\n var tooWide = rect.right - rect.left > screenw;\n if (tooWide) { rect.right = rect.left + screenw; }\n if (rect.left < 10)\n { result.scrollLeft = 0; }\n else if (rect.left < screenleft)\n { result.scrollLeft = Math.max(0, rect.left + gutterSpace - (tooWide ? 0 : 10)); }\n else if (rect.right > screenw + screenleft - 3)\n { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }\n return result\n }", "function calculateScrollPos(cm, rect) {\n var display = cm.display, snapMargin = textHeight(cm.display);\n if (rect.top < 0) { rect.top = 0; }\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = displayHeight(cm), result = {};\n if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;\n if (rect.top < screentop) {\n result.scrollTop = atTop ? 0 : rect.top;\n } else if (rect.bottom > screentop + screen) {\n var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);\n if (newTop != screentop) { result.scrollTop = newTop; }\n }\n\n var gutterSpace = cm.options.fixedGutter ? 0 : display.gutters.offsetWidth;\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft - gutterSpace;\n var screenw = displayWidth(cm) - display.gutters.offsetWidth;\n var tooWide = rect.right - rect.left > screenw;\n if (tooWide) { rect.right = rect.left + screenw; }\n if (rect.left < 10)\n { result.scrollLeft = 0; }\n else if (rect.left < screenleft)\n { result.scrollLeft = Math.max(0, rect.left + gutterSpace - (tooWide ? 0 : 10)); }\n else if (rect.right > screenw + screenleft - 3)\n { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }\n return result\n }", "function calculateScrollPos(cm, rect) {\n var display = cm.display, snapMargin = textHeight(cm.display);\n if (rect.top < 0) { rect.top = 0; }\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = displayHeight(cm), result = {};\n if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;\n if (rect.top < screentop) {\n result.scrollTop = atTop ? 0 : rect.top;\n } else if (rect.bottom > screentop + screen) {\n var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);\n if (newTop != screentop) { result.scrollTop = newTop; }\n }\n\n var gutterSpace = cm.options.fixedGutter ? 0 : display.gutters.offsetWidth;\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft - gutterSpace;\n var screenw = displayWidth(cm) - display.gutters.offsetWidth;\n var tooWide = rect.right - rect.left > screenw;\n if (tooWide) { rect.right = rect.left + screenw; }\n if (rect.left < 10)\n { result.scrollLeft = 0; }\n else if (rect.left < screenleft)\n { result.scrollLeft = Math.max(0, rect.left + gutterSpace - (tooWide ? 0 : 10)); }\n else if (rect.right > screenw + screenleft - 3)\n { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }\n return result\n }", "function calculateScrollPos(cm, rect) {\n var display = cm.display, snapMargin = textHeight(cm.display);\n if (rect.top < 0) { rect.top = 0; }\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = displayHeight(cm), result = {};\n if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;\n if (rect.top < screentop) {\n result.scrollTop = atTop ? 0 : rect.top;\n } else if (rect.bottom > screentop + screen) {\n var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);\n if (newTop != screentop) { result.scrollTop = newTop; }\n }\n\n var gutterSpace = cm.options.fixedGutter ? 0 : display.gutters.offsetWidth;\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft - gutterSpace;\n var screenw = displayWidth(cm) - display.gutters.offsetWidth;\n var tooWide = rect.right - rect.left > screenw;\n if (tooWide) { rect.right = rect.left + screenw; }\n if (rect.left < 10)\n { result.scrollLeft = 0; }\n else if (rect.left < screenleft)\n { result.scrollLeft = Math.max(0, rect.left + gutterSpace - (tooWide ? 0 : 10)); }\n else if (rect.right > screenw + screenleft - 3)\n { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }\n return result\n }", "function calculateScrollPos(cm, rect) {\n var display = cm.display, snapMargin = textHeight(cm.display);\n if (rect.top < 0) { rect.top = 0; }\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = displayHeight(cm), result = {};\n if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;\n if (rect.top < screentop) {\n result.scrollTop = atTop ? 0 : rect.top;\n } else if (rect.bottom > screentop + screen) {\n var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);\n if (newTop != screentop) { result.scrollTop = newTop; }\n }\n\n var gutterSpace = cm.options.fixedGutter ? 0 : display.gutters.offsetWidth;\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft - gutterSpace;\n var screenw = displayWidth(cm) - display.gutters.offsetWidth;\n var tooWide = rect.right - rect.left > screenw;\n if (tooWide) { rect.right = rect.left + screenw; }\n if (rect.left < 10)\n { result.scrollLeft = 0; }\n else if (rect.left < screenleft)\n { result.scrollLeft = Math.max(0, rect.left + gutterSpace - (tooWide ? 0 : 10)); }\n else if (rect.right > screenw + screenleft - 3)\n { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }\n return result\n }", "function calculateScrollPos(cm, rect) {\n var display = cm.display, snapMargin = textHeight(cm.display);\n if (rect.top < 0) { rect.top = 0; }\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = displayHeight(cm), result = {};\n if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;\n if (rect.top < screentop) {\n result.scrollTop = atTop ? 0 : rect.top;\n } else if (rect.bottom > screentop + screen) {\n var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);\n if (newTop != screentop) { result.scrollTop = newTop; }\n }\n\n var gutterSpace = cm.options.fixedGutter ? 0 : display.gutters.offsetWidth;\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft - gutterSpace;\n var screenw = displayWidth(cm) - display.gutters.offsetWidth;\n var tooWide = rect.right - rect.left > screenw;\n if (tooWide) { rect.right = rect.left + screenw; }\n if (rect.left < 10)\n { result.scrollLeft = 0; }\n else if (rect.left < screenleft)\n { result.scrollLeft = Math.max(0, rect.left + gutterSpace - (tooWide ? 0 : 10)); }\n else if (rect.right > screenw + screenleft - 3)\n { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }\n return result\n }", "function getDimensions(cm) {\n var d = cm.display, left = {}, width = {};\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n left[cm.options.gutters[i]] = n.offsetLeft;\n width[cm.options.gutters[i]] = n.offsetWidth;\n }\n return {fixedPos: compensateForHScroll(d),\n gutterTotalWidth: d.gutters.offsetWidth,\n gutterLeft: left,\n gutterWidth: width,\n wrapperWidth: d.wrapper.clientWidth};\n }", "function getDimensions(cm) {\n var d = cm.display, left = {}, width = {};\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n left[cm.options.gutters[i]] = n.offsetLeft;\n width[cm.options.gutters[i]] = n.offsetWidth;\n }\n return {fixedPos: compensateForHScroll(d),\n gutterTotalWidth: d.gutters.offsetWidth,\n gutterLeft: left,\n gutterWidth: width,\n wrapperWidth: d.wrapper.clientWidth};\n }", "function getDimensions(cm) {\n var d = cm.display, left = {}, width = {};\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n left[cm.options.gutters[i]] = n.offsetLeft;\n width[cm.options.gutters[i]] = n.offsetWidth;\n }\n return {fixedPos: compensateForHScroll(d),\n gutterTotalWidth: d.gutters.offsetWidth,\n gutterLeft: left,\n gutterWidth: width,\n wrapperWidth: d.wrapper.clientWidth};\n }", "function wa(e){for(var t=e.display,a={},n={},r=t.gutters.clientLeft,f=t.gutters.firstChild,o=0;f;f=f.nextSibling,++o)a[e.options.gutters[o]]=f.offsetLeft+f.clientLeft+r,n[e.options.gutters[o]]=f.clientWidth;return{fixedPos:xa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:a,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}", "function getDimensions(cm) {\r\n var d = cm.display, left = {}, width = {};\r\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\r\n left[cm.options.gutters[i]] = n.offsetLeft;\r\n width[cm.options.gutters[i]] = n.offsetWidth;\r\n }\r\n return {fixedPos: compensateForHScroll(d),\r\n gutterTotalWidth: d.gutters.offsetWidth,\r\n gutterLeft: left,\r\n gutterWidth: width,\r\n wrapperWidth: d.wrapper.clientWidth};\r\n }", "function getScrollbarWidth() {\n return window.innerWidth - document.documentElement.clientWidth;\n}", "function getDimensions(cm) {\n var d = cm.display, left = {}, width = {};\n var gutterLeft = d.gutters.clientLeft;\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft;\n width[cm.options.gutters[i]] = n.clientWidth;\n }\n return {fixedPos: compensateForHScroll(d),\n gutterTotalWidth: d.gutters.offsetWidth,\n gutterLeft: left,\n gutterWidth: width,\n wrapperWidth: d.wrapper.clientWidth};\n }", "function getDimensions(cm) {\n var d = cm.display, left = {}, width = {};\n var gutterLeft = d.gutters.clientLeft;\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft;\n width[cm.options.gutters[i]] = n.clientWidth;\n }\n return {fixedPos: compensateForHScroll(d),\n gutterTotalWidth: d.gutters.offsetWidth,\n gutterLeft: left,\n gutterWidth: width,\n wrapperWidth: d.wrapper.clientWidth};\n }", "function getDimensions(cm) {\n var d = cm.display, left = {}, width = {};\n var gutterLeft = d.gutters.clientLeft;\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft;\n width[cm.options.gutters[i]] = n.clientWidth;\n }\n return {fixedPos: compensateForHScroll(d),\n gutterTotalWidth: d.gutters.offsetWidth,\n gutterLeft: left,\n gutterWidth: width,\n wrapperWidth: d.wrapper.clientWidth};\n }", "function getDimensions(cm) {\n var d = cm.display, left = {}, width = {};\n var gutterLeft = d.gutters.clientLeft;\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft;\n width[cm.options.gutters[i]] = n.clientWidth;\n }\n return {fixedPos: compensateForHScroll(d),\n gutterTotalWidth: d.gutters.offsetWidth,\n gutterLeft: left,\n gutterWidth: width,\n wrapperWidth: d.wrapper.clientWidth};\n }", "function getDimensions(cm) {\n var d = cm.display, left = {}, width = {};\n var gutterLeft = d.gutters.clientLeft;\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft;\n width[cm.options.gutters[i]] = n.clientWidth;\n }\n return {fixedPos: compensateForHScroll(d),\n gutterTotalWidth: d.gutters.offsetWidth,\n gutterLeft: left,\n gutterWidth: width,\n wrapperWidth: d.wrapper.clientWidth};\n }", "function calcDragBarPosFromCss() {\n if (dragBar.css('left') === '') return null;\n var percent = /(\\d*(?:\\.\\d+)?)\\%/.exec(dragBar.css('left'))[1];\n percent = parseFloat(percent) / 100;\n return outerWidth * percent;\n }", "function getDimensions(cm) {\n var d = cm.display, left = {}, width = {};\n var gutterLeft = d.gutters.clientLeft;\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft;\n width[cm.options.gutters[i]] = n.clientWidth;\n }\n return {fixedPos: compensateForHScroll(d),\n gutterTotalWidth: d.gutters.offsetWidth,\n gutterLeft: left,\n gutterWidth: width,\n wrapperWidth: d.wrapper.clientWidth}\n }", "function getDimensions(cm) {\n var d = cm.display, left = {}, width = {};\n var gutterLeft = d.gutters.clientLeft;\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft;\n width[cm.options.gutters[i]] = n.clientWidth;\n }\n return {fixedPos: compensateForHScroll(d),\n gutterTotalWidth: d.gutters.offsetWidth,\n gutterLeft: left,\n gutterWidth: width,\n wrapperWidth: d.wrapper.clientWidth}\n }", "function getDimensions(cm) {\n var d = cm.display, left = {}, width = {};\n var gutterLeft = d.gutters.clientLeft;\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft;\n width[cm.options.gutters[i]] = n.clientWidth;\n }\n return {fixedPos: compensateForHScroll(d),\n gutterTotalWidth: d.gutters.offsetWidth,\n gutterLeft: left,\n gutterWidth: width,\n wrapperWidth: d.wrapper.clientWidth}\n }", "function getDimensions(cm) {\n var d = cm.display, left = {}, width = {};\n var gutterLeft = d.gutters.clientLeft;\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft;\n width[cm.options.gutters[i]] = n.clientWidth;\n }\n return {fixedPos: compensateForHScroll(d),\n gutterTotalWidth: d.gutters.offsetWidth,\n gutterLeft: left,\n gutterWidth: width,\n wrapperWidth: d.wrapper.clientWidth}\n }", "getRects() {\n if (!this.moving) { return this.clientRects; }\n else { return this.DOMcontainer.getBoundingClientRect(); }\n }", "function calcScrollPosition() {\n const positionBracket = calcPositionBracket();\n const scrollY = window.scrollY;\n const r = ((scrollY - positionBracket.copy.prev) / (positionBracket.copy.next - positionBracket.copy.prev));\n\n const visualsScrollTarget = Math.round(positionBracket.visual.prev + ((positionBracket.visual.next - positionBracket.visual.prev) * r));\n\n return visualsScrollTarget;\n}", "function getDimensions(cm) {\n\t var d = cm.display, left = {}, width = {};\n\t var gutterLeft = d.gutters.clientLeft;\n\t for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n\t left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft;\n\t width[cm.options.gutters[i]] = n.clientWidth;\n\t }\n\t return {fixedPos: compensateForHScroll(d),\n\t gutterTotalWidth: d.gutters.offsetWidth,\n\t gutterLeft: left,\n\t gutterWidth: width,\n\t wrapperWidth: d.wrapper.clientWidth};\n\t }", "function getDimensions(cm) {\n\t var d = cm.display, left = {}, width = {};\n\t var gutterLeft = d.gutters.clientLeft;\n\t for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n\t left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft;\n\t width[cm.options.gutters[i]] = n.clientWidth;\n\t }\n\t return {fixedPos: compensateForHScroll(d),\n\t gutterTotalWidth: d.gutters.offsetWidth,\n\t gutterLeft: left,\n\t gutterWidth: width,\n\t wrapperWidth: d.wrapper.clientWidth};\n\t }", "function getDimensions(cm) {\n\t var d = cm.display, left = {}, width = {};\n\t var gutterLeft = d.gutters.clientLeft;\n\t for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n\t left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft;\n\t width[cm.options.gutters[i]] = n.clientWidth;\n\t }\n\t return {fixedPos: compensateForHScroll(d),\n\t gutterTotalWidth: d.gutters.offsetWidth,\n\t gutterLeft: left,\n\t gutterWidth: width,\n\t wrapperWidth: d.wrapper.clientWidth};\n\t }", "function W(){var t=l.getBoundingClientRect(),e=\"offset\"+[\"Width\",\"Height\"][i.ort];return 0===i.ort?t.width||l[e]:t.height||l[e]}", "function getDimensions(cm) {\n\t\t var d = cm.display, left = {}, width = {};\n\t\t var gutterLeft = d.gutters.clientLeft;\n\t\t for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n\t\t left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft;\n\t\t width[cm.options.gutters[i]] = n.clientWidth;\n\t\t }\n\t\t return {fixedPos: compensateForHScroll(d),\n\t\t gutterTotalWidth: d.gutters.offsetWidth,\n\t\t gutterLeft: left,\n\t\t gutterWidth: width,\n\t\t wrapperWidth: d.wrapper.clientWidth};\n\t\t }", "function returnScrollbarWidth() {\n let scrollbarWidth = innerWindowWidth() - document.querySelector('html').clientWidth;\n \n return scrollbarWidth;\n}", "function getDimensions(cm) {\r\n var d = cm.display, left = {}, width = {};\r\n var gutterLeft = d.gutters.clientLeft;\r\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\r\n left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft;\r\n width[cm.options.gutters[i]] = n.clientWidth;\r\n }\r\n return {fixedPos: compensateForHScroll(d),\r\n gutterTotalWidth: d.gutters.offsetWidth,\r\n gutterLeft: left,\r\n gutterWidth: width,\r\n wrapperWidth: d.wrapper.clientWidth}\r\n}", "function getClientRect(el,origin){var offset=el.offset();var scrollbarWidths=getScrollbarWidths(el);var left=offset.left+getCssFloat(el,'border-left-width')+scrollbarWidths.left-(origin?origin.left:0);var top=offset.top+getCssFloat(el,'border-top-width')+scrollbarWidths.top-(origin?origin.top:0);return{left:left,right:left+el[0].clientWidth,top:top,bottom:top+el[0].clientHeight// clientHeight includes padding but NOT scrollbars\n};}", "function returnScrollbarWidth() {\n let scrollbarWidth = innerWindowWidth() - doc.querySelector('html').clientWidth;\n\n return scrollbarWidth;\n}", "function X(){var t=c.getBoundingClientRect(),e=\"offset\"+[\"Width\",\"Height\"][i.ort];return 0===i.ort?t.width||c[e]:t.height||c[e]}", "function getDimensions(cm) {\n var d = cm.display, left = {}, width = {};\n var gutterLeft = d.gutters.clientLeft;\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n var id = cm.display.gutterSpecs[i].className;\n left[id] = n.offsetLeft + n.clientLeft + gutterLeft;\n width[id] = n.clientWidth;\n }\n return {fixedPos: compensateForHScroll(d),\n gutterTotalWidth: d.gutters.offsetWidth,\n gutterLeft: left,\n gutterWidth: width,\n wrapperWidth: d.wrapper.clientWidth}\n }", "function getDimensions(cm) {\n var d = cm.display, left = {}, width = {};\n var gutterLeft = d.gutters.clientLeft;\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n var id = cm.display.gutterSpecs[i].className;\n left[id] = n.offsetLeft + n.clientLeft + gutterLeft;\n width[id] = n.clientWidth;\n }\n return {fixedPos: compensateForHScroll(d),\n gutterTotalWidth: d.gutters.offsetWidth,\n gutterLeft: left,\n gutterWidth: width,\n wrapperWidth: d.wrapper.clientWidth}\n }", "function getDimensions(cm) {\n var d = cm.display, left = {}, width = {};\n var gutterLeft = d.gutters.clientLeft;\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n var id = cm.display.gutterSpecs[i].className;\n left[id] = n.offsetLeft + n.clientLeft + gutterLeft;\n width[id] = n.clientWidth;\n }\n return {fixedPos: compensateForHScroll(d),\n gutterTotalWidth: d.gutters.offsetWidth,\n gutterLeft: left,\n gutterWidth: width,\n wrapperWidth: d.wrapper.clientWidth}\n }", "function getDimensions(cm) {\n var d = cm.display, left = {}, width = {};\n var gutterLeft = d.gutters.clientLeft;\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n var id = cm.display.gutterSpecs[i].className;\n left[id] = n.offsetLeft + n.clientLeft + gutterLeft;\n width[id] = n.clientWidth;\n }\n return {fixedPos: compensateForHScroll(d),\n gutterTotalWidth: d.gutters.offsetWidth,\n gutterLeft: left,\n gutterWidth: width,\n wrapperWidth: d.wrapper.clientWidth}\n }", "function getDimensions(cm) {\n var d = cm.display, left = {}, width = {};\n var gutterLeft = d.gutters.clientLeft;\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n var id = cm.display.gutterSpecs[i].className;\n left[id] = n.offsetLeft + n.clientLeft + gutterLeft;\n width[id] = n.clientWidth;\n }\n return {fixedPos: compensateForHScroll(d),\n gutterTotalWidth: d.gutters.offsetWidth,\n gutterLeft: left,\n gutterWidth: width,\n wrapperWidth: d.wrapper.clientWidth}\n }", "function getDimensions(cm) {\n var d = cm.display, left = {}, width = {};\n var gutterLeft = d.gutters.clientLeft;\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n var id = cm.display.gutterSpecs[i].className;\n left[id] = n.offsetLeft + n.clientLeft + gutterLeft;\n width[id] = n.clientWidth;\n }\n return {fixedPos: compensateForHScroll(d),\n gutterTotalWidth: d.gutters.offsetWidth,\n gutterLeft: left,\n gutterWidth: width,\n wrapperWidth: d.wrapper.clientWidth}\n }", "function getDimensions(cm) {\n var d = cm.display, left = {}, width = {};\n var gutterLeft = d.gutters.clientLeft;\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n var id = cm.display.gutterSpecs[i].className;\n left[id] = n.offsetLeft + n.clientLeft + gutterLeft;\n width[id] = n.clientWidth;\n }\n return {fixedPos: compensateForHScroll(d),\n gutterTotalWidth: d.gutters.offsetWidth,\n gutterLeft: left,\n gutterWidth: width,\n wrapperWidth: d.wrapper.clientWidth}\n }", "function getDimensions(cm) {\n var d = cm.display, left = {}, width = {};\n var gutterLeft = d.gutters.clientLeft;\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n var id = cm.display.gutterSpecs[i].className;\n left[id] = n.offsetLeft + n.clientLeft + gutterLeft;\n width[id] = n.clientWidth;\n }\n return {fixedPos: compensateForHScroll(d),\n gutterTotalWidth: d.gutters.offsetWidth,\n gutterLeft: left,\n gutterWidth: width,\n wrapperWidth: d.wrapper.clientWidth}\n }", "function getDimensions(cm) {\n var d = cm.display, left = {}, width = {};\n var gutterLeft = d.gutters.clientLeft;\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n var id = cm.display.gutterSpecs[i].className;\n left[id] = n.offsetLeft + n.clientLeft + gutterLeft;\n width[id] = n.clientWidth;\n }\n return {fixedPos: compensateForHScroll(d),\n gutterTotalWidth: d.gutters.offsetWidth,\n gutterLeft: left,\n gutterWidth: width,\n wrapperWidth: d.wrapper.clientWidth}\n }", "function getDimensions(cm) {\n var d = cm.display, left = {}, width = {};\n var gutterLeft = d.gutters.clientLeft;\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n var id = cm.display.gutterSpecs[i].className;\n left[id] = n.offsetLeft + n.clientLeft + gutterLeft;\n width[id] = n.clientWidth;\n }\n return {fixedPos: compensateForHScroll(d),\n gutterTotalWidth: d.gutters.offsetWidth,\n gutterLeft: left,\n gutterWidth: width,\n wrapperWidth: d.wrapper.clientWidth}\n }", "function getDimensions(cm) {\n var d = cm.display, left = {}, width = {};\n var gutterLeft = d.gutters.clientLeft;\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n var id = cm.display.gutterSpecs[i].className;\n left[id] = n.offsetLeft + n.clientLeft + gutterLeft;\n width[id] = n.clientWidth;\n }\n return {fixedPos: compensateForHScroll(d),\n gutterTotalWidth: d.gutters.offsetWidth,\n gutterLeft: left,\n gutterWidth: width,\n wrapperWidth: d.wrapper.clientWidth}\n }", "function getDimensions(cm) {\n var d = cm.display, left = {}, width = {};\n var gutterLeft = d.gutters.clientLeft;\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n var id = cm.display.gutterSpecs[i].className;\n left[id] = n.offsetLeft + n.clientLeft + gutterLeft;\n width[id] = n.clientWidth;\n }\n return {fixedPos: compensateForHScroll(d),\n gutterTotalWidth: d.gutters.offsetWidth,\n gutterLeft: left,\n gutterWidth: width,\n wrapperWidth: d.wrapper.clientWidth}\n }", "function getDimensions(cm) {\n var d = cm.display, left = {}, width = {};\n var gutterLeft = d.gutters.clientLeft;\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n var id = cm.display.gutterSpecs[i].className;\n left[id] = n.offsetLeft + n.clientLeft + gutterLeft;\n width[id] = n.clientWidth;\n }\n return {fixedPos: compensateForHScroll(d),\n gutterTotalWidth: d.gutters.offsetWidth,\n gutterLeft: left,\n gutterWidth: width,\n wrapperWidth: d.wrapper.clientWidth}\n }", "function getDimensions(cm) {\n var d = cm.display, left = {}, width = {};\n var gutterLeft = d.gutters.clientLeft;\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft;\n width[cm.options.gutters[i]] = n.clientWidth;\n }\n return {fixedPos: compensateForHScroll(d),\n gutterTotalWidth: d.gutters.offsetWidth,\n gutterLeft: left,\n gutterWidth: width,\n wrapperWidth: d.wrapper.clientWidth}\n}", "function getDimensions(cm) {\n var d = cm.display, left = {}, width = {};\n var gutterLeft = d.gutters.clientLeft;\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft;\n width[cm.options.gutters[i]] = n.clientWidth;\n }\n return {fixedPos: compensateForHScroll(d),\n gutterTotalWidth: d.gutters.offsetWidth,\n gutterLeft: left,\n gutterWidth: width,\n wrapperWidth: d.wrapper.clientWidth}\n}", "function getDimensions(cm) {\n var d = cm.display, left = {}, width = {};\n var gutterLeft = d.gutters.clientLeft;\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft;\n width[cm.options.gutters[i]] = n.clientWidth;\n }\n return {fixedPos: compensateForHScroll(d),\n gutterTotalWidth: d.gutters.offsetWidth,\n gutterLeft: left,\n gutterWidth: width,\n wrapperWidth: d.wrapper.clientWidth}\n}" ]
[ "0.6243216", "0.6220974", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6184225", "0.6179456", "0.6166653", "0.6166653", "0.6166653", "0.6166653", "0.6166653", "0.6166653", "0.6166653", "0.6166653", "0.6133881", "0.611915", "0.61042863", "0.60982007", "0.606743", "0.606743", "0.606743", "0.6050127", "0.6011351", "0.5974033", "0.5974033", "0.5974033", "0.5974033", "0.5974033", "0.5974033", "0.5942669", "0.5942669", "0.5942669", "0.59425336", "0.5913559", "0.59104794", "0.59091425", "0.59091425", "0.59091425", "0.59091425", "0.59091425", "0.59044963", "0.58865935", "0.58865935", "0.58865935", "0.58865935", "0.586319", "0.5849408", "0.5823719", "0.5823719", "0.5823719", "0.5822157", "0.58181536", "0.58174443", "0.5810053", "0.58049166", "0.57976025", "0.57952935", "0.57729745", "0.57729745", "0.57729745", "0.57729745", "0.57729745", "0.57729745", "0.57729745", "0.57729745", "0.57729745", "0.57729745", "0.57729745", "0.57729745", "0.57729745", "0.5764008", "0.5764008", "0.5764008" ]
0.62709266
11
Returns a function that estimates the height of a line, to use as first approximation until the line becomes visible (and is thus properly measurable).
function estimateHeight(cm) { var th = textHeight(cm.display), wrapping = cm.options.lineWrapping; var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3); return function (line) { if (lineIsHidden(cm.doc, line)) { return 0 } var widgetsHeight = 0; if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) { if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; } } } if (wrapping) { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th } else { return widgetsHeight + th } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function heightAtLine(lineObj) {\n\t\t lineObj = visualLine(lineObj);\n\n\t\t var h = 0, chunk = lineObj.parent;\n\t\t for (var i = 0; i < chunk.lines.length; ++i) {\n\t\t var line = chunk.lines[i];\n\t\t if (line == lineObj) { break }\n\t\t else { h += line.height; }\n\t\t }\n\t\t for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n\t\t for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n\t\t var cur = p.children[i$1];\n\t\t if (cur == chunk) { break }\n\t\t else { h += cur.height; }\n\t\t }\n\t\t }\n\t\t return h\n\t\t }", "function heightAtLine(lineObj) {\n\t\t lineObj = visualLine(lineObj);\n\t\t\n\t\t var h = 0, chunk = lineObj.parent;\n\t\t for (var i = 0; i < chunk.lines.length; ++i) {\n\t\t var line = chunk.lines[i];\n\t\t if (line == lineObj) break;\n\t\t else h += line.height;\n\t\t }\n\t\t for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n\t\t for (var i = 0; i < p.children.length; ++i) {\n\t\t var cur = p.children[i];\n\t\t if (cur == chunk) break;\n\t\t else h += cur.height;\n\t\t }\n\t\t }\n\t\t return h;\n\t\t }", "function heightAtLine(lineObj) {\n\t lineObj = visualLine(lineObj);\n\t\n\t var h = 0, chunk = lineObj.parent;\n\t for (var i = 0; i < chunk.lines.length; ++i) {\n\t var line = chunk.lines[i];\n\t if (line == lineObj) break;\n\t else h += line.height;\n\t }\n\t for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n\t for (var i = 0; i < p.children.length; ++i) {\n\t var cur = p.children[i];\n\t if (cur == chunk) break;\n\t else h += cur.height;\n\t }\n\t }\n\t return h;\n\t }", "function heightAtLine(lineObj) {\n\t lineObj = visualLine(lineObj);\n\n\t var h = 0, chunk = lineObj.parent;\n\t for (var i = 0; i < chunk.lines.length; ++i) {\n\t var line = chunk.lines[i];\n\t if (line == lineObj) break;\n\t else h += line.height;\n\t }\n\t for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n\t for (var i = 0; i < p.children.length; ++i) {\n\t var cur = p.children[i];\n\t if (cur == chunk) break;\n\t else h += cur.height;\n\t }\n\t }\n\t return h;\n\t }", "function heightAtLine(lineObj) {\n\t lineObj = visualLine(lineObj);\n\n\t var h = 0, chunk = lineObj.parent;\n\t for (var i = 0; i < chunk.lines.length; ++i) {\n\t var line = chunk.lines[i];\n\t if (line == lineObj) break;\n\t else h += line.height;\n\t }\n\t for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n\t for (var i = 0; i < p.children.length; ++i) {\n\t var cur = p.children[i];\n\t if (cur == chunk) break;\n\t else h += cur.height;\n\t }\n\t }\n\t return h;\n\t }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) break;\n else h += line.height;\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i = 0; i < p.children.length; ++i) {\n var cur = p.children[i];\n if (cur == chunk) break;\n else h += cur.height;\n }\n }\n return h;\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) break;\n else h += line.height;\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i = 0; i < p.children.length; ++i) {\n var cur = p.children[i];\n if (cur == chunk) break;\n else h += cur.height;\n }\n }\n return h;\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) break;\n else h += line.height;\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i = 0; i < p.children.length; ++i) {\n var cur = p.children[i];\n if (cur == chunk) break;\n else h += cur.height;\n }\n }\n return h;\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) break;\n else h += line.height;\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i = 0; i < p.children.length; ++i) {\n var cur = p.children[i];\n if (cur == chunk) break;\n else h += cur.height;\n }\n }\n return h;\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) break;\n else h += line.height;\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i = 0; i < p.children.length; ++i) {\n var cur = p.children[i];\n if (cur == chunk) break;\n else h += cur.height;\n }\n }\n return h;\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) break;\n else h += line.height;\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i = 0; i < p.children.length; ++i) {\n var cur = p.children[i];\n if (cur == chunk) break;\n else h += cur.height;\n }\n }\n return h;\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) break;\n else h += line.height;\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i = 0; i < p.children.length; ++i) {\n var cur = p.children[i];\n if (cur == chunk) break;\n else h += cur.height;\n }\n }\n return h;\n }", "function heightAtLine(lineObj) {\r\n lineObj = visualLine(lineObj);\r\n\r\n var h = 0, chunk = lineObj.parent;\r\n for (var i = 0; i < chunk.lines.length; ++i) {\r\n var line = chunk.lines[i];\r\n if (line == lineObj) break;\r\n else h += line.height;\r\n }\r\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\r\n for (var i = 0; i < p.children.length; ++i) {\r\n var cur = p.children[i];\r\n if (cur == chunk) break;\r\n else h += cur.height;\r\n }\r\n }\r\n return h;\r\n }", "function heightAtLine(lineObj) {\r\n lineObj = visualLine(lineObj);\r\n\r\n var h = 0, chunk = lineObj.parent;\r\n for (var i = 0; i < chunk.lines.length; ++i) {\r\n var line = chunk.lines[i];\r\n if (line == lineObj) { break }\r\n else { h += line.height; }\r\n }\r\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\r\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\r\n var cur = p.children[i$1];\r\n if (cur == chunk) { break }\r\n else { h += cur.height; }\r\n }\r\n }\r\n return h\r\n}", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n}", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n}", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n}", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n}", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n}", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n}", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n}", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n}", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n}", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n}", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n}", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj)\n\n var h = 0, chunk = lineObj.parent\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i]\n if (line == lineObj) { break }\n else { h += line.height }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1]\n if (cur == chunk) { break }\n else { h += cur.height }\n }\n }\n return h\n}", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj)\n\n var h = 0, chunk = lineObj.parent\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i]\n if (line == lineObj) { break }\n else { h += line.height }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1]\n if (cur == chunk) { break }\n else { h += cur.height }\n }\n }\n return h\n}", "function estimateHeight(cm) {\n\t var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n\t var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n\t return function(line) {\n\t if (lineIsHidden(cm.doc, line)) return 0;\n\n\t var widgetsHeight = 0;\n\t if (line.widgets) for (var i = 0; i < line.widgets.length; i++) {\n\t if (line.widgets[i].height) widgetsHeight += line.widgets[i].height;\n\t }\n\n\t if (wrapping)\n\t return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th;\n\t else\n\t return widgetsHeight + th;\n\t };\n\t }", "function estimateHeight(cm) {\n\t var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n\t var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n\t return function(line) {\n\t if (lineIsHidden(cm.doc, line)) return 0;\n\n\t var widgetsHeight = 0;\n\t if (line.widgets) for (var i = 0; i < line.widgets.length; i++) {\n\t if (line.widgets[i].height) widgetsHeight += line.widgets[i].height;\n\t }\n\n\t if (wrapping)\n\t return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th;\n\t else\n\t return widgetsHeight + th;\n\t };\n\t }", "function estimateHeight(cm) {\r\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\r\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\r\n return function(line) {\r\n if (lineIsHidden(cm.doc, line)) return 0;\r\n\r\n var widgetsHeight = 0;\r\n if (line.widgets) for (var i = 0; i < line.widgets.length; i++) {\r\n if (line.widgets[i].height) widgetsHeight += line.widgets[i].height;\r\n }\r\n\r\n if (wrapping)\r\n return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th;\r\n else\r\n return widgetsHeight + th;\r\n };\r\n }", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function(line) {\n if (lineIsHidden(cm.doc, line)) return 0;\n\n var widgetsHeight = 0;\n if (line.widgets) for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) widgetsHeight += line.widgets[i].height;\n }\n\n if (wrapping)\n return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th;\n else\n return widgetsHeight + th;\n };\n }", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function(line) {\n if (lineIsHidden(cm.doc, line)) return 0;\n\n var widgetsHeight = 0;\n if (line.widgets) for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) widgetsHeight += line.widgets[i].height;\n }\n\n if (wrapping)\n return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th;\n else\n return widgetsHeight + th;\n };\n }", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function(line) {\n if (lineIsHidden(cm.doc, line)) return 0;\n\n var widgetsHeight = 0;\n if (line.widgets) for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) widgetsHeight += line.widgets[i].height;\n }\n\n if (wrapping)\n return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th;\n else\n return widgetsHeight + th;\n };\n }", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function(line) {\n if (lineIsHidden(cm.doc, line)) return 0;\n\n var widgetsHeight = 0;\n if (line.widgets) for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) widgetsHeight += line.widgets[i].height;\n }\n\n if (wrapping)\n return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th;\n else\n return widgetsHeight + th;\n };\n }", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function(line) {\n if (lineIsHidden(cm.doc, line)) return 0;\n\n var widgetsHeight = 0;\n if (line.widgets) for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) widgetsHeight += line.widgets[i].height;\n }\n\n if (wrapping)\n return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th;\n else\n return widgetsHeight + th;\n };\n }", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function(line) {\n if (lineIsHidden(cm.doc, line)) return 0;\n\n var widgetsHeight = 0;\n if (line.widgets) for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) widgetsHeight += line.widgets[i].height;\n }\n\n if (wrapping)\n return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th;\n else\n return widgetsHeight + th;\n };\n }", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function(line) {\n if (lineIsHidden(cm.doc, line)) return 0;\n\n var widgetsHeight = 0;\n if (line.widgets) for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) widgetsHeight += line.widgets[i].height;\n }\n\n if (wrapping)\n return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th;\n else\n return widgetsHeight + th;\n };\n }", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function(line) {\n if (lineIsHidden(cm.doc, line)) return 0;\n\n var widgetsHeight = 0;\n if (line.widgets) for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) widgetsHeight += line.widgets[i].height;\n }\n\n if (wrapping)\n return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th;\n else\n return widgetsHeight + th;\n };\n }", "function estimateHeight(cm) {\n\t\t var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n\t\t var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n\t\t return function (line) {\n\t\t if (lineIsHidden(cm.doc, line)) { return 0 }\n\n\t\t var widgetsHeight = 0;\n\t\t if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n\t\t if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n\t\t } }\n\n\t\t if (wrapping)\n\t\t { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n\t\t else\n\t\t { return widgetsHeight + th }\n\t\t }\n\t\t }", "function estimateHeight(cm) {\n var th = textHeight(cm.display),\n wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) {\n return 0;\n }\n\n var widgetsHeight = 0;\n\n if (line.widgets) {\n for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) {\n widgetsHeight += line.widgets[i].height;\n }\n }\n }\n\n if (wrapping) {\n return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th;\n } else {\n return widgetsHeight + th;\n }\n };\n }", "function estimateHeight(cm) {\n\t var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n\t var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n\t return function(line) {\n\t if (lineIsHidden(cm.doc, line)) return 0;\n\t\n\t var widgetsHeight = 0;\n\t if (line.widgets) for (var i = 0; i < line.widgets.length; i++) {\n\t if (line.widgets[i].height) widgetsHeight += line.widgets[i].height;\n\t }\n\t\n\t if (wrapping)\n\t return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th;\n\t else\n\t return widgetsHeight + th;\n\t };\n\t }", "function estimateHeight(cm) {\n\t\t var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n\t\t var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n\t\t return function(line) {\n\t\t if (lineIsHidden(cm.doc, line)) return 0;\n\t\t\n\t\t var widgetsHeight = 0;\n\t\t if (line.widgets) for (var i = 0; i < line.widgets.length; i++) {\n\t\t if (line.widgets[i].height) widgetsHeight += line.widgets[i].height;\n\t\t }\n\t\t\n\t\t if (wrapping)\n\t\t return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th;\n\t\t else\n\t\t return widgetsHeight + th;\n\t\t };\n\t\t }", "function getLineHeight(elem) {\n var lh = computeStyle(elem, 'line-height');\n if (lh == 'normal') {\n // Normal line heights vary from browser to browser. The spec recommends\n // a value between 1.0 and 1.2 of the font size. Using 1.1 to split the diff.\n lh = parseInt(computeStyle(elem, 'font-size')) * 1.2;\n }\n return parseInt(lh);\n }", "function getLineHeight(elem) {\n var lh = computeStyle(elem, 'line-height');\n if (lh == 'normal') {\n // Normal line heights vary from browser to browser. The spec recommends\n // a value between 1.0 and 1.2 of the font size. Using 1.1 to split the diff.\n lh = parseInt(computeStyle(elem, 'font-size'), 10) * 1.2;\n }\n return parseInt(lh, 10);\n }", "function getLineHeight(elem) {\n var lh = computeStyle(elem, 'line-height');\n if (lh == 'normal') {\n // Normal line heights vary from browser to browser. The spec recommends\n // a value between 1.0 and 1.2 of the font size. Using 1.1 to split the diff.\n lh = parseInt(computeStyle(elem, 'font-size')) * 1.2;\n }\n return parseInt(lh);\n }", "function estimateHeight(cm) {\r\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\r\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\r\n return function (line) {\r\n if (lineIsHidden(cm.doc, line)) { return 0 }\r\n\r\n var widgetsHeight = 0;\r\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\r\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\r\n } }\r\n\r\n if (wrapping)\r\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\r\n else\r\n { return widgetsHeight + th }\r\n }\r\n}", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n}", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n}", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n}", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n}", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n}", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n}", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n}", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n}", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n}", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n}", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n}", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3)\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n}", "function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3)\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n}", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n\n if (diff) {\n for (var n = line; n; n = n.parent) {\n n.height += diff;\n }\n }\n } // Given a line object, find its line number by walking up through", "function height(param) {\n if (param) {\n return param.h;\n } else {\n return 0;\n }\n }", "function getMaxLines(height) {\n var availHeight = height || element.clientHeight,\n lineHeight = getLineHeight(element);\n\n return Math.max(Math.floor(availHeight / lineHeight), 0);\n }", "function lineHeight(){\n\t\thistoryLine.each(function(index, element){\n\t\t\tif(index == $('.line').length - 1){\n\t\t\t\treturn false;\n\t\t\t} else{\n\t\t\t\tvar thisBlock = $(this).closest('.history-item').height()/2;\n\t\t\t\tvar nextBlock = $(this).closest('.history-item').next().height()/2;\n\t\t\t\tvar h = thisBlock+nextBlock;\n\t\t\t\t$(this).height(h);\n\t\t\t}\n\t\t\t\n\t\t})\n\t}", "getYForLine(line) {\n const options = this.options;\n const spacing = options.spacing_between_lines_px;\n const headroom = options.space_above_staff_ln;\n\n const y = this.y + (line * spacing) + (headroom * spacing);\n\n return y;\n }", "lineBlockAtHeight(height) {\n this.readMeasured();\n return this.viewState.lineBlockAtHeight(height);\n }", "function updateLineHeight(line, height) {\n\t\t var diff = height - line.height;\n\t\t if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n\t\t }", "function getMaxLines(height) {\n var availHeight = height || element.clientHeight,\n lineHeight = getLineHeight(element);\n\n return Math.max(Math.floor(availHeight/lineHeight), 0);\n }" ]
[ "0.75962454", "0.75941265", "0.7518054", "0.7507497", "0.7507497", "0.74446887", "0.74446887", "0.74446887", "0.74446887", "0.74446887", "0.74446887", "0.74446887", "0.74446887", "0.74446887", "0.74446887", "0.74446887", "0.74446887", "0.74446887", "0.74446887", "0.74446887", "0.74446887", "0.74446887", "0.74202573", "0.74202573", "0.74202573", "0.74202573", "0.74202573", "0.74202573", "0.74202573", "0.74103963", "0.73879075", "0.73739403", "0.73739403", "0.73739403", "0.73739403", "0.73739403", "0.73739403", "0.73739403", "0.73739403", "0.73739403", "0.73739403", "0.73739403", "0.73448396", "0.73448396", "0.71729946", "0.71729946", "0.71655524", "0.7140194", "0.7140194", "0.7140194", "0.7140194", "0.7140194", "0.7140194", "0.7140194", "0.7140194", "0.7139578", "0.7136774", "0.7099888", "0.7098922", "0.70782244", "0.7058793", "0.7050714", "0.70443624", "0.69912213", "0.69912213", "0.69912213", "0.69912213", "0.69912213", "0.69912213", "0.69912213", "0.69912213", "0.69912213", "0.69912213", "0.69912213", "0.69646585", "0.69646585", "0.6711818", "0.65829915", "0.6574455", "0.6458157", "0.6445091", "0.6387208", "0.63835144", "0.63825047" ]
0.7124381
72
Given a mouse event, find the corresponding position. If liberal is false, it checks whether a gutter or scrollbar was clicked, and returns null if it was. forRect is used by rectangular selections, and tries to estimate a character position even for coordinates beyond the right of the text.
function posFromMouse(cm, e, liberal, forRect) { var display = cm.display; if (!liberal && e_target(e).getAttribute("cm-not-content") == "true") { return null } var x, y, space = display.lineSpace.getBoundingClientRect(); // Fails unpredictably on IE[67] when mouse is dragged around quickly. try { x = e.clientX - space.left; y = e.clientY - space.top; } catch (e$1) { return null } var coords = coordsChar(cm, x, y), line; if (forRect && coords.xRel > 0 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) { var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length; coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff)); } return coords }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal) {\n var target = e_target(e);\n if (target == display.scrollbarH || target == display.scrollbarV ||\n target == display.scrollbarFiller || target == display.gutterFiller) return null;\n }\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null; }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords;\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal) {\n var target = e_target(e);\n if (target == display.scrollbarH || target == display.scrollbarV ||\n target == display.scrollbarFiller || target == display.gutterFiller) return null;\n }\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null; }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords;\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal) {\n var target = e_target(e);\n if (target == display.scrollbarH || target == display.scrollbarV ||\n target == display.scrollbarFiller || target == display.gutterFiller) return null;\n }\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null; }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords;\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal) {\n var target = e_target(e);\n if (target == display.scrollbarH || target == display.scrollbarV ||\n target == display.scrollbarFiller || target == display.gutterFiller) return null;\n }\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null; }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords;\n }", "function posFromMouse(cm, e, liberal, forRect) {\r\n var display = cm.display;\r\n if (!liberal) {\r\n var target = e_target(e);\r\n if (target == display.scrollbarH || target == display.scrollbarV ||\r\n target == display.scrollbarFiller || target == display.gutterFiller) return null;\r\n }\r\n var x, y, space = display.lineSpace.getBoundingClientRect();\r\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\r\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\r\n catch (e) { return null; }\r\n var coords = coordsChar(cm, x, y), line;\r\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\r\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\r\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\r\n }\r\n return coords;\r\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"not-content\") == \"true\") return null;\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null; }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords;\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"not-content\") == \"true\") return null;\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null; }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords;\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") return null;\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null; }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords;\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") return null;\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null; }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords;\n }", "function posFromMouse(cm, e, liberal, forRect) {\n\t var display = cm.display;\n\t if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") return null;\n\n\t var x, y, space = display.lineSpace.getBoundingClientRect();\n\t // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n\t try { x = e.clientX - space.left; y = e.clientY - space.top; }\n\t catch (e) { return null; }\n\t var coords = coordsChar(cm, x, y), line;\n\t if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n\t var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n\t coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n\t }\n\t return coords;\n\t }", "function posFromMouse(cm, e, liberal, forRect) {\n\t var display = cm.display;\n\t if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") return null;\n\n\t var x, y, space = display.lineSpace.getBoundingClientRect();\n\t // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n\t try { x = e.clientX - space.left; y = e.clientY - space.top; }\n\t catch (e) { return null; }\n\t var coords = coordsChar(cm, x, y), line;\n\t if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n\t var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n\t coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n\t }\n\t return coords;\n\t }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n}", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n}", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n}", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n}", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n}", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n}", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n}", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n}", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n}", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n}", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n}", "function posFromMouse(cm, e, liberal, forRect) {\n\t var display = cm.display;\n\t if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") return null;\n\t\n\t var x, y, space = display.lineSpace.getBoundingClientRect();\n\t // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n\t try { x = e.clientX - space.left; y = e.clientY - space.top; }\n\t catch (e) { return null; }\n\t var coords = coordsChar(cm, x, y), line;\n\t if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n\t var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n\t coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n\t }\n\t return coords;\n\t }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel > 0 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n }", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel > 0 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n }", "function posFromMouse(cm, e, liberal, forRect) {\r\n var display = cm.display;\r\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\r\n\r\n var x, y, space = display.lineSpace.getBoundingClientRect();\r\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\r\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\r\n catch (e) { return null }\r\n var coords = coordsChar(cm, x, y), line;\r\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\r\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\r\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\r\n }\r\n return coords\r\n}", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect()\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff))\n }\n return coords\n}", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect()\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff))\n }\n return coords\n}", "function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") {\n return null;\n }\n\n var x,\n y,\n space = display.lineSpace.getBoundingClientRect(); // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n\n try {\n x = e.clientX - space.left;\n y = e.clientY - space.top;\n } catch (e) {\n return null;\n }\n\n var coords = _coordsChar(cm, x, y),\n line;\n\n if (forRect && coords.xRel > 0 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n\n return coords;\n } // Find the view element corresponding to a given line. Return null", "function posFromMouse(cm, e, liberal, forRect) {\n\t\t var display = cm.display;\n\t\t if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") return null;\n\t\t\n\t\t var x, y, space = display.lineSpace.getBoundingClientRect();\n\t\t // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n\t\t try { x = e.clientX - space.left; y = e.clientY - space.top; }\n\t\t catch (e) { return null; }\n\t\t var coords = coordsChar(cm, x, y), line;\n\t\t if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n\t\t var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n\t\t coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n\t\t }\n\t\t return coords;\n\t\t }", "function posFromMouse(cm, e, liberal, forRect) {\n\t\t var display = cm.display;\n\t\t if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n\t\t var x, y, space = display.lineSpace.getBoundingClientRect();\n\t\t // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n\t\t try { x = e.clientX - space.left; y = e.clientY - space.top; }\n\t\t catch (e$1) { return null }\n\t\t var coords = coordsChar(cm, x, y), line;\n\t\t if (forRect && coords.xRel > 0 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n\t\t var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n\t\t coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n\t\t }\n\t\t return coords\n\t\t }", "function bufferPositionFromMouseEvent(editor, event) {\n const sp = atom.views.getView(editor).component.screenPositionForMouseEvent(event);\n if (isNaN(sp.row) || isNaN(sp.column)) {\n return;\n }\n return editor.bufferPositionForScreenPosition(sp);\n}", "_positionFromMouseEvent(event, element, mouseService) {\n const coords = mouseService.getCoords(event, element, this._bufferService.cols, this._bufferService.rows);\n if (!coords) {\n return;\n }\n return { x: coords[0], y: coords[1] + this._bufferService.buffer.ydisp };\n }", "function getCursorPos( event ) {\n var rect = this.getBoundingClientRect();\n var x = Math.floor( ( event.clientX - rect.left ) / grid / s), \n y = Math.floor( ( event.clientY - rect.top ) / grid / s);\n if( maze[x][y] ) return;\n if( start.x == -1 ) {\n start = { x: x, y: y };\n maze[start.x][start.y] = 8;\n drawBlock(start.x,start.y,8);\n } else {\n end = { x: x, y: y };\n maze[end.x][end.y] = 8;\n drawBlock(end.x,end.y,8);\n // console.log('start search');\n startSolve();\n }\n}", "getPosition(gid, eid, findAlt){\n let container = document.querySelector(`${this.eCfg.selector} > svg`).getBoundingClientRect();\n let e = document.querySelector(`${this.eCfg.selector} > svg > #${gid} > #${eid}`).getBoundingClientRect();\n if (findAlt){\n let eAlt = document.querySelector(`${this.eCfg.selector} > svg > #${gid} > #${eid}-alt`)\n if (eAlt) eAlt = eAlt.getBoundingClientRect();\n if (eAlt) e = eAlt;\n }\n return {left:(e.left-container.left)+(e.width/2), top:(e.top-container.top)+(e.height/2)};\n }", "getLocalCoords(elem, ev) {\n let ox = 0, oy = 0;\n let first;\n let pageX, pageY;\n\n // Walk back up the tree to calculate the total page offset of the\n // currentTarget element. I can't tell you how happy this makes me.\n // Really.\n while (elem !== null) {\n ox += elem.offsetLeft;\n oy += elem.offsetTop;\n elem = elem.offsetParent;\n }\n\n if ('changedTouches' in ev) {\n first = ev.changedTouches[0];\n pageX = first.pageX;\n pageY = first.pageY;\n } else {\n pageX = ev.pageX;\n pageY = ev.pageY;\n }\n\n return { 'x': pageX - ox, 'y': pageY - oy };\n }", "function onSelected() {\n let selection = window.getSelection();\n if (selection.toString().trim()) {\n // console.log(selection);\n selectedNode = selection.anchorNode;\n selectedRect = selection.getRangeAt(0).getBoundingClientRect();\n } \n}", "function getCursorPosition(event) {\r\n\tvar x;\r\n\tvar y;\r\n\tif (event.pageX || event.pageY) {\r\n\t x = event.pageX;\r\n\t y = event.pageY;\r\n\t} else {\r\n\t x = event.clientX\r\n\t\t+ document.body.scrollLeft\r\n\t\t+ document.documentElement.scrollLeft;\r\n\t y = event.clientY\r\n\t\t+ document.body.scrollTop\r\n\t\t+ document.documentElement.scrollTop;\r\n\t}\r\n\r\n if(canvas != null) {\r\n x -= canvas.offsetLeft;\r\n y -= canvas.offsetTop;\r\n }\r\n\r\n\tvar point = [Math.floor((x - 2) / CELL_SIZE), Math.floor((y - 4) / CELL_SIZE)];\r\n\treturn point;\r\n }", "function getCoords(element,e)\r\n{\r\n\tvar functionContinue = false;\r\n\r\n\tvar theElement = document.getElementById(element);\r\n\t\r\n\t// let's check to see if we already have gotten the position of this element\r\n\tvar posObj = posObjArray[element];\r\n\t\r\n\t// if we haven't gotten it yet then let's do get it....\r\n\tif(posObj==null)\r\n\t{\r\n\t\tposObj = SEDHTMLMenu_GetElementPosition(theElement);\r\n\t\tposObjArray[element]=posObj;\r\n\t}\r\n\t\r\n\tvar topXDIV = posObj.left;\r\n\tvar topYDIV = posObj.top;\r\n\t\r\n\tvar bottomXDIV = posObj.left + posObj.width;\r\n\tvar bottomYDIV = posObj.top + posObj.height;\r\n\t\r\n\tif ( browser.toUpperCase() == \"IE\" ) {\r\n\t\tvar mouseX = e.clientX + document.body.scrollLeft;\r\n\t\tvar mouseY = e.clientY;\r\n\t}\r\n\telse if ( browser.toUpperCase() == \"MZ\" ) {\r\n\t\tvar mouseX = e.clientX + window.scrollX;\r\n\t\tvar mouseY = e.clientY;\r\n\t}\r\n\t\r\n\t// now we check to see if the mouse is inside of the element because we don't want to continue with the calling function if so\r\n\tif( (mouseX >= topXDIV) && (mouseX <= bottomXDIV) && (mouseY >= topYDIV) && (mouseY <= bottomYDIV) ) {\r\n\t\tfunctionContinue = false;\r\n\t} else {\r\n\t\tfunctionContinue = true;\r\n\t}\r\n\t\r\n\treturn functionContinue;\r\n}", "function getVisibleSelectionRect(global){var selection=global.getSelection();if(!selection.rangeCount){return null;}var range=selection.getRangeAt(0);var boundingRect=getRangeBoundingClientRect(range);var top=boundingRect.top;var right=boundingRect.right;var bottom=boundingRect.bottom;var left=boundingRect.left;// When a re-render leads to a node being removed, the DOM selection will\r\n\t// temporarily be placed on an ancestor node, which leads to an invalid\r\n\t// bounding rect. Discard this state.\r\n\tif(top===0&&right===0&&bottom===0&&left===0){return null;}return boundingRect;}", "function FindMousePos(e)\r\n{ \r\n \r\n //get the mouse coordinates \r\n // Detect if the browser is IE or not.\r\n // If it is not IE, we assume that the browser is NS.\r\n if(!e)e = window.event;\r\n if (e.clientX) { // grab the x-y pos.s if browser is IE\r\n tempX = e.clientX + (document.documentElement.scrollLeft ?\r\n document.documentElement.scrollLeft :\r\n document.body.scrollLeft);\r\n \r\n tempY = e.clientY + (document.documentElement.scrollTop ?\r\n document.documentElement.scrollTop :\r\n document.body.scrollTop);\r\n } else if (e.pageX) { // grab the x-y pos.s if browser is NS\r\n tempX = e.pageX;\r\n tempY = e.pageY;\r\n } \r\n \r\n // catch possible negative values in NS4\r\n if (tempX < 0){tempX = 0}\r\n if (tempY < 0){tempY = 0} \r\n \r\n _varGlbMouseX = tempX;\r\n _varGlbMouseY = tempY;\r\n \r\n}", "function mouseCoordsToElem(div,mouseEvent){//y coords not verified \n //var div=document.getElementById(divId);\n var documentCoords=findDocumentCoords(mouseEvent);\n var div0 = div.getBoundingClientRect();\n var x=documentCoords.x- div0.left - window.pageXOffset;\n //var x=documentCoords.x-(div0.left+document.body.scrollLeft);\n var y=documentCoords.y- div0.top - window.pageYOffset;\n return{\n x:x,\n y:y//y coords not verified \n };\n}", "function findMousePosition(event){\n var rect = canvas.getBoundingClientRect();\n var root = document.documentElement;\n var mouseX = event.clientX - rect.left - root.scrollLeft;\n var mouseY = event.clientY - rect.top - root.scrollTop;\n return {\n x:mouseX,\n y:mouseY\n };\n}", "function getCursorPosition(canvas, event) {\n if (down) {\n const rect = canvas.getBoundingClientRect();\n mouseX = event.clientX - rect.left;\n mouseY = event.clientY - rect.top;\n context.fillRect(mouseX, mouseY, 1, 1);\n }\n}", "function getRelativePosition (evt) {\n var mouseX, mouseY;\n var e = evt.originalEvent || evt,\n canvas = evt.currentTarget || evt.srcElement,\n boundingRect = canvas.getBoundingClientRect();\n\n if (e.touches) {\n mouseX = e.touches[0].clientX - boundingRect.left;\n mouseY = e.touches[0].clientY - boundingRect.top;\n }\n else {\n mouseX = e.clientX - boundingRect.left;\n mouseY = e.clientY - boundingRect.top;\n }\n\n return {\n x: mouseX,\n y: mouseY\n };\n\n}", "function getSelectionForEvent(event, editorState) {\n\t var node = null;\n\t var offset = null;\n\n\t if (typeof document.caretRangeFromPoint === 'function') {\n\t var dropRange = document.caretRangeFromPoint(event.x, event.y);\n\t node = dropRange.startContainer;\n\t offset = dropRange.startOffset;\n\t } else if (event.rangeParent) {\n\t node = event.rangeParent;\n\t offset = event.rangeOffset;\n\t } else {\n\t return null;\n\t }\n\n\t node = nullthrows(node);\n\t offset = nullthrows(offset);\n\t var offsetKey = nullthrows(findAncestorOffsetKey(node));\n\n\t return getUpdatedSelectionState(editorState, offsetKey, offset, offsetKey, offset);\n\t}", "function getCursorPosition(canvas, event) {\n\t var rect = canvas.getBoundingClientRect();\n\t var x = event.clientX - rect.left;\n\t var y = event.clientY - rect.top;\n\t return [x,y];\n\t}", "function getCursorPos(event) \r\n {\r\n var x = 0;\r\n let y = 0;\r\n event = event || window.event;\r\n\r\n x = event.offsetX;\r\n y = event.offsetY;\r\n\r\n return {x : x, y : y};\r\n }", "function getCoordinate(event) {\n let ne = rectangle.getBounds().getNorthEast();\n let sw = rectangle.getBounds().getSouthWest();\n\n rightUpLat = ne.lat();\n rightUpLng = ne.lng();\n leftDownLat = sw.lat();\n leftDownLng = sw.lng();\n\n let rectangleLength = rightUpLng - leftDownLng;\n let rectangleWidth = rightUpLat - leftDownLat;\n let check = false;\n\n if (rectangleWidth > maxWidth) {\n\n let newBounds = {\n north: rightUpLat,\n south: rightUpLat - maxWidth + 0.02,\n east: rightUpLng,\n west: leftDownLng\n };\n\n rectangle.setBounds(newBounds);\n check = true;\n }\n\n if (rectangleLength > maxLength) {\n\n let newBounds = {\n north: rightUpLat,\n south: leftDownLat,\n east: rightUpLng,\n west: rightUpLng - maxLength + 0.02\n };\n\n rectangle.setBounds(newBounds);\n check = true;\n }\n\n\n if (check) {\n alert('Превышен максимальный размер области');\n }\n}", "function getPosition(e) {\n var rect = e.target.getBoundingClientRect();\n var x = e.clientX - rect.left;\n var y = e.clientY - rect.top;\n console.log(x, y);\n return {\n x,\n y,\n };\n}", "function getSelectionForEvent(event, editorState) {\n var node = null;\n var offset = null;\n\n if (typeof document.caretRangeFromPoint === 'function') {\n var dropRange = document.caretRangeFromPoint(event.x, event.y);\n node = dropRange.startContainer;\n offset = dropRange.startOffset;\n } else if (event.rangeParent) {\n node = event.rangeParent;\n offset = event.rangeOffset;\n } else {\n return null;\n }\n\n node = nullthrows(node);\n offset = nullthrows(offset);\n var offsetKey = nullthrows(findAncestorOffsetKey(node));\n\n return getUpdatedSelectionState(editorState, offsetKey, offset, offsetKey, offset);\n}", "function getSelectionForEvent(event, editorState) {\n var node = null;\n var offset = null;\n\n if (typeof document.caretRangeFromPoint === 'function') {\n var dropRange = document.caretRangeFromPoint(event.x, event.y);\n node = dropRange.startContainer;\n offset = dropRange.startOffset;\n } else if (event.rangeParent) {\n node = event.rangeParent;\n offset = event.rangeOffset;\n } else {\n return null;\n }\n\n node = nullthrows(node);\n offset = nullthrows(offset);\n var offsetKey = nullthrows(findAncestorOffsetKey(node));\n\n return getUpdatedSelectionState(editorState, offsetKey, offset, offsetKey, offset);\n}", "function getSelectionForEvent(event, editorState) {\n var node = null;\n var offset = null;\n\n if (typeof document.caretRangeFromPoint === 'function') {\n var dropRange = document.caretRangeFromPoint(event.x, event.y);\n node = dropRange.startContainer;\n offset = dropRange.startOffset;\n } else if (event.rangeParent) {\n node = event.rangeParent;\n offset = event.rangeOffset;\n } else {\n return null;\n }\n\n node = nullthrows(node);\n offset = nullthrows(offset);\n var offsetKey = nullthrows(findAncestorOffsetKey(node));\n\n return getUpdatedSelectionState(editorState, offsetKey, offset, offsetKey, offset);\n}", "function getSelectionForEvent(event, editorState) {\n var node = null;\n var offset = null;\n\n if (typeof document.caretRangeFromPoint === 'function') {\n var dropRange = document.caretRangeFromPoint(event.x, event.y);\n node = dropRange.startContainer;\n offset = dropRange.startOffset;\n } else if (event.rangeParent) {\n node = event.rangeParent;\n offset = event.rangeOffset;\n } else {\n return null;\n }\n\n node = nullthrows(node);\n offset = nullthrows(offset);\n var offsetKey = nullthrows(findAncestorOffsetKey(node));\n\n return getUpdatedSelectionState(editorState, offsetKey, offset, offsetKey, offset);\n}", "function getSelectionForEvent(event, editorState) {\n var node = null;\n var offset = null;\n\n if (typeof document.caretRangeFromPoint === 'function') {\n var dropRange = document.caretRangeFromPoint(event.x, event.y);\n node = dropRange.startContainer;\n offset = dropRange.startOffset;\n } else if (event.rangeParent) {\n node = event.rangeParent;\n offset = event.rangeOffset;\n } else {\n return null;\n }\n\n node = nullthrows(node);\n offset = nullthrows(offset);\n var offsetKey = nullthrows(findAncestorOffsetKey(node));\n\n return getUpdatedSelectionState(editorState, offsetKey, offset, offsetKey, offset);\n}", "function getSelectionForEvent(event, editorState) {\n var node = null;\n var offset = null;\n\n if (typeof document.caretRangeFromPoint === 'function') {\n var dropRange = document.caretRangeFromPoint(event.x, event.y);\n node = dropRange.startContainer;\n offset = dropRange.startOffset;\n } else if (event.rangeParent) {\n node = event.rangeParent;\n offset = event.rangeOffset;\n } else {\n return null;\n }\n\n node = nullthrows(node);\n offset = nullthrows(offset);\n var offsetKey = nullthrows(findAncestorOffsetKey(node));\n\n return getUpdatedSelectionState(editorState, offsetKey, offset, offsetKey, offset);\n}", "function getSelectionForEvent(event, editorState) {\n var node = null;\n var offset = null;\n\n if (typeof document.caretRangeFromPoint === 'function') {\n var dropRange = document.caretRangeFromPoint(event.x, event.y);\n node = dropRange.startContainer;\n offset = dropRange.startOffset;\n } else if (event.rangeParent) {\n node = event.rangeParent;\n offset = event.rangeOffset;\n } else {\n return null;\n }\n\n node = nullthrows(node);\n offset = nullthrows(offset);\n var offsetKey = nullthrows(findAncestorOffsetKey(node));\n\n return getUpdatedSelectionState(editorState, offsetKey, offset, offsetKey, offset);\n}", "function getSelectionForEvent(event, editorState) {\n var node = null;\n var offset = null;\n\n if (typeof document.caretRangeFromPoint === 'function') {\n var dropRange = document.caretRangeFromPoint(event.x, event.y);\n node = dropRange.startContainer;\n offset = dropRange.startOffset;\n } else if (event.rangeParent) {\n node = event.rangeParent;\n offset = event.rangeOffset;\n } else {\n return null;\n }\n\n node = nullthrows(node);\n offset = nullthrows(offset);\n var offsetKey = nullthrows(findAncestorOffsetKey(node));\n\n return getUpdatedSelectionState(editorState, offsetKey, offset, offsetKey, offset);\n}", "function getSelectionForEvent(event, editorState) {\n var node = null;\n var offset = null;\n\n if (typeof document.caretRangeFromPoint === 'function') {\n var dropRange = document.caretRangeFromPoint(event.x, event.y);\n node = dropRange.startContainer;\n offset = dropRange.startOffset;\n } else if (event.rangeParent) {\n node = event.rangeParent;\n offset = event.rangeOffset;\n } else {\n return null;\n }\n\n node = nullthrows(node);\n offset = nullthrows(offset);\n var offsetKey = nullthrows(findAncestorOffsetKey(node));\n\n return getUpdatedSelectionState(editorState, offsetKey, offset, offsetKey, offset);\n}", "function getVisibleSelectionRect(global) {\n var selection = global.getSelection();\n if (!selection.rangeCount) {\n return null;\n }\n\n var range = selection.getRangeAt(0);\n var boundingRect = getRangeBoundingClientRect(range);\n var top = boundingRect.top;\n var right = boundingRect.right;\n var bottom = boundingRect.bottom;\n var left = boundingRect.left;\n\n // When a re-render leads to a node being removed, the DOM selection will\n // temporarily be placed on an ancestor node, which leads to an invalid\n // bounding rect. Discard this state.\n\n if (top === 0 && right === 0 && bottom === 0 && left === 0) {\n return null;\n }\n\n return boundingRect;\n}", "function getVisibleSelectionRect(global) {\n var selection = global.getSelection();\n if (!selection.rangeCount) {\n return null;\n }\n\n var range = selection.getRangeAt(0);\n var boundingRect = getRangeBoundingClientRect(range);\n var top = boundingRect.top;\n var right = boundingRect.right;\n var bottom = boundingRect.bottom;\n var left = boundingRect.left;\n\n // When a re-render leads to a node being removed, the DOM selection will\n // temporarily be placed on an ancestor node, which leads to an invalid\n // bounding rect. Discard this state.\n\n if (top === 0 && right === 0 && bottom === 0 && left === 0) {\n return null;\n }\n\n return boundingRect;\n}", "function getVisibleSelectionRect(global) {\n var selection = global.getSelection();\n if (!selection.rangeCount) {\n return null;\n }\n\n var range = selection.getRangeAt(0);\n var boundingRect = getRangeBoundingClientRect(range);\n var top = boundingRect.top;\n var right = boundingRect.right;\n var bottom = boundingRect.bottom;\n var left = boundingRect.left;\n\n // When a re-render leads to a node being removed, the DOM selection will\n // temporarily be placed on an ancestor node, which leads to an invalid\n // bounding rect. Discard this state.\n\n if (top === 0 && right === 0 && bottom === 0 && left === 0) {\n return null;\n }\n\n return boundingRect;\n}", "function getPositionMouse(canvas, event) {\n var area = canvas.getBoundingClientRect();\n return {\n x: event.clientX - area.left,\n y: event.clientY - area.top\n };\n}", "function deriveCursorForDocument(paramMouseX, paramMouseY, paramDocument) {\r\n\r\n\t// Calculate line and column number based on mouse position\r\n\tvar currow = Math.floor((mouseY - PADDING_TOP)/FONT_HEIGHT);\r\n\tvar curcol = Math.floor((mouseX - PADDING_LEFT)/FONT_WIDTH);\r\n\t\r\n\t// Perform sanity check on calculated values:\r\n\t// If the calculated line is below the last line, then set cursor at last character in document\r\n\tif (currow > paramDocument.getDocumentLength()-1) {\r\n\t\tcurrow = paramDocument.getDocumentLength()-1;\r\n\t\tcurcol = paramDocument.getLineLength( paramDocument.getDocumentLength() );\r\n\t}\r\n\t// If the calculated cursor is beyond the first or last character in a line, \r\n\t// then set the cursor to the first or last character, respectively\r\n\telse {\t\t\r\n\t\tif ( curcol < 0 ) curcol = 0;\r\n\t\tif ( curcol > paramDocument.getLineLength(currow) ) curcol = paramDocument.getLineLength(currow);\r\n\t}\r\n\t\r\n\t// Before we move the cursor there, make sure that the line isn't locked\r\n\tif( paramDocument.getLineLockingUser( currow ) != null ){\r\n\t\talert(\"Another user is currently on line \"+currow+\", and it is locked.\");\r\n\t\treturn;\r\n\t}\r\n\t\r\n\t// Store the calculated values\r\n\tsetCursor(currow,curcol);\r\n}", "function getSelectionCoords(win) {\n\n win = win || window;\n var doc = win.document;\n var sel = doc.selection, range, rects, rect;\n var left = 0, top = 0, bottom = 0, right = 0;\n\n if (sel) {\n if (sel.type != \"Control\") {\n range = sel.createRange();\n range.collapse(true);\n left = range.boundingLeft;\n top = range.boundingTop;\n bottom = range.boundingBottom;\n right = range.boundingRight;\n }\n } else if (win.getSelection) {\n sel = win.getSelection();\n if (sel.rangeCount) {\n range = sel.getRangeAt(0).cloneRange();\n if (range.getClientRects) {\n range.collapse(true);\n rects = range.getClientRects();\n if (rects.length > 0) {\n rect = rects[0];\n }\n left = rect.left;\n top = rect.top;\n bottom = rect.bottom;\n right = rect.right;\n\n }\n // Fall back to inserting a temporary element\n if (left == 0 && top == 0 && bottom == 0 && right ==0) {\n var span = doc.createElement(\"span\");\n if (span.getClientRects) {\n // Ensure span has dimensions and position by\n // adding a zero-width space character\n span.appendChild( doc.createTextNode(\"\\u200b\") );\n range.insertNode(span);\n rect = span.getClientRects()[0];\n left = rect.left;\n top = rect.top;\n bottom = rect.bottom;\n right = rect.right;\n\n var spanParent = span.parentNode;\n spanParent.removeChild(span);\n\n // Glue any broken text nodes back together\n spanParent.normalize();\n }\n }\n }\n }\n\n return { left: left, top: top, bottom: bottom, right: right };\n}", "function kwmousePosition(event, element)\n{\n var offset = jQuery(element).offset();\n return {left: event.pageX - offset.left, top: event.pageY - offset.top};\n}", "function getCoords(event, element, colCount, rowCount, hasValidCharSize, actualCellWidth, actualCellHeight, isSelection) {\n // Coordinates cannot be measured if there are no valid\n if (!hasValidCharSize) {\n return undefined;\n }\n const coords = getCoordsRelativeToElement(event, element);\n if (!coords) {\n return undefined;\n }\n coords[0] = Math.ceil((coords[0] + (isSelection ? actualCellWidth / 2 : 0)) / actualCellWidth);\n coords[1] = Math.ceil(coords[1] / actualCellHeight);\n // Ensure coordinates are within the terminal viewport. Note that selections\n // need an addition point of precision to cover the end point (as characters\n // cover half of one char and half of the next).\n coords[0] = Math.min(Math.max(coords[0], 1), colCount + (isSelection ? 1 : 0));\n coords[1] = Math.min(Math.max(coords[1], 1), rowCount);\n return coords;\n}", "function getCursorPosition(e) {\n\tvar x, y;\n\tif ( event.offsetX == null ) {\t// Firefox\n\t x = event.originalEvent.layerX;\n\t y = event.originalEvent.layerY;\n\t}\n\telse {\t// Other browsers\n\t x = event.offsetX;\n\t y = event.offsetY;\n\t}\n\treturn [x, y];\n}", "function getMousePos(canvasDom, mouseEvent) {\n\t\tvar rect = canvasDom.getBoundingClientRect();\n\t\treturn {\n\t\t\tx: mouseEvent.clientX - rect.left,\n\t\t\ty: mouseEvent.clientY - rect.top\n\t\t};\n\t}", "function getMousePos(canvasDom, mouseEvent) {\n\t\tvar rect = canvasDom.getBoundingClientRect();\n\t\treturn {\n\t\t\tx: mouseEvent.clientX - rect.left,\n\t\t\ty: mouseEvent.clientY - rect.top\n\t\t};\n\t}", "function getMousePos(canvasDom, mouseEvent) {\r\n var rect = canvasDom.getBoundingClientRect();\r\n return {\r\n x: mouseEvent.pageX - rect.left,\r\n y: mouseEvent.pageY - rect.top\r\n };\r\n }", "function getEventPosition(evt) {\n\t\tif (evt.offsetX !== undefined) {\n\t\t\treturn { x: evt.offsetX, y: evt.offsetY };\n\t\t}\n\n\t\tvar el = evt.target,\n\t\t\toffset = { x: 0, y: 0 };\n\n\t\twhile (el.offsetParent) {\n\t\t\toffset.x += el.offsetLeft;\n\t\t\toffset.y += el.offsetTop;\n\t\t\tel = el.offsetParent;\n\t\t}\n\n\t\toffset.x = evt.pageX - offset.x;\n\t\toffset.y = evt.pageY - offset.y;\n\n\t\treturn offset;\n\t}", "function getMousePos(evt) {\n \tvar rect = canvas.getBoundingClientRect();\n \t\n \treturn {\n \t\tx: Math.floor(evt.clientX - rect.left),\n \t\ty: Math.floor(evt.clientY - rect.top)\n \t};\n }", "function getMousePos(evt) {\n \tvar rect = canvas.getBoundingClientRect();\n \t\n \treturn {\n \t\tx: Math.floor(evt.clientX - rect.left),\n \t\ty: Math.floor(evt.clientY - rect.top)\n \t};\n }", "function getMousePos(canvasDom, mouseEvent) {\n\t\tvar rect = canvasDom.getBoundingClientRect();\n\t\treturn {\n\t\t\tx : mouseEvent.clientX - rect.left,\n\t\t\ty : mouseEvent.clientY - rect.top\n\t\t};\n\t}", "function getMousePos(canvasDom, mouseEvent) {\n\t\tvar rect = canvasDom.getBoundingClientRect();\n\t\treturn {\n\t\t\tx : mouseEvent.clientX - rect.left,\n\t\t\ty : mouseEvent.clientY - rect.top\n\t\t};\n\t}", "function getMousePos(canvasDom, mouseEvent) {\n\t\tvar rect = canvasDom.getBoundingClientRect();\n\t\treturn {\n\t\t\tx : mouseEvent.clientX - rect.left,\n\t\t\ty : mouseEvent.clientY - rect.top\n\t\t};\n\t}", "function getVisibleSelectionRect(global) {\n var selection = global.getSelection();\n if (!selection.rangeCount) {\n return null;\n }\n\n var range = selection.getRangeAt(0);\n var boundingRect = getRangeBoundingClientRect(range);\n var top = boundingRect.top,\n right = boundingRect.right,\n bottom = boundingRect.bottom,\n left = boundingRect.left;\n\n // When a re-render leads to a node being removed, the DOM selection will\n // temporarily be placed on an ancestor node, which leads to an invalid\n // bounding rect. Discard this state.\n\n if (top === 0 && right === 0 && bottom === 0 && left === 0) {\n return null;\n }\n\n return boundingRect;\n}", "function getVisibleSelectionRect(global) {\n var selection = global.getSelection();\n if (!selection.rangeCount) {\n return null;\n }\n\n var range = selection.getRangeAt(0);\n var boundingRect = getRangeBoundingClientRect(range);\n var top = boundingRect.top,\n right = boundingRect.right,\n bottom = boundingRect.bottom,\n left = boundingRect.left;\n\n // When a re-render leads to a node being removed, the DOM selection will\n // temporarily be placed on an ancestor node, which leads to an invalid\n // bounding rect. Discard this state.\n\n if (top === 0 && right === 0 && bottom === 0 && left === 0) {\n return null;\n }\n\n return boundingRect;\n}", "function getVisibleSelectionRect(global) {\n var selection = global.getSelection();\n if (!selection.rangeCount) {\n return null;\n }\n\n var range = selection.getRangeAt(0);\n var boundingRect = getRangeBoundingClientRect(range);\n var top = boundingRect.top,\n right = boundingRect.right,\n bottom = boundingRect.bottom,\n left = boundingRect.left;\n\n // When a re-render leads to a node being removed, the DOM selection will\n // temporarily be placed on an ancestor node, which leads to an invalid\n // bounding rect. Discard this state.\n\n if (top === 0 && right === 0 && bottom === 0 && left === 0) {\n return null;\n }\n\n return boundingRect;\n}", "function getVisibleSelectionRect(global) {\n var selection = global.getSelection();\n if (!selection.rangeCount) {\n return null;\n }\n\n var range = selection.getRangeAt(0);\n var boundingRect = getRangeBoundingClientRect(range);\n var top = boundingRect.top,\n right = boundingRect.right,\n bottom = boundingRect.bottom,\n left = boundingRect.left;\n\n // When a re-render leads to a node being removed, the DOM selection will\n // temporarily be placed on an ancestor node, which leads to an invalid\n // bounding rect. Discard this state.\n\n if (top === 0 && right === 0 && bottom === 0 && left === 0) {\n return null;\n }\n\n return boundingRect;\n}", "function getVisibleSelectionRect(global) {\n var selection = global.getSelection();\n if (!selection.rangeCount) {\n return null;\n }\n\n var range = selection.getRangeAt(0);\n var boundingRect = getRangeBoundingClientRect(range);\n var top = boundingRect.top,\n right = boundingRect.right,\n bottom = boundingRect.bottom,\n left = boundingRect.left;\n\n // When a re-render leads to a node being removed, the DOM selection will\n // temporarily be placed on an ancestor node, which leads to an invalid\n // bounding rect. Discard this state.\n\n if (top === 0 && right === 0 && bottom === 0 && left === 0) {\n return null;\n }\n\n return boundingRect;\n}", "function getVisibleSelectionRect(global) {\n var selection = global.getSelection();\n if (!selection.rangeCount) {\n return null;\n }\n\n var range = selection.getRangeAt(0);\n var boundingRect = getRangeBoundingClientRect(range);\n var top = boundingRect.top,\n right = boundingRect.right,\n bottom = boundingRect.bottom,\n left = boundingRect.left;\n\n // When a re-render leads to a node being removed, the DOM selection will\n // temporarily be placed on an ancestor node, which leads to an invalid\n // bounding rect. Discard this state.\n\n if (top === 0 && right === 0 && bottom === 0 && left === 0) {\n return null;\n }\n\n return boundingRect;\n}", "function calculateMousePos(evt) {\n\tvar rect = canvas.getBoundingClientRect();\n\tvar root = document.documentElement;\n\tvar mouseX = evt.clientX - rect.left - root.scrollLeft;\n\tvar mouseY = evt.clientY - rect.top - root.scrollTop;\n\treturn {\n\t\tx: mouseX,\n\t\ty: mouseY\n\t};\n}", "function getVisibleSelectionRect(global) {\n\t var selection = global.getSelection();\n\t if (!selection.rangeCount) {\n\t return null;\n\t }\n\n\t var range = selection.getRangeAt(0);\n\t var boundingRect = getRangeBoundingClientRect(range);\n\t var top = boundingRect.top;\n\t var right = boundingRect.right;\n\t var bottom = boundingRect.bottom;\n\t var left = boundingRect.left;\n\n\t // When a re-render leads to a node being removed, the DOM selection will\n\t // temporarily be placed on an ancestor node, which leads to an invalid\n\t // bounding rect. Discard this state.\n\n\t if (top === 0 && right === 0 && bottom === 0 && left === 0) {\n\t return null;\n\t }\n\n\t return boundingRect;\n\t}", "function offsetMousePos(parent, evt) {\n var p = topLeftCorner(parent.getClientRects()[0]);\n return { x: evt.clientX - p.x, y: evt.clientY - p.y };\n}" ]
[ "0.77090347", "0.77090347", "0.77090347", "0.77090347", "0.76392555", "0.75154114", "0.75154114", "0.74738806", "0.74738806", "0.74582624", "0.74582624", "0.7457641", "0.7457641", "0.7457641", "0.7457641", "0.7457641", "0.7457641", "0.7457641", "0.7457641", "0.7455493", "0.7455493", "0.7455493", "0.7455493", "0.7455493", "0.7455493", "0.7455493", "0.7455493", "0.7455493", "0.7455493", "0.7455493", "0.74448097", "0.74375397", "0.74375397", "0.7433318", "0.7422766", "0.7422766", "0.7398451", "0.73822093", "0.73484635", "0.6018304", "0.59751", "0.589905", "0.5895591", "0.58544344", "0.5780144", "0.57752454", "0.57561135", "0.57188255", "0.5673286", "0.5671171", "0.5666509", "0.5662992", "0.5659871", "0.56523967", "0.5651329", "0.56459546", "0.56424195", "0.5641762", "0.56408393", "0.56408393", "0.56408393", "0.56408393", "0.56408393", "0.56408393", "0.56408393", "0.56408393", "0.56408393", "0.5631316", "0.5631316", "0.5631316", "0.5630631", "0.56229097", "0.56142044", "0.5612141", "0.56079674", "0.56033814", "0.5602174", "0.5602174", "0.5600488", "0.5598154", "0.55953944", "0.55953944", "0.5589102", "0.5589102", "0.5589102", "0.55872685", "0.55872685", "0.55872685", "0.55872685", "0.55872685", "0.55872685", "0.55791754", "0.55778384", "0.55776584" ]
0.7435852
39
Find the view element corresponding to a given line. Return null when the line isn't visible.
function findViewIndex(cm, n) { if (n >= cm.display.viewTo) { return null } n -= cm.display.viewFrom; if (n < 0) { return null } var view = cm.display.view; for (var i = 0; i < view.length; i++) { n -= view[i].size; if (n < 0) { return i } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n }", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n }", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n }", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n }", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n }", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n }", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n }", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n }", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n }", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n }", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n }", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n }", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n }", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n }", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n }", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n }", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n }", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n return cm.display.view[findViewIndex(cm, lineN)];\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n return ext;\n }", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n return cm.display.view[findViewIndex(cm, lineN)];\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n return ext;\n }", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n return cm.display.view[findViewIndex(cm, lineN)];\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n return ext;\n }", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n return cm.display.view[findViewIndex(cm, lineN)];\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n return ext;\n }", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n return cm.display.view[findViewIndex(cm, lineN)];\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n return ext;\n }", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n return cm.display.view[findViewIndex(cm, lineN)];\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n return ext;\n }", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n return cm.display.view[findViewIndex(cm, lineN)];\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n return ext;\n }", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n return cm.display.view[findViewIndex(cm, lineN)];\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n return ext;\n }", "function findViewForLine(cm, lineN) {\n\t if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n\t return cm.display.view[findViewIndex(cm, lineN)];\n\t var ext = cm.display.externalMeasured;\n\t if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n\t return ext;\n\t }", "function findViewForLine(cm, lineN) {\n\t if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n\t return cm.display.view[findViewIndex(cm, lineN)];\n\t var ext = cm.display.externalMeasured;\n\t if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n\t return ext;\n\t }", "function findViewForLine(cm, lineN) {\n\t if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n\t return cm.display.view[findViewIndex(cm, lineN)];\n\t var ext = cm.display.externalMeasured;\n\t if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n\t return ext;\n\t }", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n}", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n}", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n}", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n}", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n}", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n}", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n}", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n}", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n}", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n}", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n}", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n}", "function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n}", "function findViewForLine(cm, lineN) {\n\t\t if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n\t\t return cm.display.view[findViewIndex(cm, lineN)];\n\t\t var ext = cm.display.externalMeasured;\n\t\t if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n\t\t return ext;\n\t\t }", "function findViewForLine(cm, lineN) {\r\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\r\n return cm.display.view[findViewIndex(cm, lineN)];\r\n var ext = cm.display.externalMeasured;\r\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\r\n return ext;\r\n }", "function findViewForLine(cm, lineN) {\n\t\t if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n\t\t { return cm.display.view[findViewIndex(cm, lineN)] }\n\t\t var ext = cm.display.externalMeasured;\n\t\t if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n\t\t { return ext }\n\t\t }", "function findViewForLine(cm, lineN) {\r\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\r\n { return cm.display.view[findViewIndex(cm, lineN)]; }\r\n var ext = cm.display.externalMeasured;\r\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\r\n { return ext; }\r\n }", "function findViewForLine(cm, lineN) {\r\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\r\n { return cm.display.view[findViewIndex(cm, lineN)] }\r\n var ext = cm.display.externalMeasured;\r\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\r\n { return ext }\r\n}", "function visualLine(line) {\n\t\t var merged;\n\t\t while (merged = collapsedSpanAtStart(line))\n\t\t line = merged.find(-1, true).line;\n\t\t return line;\n\t\t }", "function visualLine(line) {\n\t var merged;\n\t while (merged = collapsedSpanAtStart(line))\n\t line = merged.find(-1, true).line;\n\t return line;\n\t }", "function visualLine(line) {\n\t var merged;\n\t while (merged = collapsedSpanAtStart(line))\n\t line = merged.find(-1, true).line;\n\t return line;\n\t }", "function visualLine(line) {\n\t var merged;\n\t while (merged = collapsedSpanAtStart(line))\n\t line = merged.find(-1, true).line;\n\t return line;\n\t }", "function visualLine(line) {\n\t\t var merged;\n\t\t while (merged = collapsedSpanAtStart(line))\n\t\t { line = merged.find(-1, true).line; }\n\t\t return line\n\t\t }", "function visualLine(line) {\r\n var merged;\r\n while (merged = collapsedSpanAtStart(line))\r\n line = merged.find(-1, true).line;\r\n return line;\r\n }", "function visualLine(line) {\n var merged;\n\n while (merged = collapsedSpanAtStart(line)) {\n line = merged.find(-1, true).line;\n }\n\n return line;\n }", "function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n line = merged.find(-1, true).line;\n return line;\n }", "function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n line = merged.find(-1, true).line;\n return line;\n }", "function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n line = merged.find(-1, true).line;\n return line;\n }", "function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n line = merged.find(-1, true).line;\n return line;\n }", "function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n line = merged.find(-1, true).line;\n return line;\n }", "function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n line = merged.find(-1, true).line;\n return line;\n }", "function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n line = merged.find(-1, true).line;\n return line;\n }", "function visualLine(line) {\r\n var merged;\r\n while (merged = collapsedSpanAtStart(line))\r\n { line = merged.find(-1, true).line; }\r\n return line\r\n}", "function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n { line = merged.find(-1, true).line; }\n return line\n }", "function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n { line = merged.find(-1, true).line; }\n return line\n }", "function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n { line = merged.find(-1, true).line; }\n return line\n }", "function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n { line = merged.find(-1, true).line; }\n return line\n }", "function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n { line = merged.find(-1, true).line; }\n return line\n }", "function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n { line = merged.find(-1, true).line; }\n return line\n }", "function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n { line = merged.find(-1, true).line; }\n return line\n }", "function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n { line = merged.find(-1, true).line; }\n return line\n }", "function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n { line = merged.find(-1, true).line; }\n return line\n }", "function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n { line = merged.find(-1, true).line; }\n return line\n }", "function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n { line = merged.find(-1, true).line; }\n return line\n }", "function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n { line = merged.find(-1, true).line; }\n return line\n }", "function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n { line = merged.find(-1, true).line; }\n return line\n }", "function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n { line = merged.find(-1, true).line; }\n return line\n }", "function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n { line = merged.find(-1, true).line; }\n return line\n }", "function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n { line = merged.find(-1, true).line; }\n return line\n }", "function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n { line = merged.find(-1, true).line; }\n return line\n }", "getPositionFromDOMInfo(spanNode, offset) {\n const viewLineDomNode = this._getViewLineDomNode(spanNode);\n if (viewLineDomNode === null) {\n // Couldn't find view line node\n return null;\n }\n const lineNumber = this._getLineNumberFor(viewLineDomNode);\n if (lineNumber === -1) {\n // Couldn't find view line node\n return null;\n }\n if (lineNumber < 1 || lineNumber > this._context.model.getLineCount()) {\n // lineNumber is outside range\n return null;\n }\n if (this._context.model.getLineMaxColumn(lineNumber) === 1) {\n // Line is empty\n return new position_1.Position(lineNumber, 1);\n }\n const rendStartLineNumber = this._visibleLines.getStartLineNumber();\n const rendEndLineNumber = this._visibleLines.getEndLineNumber();\n if (lineNumber < rendStartLineNumber || lineNumber > rendEndLineNumber) {\n // Couldn't find line\n return null;\n }\n let column = this._visibleLines.getVisibleLine(lineNumber).getColumnOfNodeOffset(lineNumber, spanNode, offset);\n const minColumn = this._context.model.getLineMinColumn(lineNumber);\n if (column < minColumn) {\n column = minColumn;\n }\n return new position_1.Position(lineNumber, column);\n }", "function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n { line = merged.find(-1, true).line; }\n return line\n}", "function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n { line = merged.find(-1, true).line; }\n return line\n}", "function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n { line = merged.find(-1, true).line; }\n return line\n}", "function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n { line = merged.find(-1, true).line; }\n return line\n}", "function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n { line = merged.find(-1, true).line; }\n return line\n}", "function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n { line = merged.find(-1, true).line; }\n return line\n}", "function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n { line = merged.find(-1, true).line; }\n return line\n}", "function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n { line = merged.find(-1, true).line; }\n return line\n}", "function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n { line = merged.find(-1, true).line; }\n return line\n}", "function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n { line = merged.find(-1, true).line; }\n return line\n}", "function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n { line = merged.find(-1, true).line; }\n return line\n}", "function visualLine(line) {\n var merged\n while (merged = collapsedSpanAtStart(line))\n { line = merged.find(-1, true).line }\n return line\n}", "function visualLine(line) {\n var merged\n while (merged = collapsedSpanAtStart(line))\n { line = merged.find(-1, true).line }\n return line\n}", "function visualLineNo(doc, lineN) {\n var line = getLine(doc, lineN), vis = visualLine(line)\n if (line == vis) { return lineN }\n return lineNo(vis)\n}", "function visualLineNo(doc, lineN) {\n var line = getLine(doc, lineN), vis = visualLine(line)\n if (line == vis) { return lineN }\n return lineNo(vis)\n}", "function visualLineNo(doc, lineN) {\n var line = getLine(doc, lineN), vis = visualLine(line);\n if (line == vis) { return lineN }\n return lineNo(vis)\n }", "function visualLineNo(doc, lineN) {\n var line = getLine(doc, lineN), vis = visualLine(line);\n if (line == vis) { return lineN }\n return lineNo(vis)\n }", "function visualLineNo(doc, lineN) {\n var line = getLine(doc, lineN), vis = visualLine(line);\n if (line == vis) { return lineN }\n return lineNo(vis)\n }", "function visualLineNo(doc, lineN) {\n var line = getLine(doc, lineN), vis = visualLine(line);\n if (line == vis) { return lineN }\n return lineNo(vis)\n }", "function visualLineNo(doc, lineN) {\n var line = getLine(doc, lineN), vis = visualLine(line);\n if (line == vis) { return lineN }\n return lineNo(vis)\n }", "function visualLineNo(doc, lineN) {\n var line = getLine(doc, lineN), vis = visualLine(line);\n if (line == vis) { return lineN }\n return lineNo(vis)\n }", "function visualLineNo(doc, lineN) {\n var line = getLine(doc, lineN), vis = visualLine(line);\n if (line == vis) { return lineN }\n return lineNo(vis)\n }" ]
[ "0.700917", "0.700917", "0.700917", "0.700917", "0.700917", "0.700917", "0.700917", "0.700917", "0.700917", "0.700917", "0.700917", "0.700917", "0.700917", "0.700917", "0.700917", "0.700917", "0.700917", "0.6991396", "0.6991396", "0.6991396", "0.6991396", "0.6991396", "0.6991396", "0.6991396", "0.6991396", "0.69733727", "0.69733727", "0.69733727", "0.69404536", "0.69404536", "0.69404536", "0.69404536", "0.69404536", "0.69404536", "0.69404536", "0.69404536", "0.69404536", "0.69404536", "0.69404536", "0.69353235", "0.69353235", "0.6908597", "0.6896335", "0.6894397", "0.6874752", "0.6870882", "0.6132745", "0.6127492", "0.6127492", "0.6127492", "0.609546", "0.6018491", "0.60032576", "0.60020024", "0.60020024", "0.60020024", "0.60020024", "0.60020024", "0.60020024", "0.60020024", "0.5976657", "0.5966817", "0.5966817", "0.5966817", "0.5966817", "0.5966817", "0.5966817", "0.5966817", "0.5966817", "0.5966817", "0.5966817", "0.5966817", "0.5966817", "0.5966817", "0.5966817", "0.5966817", "0.5966817", "0.5966817", "0.5887464", "0.58720255", "0.58720255", "0.58720255", "0.58720255", "0.58720255", "0.58720255", "0.58720255", "0.58720255", "0.58720255", "0.58720255", "0.58720255", "0.58392996", "0.58392996", "0.5835033", "0.5835033", "0.57934594", "0.57934594", "0.57934594", "0.57934594", "0.57934594", "0.57934594", "0.57934594" ]
0.0
-1
Updates the display.view data structure for a given change to the document. From and to are in prechange coordinates. Lendiff is the amount of lines added or subtracted by the change. This is used for changes that span multiple lines, or change the way lines are divided into visual lines. regLineChange (below) registers singleline changes.
function regChange(cm, from, to, lendiff) { if (from == null) { from = cm.doc.first; } if (to == null) { to = cm.doc.first + cm.doc.size; } if (!lendiff) { lendiff = 0; } var display = cm.display; if (lendiff && to < display.viewTo && (display.updateLineNumbers == null || display.updateLineNumbers > from)) { display.updateLineNumbers = from; } cm.curOp.viewChanged = true; if (from >= display.viewTo) { // Change after if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo) { resetView(cm); } } else if (to <= display.viewFrom) { // Change before if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) { resetView(cm); } else { display.viewFrom += lendiff; display.viewTo += lendiff; } } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap resetView(cm); } else if (from <= display.viewFrom) { // Top overlap var cut = viewCuttingPoint(cm, to, to + lendiff, 1); if (cut) { display.view = display.view.slice(cut.index); display.viewFrom = cut.lineN; display.viewTo += lendiff; } else { resetView(cm); } } else if (to >= display.viewTo) { // Bottom overlap var cut$1 = viewCuttingPoint(cm, from, from, -1); if (cut$1) { display.view = display.view.slice(0, cut$1.index); display.viewTo = cut$1.lineN; } else { resetView(cm); } } else { // Gap in the middle var cutTop = viewCuttingPoint(cm, from, from, -1); var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1); if (cutTop && cutBot) { display.view = display.view.slice(0, cutTop.index) .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN)) .concat(display.view.slice(cutBot.index)); display.viewTo += lendiff; } else { resetView(cm); } } var ext = display.externalMeasured; if (ext) { if (to < ext.lineN) { ext.lineN += lendiff; } else if (from < ext.lineN + ext.size) { display.externalMeasured = null; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function regChange(cm, from, to, lendiff) {\n if (from == null) {\n from = cm.doc.first;\n }\n\n if (to == null) {\n to = cm.doc.first + cm.doc.size;\n }\n\n if (!lendiff) {\n lendiff = 0;\n }\n\n var display = cm.display;\n\n if (lendiff && to < display.viewTo && (display.updateLineNumbers == null || display.updateLineNumbers > from)) {\n display.updateLineNumbers = from;\n }\n\n cm.curOp.viewChanged = true;\n\n if (from >= display.viewTo) {\n // Change after\n if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo) {\n resetView(cm);\n }\n } else if (to <= display.viewFrom) {\n // Change before\n if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\n resetView(cm);\n } else {\n display.viewFrom += lendiff;\n display.viewTo += lendiff;\n }\n } else if (from <= display.viewFrom && to >= display.viewTo) {\n // Full overlap\n resetView(cm);\n } else if (from <= display.viewFrom) {\n // Top overlap\n var cut = viewCuttingPoint(cm, to, to + lendiff, 1);\n\n if (cut) {\n display.view = display.view.slice(cut.index);\n display.viewFrom = cut.lineN;\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n } else if (to >= display.viewTo) {\n // Bottom overlap\n var cut$1 = viewCuttingPoint(cm, from, from, -1);\n\n if (cut$1) {\n display.view = display.view.slice(0, cut$1.index);\n display.viewTo = cut$1.lineN;\n } else {\n resetView(cm);\n }\n } else {\n // Gap in the middle\n var cutTop = viewCuttingPoint(cm, from, from, -1);\n var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);\n\n if (cutTop && cutBot) {\n display.view = display.view.slice(0, cutTop.index).concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN)).concat(display.view.slice(cutBot.index));\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n }\n\n var ext = display.externalMeasured;\n\n if (ext) {\n if (to < ext.lineN) {\n ext.lineN += lendiff;\n } else if (from < ext.lineN + ext.size) {\n display.externalMeasured = null;\n }\n }\n } // Register a change to a single line. Type must be one of \"text\",", "function regChange(cm, from, to, lendiff) {\n\t if (from == null) from = cm.doc.first;\n\t if (to == null) to = cm.doc.first + cm.doc.size;\n\t if (!lendiff) lendiff = 0;\n\t\n\t var display = cm.display;\n\t if (lendiff && to < display.viewTo &&\n\t (display.updateLineNumbers == null || display.updateLineNumbers > from))\n\t display.updateLineNumbers = from;\n\t\n\t cm.curOp.viewChanged = true;\n\t\n\t if (from >= display.viewTo) { // Change after\n\t if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)\n\t resetView(cm);\n\t } else if (to <= display.viewFrom) { // Change before\n\t if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\n\t resetView(cm);\n\t } else {\n\t display.viewFrom += lendiff;\n\t display.viewTo += lendiff;\n\t }\n\t } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap\n\t resetView(cm);\n\t } else if (from <= display.viewFrom) { // Top overlap\n\t var cut = viewCuttingPoint(cm, to, to + lendiff, 1);\n\t if (cut) {\n\t display.view = display.view.slice(cut.index);\n\t display.viewFrom = cut.lineN;\n\t display.viewTo += lendiff;\n\t } else {\n\t resetView(cm);\n\t }\n\t } else if (to >= display.viewTo) { // Bottom overlap\n\t var cut = viewCuttingPoint(cm, from, from, -1);\n\t if (cut) {\n\t display.view = display.view.slice(0, cut.index);\n\t display.viewTo = cut.lineN;\n\t } else {\n\t resetView(cm);\n\t }\n\t } else { // Gap in the middle\n\t var cutTop = viewCuttingPoint(cm, from, from, -1);\n\t var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);\n\t if (cutTop && cutBot) {\n\t display.view = display.view.slice(0, cutTop.index)\n\t .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))\n\t .concat(display.view.slice(cutBot.index));\n\t display.viewTo += lendiff;\n\t } else {\n\t resetView(cm);\n\t }\n\t }\n\t\n\t var ext = display.externalMeasured;\n\t if (ext) {\n\t if (to < ext.lineN)\n\t ext.lineN += lendiff;\n\t else if (from < ext.lineN + ext.size)\n\t display.externalMeasured = null;\n\t }\n\t }", "function regChange(cm, from, to, lendiff) {\n\t if (from == null) from = cm.doc.first;\n\t if (to == null) to = cm.doc.first + cm.doc.size;\n\t if (!lendiff) lendiff = 0;\n\n\t var display = cm.display;\n\t if (lendiff && to < display.viewTo &&\n\t (display.updateLineNumbers == null || display.updateLineNumbers > from))\n\t display.updateLineNumbers = from;\n\n\t cm.curOp.viewChanged = true;\n\n\t if (from >= display.viewTo) { // Change after\n\t if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)\n\t resetView(cm);\n\t } else if (to <= display.viewFrom) { // Change before\n\t if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\n\t resetView(cm);\n\t } else {\n\t display.viewFrom += lendiff;\n\t display.viewTo += lendiff;\n\t }\n\t } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap\n\t resetView(cm);\n\t } else if (from <= display.viewFrom) { // Top overlap\n\t var cut = viewCuttingPoint(cm, to, to + lendiff, 1);\n\t if (cut) {\n\t display.view = display.view.slice(cut.index);\n\t display.viewFrom = cut.lineN;\n\t display.viewTo += lendiff;\n\t } else {\n\t resetView(cm);\n\t }\n\t } else if (to >= display.viewTo) { // Bottom overlap\n\t var cut = viewCuttingPoint(cm, from, from, -1);\n\t if (cut) {\n\t display.view = display.view.slice(0, cut.index);\n\t display.viewTo = cut.lineN;\n\t } else {\n\t resetView(cm);\n\t }\n\t } else { // Gap in the middle\n\t var cutTop = viewCuttingPoint(cm, from, from, -1);\n\t var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);\n\t if (cutTop && cutBot) {\n\t display.view = display.view.slice(0, cutTop.index)\n\t .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))\n\t .concat(display.view.slice(cutBot.index));\n\t display.viewTo += lendiff;\n\t } else {\n\t resetView(cm);\n\t }\n\t }\n\n\t var ext = display.externalMeasured;\n\t if (ext) {\n\t if (to < ext.lineN)\n\t ext.lineN += lendiff;\n\t else if (from < ext.lineN + ext.size)\n\t display.externalMeasured = null;\n\t }\n\t }", "function regChange(cm, from, to, lendiff) {\n\t if (from == null) from = cm.doc.first;\n\t if (to == null) to = cm.doc.first + cm.doc.size;\n\t if (!lendiff) lendiff = 0;\n\n\t var display = cm.display;\n\t if (lendiff && to < display.viewTo &&\n\t (display.updateLineNumbers == null || display.updateLineNumbers > from))\n\t display.updateLineNumbers = from;\n\n\t cm.curOp.viewChanged = true;\n\n\t if (from >= display.viewTo) { // Change after\n\t if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)\n\t resetView(cm);\n\t } else if (to <= display.viewFrom) { // Change before\n\t if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\n\t resetView(cm);\n\t } else {\n\t display.viewFrom += lendiff;\n\t display.viewTo += lendiff;\n\t }\n\t } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap\n\t resetView(cm);\n\t } else if (from <= display.viewFrom) { // Top overlap\n\t var cut = viewCuttingPoint(cm, to, to + lendiff, 1);\n\t if (cut) {\n\t display.view = display.view.slice(cut.index);\n\t display.viewFrom = cut.lineN;\n\t display.viewTo += lendiff;\n\t } else {\n\t resetView(cm);\n\t }\n\t } else if (to >= display.viewTo) { // Bottom overlap\n\t var cut = viewCuttingPoint(cm, from, from, -1);\n\t if (cut) {\n\t display.view = display.view.slice(0, cut.index);\n\t display.viewTo = cut.lineN;\n\t } else {\n\t resetView(cm);\n\t }\n\t } else { // Gap in the middle\n\t var cutTop = viewCuttingPoint(cm, from, from, -1);\n\t var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);\n\t if (cutTop && cutBot) {\n\t display.view = display.view.slice(0, cutTop.index)\n\t .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))\n\t .concat(display.view.slice(cutBot.index));\n\t display.viewTo += lendiff;\n\t } else {\n\t resetView(cm);\n\t }\n\t }\n\n\t var ext = display.externalMeasured;\n\t if (ext) {\n\t if (to < ext.lineN)\n\t ext.lineN += lendiff;\n\t else if (from < ext.lineN + ext.size)\n\t display.externalMeasured = null;\n\t }\n\t }", "function regChange(cm, from, to, lendiff) {\r\n if (from == null) from = cm.doc.first;\r\n if (to == null) to = cm.doc.first + cm.doc.size;\r\n if (!lendiff) lendiff = 0;\r\n\r\n var display = cm.display;\r\n if (lendiff && to < display.viewTo &&\r\n (display.updateLineNumbers == null || display.updateLineNumbers > from))\r\n display.updateLineNumbers = from;\r\n\r\n cm.curOp.viewChanged = true;\r\n\r\n if (from >= display.viewTo) { // Change after\r\n if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)\r\n resetView(cm);\r\n } else if (to <= display.viewFrom) { // Change before\r\n if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\r\n resetView(cm);\r\n } else {\r\n display.viewFrom += lendiff;\r\n display.viewTo += lendiff;\r\n }\r\n } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap\r\n resetView(cm);\r\n } else if (from <= display.viewFrom) { // Top overlap\r\n var cut = viewCuttingPoint(cm, to, to + lendiff, 1);\r\n if (cut) {\r\n display.view = display.view.slice(cut.index);\r\n display.viewFrom = cut.lineN;\r\n display.viewTo += lendiff;\r\n } else {\r\n resetView(cm);\r\n }\r\n } else if (to >= display.viewTo) { // Bottom overlap\r\n var cut = viewCuttingPoint(cm, from, from, -1);\r\n if (cut) {\r\n display.view = display.view.slice(0, cut.index);\r\n display.viewTo = cut.lineN;\r\n } else {\r\n resetView(cm);\r\n }\r\n } else { // Gap in the middle\r\n var cutTop = viewCuttingPoint(cm, from, from, -1);\r\n var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);\r\n if (cutTop && cutBot) {\r\n display.view = display.view.slice(0, cutTop.index)\r\n .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))\r\n .concat(display.view.slice(cutBot.index));\r\n display.viewTo += lendiff;\r\n } else {\r\n resetView(cm);\r\n }\r\n }\r\n\r\n var ext = display.externalMeasured;\r\n if (ext) {\r\n if (to < ext.lineN)\r\n ext.lineN += lendiff;\r\n else if (from < ext.lineN + ext.size)\r\n display.externalMeasured = null;\r\n }\r\n }", "function regChange(cm, from, to, lendiff) {\n\t\t if (from == null) from = cm.doc.first;\n\t\t if (to == null) to = cm.doc.first + cm.doc.size;\n\t\t if (!lendiff) lendiff = 0;\n\t\t\n\t\t var display = cm.display;\n\t\t if (lendiff && to < display.viewTo &&\n\t\t (display.updateLineNumbers == null || display.updateLineNumbers > from))\n\t\t display.updateLineNumbers = from;\n\t\t\n\t\t cm.curOp.viewChanged = true;\n\t\t\n\t\t if (from >= display.viewTo) { // Change after\n\t\t if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)\n\t\t resetView(cm);\n\t\t } else if (to <= display.viewFrom) { // Change before\n\t\t if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\n\t\t resetView(cm);\n\t\t } else {\n\t\t display.viewFrom += lendiff;\n\t\t display.viewTo += lendiff;\n\t\t }\n\t\t } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap\n\t\t resetView(cm);\n\t\t } else if (from <= display.viewFrom) { // Top overlap\n\t\t var cut = viewCuttingPoint(cm, to, to + lendiff, 1);\n\t\t if (cut) {\n\t\t display.view = display.view.slice(cut.index);\n\t\t display.viewFrom = cut.lineN;\n\t\t display.viewTo += lendiff;\n\t\t } else {\n\t\t resetView(cm);\n\t\t }\n\t\t } else if (to >= display.viewTo) { // Bottom overlap\n\t\t var cut = viewCuttingPoint(cm, from, from, -1);\n\t\t if (cut) {\n\t\t display.view = display.view.slice(0, cut.index);\n\t\t display.viewTo = cut.lineN;\n\t\t } else {\n\t\t resetView(cm);\n\t\t }\n\t\t } else { // Gap in the middle\n\t\t var cutTop = viewCuttingPoint(cm, from, from, -1);\n\t\t var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);\n\t\t if (cutTop && cutBot) {\n\t\t display.view = display.view.slice(0, cutTop.index)\n\t\t .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))\n\t\t .concat(display.view.slice(cutBot.index));\n\t\t display.viewTo += lendiff;\n\t\t } else {\n\t\t resetView(cm);\n\t\t }\n\t\t }\n\t\t\n\t\t var ext = display.externalMeasured;\n\t\t if (ext) {\n\t\t if (to < ext.lineN)\n\t\t ext.lineN += lendiff;\n\t\t else if (from < ext.lineN + ext.size)\n\t\t display.externalMeasured = null;\n\t\t }\n\t\t }", "function regChange(cm, from, to, lendiff) {\n if (from == null) from = cm.doc.first;\n if (to == null) to = cm.doc.first + cm.doc.size;\n if (!lendiff) lendiff = 0;\n\n var display = cm.display;\n if (lendiff && to < display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers > from))\n display.updateLineNumbers = from;\n\n cm.curOp.viewChanged = true;\n\n if (from >= display.viewTo) { // Change after\n if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)\n resetView(cm);\n } else if (to <= display.viewFrom) { // Change before\n if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\n resetView(cm);\n } else {\n display.viewFrom += lendiff;\n display.viewTo += lendiff;\n }\n } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap\n resetView(cm);\n } else if (from <= display.viewFrom) { // Top overlap\n var cut = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cut) {\n display.view = display.view.slice(cut.index);\n display.viewFrom = cut.lineN;\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n } else if (to >= display.viewTo) { // Bottom overlap\n var cut = viewCuttingPoint(cm, from, from, -1);\n if (cut) {\n display.view = display.view.slice(0, cut.index);\n display.viewTo = cut.lineN;\n } else {\n resetView(cm);\n }\n } else { // Gap in the middle\n var cutTop = viewCuttingPoint(cm, from, from, -1);\n var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cutTop && cutBot) {\n display.view = display.view.slice(0, cutTop.index)\n .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))\n .concat(display.view.slice(cutBot.index));\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n }\n\n var ext = display.externalMeasured;\n if (ext) {\n if (to < ext.lineN)\n ext.lineN += lendiff;\n else if (from < ext.lineN + ext.size)\n display.externalMeasured = null;\n }\n }", "function regChange(cm, from, to, lendiff) {\n if (from == null) from = cm.doc.first;\n if (to == null) to = cm.doc.first + cm.doc.size;\n if (!lendiff) lendiff = 0;\n\n var display = cm.display;\n if (lendiff && to < display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers > from))\n display.updateLineNumbers = from;\n\n cm.curOp.viewChanged = true;\n\n if (from >= display.viewTo) { // Change after\n if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)\n resetView(cm);\n } else if (to <= display.viewFrom) { // Change before\n if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\n resetView(cm);\n } else {\n display.viewFrom += lendiff;\n display.viewTo += lendiff;\n }\n } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap\n resetView(cm);\n } else if (from <= display.viewFrom) { // Top overlap\n var cut = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cut) {\n display.view = display.view.slice(cut.index);\n display.viewFrom = cut.lineN;\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n } else if (to >= display.viewTo) { // Bottom overlap\n var cut = viewCuttingPoint(cm, from, from, -1);\n if (cut) {\n display.view = display.view.slice(0, cut.index);\n display.viewTo = cut.lineN;\n } else {\n resetView(cm);\n }\n } else { // Gap in the middle\n var cutTop = viewCuttingPoint(cm, from, from, -1);\n var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cutTop && cutBot) {\n display.view = display.view.slice(0, cutTop.index)\n .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))\n .concat(display.view.slice(cutBot.index));\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n }\n\n var ext = display.externalMeasured;\n if (ext) {\n if (to < ext.lineN)\n ext.lineN += lendiff;\n else if (from < ext.lineN + ext.size)\n display.externalMeasured = null;\n }\n }", "function regChange(cm, from, to, lendiff) {\n if (from == null) from = cm.doc.first;\n if (to == null) to = cm.doc.first + cm.doc.size;\n if (!lendiff) lendiff = 0;\n\n var display = cm.display;\n if (lendiff && to < display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers > from))\n display.updateLineNumbers = from;\n\n cm.curOp.viewChanged = true;\n\n if (from >= display.viewTo) { // Change after\n if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)\n resetView(cm);\n } else if (to <= display.viewFrom) { // Change before\n if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\n resetView(cm);\n } else {\n display.viewFrom += lendiff;\n display.viewTo += lendiff;\n }\n } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap\n resetView(cm);\n } else if (from <= display.viewFrom) { // Top overlap\n var cut = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cut) {\n display.view = display.view.slice(cut.index);\n display.viewFrom = cut.lineN;\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n } else if (to >= display.viewTo) { // Bottom overlap\n var cut = viewCuttingPoint(cm, from, from, -1);\n if (cut) {\n display.view = display.view.slice(0, cut.index);\n display.viewTo = cut.lineN;\n } else {\n resetView(cm);\n }\n } else { // Gap in the middle\n var cutTop = viewCuttingPoint(cm, from, from, -1);\n var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cutTop && cutBot) {\n display.view = display.view.slice(0, cutTop.index)\n .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))\n .concat(display.view.slice(cutBot.index));\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n }\n\n var ext = display.externalMeasured;\n if (ext) {\n if (to < ext.lineN)\n ext.lineN += lendiff;\n else if (from < ext.lineN + ext.size)\n display.externalMeasured = null;\n }\n }", "function regChange(cm, from, to, lendiff) {\n if (from == null) from = cm.doc.first;\n if (to == null) to = cm.doc.first + cm.doc.size;\n if (!lendiff) lendiff = 0;\n\n var display = cm.display;\n if (lendiff && to < display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers > from))\n display.updateLineNumbers = from;\n\n cm.curOp.viewChanged = true;\n\n if (from >= display.viewTo) { // Change after\n if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)\n resetView(cm);\n } else if (to <= display.viewFrom) { // Change before\n if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\n resetView(cm);\n } else {\n display.viewFrom += lendiff;\n display.viewTo += lendiff;\n }\n } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap\n resetView(cm);\n } else if (from <= display.viewFrom) { // Top overlap\n var cut = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cut) {\n display.view = display.view.slice(cut.index);\n display.viewFrom = cut.lineN;\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n } else if (to >= display.viewTo) { // Bottom overlap\n var cut = viewCuttingPoint(cm, from, from, -1);\n if (cut) {\n display.view = display.view.slice(0, cut.index);\n display.viewTo = cut.lineN;\n } else {\n resetView(cm);\n }\n } else { // Gap in the middle\n var cutTop = viewCuttingPoint(cm, from, from, -1);\n var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cutTop && cutBot) {\n display.view = display.view.slice(0, cutTop.index)\n .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))\n .concat(display.view.slice(cutBot.index));\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n }\n\n var ext = display.externalMeasured;\n if (ext) {\n if (to < ext.lineN)\n ext.lineN += lendiff;\n else if (from < ext.lineN + ext.size)\n display.externalMeasured = null;\n }\n }", "function regChange(cm, from, to, lendiff) {\n if (from == null) from = cm.doc.first;\n if (to == null) to = cm.doc.first + cm.doc.size;\n if (!lendiff) lendiff = 0;\n\n var display = cm.display;\n if (lendiff && to < display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers > from))\n display.updateLineNumbers = from;\n\n cm.curOp.viewChanged = true;\n\n if (from >= display.viewTo) { // Change after\n if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)\n resetView(cm);\n } else if (to <= display.viewFrom) { // Change before\n if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\n resetView(cm);\n } else {\n display.viewFrom += lendiff;\n display.viewTo += lendiff;\n }\n } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap\n resetView(cm);\n } else if (from <= display.viewFrom) { // Top overlap\n var cut = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cut) {\n display.view = display.view.slice(cut.index);\n display.viewFrom = cut.lineN;\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n } else if (to >= display.viewTo) { // Bottom overlap\n var cut = viewCuttingPoint(cm, from, from, -1);\n if (cut) {\n display.view = display.view.slice(0, cut.index);\n display.viewTo = cut.lineN;\n } else {\n resetView(cm);\n }\n } else { // Gap in the middle\n var cutTop = viewCuttingPoint(cm, from, from, -1);\n var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cutTop && cutBot) {\n display.view = display.view.slice(0, cutTop.index)\n .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))\n .concat(display.view.slice(cutBot.index));\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n }\n\n var ext = display.externalMeasured;\n if (ext) {\n if (to < ext.lineN)\n ext.lineN += lendiff;\n else if (from < ext.lineN + ext.size)\n display.externalMeasured = null;\n }\n }", "function regChange(cm, from, to, lendiff) {\n if (from == null) from = cm.doc.first;\n if (to == null) to = cm.doc.first + cm.doc.size;\n if (!lendiff) lendiff = 0;\n\n var display = cm.display;\n if (lendiff && to < display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers > from))\n display.updateLineNumbers = from;\n\n cm.curOp.viewChanged = true;\n\n if (from >= display.viewTo) { // Change after\n if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)\n resetView(cm);\n } else if (to <= display.viewFrom) { // Change before\n if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\n resetView(cm);\n } else {\n display.viewFrom += lendiff;\n display.viewTo += lendiff;\n }\n } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap\n resetView(cm);\n } else if (from <= display.viewFrom) { // Top overlap\n var cut = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cut) {\n display.view = display.view.slice(cut.index);\n display.viewFrom = cut.lineN;\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n } else if (to >= display.viewTo) { // Bottom overlap\n var cut = viewCuttingPoint(cm, from, from, -1);\n if (cut) {\n display.view = display.view.slice(0, cut.index);\n display.viewTo = cut.lineN;\n } else {\n resetView(cm);\n }\n } else { // Gap in the middle\n var cutTop = viewCuttingPoint(cm, from, from, -1);\n var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cutTop && cutBot) {\n display.view = display.view.slice(0, cutTop.index)\n .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))\n .concat(display.view.slice(cutBot.index));\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n }\n\n var ext = display.externalMeasured;\n if (ext) {\n if (to < ext.lineN)\n ext.lineN += lendiff;\n else if (from < ext.lineN + ext.size)\n display.externalMeasured = null;\n }\n }", "function regChange(cm, from, to, lendiff) {\n if (from == null) from = cm.doc.first;\n if (to == null) to = cm.doc.first + cm.doc.size;\n if (!lendiff) lendiff = 0;\n\n var display = cm.display;\n if (lendiff && to < display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers > from))\n display.updateLineNumbers = from;\n\n cm.curOp.viewChanged = true;\n\n if (from >= display.viewTo) { // Change after\n if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)\n resetView(cm);\n } else if (to <= display.viewFrom) { // Change before\n if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\n resetView(cm);\n } else {\n display.viewFrom += lendiff;\n display.viewTo += lendiff;\n }\n } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap\n resetView(cm);\n } else if (from <= display.viewFrom) { // Top overlap\n var cut = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cut) {\n display.view = display.view.slice(cut.index);\n display.viewFrom = cut.lineN;\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n } else if (to >= display.viewTo) { // Bottom overlap\n var cut = viewCuttingPoint(cm, from, from, -1);\n if (cut) {\n display.view = display.view.slice(0, cut.index);\n display.viewTo = cut.lineN;\n } else {\n resetView(cm);\n }\n } else { // Gap in the middle\n var cutTop = viewCuttingPoint(cm, from, from, -1);\n var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cutTop && cutBot) {\n display.view = display.view.slice(0, cutTop.index)\n .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))\n .concat(display.view.slice(cutBot.index));\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n }\n\n var ext = display.externalMeasured;\n if (ext) {\n if (to < ext.lineN)\n ext.lineN += lendiff;\n else if (from < ext.lineN + ext.size)\n display.externalMeasured = null;\n }\n }", "function regChange(cm, from, to, lendiff) {\n if (from == null) from = cm.doc.first;\n if (to == null) to = cm.doc.first + cm.doc.size;\n if (!lendiff) lendiff = 0;\n\n var display = cm.display;\n if (lendiff && to < display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers > from))\n display.updateLineNumbers = from;\n\n cm.curOp.viewChanged = true;\n\n if (from >= display.viewTo) { // Change after\n if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)\n resetView(cm);\n } else if (to <= display.viewFrom) { // Change before\n if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\n resetView(cm);\n } else {\n display.viewFrom += lendiff;\n display.viewTo += lendiff;\n }\n } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap\n resetView(cm);\n } else if (from <= display.viewFrom) { // Top overlap\n var cut = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cut) {\n display.view = display.view.slice(cut.index);\n display.viewFrom = cut.lineN;\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n } else if (to >= display.viewTo) { // Bottom overlap\n var cut = viewCuttingPoint(cm, from, from, -1);\n if (cut) {\n display.view = display.view.slice(0, cut.index);\n display.viewTo = cut.lineN;\n } else {\n resetView(cm);\n }\n } else { // Gap in the middle\n var cutTop = viewCuttingPoint(cm, from, from, -1);\n var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cutTop && cutBot) {\n display.view = display.view.slice(0, cutTop.index)\n .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))\n .concat(display.view.slice(cutBot.index));\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n }\n\n var ext = display.externalMeasured;\n if (ext) {\n if (to < ext.lineN)\n ext.lineN += lendiff;\n else if (from < ext.lineN + ext.size)\n display.externalMeasured = null;\n }\n }", "function regChange(cm, from, to, lendiff) {\n\t\t if (from == null) { from = cm.doc.first; }\n\t\t if (to == null) { to = cm.doc.first + cm.doc.size; }\n\t\t if (!lendiff) { lendiff = 0; }\n\n\t\t var display = cm.display;\n\t\t if (lendiff && to < display.viewTo &&\n\t\t (display.updateLineNumbers == null || display.updateLineNumbers > from))\n\t\t { display.updateLineNumbers = from; }\n\n\t\t cm.curOp.viewChanged = true;\n\n\t\t if (from >= display.viewTo) { // Change after\n\t\t if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)\n\t\t { resetView(cm); }\n\t\t } else if (to <= display.viewFrom) { // Change before\n\t\t if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\n\t\t resetView(cm);\n\t\t } else {\n\t\t display.viewFrom += lendiff;\n\t\t display.viewTo += lendiff;\n\t\t }\n\t\t } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap\n\t\t resetView(cm);\n\t\t } else if (from <= display.viewFrom) { // Top overlap\n\t\t var cut = viewCuttingPoint(cm, to, to + lendiff, 1);\n\t\t if (cut) {\n\t\t display.view = display.view.slice(cut.index);\n\t\t display.viewFrom = cut.lineN;\n\t\t display.viewTo += lendiff;\n\t\t } else {\n\t\t resetView(cm);\n\t\t }\n\t\t } else if (to >= display.viewTo) { // Bottom overlap\n\t\t var cut$1 = viewCuttingPoint(cm, from, from, -1);\n\t\t if (cut$1) {\n\t\t display.view = display.view.slice(0, cut$1.index);\n\t\t display.viewTo = cut$1.lineN;\n\t\t } else {\n\t\t resetView(cm);\n\t\t }\n\t\t } else { // Gap in the middle\n\t\t var cutTop = viewCuttingPoint(cm, from, from, -1);\n\t\t var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);\n\t\t if (cutTop && cutBot) {\n\t\t display.view = display.view.slice(0, cutTop.index)\n\t\t .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))\n\t\t .concat(display.view.slice(cutBot.index));\n\t\t display.viewTo += lendiff;\n\t\t } else {\n\t\t resetView(cm);\n\t\t }\n\t\t }\n\n\t\t var ext = display.externalMeasured;\n\t\t if (ext) {\n\t\t if (to < ext.lineN)\n\t\t { ext.lineN += lendiff; }\n\t\t else if (from < ext.lineN + ext.size)\n\t\t { display.externalMeasured = null; }\n\t\t }\n\t\t }", "function regChange(cm, from, to, lendiff) {\r\n if (from == null) { from = cm.doc.first; }\r\n if (to == null) { to = cm.doc.first + cm.doc.size; }\r\n if (!lendiff) { lendiff = 0; }\r\n\r\n var display = cm.display;\r\n if (lendiff && to < display.viewTo &&\r\n (display.updateLineNumbers == null || display.updateLineNumbers > from))\r\n { display.updateLineNumbers = from; }\r\n\r\n cm.curOp.viewChanged = true;\r\n\r\n if (from >= display.viewTo) { // Change after\r\n if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)\r\n { resetView(cm); }\r\n } else if (to <= display.viewFrom) { // Change before\r\n if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\r\n resetView(cm);\r\n } else {\r\n display.viewFrom += lendiff;\r\n display.viewTo += lendiff;\r\n }\r\n } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap\r\n resetView(cm);\r\n } else if (from <= display.viewFrom) { // Top overlap\r\n var cut = viewCuttingPoint(cm, to, to + lendiff, 1);\r\n if (cut) {\r\n display.view = display.view.slice(cut.index);\r\n display.viewFrom = cut.lineN;\r\n display.viewTo += lendiff;\r\n } else {\r\n resetView(cm);\r\n }\r\n } else if (to >= display.viewTo) { // Bottom overlap\r\n var cut$1 = viewCuttingPoint(cm, from, from, -1);\r\n if (cut$1) {\r\n display.view = display.view.slice(0, cut$1.index);\r\n display.viewTo = cut$1.lineN;\r\n } else {\r\n resetView(cm);\r\n }\r\n } else { // Gap in the middle\r\n var cutTop = viewCuttingPoint(cm, from, from, -1);\r\n var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);\r\n if (cutTop && cutBot) {\r\n display.view = display.view.slice(0, cutTop.index)\r\n .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))\r\n .concat(display.view.slice(cutBot.index));\r\n display.viewTo += lendiff;\r\n } else {\r\n resetView(cm);\r\n }\r\n }\r\n\r\n var ext = display.externalMeasured;\r\n if (ext) {\r\n if (to < ext.lineN)\r\n { ext.lineN += lendiff; }\r\n else if (from < ext.lineN + ext.size)\r\n { display.externalMeasured = null; }\r\n }\r\n}", "function regChange(cm, from, to, lendiff) {\n if (from == null) { from = cm.doc.first; }\n if (to == null) { to = cm.doc.first + cm.doc.size; }\n if (!lendiff) { lendiff = 0; }\n\n var display = cm.display;\n if (lendiff && to < display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers > from))\n { display.updateLineNumbers = from; }\n\n cm.curOp.viewChanged = true;\n\n if (from >= display.viewTo) { // Change after\n if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)\n { resetView(cm); }\n } else if (to <= display.viewFrom) { // Change before\n if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\n resetView(cm);\n } else {\n display.viewFrom += lendiff;\n display.viewTo += lendiff;\n }\n } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap\n resetView(cm);\n } else if (from <= display.viewFrom) { // Top overlap\n var cut = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cut) {\n display.view = display.view.slice(cut.index);\n display.viewFrom = cut.lineN;\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n } else if (to >= display.viewTo) { // Bottom overlap\n var cut$1 = viewCuttingPoint(cm, from, from, -1);\n if (cut$1) {\n display.view = display.view.slice(0, cut$1.index);\n display.viewTo = cut$1.lineN;\n } else {\n resetView(cm);\n }\n } else { // Gap in the middle\n var cutTop = viewCuttingPoint(cm, from, from, -1);\n var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cutTop && cutBot) {\n display.view = display.view.slice(0, cutTop.index)\n .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))\n .concat(display.view.slice(cutBot.index));\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n }\n\n var ext = display.externalMeasured;\n if (ext) {\n if (to < ext.lineN)\n { ext.lineN += lendiff; }\n else if (from < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n }\n}", "function regChange(cm, from, to, lendiff) {\n if (from == null) { from = cm.doc.first; }\n if (to == null) { to = cm.doc.first + cm.doc.size; }\n if (!lendiff) { lendiff = 0; }\n\n var display = cm.display;\n if (lendiff && to < display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers > from))\n { display.updateLineNumbers = from; }\n\n cm.curOp.viewChanged = true;\n\n if (from >= display.viewTo) { // Change after\n if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)\n { resetView(cm); }\n } else if (to <= display.viewFrom) { // Change before\n if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\n resetView(cm);\n } else {\n display.viewFrom += lendiff;\n display.viewTo += lendiff;\n }\n } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap\n resetView(cm);\n } else if (from <= display.viewFrom) { // Top overlap\n var cut = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cut) {\n display.view = display.view.slice(cut.index);\n display.viewFrom = cut.lineN;\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n } else if (to >= display.viewTo) { // Bottom overlap\n var cut$1 = viewCuttingPoint(cm, from, from, -1);\n if (cut$1) {\n display.view = display.view.slice(0, cut$1.index);\n display.viewTo = cut$1.lineN;\n } else {\n resetView(cm);\n }\n } else { // Gap in the middle\n var cutTop = viewCuttingPoint(cm, from, from, -1);\n var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cutTop && cutBot) {\n display.view = display.view.slice(0, cutTop.index)\n .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))\n .concat(display.view.slice(cutBot.index));\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n }\n\n var ext = display.externalMeasured;\n if (ext) {\n if (to < ext.lineN)\n { ext.lineN += lendiff; }\n else if (from < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n }\n}", "function regChange(cm, from, to, lendiff) {\n if (from == null) { from = cm.doc.first; }\n if (to == null) { to = cm.doc.first + cm.doc.size; }\n if (!lendiff) { lendiff = 0; }\n\n var display = cm.display;\n if (lendiff && to < display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers > from))\n { display.updateLineNumbers = from; }\n\n cm.curOp.viewChanged = true;\n\n if (from >= display.viewTo) { // Change after\n if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)\n { resetView(cm); }\n } else if (to <= display.viewFrom) { // Change before\n if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\n resetView(cm);\n } else {\n display.viewFrom += lendiff;\n display.viewTo += lendiff;\n }\n } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap\n resetView(cm);\n } else if (from <= display.viewFrom) { // Top overlap\n var cut = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cut) {\n display.view = display.view.slice(cut.index);\n display.viewFrom = cut.lineN;\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n } else if (to >= display.viewTo) { // Bottom overlap\n var cut$1 = viewCuttingPoint(cm, from, from, -1);\n if (cut$1) {\n display.view = display.view.slice(0, cut$1.index);\n display.viewTo = cut$1.lineN;\n } else {\n resetView(cm);\n }\n } else { // Gap in the middle\n var cutTop = viewCuttingPoint(cm, from, from, -1);\n var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cutTop && cutBot) {\n display.view = display.view.slice(0, cutTop.index)\n .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))\n .concat(display.view.slice(cutBot.index));\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n }\n\n var ext = display.externalMeasured;\n if (ext) {\n if (to < ext.lineN)\n { ext.lineN += lendiff; }\n else if (from < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n }\n}", "function regChange(cm, from, to, lendiff) {\n if (from == null) { from = cm.doc.first; }\n if (to == null) { to = cm.doc.first + cm.doc.size; }\n if (!lendiff) { lendiff = 0; }\n\n var display = cm.display;\n if (lendiff && to < display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers > from))\n { display.updateLineNumbers = from; }\n\n cm.curOp.viewChanged = true;\n\n if (from >= display.viewTo) { // Change after\n if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)\n { resetView(cm); }\n } else if (to <= display.viewFrom) { // Change before\n if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\n resetView(cm);\n } else {\n display.viewFrom += lendiff;\n display.viewTo += lendiff;\n }\n } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap\n resetView(cm);\n } else if (from <= display.viewFrom) { // Top overlap\n var cut = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cut) {\n display.view = display.view.slice(cut.index);\n display.viewFrom = cut.lineN;\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n } else if (to >= display.viewTo) { // Bottom overlap\n var cut$1 = viewCuttingPoint(cm, from, from, -1);\n if (cut$1) {\n display.view = display.view.slice(0, cut$1.index);\n display.viewTo = cut$1.lineN;\n } else {\n resetView(cm);\n }\n } else { // Gap in the middle\n var cutTop = viewCuttingPoint(cm, from, from, -1);\n var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cutTop && cutBot) {\n display.view = display.view.slice(0, cutTop.index)\n .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))\n .concat(display.view.slice(cutBot.index));\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n }\n\n var ext = display.externalMeasured;\n if (ext) {\n if (to < ext.lineN)\n { ext.lineN += lendiff; }\n else if (from < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n }\n}", "function regChange(cm, from, to, lendiff) {\n if (from == null) { from = cm.doc.first; }\n if (to == null) { to = cm.doc.first + cm.doc.size; }\n if (!lendiff) { lendiff = 0; }\n\n var display = cm.display;\n if (lendiff && to < display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers > from))\n { display.updateLineNumbers = from; }\n\n cm.curOp.viewChanged = true;\n\n if (from >= display.viewTo) { // Change after\n if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)\n { resetView(cm); }\n } else if (to <= display.viewFrom) { // Change before\n if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\n resetView(cm);\n } else {\n display.viewFrom += lendiff;\n display.viewTo += lendiff;\n }\n } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap\n resetView(cm);\n } else if (from <= display.viewFrom) { // Top overlap\n var cut = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cut) {\n display.view = display.view.slice(cut.index);\n display.viewFrom = cut.lineN;\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n } else if (to >= display.viewTo) { // Bottom overlap\n var cut$1 = viewCuttingPoint(cm, from, from, -1);\n if (cut$1) {\n display.view = display.view.slice(0, cut$1.index);\n display.viewTo = cut$1.lineN;\n } else {\n resetView(cm);\n }\n } else { // Gap in the middle\n var cutTop = viewCuttingPoint(cm, from, from, -1);\n var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cutTop && cutBot) {\n display.view = display.view.slice(0, cutTop.index)\n .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))\n .concat(display.view.slice(cutBot.index));\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n }\n\n var ext = display.externalMeasured;\n if (ext) {\n if (to < ext.lineN)\n { ext.lineN += lendiff; }\n else if (from < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n }\n}", "function regChange(cm, from, to, lendiff) {\n if (from == null) { from = cm.doc.first; }\n if (to == null) { to = cm.doc.first + cm.doc.size; }\n if (!lendiff) { lendiff = 0; }\n\n var display = cm.display;\n if (lendiff && to < display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers > from))\n { display.updateLineNumbers = from; }\n\n cm.curOp.viewChanged = true;\n\n if (from >= display.viewTo) { // Change after\n if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)\n { resetView(cm); }\n } else if (to <= display.viewFrom) { // Change before\n if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\n resetView(cm);\n } else {\n display.viewFrom += lendiff;\n display.viewTo += lendiff;\n }\n } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap\n resetView(cm);\n } else if (from <= display.viewFrom) { // Top overlap\n var cut = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cut) {\n display.view = display.view.slice(cut.index);\n display.viewFrom = cut.lineN;\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n } else if (to >= display.viewTo) { // Bottom overlap\n var cut$1 = viewCuttingPoint(cm, from, from, -1);\n if (cut$1) {\n display.view = display.view.slice(0, cut$1.index);\n display.viewTo = cut$1.lineN;\n } else {\n resetView(cm);\n }\n } else { // Gap in the middle\n var cutTop = viewCuttingPoint(cm, from, from, -1);\n var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cutTop && cutBot) {\n display.view = display.view.slice(0, cutTop.index)\n .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))\n .concat(display.view.slice(cutBot.index));\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n }\n\n var ext = display.externalMeasured;\n if (ext) {\n if (to < ext.lineN)\n { ext.lineN += lendiff; }\n else if (from < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n }\n}", "function regChange(cm, from, to, lendiff) {\n if (from == null) { from = cm.doc.first; }\n if (to == null) { to = cm.doc.first + cm.doc.size; }\n if (!lendiff) { lendiff = 0; }\n\n var display = cm.display;\n if (lendiff && to < display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers > from))\n { display.updateLineNumbers = from; }\n\n cm.curOp.viewChanged = true;\n\n if (from >= display.viewTo) { // Change after\n if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)\n { resetView(cm); }\n } else if (to <= display.viewFrom) { // Change before\n if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\n resetView(cm);\n } else {\n display.viewFrom += lendiff;\n display.viewTo += lendiff;\n }\n } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap\n resetView(cm);\n } else if (from <= display.viewFrom) { // Top overlap\n var cut = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cut) {\n display.view = display.view.slice(cut.index);\n display.viewFrom = cut.lineN;\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n } else if (to >= display.viewTo) { // Bottom overlap\n var cut$1 = viewCuttingPoint(cm, from, from, -1);\n if (cut$1) {\n display.view = display.view.slice(0, cut$1.index);\n display.viewTo = cut$1.lineN;\n } else {\n resetView(cm);\n }\n } else { // Gap in the middle\n var cutTop = viewCuttingPoint(cm, from, from, -1);\n var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cutTop && cutBot) {\n display.view = display.view.slice(0, cutTop.index)\n .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))\n .concat(display.view.slice(cutBot.index));\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n }\n\n var ext = display.externalMeasured;\n if (ext) {\n if (to < ext.lineN)\n { ext.lineN += lendiff; }\n else if (from < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n }\n}", "function regChange(cm, from, to, lendiff) {\n if (from == null) { from = cm.doc.first; }\n if (to == null) { to = cm.doc.first + cm.doc.size; }\n if (!lendiff) { lendiff = 0; }\n\n var display = cm.display;\n if (lendiff && to < display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers > from))\n { display.updateLineNumbers = from; }\n\n cm.curOp.viewChanged = true;\n\n if (from >= display.viewTo) { // Change after\n if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)\n { resetView(cm); }\n } else if (to <= display.viewFrom) { // Change before\n if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\n resetView(cm);\n } else {\n display.viewFrom += lendiff;\n display.viewTo += lendiff;\n }\n } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap\n resetView(cm);\n } else if (from <= display.viewFrom) { // Top overlap\n var cut = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cut) {\n display.view = display.view.slice(cut.index);\n display.viewFrom = cut.lineN;\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n } else if (to >= display.viewTo) { // Bottom overlap\n var cut$1 = viewCuttingPoint(cm, from, from, -1);\n if (cut$1) {\n display.view = display.view.slice(0, cut$1.index);\n display.viewTo = cut$1.lineN;\n } else {\n resetView(cm);\n }\n } else { // Gap in the middle\n var cutTop = viewCuttingPoint(cm, from, from, -1);\n var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cutTop && cutBot) {\n display.view = display.view.slice(0, cutTop.index)\n .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))\n .concat(display.view.slice(cutBot.index));\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n }\n\n var ext = display.externalMeasured;\n if (ext) {\n if (to < ext.lineN)\n { ext.lineN += lendiff; }\n else if (from < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n }\n}", "function regChange(cm, from, to, lendiff) {\n if (from == null) { from = cm.doc.first; }\n if (to == null) { to = cm.doc.first + cm.doc.size; }\n if (!lendiff) { lendiff = 0; }\n\n var display = cm.display;\n if (lendiff && to < display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers > from))\n { display.updateLineNumbers = from; }\n\n cm.curOp.viewChanged = true;\n\n if (from >= display.viewTo) { // Change after\n if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)\n { resetView(cm); }\n } else if (to <= display.viewFrom) { // Change before\n if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\n resetView(cm);\n } else {\n display.viewFrom += lendiff;\n display.viewTo += lendiff;\n }\n } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap\n resetView(cm);\n } else if (from <= display.viewFrom) { // Top overlap\n var cut = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cut) {\n display.view = display.view.slice(cut.index);\n display.viewFrom = cut.lineN;\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n } else if (to >= display.viewTo) { // Bottom overlap\n var cut$1 = viewCuttingPoint(cm, from, from, -1);\n if (cut$1) {\n display.view = display.view.slice(0, cut$1.index);\n display.viewTo = cut$1.lineN;\n } else {\n resetView(cm);\n }\n } else { // Gap in the middle\n var cutTop = viewCuttingPoint(cm, from, from, -1);\n var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cutTop && cutBot) {\n display.view = display.view.slice(0, cutTop.index)\n .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))\n .concat(display.view.slice(cutBot.index));\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n }\n\n var ext = display.externalMeasured;\n if (ext) {\n if (to < ext.lineN)\n { ext.lineN += lendiff; }\n else if (from < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n }\n}", "function regChange(cm, from, to, lendiff) {\n if (from == null) { from = cm.doc.first; }\n if (to == null) { to = cm.doc.first + cm.doc.size; }\n if (!lendiff) { lendiff = 0; }\n\n var display = cm.display;\n if (lendiff && to < display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers > from))\n { display.updateLineNumbers = from; }\n\n cm.curOp.viewChanged = true;\n\n if (from >= display.viewTo) { // Change after\n if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)\n { resetView(cm); }\n } else if (to <= display.viewFrom) { // Change before\n if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\n resetView(cm);\n } else {\n display.viewFrom += lendiff;\n display.viewTo += lendiff;\n }\n } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap\n resetView(cm);\n } else if (from <= display.viewFrom) { // Top overlap\n var cut = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cut) {\n display.view = display.view.slice(cut.index);\n display.viewFrom = cut.lineN;\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n } else if (to >= display.viewTo) { // Bottom overlap\n var cut$1 = viewCuttingPoint(cm, from, from, -1);\n if (cut$1) {\n display.view = display.view.slice(0, cut$1.index);\n display.viewTo = cut$1.lineN;\n } else {\n resetView(cm);\n }\n } else { // Gap in the middle\n var cutTop = viewCuttingPoint(cm, from, from, -1);\n var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cutTop && cutBot) {\n display.view = display.view.slice(0, cutTop.index)\n .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))\n .concat(display.view.slice(cutBot.index));\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n }\n\n var ext = display.externalMeasured;\n if (ext) {\n if (to < ext.lineN)\n { ext.lineN += lendiff; }\n else if (from < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n }\n}", "function regChange(cm, from, to, lendiff) {\n if (from == null) { from = cm.doc.first; }\n if (to == null) { to = cm.doc.first + cm.doc.size; }\n if (!lendiff) { lendiff = 0; }\n\n var display = cm.display;\n if (lendiff && to < display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers > from))\n { display.updateLineNumbers = from; }\n\n cm.curOp.viewChanged = true;\n\n if (from >= display.viewTo) { // Change after\n if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)\n { resetView(cm); }\n } else if (to <= display.viewFrom) { // Change before\n if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\n resetView(cm);\n } else {\n display.viewFrom += lendiff;\n display.viewTo += lendiff;\n }\n } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap\n resetView(cm);\n } else if (from <= display.viewFrom) { // Top overlap\n var cut = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cut) {\n display.view = display.view.slice(cut.index);\n display.viewFrom = cut.lineN;\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n } else if (to >= display.viewTo) { // Bottom overlap\n var cut$1 = viewCuttingPoint(cm, from, from, -1);\n if (cut$1) {\n display.view = display.view.slice(0, cut$1.index);\n display.viewTo = cut$1.lineN;\n } else {\n resetView(cm);\n }\n } else { // Gap in the middle\n var cutTop = viewCuttingPoint(cm, from, from, -1);\n var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cutTop && cutBot) {\n display.view = display.view.slice(0, cutTop.index)\n .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))\n .concat(display.view.slice(cutBot.index));\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n }\n\n var ext = display.externalMeasured;\n if (ext) {\n if (to < ext.lineN)\n { ext.lineN += lendiff; }\n else if (from < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n }\n}", "function regChange(cm, from, to, lendiff) {\n if (from == null) { from = cm.doc.first }\n if (to == null) { to = cm.doc.first + cm.doc.size }\n if (!lendiff) { lendiff = 0 }\n\n var display = cm.display\n if (lendiff && to < display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers > from))\n { display.updateLineNumbers = from }\n\n cm.curOp.viewChanged = true\n\n if (from >= display.viewTo) { // Change after\n if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)\n { resetView(cm) }\n } else if (to <= display.viewFrom) { // Change before\n if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\n resetView(cm)\n } else {\n display.viewFrom += lendiff\n display.viewTo += lendiff\n }\n } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap\n resetView(cm)\n } else if (from <= display.viewFrom) { // Top overlap\n var cut = viewCuttingPoint(cm, to, to + lendiff, 1)\n if (cut) {\n display.view = display.view.slice(cut.index)\n display.viewFrom = cut.lineN\n display.viewTo += lendiff\n } else {\n resetView(cm)\n }\n } else if (to >= display.viewTo) { // Bottom overlap\n var cut$1 = viewCuttingPoint(cm, from, from, -1)\n if (cut$1) {\n display.view = display.view.slice(0, cut$1.index)\n display.viewTo = cut$1.lineN\n } else {\n resetView(cm)\n }\n } else { // Gap in the middle\n var cutTop = viewCuttingPoint(cm, from, from, -1)\n var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1)\n if (cutTop && cutBot) {\n display.view = display.view.slice(0, cutTop.index)\n .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))\n .concat(display.view.slice(cutBot.index))\n display.viewTo += lendiff\n } else {\n resetView(cm)\n }\n }\n\n var ext = display.externalMeasured\n if (ext) {\n if (to < ext.lineN)\n { ext.lineN += lendiff }\n else if (from < ext.lineN + ext.size)\n { display.externalMeasured = null }\n }\n}", "function regChange(cm, from, to, lendiff) {\n if (from == null) { from = cm.doc.first }\n if (to == null) { to = cm.doc.first + cm.doc.size }\n if (!lendiff) { lendiff = 0 }\n\n var display = cm.display\n if (lendiff && to < display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers > from))\n { display.updateLineNumbers = from }\n\n cm.curOp.viewChanged = true\n\n if (from >= display.viewTo) { // Change after\n if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)\n { resetView(cm) }\n } else if (to <= display.viewFrom) { // Change before\n if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\n resetView(cm)\n } else {\n display.viewFrom += lendiff\n display.viewTo += lendiff\n }\n } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap\n resetView(cm)\n } else if (from <= display.viewFrom) { // Top overlap\n var cut = viewCuttingPoint(cm, to, to + lendiff, 1)\n if (cut) {\n display.view = display.view.slice(cut.index)\n display.viewFrom = cut.lineN\n display.viewTo += lendiff\n } else {\n resetView(cm)\n }\n } else if (to >= display.viewTo) { // Bottom overlap\n var cut$1 = viewCuttingPoint(cm, from, from, -1)\n if (cut$1) {\n display.view = display.view.slice(0, cut$1.index)\n display.viewTo = cut$1.lineN\n } else {\n resetView(cm)\n }\n } else { // Gap in the middle\n var cutTop = viewCuttingPoint(cm, from, from, -1)\n var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1)\n if (cutTop && cutBot) {\n display.view = display.view.slice(0, cutTop.index)\n .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))\n .concat(display.view.slice(cutBot.index))\n display.viewTo += lendiff\n } else {\n resetView(cm)\n }\n }\n\n var ext = display.externalMeasured\n if (ext) {\n if (to < ext.lineN)\n { ext.lineN += lendiff }\n else if (from < ext.lineN + ext.size)\n { display.externalMeasured = null }\n }\n}", "function updateDisplay(changes) {\n if (!scroller.clientWidth) {\n showingFrom = showingTo = 0;\n return;\n }\n // First create a range of theoretically intact lines, and punch\n // holes in that using the change info.\n var intact = changes === true ? [] : [{from: showingFrom, to: showingTo, domStart: 0}];\n for (var i = 0, l = changes.length || 0; i < l; ++i) {\n var change = changes[i], intact2 = [], diff = change.diff || 0;\n for (var j = 0, l2 = intact.length; j < l2; ++j) {\n var range = intact[j];\n if (change.to <= range.from)\n intact2.push({from: range.from + diff, to: range.to + diff, domStart: range.domStart});\n else if (range.to <= change.from)\n intact2.push(range);\n else {\n if (change.from > range.from)\n intact2.push({from: range.from, to: change.from, domStart: range.domStart})\n if (change.to < range.to)\n intact2.push({from: change.to + diff, to: range.to + diff,\n domStart: range.domStart + (change.to - range.from)});\n }\n }\n intact = intact2;\n }\n\n // Then, determine which lines we'd want to see, and which\n // updates have to be made to get there.\n var visible = visibleLines();\n var from = Math.min(showingFrom, Math.max(visible.from - 3, 0)),\n to = Math.min(lines.length, Math.max(showingTo, visible.to + 3)),\n updates = [], domPos = 0, domEnd = showingTo - showingFrom, pos = from, changedLines = 0;\n\n for (var i = 0, l = intact.length; i < l; ++i) {\n var range = intact[i];\n if (range.to <= from) continue;\n if (range.from >= to) break;\n if (range.domStart > domPos || range.from > pos) {\n updates.push({from: pos, to: range.from, domSize: range.domStart - domPos, domStart: domPos});\n changedLines += range.from - pos;\n }\n pos = range.to;\n domPos = range.domStart + (range.to - range.from);\n }\n if (domPos != domEnd || pos != to) {\n changedLines += Math.abs(to - pos);\n updates.push({from: pos, to: to, domSize: domEnd - domPos, domStart: domPos});\n }\n\n if (!updates.length) return;\n lineDiv.style.display = \"none\";\n // If more than 30% of the screen needs update, just do a full\n // redraw (which is quicker than patching)\n if (changedLines > (visible.to - visible.from) * .3)\n refreshDisplay(from = Math.max(visible.from - 10, 0), to = Math.min(visible.to + 7, lines.length));\n // Otherwise, only update the stuff that needs updating.\n else\n patchDisplay(updates);\n lineDiv.style.display = \"\";\n\n // Position the mover div to align with the lines it's supposed\n // to be showing (which will cover the visible display)\n var different = from != showingFrom || to != showingTo || lastHeight != scroller.clientHeight;\n showingFrom = from; showingTo = to;\n mover.style.top = (from * lineHeight()) + \"px\";\n if (different) {\n lastHeight = scroller.clientHeight;\n code.style.height = (lines.length * lineHeight() + 2 * paddingTop()) + \"px\";\n updateGutter();\n }\n\n if (maxWidth == null) maxWidth = stringWidth(maxLine);\n if (maxWidth > scroller.clientWidth) {\n lineSpace.style.width = maxWidth + \"px\";\n // Needed to prevent odd wrapping/hiding of widgets placed in here.\n code.style.width = \"\";\n code.style.width = scroller.scrollWidth + \"px\";\n } else {\n lineSpace.style.width = code.style.width = \"\";\n }\n\n // Since this is all rather error prone, it is honoured with the\n // only assertion in the whole file.\n if (lineDiv.childNodes.length != showingTo - showingFrom)\n throw new Error(\"BAD PATCH! \" + JSON.stringify(updates) + \" size=\" + (showingTo - showingFrom) +\n \" nodes=\" + lineDiv.childNodes.length);\n updateCursor();\n }", "function updateDisplay(changes) {\n if (!scroller.clientWidth) {\n showingFrom = showingTo = 0;\n return;\n }\n // First create a range of theoretically intact lines, and punch\n // holes in that using the change info.\n var intact = changes === true ? [] : [{from: showingFrom, to: showingTo, domStart: 0}];\n for (var i = 0, l = changes.length || 0; i < l; ++i) {\n var change = changes[i], intact2 = [], diff = change.diff || 0;\n for (var j = 0, l2 = intact.length; j < l2; ++j) {\n var range = intact[j];\n if (change.to <= range.from)\n intact2.push({from: range.from + diff, to: range.to + diff, domStart: range.domStart});\n else if (range.to <= change.from)\n intact2.push(range);\n else {\n if (change.from > range.from)\n intact2.push({from: range.from, to: change.from, domStart: range.domStart})\n if (change.to < range.to)\n intact2.push({from: change.to + diff, to: range.to + diff,\n domStart: range.domStart + (change.to - range.from)});\n }\n }\n intact = intact2;\n }\n\n // Then, determine which lines we'd want to see, and which\n // updates have to be made to get there.\n var visible = visibleLines();\n var from = Math.min(showingFrom, Math.max(visible.from - 3, 0)),\n to = Math.min(lines.length, Math.max(showingTo, visible.to + 3)),\n updates = [], domPos = 0, domEnd = showingTo - showingFrom, pos = from, changedLines = 0;\n\n for (var i = 0, l = intact.length; i < l; ++i) {\n var range = intact[i];\n if (range.to <= from) continue;\n if (range.from >= to) break;\n if (range.domStart > domPos || range.from > pos) {\n updates.push({from: pos, to: range.from, domSize: range.domStart - domPos, domStart: domPos});\n changedLines += range.from - pos;\n }\n pos = range.to;\n domPos = range.domStart + (range.to - range.from);\n }\n if (domPos != domEnd || pos != to) {\n changedLines += Math.abs(to - pos);\n updates.push({from: pos, to: to, domSize: domEnd - domPos, domStart: domPos});\n }\n\n if (!updates.length) return;\n lineDiv.style.display = \"none\";\n // If more than 30% of the screen needs update, just do a full\n // redraw (which is quicker than patching)\n if (changedLines > (visible.to - visible.from) * .3)\n refreshDisplay(from = Math.max(visible.from - 10, 0), to = Math.min(visible.to + 7, lines.length));\n // Otherwise, only update the stuff that needs updating.\n else\n patchDisplay(updates);\n lineDiv.style.display = \"\";\n\n // Position the mover div to align with the lines it's supposed\n // to be showing (which will cover the visible display)\n var different = from != showingFrom || to != showingTo || lastHeight != scroller.clientHeight;\n showingFrom = from; showingTo = to;\n mover.style.top = (from * lineHeight()) + \"px\";\n if (different) {\n lastHeight = scroller.clientHeight;\n code.style.height = (lines.length * lineHeight() + 2 * paddingTop()) + \"px\";\n updateGutter();\n }\n\n if (maxWidth == null) maxWidth = stringWidth(maxLine);\n if (maxWidth > scroller.clientWidth) {\n lineSpace.style.width = maxWidth + \"px\";\n // Needed to prevent odd wrapping/hiding of widgets placed in here.\n code.style.width = \"\";\n code.style.width = scroller.scrollWidth + \"px\";\n } else {\n lineSpace.style.width = code.style.width = \"\";\n }\n\n // Since this is all rather error prone, it is honoured with the\n // only assertion in the whole file.\n if (lineDiv.childNodes.length != showingTo - showingFrom)\n throw new Error(\"BAD PATCH! \" + JSON.stringify(updates) + \" size=\" + (showingTo - showingFrom) +\n \" nodes=\" + lineDiv.childNodes.length);\n updateCursor();\n }", "function updateDisplay(changes) {\n if (!scroller.clientWidth) {\n showingFrom = showingTo = 0;\n return;\n }\n // First create a range of theoretically intact lines, and punch\n // holes in that using the change info.\n var intact = changes === true ? [] : [{from: showingFrom, to: showingTo, domStart: 0}];\n for (var i = 0, l = changes.length || 0; i < l; ++i) {\n var change = changes[i], intact2 = [], diff = change.diff || 0;\n for (var j = 0, l2 = intact.length; j < l2; ++j) {\n var range = intact[j];\n if (change.to <= range.from)\n intact2.push({from: range.from + diff, to: range.to + diff, domStart: range.domStart});\n else if (range.to <= change.from)\n intact2.push(range);\n else {\n if (change.from > range.from)\n intact2.push({from: range.from, to: change.from, domStart: range.domStart});\n if (change.to < range.to)\n intact2.push({from: change.to + diff, to: range.to + diff,\n domStart: range.domStart + (change.to - range.from)});\n }\n }\n intact = intact2;\n }\n\n // Then, determine which lines we'd want to see, and which\n // updates have to be made to get there.\n var visible = visibleLines();\n var from = Math.min(showingFrom, Math.max(visible.from - 3, 0)),\n to = Math.min(lines.length, Math.max(showingTo, visible.to + 3)),\n updates = [], domPos = 0, domEnd = showingTo - showingFrom, pos = from, changedLines = 0;\n\n for (var i = 0, l = intact.length; i < l; ++i) {\n var range = intact[i];\n if (range.to <= from) continue;\n if (range.from >= to) break;\n if (range.domStart > domPos || range.from > pos) {\n updates.push({from: pos, to: range.from, domSize: range.domStart - domPos, domStart: domPos});\n changedLines += range.from - pos;\n }\n pos = range.to;\n domPos = range.domStart + (range.to - range.from);\n }\n if (domPos != domEnd || pos != to) {\n changedLines += Math.abs(to - pos);\n updates.push({from: pos, to: to, domSize: domEnd - domPos, domStart: domPos});\n if (to - pos != domEnd - domPos) gutterDirty = true;\n }\n\n if (!updates.length) return;\n lineDiv.style.display = \"none\";\n // If more than 30% of the screen needs update, just do a full\n // redraw (which is quicker than patching)\n if (changedLines > (visible.to - visible.from) * .3)\n refreshDisplay(from = Math.max(visible.from - 10, 0), to = Math.min(visible.to + 7, lines.length));\n // Otherwise, only update the stuff that needs updating.\n else\n patchDisplay(updates);\n lineDiv.style.display = \"\";\n\n // Position the mover div to align with the lines it's supposed\n // to be showing (which will cover the visible display)\n var different = from != showingFrom || to != showingTo || lastHeight != scroller.clientHeight;\n showingFrom = from; showingTo = to;\n mover.style.top = (from * lineHeight()) + \"px\";\n if (different) {\n lastHeight = scroller.clientHeight;\n code.style.height = (lines.length * lineHeight() + 2 * paddingTop()) + \"px\";\n }\n if (different || gutterDirty) updateGutter();\n\n if (maxWidth == null) maxWidth = stringWidth(maxLine);\n if (maxWidth > scroller.clientWidth) {\n lineSpace.style.width = maxWidth + \"px\";\n // Needed to prevent odd wrapping/hiding of widgets placed in here.\n code.style.width = \"\";\n code.style.width = scroller.scrollWidth + \"px\";\n } else {\n lineSpace.style.width = code.style.width = \"\";\n }\n\n // Since this is all rather error prone, it is honoured with the\n // only assertion in the whole file.\n if (lineDiv.childNodes.length != showingTo - showingFrom)\n throw new Error(\"BAD PATCH! \" + JSON.stringify(updates) + \" size=\" + (showingTo - showingFrom) +\n \" nodes=\" + lineDiv.childNodes.length);\n updateCursor();\n }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n\t\t for (var j = 0; j < lineView.changes.length; j++) {\n\t\t var type = lineView.changes[j];\n\t\t if (type == \"text\") { updateLineText(cm, lineView); }\n\t\t else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n\t\t else if (type == \"class\") { updateLineClasses(cm, lineView); }\n\t\t else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n\t\t }\n\t\t lineView.changes = null;\n\t\t }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n\t\t for (var j = 0; j < lineView.changes.length; j++) {\n\t\t var type = lineView.changes[j];\n\t\t if (type == \"text\") updateLineText(cm, lineView);\n\t\t else if (type == \"gutter\") updateLineGutter(cm, lineView, lineN, dims);\n\t\t else if (type == \"class\") updateLineClasses(lineView);\n\t\t else if (type == \"widget\") updateLineWidgets(cm, lineView, dims);\n\t\t }\n\t\t lineView.changes = null;\n\t\t }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n\t for (var j = 0; j < lineView.changes.length; j++) {\n\t var type = lineView.changes[j];\n\t if (type == \"text\") updateLineText(cm, lineView);\n\t else if (type == \"gutter\") updateLineGutter(cm, lineView, lineN, dims);\n\t else if (type == \"class\") updateLineClasses(lineView);\n\t else if (type == \"widget\") updateLineWidgets(cm, lineView, dims);\n\t }\n\t lineView.changes = null;\n\t }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n\t for (var j = 0; j < lineView.changes.length; j++) {\n\t var type = lineView.changes[j];\n\t if (type == \"text\") updateLineText(cm, lineView);\n\t else if (type == \"gutter\") updateLineGutter(cm, lineView, lineN, dims);\n\t else if (type == \"class\") updateLineClasses(lineView);\n\t else if (type == \"widget\") updateLineWidgets(cm, lineView, dims);\n\t }\n\t lineView.changes = null;\n\t }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n\t for (var j = 0; j < lineView.changes.length; j++) {\n\t var type = lineView.changes[j];\n\t if (type == \"text\") updateLineText(cm, lineView);\n\t else if (type == \"gutter\") updateLineGutter(cm, lineView, lineN, dims);\n\t else if (type == \"class\") updateLineClasses(lineView);\n\t else if (type == \"widget\") updateLineWidgets(cm, lineView, dims);\n\t }\n\t lineView.changes = null;\n\t }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") updateLineText(cm, lineView);\n else if (type == \"gutter\") updateLineGutter(cm, lineView, lineN, dims);\n else if (type == \"class\") updateLineClasses(lineView);\n else if (type == \"widget\") updateLineWidgets(lineView, dims);\n }\n lineView.changes = null;\n }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") updateLineText(cm, lineView);\n else if (type == \"gutter\") updateLineGutter(cm, lineView, lineN, dims);\n else if (type == \"class\") updateLineClasses(lineView);\n else if (type == \"widget\") updateLineWidgets(lineView, dims);\n }\n lineView.changes = null;\n }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") updateLineText(cm, lineView);\n else if (type == \"gutter\") updateLineGutter(cm, lineView, lineN, dims);\n else if (type == \"class\") updateLineClasses(lineView);\n else if (type == \"widget\") updateLineWidgets(lineView, dims);\n }\n lineView.changes = null;\n }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") updateLineText(cm, lineView);\n else if (type == \"gutter\") updateLineGutter(cm, lineView, lineN, dims);\n else if (type == \"class\") updateLineClasses(lineView);\n else if (type == \"widget\") updateLineWidgets(lineView, dims);\n }\n lineView.changes = null;\n }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") updateLineText(cm, lineView);\n else if (type == \"gutter\") updateLineGutter(cm, lineView, lineN, dims);\n else if (type == \"class\") updateLineClasses(lineView);\n else if (type == \"widget\") updateLineWidgets(lineView, dims);\n }\n lineView.changes = null;\n }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") updateLineText(cm, lineView);\n else if (type == \"gutter\") updateLineGutter(cm, lineView, lineN, dims);\n else if (type == \"class\") updateLineClasses(lineView);\n else if (type == \"widget\") updateLineWidgets(lineView, dims);\n }\n lineView.changes = null;\n }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") updateLineText(cm, lineView);\n else if (type == \"gutter\") updateLineGutter(cm, lineView, lineN, dims);\n else if (type == \"class\") updateLineClasses(lineView);\n else if (type == \"widget\") updateLineWidgets(cm, lineView, dims);\n }\n lineView.changes = null;\n }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") updateLineText(cm, lineView);\n else if (type == \"gutter\") updateLineGutter(cm, lineView, lineN, dims);\n else if (type == \"class\") updateLineClasses(lineView);\n else if (type == \"widget\") updateLineWidgets(cm, lineView, dims);\n }\n lineView.changes = null;\n }", "function updateLineForChanges(cm, lineView, lineN, dims) {\r\n for (var j = 0; j < lineView.changes.length; j++) {\r\n var type = lineView.changes[j];\r\n if (type == \"text\") updateLineText(cm, lineView);\r\n else if (type == \"gutter\") updateLineGutter(cm, lineView, lineN, dims);\r\n else if (type == \"class\") updateLineClasses(lineView);\r\n else if (type == \"widget\") updateLineWidgets(lineView, dims);\r\n }\r\n lineView.changes = null;\r\n }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n\n if (type == \"text\") {\n updateLineText(cm, lineView);\n } else if (type == \"gutter\") {\n updateLineGutter(cm, lineView, lineN, dims);\n } else if (type == \"class\") {\n updateLineClasses(cm, lineView);\n } else if (type == \"widget\") {\n updateLineWidgets(cm, lineView, dims);\n }\n }\n\n lineView.changes = null;\n } // Lines with gutter elements, widgets or a background class need to", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j]\n if (type == \"text\") { updateLineText(cm, lineView) }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims) }\n else if (type == \"class\") { updateLineClasses(cm, lineView) }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims) }\n }\n lineView.changes = null\n}", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j]\n if (type == \"text\") { updateLineText(cm, lineView) }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims) }\n else if (type == \"class\") { updateLineClasses(lineView) }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims) }\n }\n lineView.changes = null\n}", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n}", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n}", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n}", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n}", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n}", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n}", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n}", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n}", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n}", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n}", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n}", "function updateLineForChanges(cm, lineView, lineN, dims) {\r\n for (var j = 0; j < lineView.changes.length; j++) {\r\n var type = lineView.changes[j];\r\n if (type == \"text\") { updateLineText(cm, lineView); }\r\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\r\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\r\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\r\n }\r\n lineView.changes = null;\r\n}", "function regLineChange(cm, line, type) {\n\t\t cm.curOp.viewChanged = true;\n\t\t var display = cm.display, ext = cm.display.externalMeasured;\n\t\t if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n\t\t display.externalMeasured = null;\n\t\t\n\t\t if (line < display.viewFrom || line >= display.viewTo) return;\n\t\t var lineView = display.view[findViewIndex(cm, line)];\n\t\t if (lineView.node == null) return;\n\t\t var arr = lineView.changes || (lineView.changes = []);\n\t\t if (indexOf(arr, type) == -1) arr.push(type);\n\t\t }", "function regLineChange(cm, line, type) {\n\t\t cm.curOp.viewChanged = true;\n\t\t var display = cm.display, ext = cm.display.externalMeasured;\n\t\t if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n\t\t { display.externalMeasured = null; }\n\n\t\t if (line < display.viewFrom || line >= display.viewTo) { return }\n\t\t var lineView = display.view[findViewIndex(cm, line)];\n\t\t if (lineView.node == null) { return }\n\t\t var arr = lineView.changes || (lineView.changes = []);\n\t\t if (indexOf(arr, type) == -1) { arr.push(type); }\n\t\t }", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\r\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\r\n function update(line, text, spans) {\r\n updateLine(line, text, spans, estimateHeight$$1);\r\n signalLater(line, \"change\", line, change);\r\n }\r\n function linesFor(start, end) {\r\n var result = [];\r\n for (var i = start; i < end; ++i)\r\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\r\n return result\r\n }\r\n\r\n var from = change.from, to = change.to, text = change.text;\r\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\r\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\r\n\r\n // Adjust the line structure\r\n if (change.full) {\r\n doc.insert(0, linesFor(0, text.length));\r\n doc.remove(text.length, doc.size - text.length);\r\n } else if (isWholeLineUpdate(doc, change)) {\r\n // This is a whole-line replace. Treated specially to make\r\n // sure line objects move the way they are supposed to.\r\n var added = linesFor(0, text.length - 1);\r\n update(lastLine, lastLine.text, lastSpans);\r\n if (nlines) { doc.remove(from.line, nlines); }\r\n if (added.length) { doc.insert(from.line, added); }\r\n } else if (firstLine == lastLine) {\r\n if (text.length == 1) {\r\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\r\n } else {\r\n var added$1 = linesFor(1, text.length - 1);\r\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\r\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\r\n doc.insert(from.line + 1, added$1);\r\n }\r\n } else if (text.length == 1) {\r\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\r\n doc.remove(from.line + 1, nlines);\r\n } else {\r\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\r\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\r\n var added$2 = linesFor(1, text.length - 1);\r\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\r\n doc.insert(from.line + 1, added$2);\r\n }\r\n\r\n signalLater(doc, \"change\", doc, change);\r\n}", "function regLineChange(cm, line, type) {\n\t cm.curOp.viewChanged = true;\n\t var display = cm.display, ext = cm.display.externalMeasured;\n\t if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n\t display.externalMeasured = null;\n\t\n\t if (line < display.viewFrom || line >= display.viewTo) return;\n\t var lineView = display.view[findViewIndex(cm, line)];\n\t if (lineView.node == null) return;\n\t var arr = lineView.changes || (lineView.changes = []);\n\t if (indexOf(arr, type) == -1) arr.push(type);\n\t }", "function regLineChange(cm, line, type) {\n\t cm.curOp.viewChanged = true;\n\t var display = cm.display, ext = cm.display.externalMeasured;\n\t if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n\t display.externalMeasured = null;\n\n\t if (line < display.viewFrom || line >= display.viewTo) return;\n\t var lineView = display.view[findViewIndex(cm, line)];\n\t if (lineView.node == null) return;\n\t var arr = lineView.changes || (lineView.changes = []);\n\t if (indexOf(arr, type) == -1) arr.push(type);\n\t }", "function regLineChange(cm, line, type) {\n\t cm.curOp.viewChanged = true;\n\t var display = cm.display, ext = cm.display.externalMeasured;\n\t if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n\t display.externalMeasured = null;\n\n\t if (line < display.viewFrom || line >= display.viewTo) return;\n\t var lineView = display.view[findViewIndex(cm, line)];\n\t if (lineView.node == null) return;\n\t var arr = lineView.changes || (lineView.changes = []);\n\t if (indexOf(arr, type) == -1) arr.push(type);\n\t }" ]
[ "0.7041917", "0.70200956", "0.7002636", "0.7002636", "0.6970039", "0.6949149", "0.6944299", "0.6944299", "0.6944299", "0.6944299", "0.6944299", "0.6944299", "0.6944299", "0.6944299", "0.69192004", "0.6917124", "0.6862251", "0.6862251", "0.6862251", "0.6862251", "0.6862251", "0.6862251", "0.6862251", "0.6862251", "0.6862251", "0.6862251", "0.6862251", "0.6849632", "0.6849632", "0.66903925", "0.66903925", "0.66903836", "0.65971005", "0.6592595", "0.658283", "0.658283", "0.658283", "0.65077937", "0.65077937", "0.65077937", "0.65077937", "0.65077937", "0.65077937", "0.64985406", "0.64985406", "0.64985406", "0.64985406", "0.64985406", "0.64985406", "0.64985406", "0.64985406", "0.64985406", "0.64985406", "0.64985406", "0.64985406", "0.64985406", "0.64985406", "0.64985406", "0.64985406", "0.64985406", "0.6495687", "0.6495687", "0.64936554", "0.6467422", "0.64310634", "0.64308363", "0.6392689", "0.6392689", "0.6392689", "0.6392689", "0.6392689", "0.6392689", "0.6392689", "0.6392689", "0.6392689", "0.6392689", "0.6392689", "0.6383231", "0.61842954", "0.617465", "0.6158833", "0.61354023", "0.61080253", "0.61080253" ]
0.6954716
16
Register a change to a single line. Type must be one of "text", "gutter", "class", "widget"
function regLineChange(cm, line, type) { cm.curOp.viewChanged = true; var display = cm.display, ext = cm.display.externalMeasured; if (ext && line >= ext.lineN && line < ext.lineN + ext.size) { display.externalMeasured = null; } if (line < display.viewFrom || line >= display.viewTo) { return } var lineView = display.view[findViewIndex(cm, line)]; if (lineView.node == null) { return } var arr = lineView.changes || (lineView.changes = []); if (indexOf(arr, type) == -1) { arr.push(type); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function LineChange (type, text) {\n this.type = type // ADDED, REMOVED, UNMODIFIED\n this.text = text\n}", "function regLineChange(cm, line, type) {\n cm.curOp.viewChanged = true\n var display = cm.display, ext = cm.display.externalMeasured\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n { display.externalMeasured = null }\n\n if (line < display.viewFrom || line >= display.viewTo) { return }\n var lineView = display.view[findViewIndex(cm, line)]\n if (lineView.node == null) { return }\n var arr = lineView.changes || (lineView.changes = [])\n if (indexOf(arr, type) == -1) { arr.push(type) }\n}", "function regLineChange(cm, line, type) {\n cm.curOp.viewChanged = true\n var display = cm.display, ext = cm.display.externalMeasured\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n { display.externalMeasured = null }\n\n if (line < display.viewFrom || line >= display.viewTo) { return }\n var lineView = display.view[findViewIndex(cm, line)]\n if (lineView.node == null) { return }\n var arr = lineView.changes || (lineView.changes = [])\n if (indexOf(arr, type) == -1) { arr.push(type) }\n}", "function regLineChange(cm, line, type) {\n cm.curOp.viewChanged = true;\n var display = cm.display, ext = cm.display.externalMeasured;\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n\n if (line < display.viewFrom || line >= display.viewTo) { return }\n var lineView = display.view[findViewIndex(cm, line)];\n if (lineView.node == null) { return }\n var arr = lineView.changes || (lineView.changes = []);\n if (indexOf(arr, type) == -1) { arr.push(type); }\n}", "function regLineChange(cm, line, type) {\n cm.curOp.viewChanged = true;\n var display = cm.display, ext = cm.display.externalMeasured;\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n\n if (line < display.viewFrom || line >= display.viewTo) { return }\n var lineView = display.view[findViewIndex(cm, line)];\n if (lineView.node == null) { return }\n var arr = lineView.changes || (lineView.changes = []);\n if (indexOf(arr, type) == -1) { arr.push(type); }\n}", "function regLineChange(cm, line, type) {\n cm.curOp.viewChanged = true;\n var display = cm.display, ext = cm.display.externalMeasured;\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n\n if (line < display.viewFrom || line >= display.viewTo) { return }\n var lineView = display.view[findViewIndex(cm, line)];\n if (lineView.node == null) { return }\n var arr = lineView.changes || (lineView.changes = []);\n if (indexOf(arr, type) == -1) { arr.push(type); }\n}", "function regLineChange(cm, line, type) {\n cm.curOp.viewChanged = true;\n var display = cm.display, ext = cm.display.externalMeasured;\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n\n if (line < display.viewFrom || line >= display.viewTo) { return }\n var lineView = display.view[findViewIndex(cm, line)];\n if (lineView.node == null) { return }\n var arr = lineView.changes || (lineView.changes = []);\n if (indexOf(arr, type) == -1) { arr.push(type); }\n}", "function regLineChange(cm, line, type) {\n cm.curOp.viewChanged = true;\n var display = cm.display, ext = cm.display.externalMeasured;\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n\n if (line < display.viewFrom || line >= display.viewTo) { return }\n var lineView = display.view[findViewIndex(cm, line)];\n if (lineView.node == null) { return }\n var arr = lineView.changes || (lineView.changes = []);\n if (indexOf(arr, type) == -1) { arr.push(type); }\n}", "function regLineChange(cm, line, type) {\n cm.curOp.viewChanged = true;\n var display = cm.display, ext = cm.display.externalMeasured;\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n\n if (line < display.viewFrom || line >= display.viewTo) { return }\n var lineView = display.view[findViewIndex(cm, line)];\n if (lineView.node == null) { return }\n var arr = lineView.changes || (lineView.changes = []);\n if (indexOf(arr, type) == -1) { arr.push(type); }\n}", "function regLineChange(cm, line, type) {\n cm.curOp.viewChanged = true;\n var display = cm.display, ext = cm.display.externalMeasured;\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n\n if (line < display.viewFrom || line >= display.viewTo) { return }\n var lineView = display.view[findViewIndex(cm, line)];\n if (lineView.node == null) { return }\n var arr = lineView.changes || (lineView.changes = []);\n if (indexOf(arr, type) == -1) { arr.push(type); }\n}", "function regLineChange(cm, line, type) {\n cm.curOp.viewChanged = true;\n var display = cm.display, ext = cm.display.externalMeasured;\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n\n if (line < display.viewFrom || line >= display.viewTo) { return }\n var lineView = display.view[findViewIndex(cm, line)];\n if (lineView.node == null) { return }\n var arr = lineView.changes || (lineView.changes = []);\n if (indexOf(arr, type) == -1) { arr.push(type); }\n}", "function regLineChange(cm, line, type) {\n cm.curOp.viewChanged = true;\n var display = cm.display, ext = cm.display.externalMeasured;\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n\n if (line < display.viewFrom || line >= display.viewTo) { return }\n var lineView = display.view[findViewIndex(cm, line)];\n if (lineView.node == null) { return }\n var arr = lineView.changes || (lineView.changes = []);\n if (indexOf(arr, type) == -1) { arr.push(type); }\n}", "function regLineChange(cm, line, type) {\n cm.curOp.viewChanged = true;\n var display = cm.display, ext = cm.display.externalMeasured;\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n\n if (line < display.viewFrom || line >= display.viewTo) { return }\n var lineView = display.view[findViewIndex(cm, line)];\n if (lineView.node == null) { return }\n var arr = lineView.changes || (lineView.changes = []);\n if (indexOf(arr, type) == -1) { arr.push(type); }\n}", "function regLineChange(cm, line, type) {\n cm.curOp.viewChanged = true;\n var display = cm.display, ext = cm.display.externalMeasured;\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n\n if (line < display.viewFrom || line >= display.viewTo) { return }\n var lineView = display.view[findViewIndex(cm, line)];\n if (lineView.node == null) { return }\n var arr = lineView.changes || (lineView.changes = []);\n if (indexOf(arr, type) == -1) { arr.push(type); }\n}", "function regLineChange(cm, line, type) {\n cm.curOp.viewChanged = true;\n var display = cm.display, ext = cm.display.externalMeasured;\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n display.externalMeasured = null;\n\n if (line < display.viewFrom || line >= display.viewTo) return;\n var lineView = display.view[findViewIndex(cm, line)];\n if (lineView.node == null) return;\n var arr = lineView.changes || (lineView.changes = []);\n if (indexOf(arr, type) == -1) arr.push(type);\n }", "function regLineChange(cm, line, type) {\n cm.curOp.viewChanged = true;\n var display = cm.display, ext = cm.display.externalMeasured;\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n display.externalMeasured = null;\n\n if (line < display.viewFrom || line >= display.viewTo) return;\n var lineView = display.view[findViewIndex(cm, line)];\n if (lineView.node == null) return;\n var arr = lineView.changes || (lineView.changes = []);\n if (indexOf(arr, type) == -1) arr.push(type);\n }", "function regLineChange(cm, line, type) {\n cm.curOp.viewChanged = true;\n var display = cm.display, ext = cm.display.externalMeasured;\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n display.externalMeasured = null;\n\n if (line < display.viewFrom || line >= display.viewTo) return;\n var lineView = display.view[findViewIndex(cm, line)];\n if (lineView.node == null) return;\n var arr = lineView.changes || (lineView.changes = []);\n if (indexOf(arr, type) == -1) arr.push(type);\n }", "function regLineChange(cm, line, type) {\n cm.curOp.viewChanged = true;\n var display = cm.display, ext = cm.display.externalMeasured;\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n display.externalMeasured = null;\n\n if (line < display.viewFrom || line >= display.viewTo) return;\n var lineView = display.view[findViewIndex(cm, line)];\n if (lineView.node == null) return;\n var arr = lineView.changes || (lineView.changes = []);\n if (indexOf(arr, type) == -1) arr.push(type);\n }", "function regLineChange(cm, line, type) {\n cm.curOp.viewChanged = true;\n var display = cm.display, ext = cm.display.externalMeasured;\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n display.externalMeasured = null;\n\n if (line < display.viewFrom || line >= display.viewTo) return;\n var lineView = display.view[findViewIndex(cm, line)];\n if (lineView.node == null) return;\n var arr = lineView.changes || (lineView.changes = []);\n if (indexOf(arr, type) == -1) arr.push(type);\n }", "function regLineChange(cm, line, type) {\n cm.curOp.viewChanged = true;\n var display = cm.display, ext = cm.display.externalMeasured;\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n display.externalMeasured = null;\n\n if (line < display.viewFrom || line >= display.viewTo) return;\n var lineView = display.view[findViewIndex(cm, line)];\n if (lineView.node == null) return;\n var arr = lineView.changes || (lineView.changes = []);\n if (indexOf(arr, type) == -1) arr.push(type);\n }", "function regLineChange(cm, line, type) {\n cm.curOp.viewChanged = true;\n var display = cm.display, ext = cm.display.externalMeasured;\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n display.externalMeasured = null;\n\n if (line < display.viewFrom || line >= display.viewTo) return;\n var lineView = display.view[findViewIndex(cm, line)];\n if (lineView.node == null) return;\n var arr = lineView.changes || (lineView.changes = []);\n if (indexOf(arr, type) == -1) arr.push(type);\n }", "function regLineChange(cm, line, type) {\n cm.curOp.viewChanged = true;\n var display = cm.display, ext = cm.display.externalMeasured;\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n display.externalMeasured = null;\n\n if (line < display.viewFrom || line >= display.viewTo) return;\n var lineView = display.view[findViewIndex(cm, line)];\n if (lineView.node == null) return;\n var arr = lineView.changes || (lineView.changes = []);\n if (indexOf(arr, type) == -1) arr.push(type);\n }", "function regLineChange(cm, line, type) {\r\n cm.curOp.viewChanged = true;\r\n var display = cm.display, ext = cm.display.externalMeasured;\r\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\r\n { display.externalMeasured = null; }\r\n\r\n if (line < display.viewFrom || line >= display.viewTo) { return }\r\n var lineView = display.view[findViewIndex(cm, line)];\r\n if (lineView.node == null) { return }\r\n var arr = lineView.changes || (lineView.changes = []);\r\n if (indexOf(arr, type) == -1) { arr.push(type); }\r\n}", "function regLineChange(cm, line, type) {\r\n cm.curOp.viewChanged = true;\r\n var display = cm.display, ext = cm.display.externalMeasured;\r\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\r\n display.externalMeasured = null;\r\n\r\n if (line < display.viewFrom || line >= display.viewTo) return;\r\n var lineView = display.view[findViewIndex(cm, line)];\r\n if (lineView.node == null) return;\r\n var arr = lineView.changes || (lineView.changes = []);\r\n if (indexOf(arr, type) == -1) arr.push(type);\r\n }", "function regLineChange(cm, line, type) {\n\t\t cm.curOp.viewChanged = true;\n\t\t var display = cm.display, ext = cm.display.externalMeasured;\n\t\t if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n\t\t { display.externalMeasured = null; }\n\n\t\t if (line < display.viewFrom || line >= display.viewTo) { return }\n\t\t var lineView = display.view[findViewIndex(cm, line)];\n\t\t if (lineView.node == null) { return }\n\t\t var arr = lineView.changes || (lineView.changes = []);\n\t\t if (indexOf(arr, type) == -1) { arr.push(type); }\n\t\t }", "function regLineChange(cm, line, type) {\n\t\t cm.curOp.viewChanged = true;\n\t\t var display = cm.display, ext = cm.display.externalMeasured;\n\t\t if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n\t\t display.externalMeasured = null;\n\t\t\n\t\t if (line < display.viewFrom || line >= display.viewTo) return;\n\t\t var lineView = display.view[findViewIndex(cm, line)];\n\t\t if (lineView.node == null) return;\n\t\t var arr = lineView.changes || (lineView.changes = []);\n\t\t if (indexOf(arr, type) == -1) arr.push(type);\n\t\t }", "function regLineChange(cm, line, type) {\n\t cm.curOp.viewChanged = true;\n\t var display = cm.display, ext = cm.display.externalMeasured;\n\t if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n\t display.externalMeasured = null;\n\n\t if (line < display.viewFrom || line >= display.viewTo) return;\n\t var lineView = display.view[findViewIndex(cm, line)];\n\t if (lineView.node == null) return;\n\t var arr = lineView.changes || (lineView.changes = []);\n\t if (indexOf(arr, type) == -1) arr.push(type);\n\t }", "function regLineChange(cm, line, type) {\n\t cm.curOp.viewChanged = true;\n\t var display = cm.display, ext = cm.display.externalMeasured;\n\t if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n\t display.externalMeasured = null;\n\n\t if (line < display.viewFrom || line >= display.viewTo) return;\n\t var lineView = display.view[findViewIndex(cm, line)];\n\t if (lineView.node == null) return;\n\t var arr = lineView.changes || (lineView.changes = []);\n\t if (indexOf(arr, type) == -1) arr.push(type);\n\t }", "function regLineChange(cm, line, type) {\n\t cm.curOp.viewChanged = true;\n\t var display = cm.display, ext = cm.display.externalMeasured;\n\t if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n\t display.externalMeasured = null;\n\t\n\t if (line < display.viewFrom || line >= display.viewTo) return;\n\t var lineView = display.view[findViewIndex(cm, line)];\n\t if (lineView.node == null) return;\n\t var arr = lineView.changes || (lineView.changes = []);\n\t if (indexOf(arr, type) == -1) arr.push(type);\n\t }", "function onChangeLine(txt) {\n changeCurrMeme('line-txt', txt);\n renderCanvas();\n}", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n\n if (type == \"text\") {\n updateLineText(cm, lineView);\n } else if (type == \"gutter\") {\n updateLineGutter(cm, lineView, lineN, dims);\n } else if (type == \"class\") {\n updateLineClasses(cm, lineView);\n } else if (type == \"widget\") {\n updateLineWidgets(cm, lineView, dims);\n }\n }\n\n lineView.changes = null;\n } // Lines with gutter elements, widgets or a background class need to", "function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle\n if (typeof handle == \"number\") { line = getLine(doc, clipLine(doc, handle)) }\n else { no = lineNo(handle) }\n if (no == null) { return null }\n if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType) }\n return line\n}", "function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle\n if (typeof handle == \"number\") { line = getLine(doc, clipLine(doc, handle)) }\n else { no = lineNo(handle) }\n if (no == null) { return null }\n if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType) }\n return line\n}", "function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") { line = getLine(doc, clipLine(doc, handle)); }\n else { no = lineNo(handle); }\n if (no == null) { return null }\n if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }\n return line\n }", "function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") { line = getLine(doc, clipLine(doc, handle)); }\n else { no = lineNo(handle); }\n if (no == null) { return null }\n if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }\n return line\n }", "function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") { line = getLine(doc, clipLine(doc, handle)); }\n else { no = lineNo(handle); }\n if (no == null) { return null }\n if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }\n return line\n }", "function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") { line = getLine(doc, clipLine(doc, handle)); }\n else { no = lineNo(handle); }\n if (no == null) { return null }\n if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }\n return line\n }", "function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") { line = getLine(doc, clipLine(doc, handle)); }\n else { no = lineNo(handle); }\n if (no == null) { return null }\n if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }\n return line\n }", "function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") { line = getLine(doc, clipLine(doc, handle)); }\n else { no = lineNo(handle); }\n if (no == null) { return null }\n if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }\n return line\n }", "function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") { line = getLine(doc, clipLine(doc, handle)); }\n else { no = lineNo(handle); }\n if (no == null) { return null }\n if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }\n return line\n }", "function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") { line = getLine(doc, clipLine(doc, handle)); }\n else { no = lineNo(handle); }\n if (no == null) { return null }\n if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }\n return line\n }", "function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") { line = getLine(doc, clipLine(doc, handle)); }\n else { no = lineNo(handle); }\n if (no == null) { return null }\n if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }\n return line\n }", "function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") { line = getLine(doc, clipLine(doc, handle)); }\n else { no = lineNo(handle); }\n if (no == null) { return null }\n if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }\n return line\n }", "function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") { line = getLine(doc, clipLine(doc, handle)); }\n else { no = lineNo(handle); }\n if (no == null) { return null }\n if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }\n return line\n }", "function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") { line = getLine(doc, clipLine(doc, handle)); }\n else { no = lineNo(handle); }\n if (no == null) { return null }\n if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }\n return line\n }", "function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") { line = getLine(doc, clipLine(doc, handle)); }\n else { no = lineNo(handle); }\n if (no == null) { return null }\n if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }\n return line\n }", "function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") { line = getLine(doc, clipLine(doc, handle)); }\n else { no = lineNo(handle); }\n if (no == null) { return null }\n if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }\n return line\n }", "function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") { line = getLine(doc, clipLine(doc, handle)); }\n else { no = lineNo(handle); }\n if (no == null) { return null }\n if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }\n return line\n }", "function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") { line = getLine(doc, clipLine(doc, handle)); }\n else { no = lineNo(handle); }\n if (no == null) { return null }\n if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }\n return line\n }", "function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") { line = getLine(doc, clipLine(doc, handle)); }\n else { no = lineNo(handle); }\n if (no == null) { return null }\n if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }\n return line\n }", "function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") { line = getLine(doc, clipLine(doc, handle)); }\n else { no = lineNo(handle); }\n if (no == null) { return null }\n if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }\n return line\n}", "function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") { line = getLine(doc, clipLine(doc, handle)); }\n else { no = lineNo(handle); }\n if (no == null) { return null }\n if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }\n return line\n}", "function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") { line = getLine(doc, clipLine(doc, handle)); }\n else { no = lineNo(handle); }\n if (no == null) { return null }\n if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }\n return line\n}", "function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") { line = getLine(doc, clipLine(doc, handle)); }\n else { no = lineNo(handle); }\n if (no == null) { return null }\n if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }\n return line\n}", "function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") { line = getLine(doc, clipLine(doc, handle)); }\n else { no = lineNo(handle); }\n if (no == null) { return null }\n if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }\n return line\n}", "function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") { line = getLine(doc, clipLine(doc, handle)); }\n else { no = lineNo(handle); }\n if (no == null) { return null }\n if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }\n return line\n}", "function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") { line = getLine(doc, clipLine(doc, handle)); }\n else { no = lineNo(handle); }\n if (no == null) { return null }\n if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }\n return line\n}", "function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") { line = getLine(doc, clipLine(doc, handle)); }\n else { no = lineNo(handle); }\n if (no == null) { return null }\n if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }\n return line\n}", "function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") { line = getLine(doc, clipLine(doc, handle)); }\n else { no = lineNo(handle); }\n if (no == null) { return null }\n if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }\n return line\n}", "function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") { line = getLine(doc, clipLine(doc, handle)); }\n else { no = lineNo(handle); }\n if (no == null) { return null }\n if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }\n return line\n}", "function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") { line = getLine(doc, clipLine(doc, handle)); }\n else { no = lineNo(handle); }\n if (no == null) { return null }\n if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }\n return line\n}", "function changeLine(doc, handle, changeType, op) {\r\n var no = handle, line = handle;\r\n if (typeof handle == \"number\") { line = getLine(doc, clipLine(doc, handle)); }\r\n else { no = lineNo(handle); }\r\n if (no == null) { return null }\r\n if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }\r\n return line\r\n}", "function onAddLine() {\n createNewLine('');\n renderLineBoxs()\n}", "function changeLine(doc, handle, changeType, op) {\r\n var no = handle, line = handle;\r\n if (typeof handle == \"number\") line = getLine(doc, clipLine(doc, handle));\r\n else no = lineNo(handle);\r\n if (no == null) return null;\r\n if (op(line, no) && doc.cm) regLineChange(doc.cm, no, changeType);\r\n return line;\r\n }", "function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") line = getLine(doc, clipLine(doc, handle));\n else no = lineNo(handle);\n if (no == null) return null;\n if (op(line, no) && doc.cm) regLineChange(doc.cm, no, changeType);\n return line;\n }", "function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") line = getLine(doc, clipLine(doc, handle));\n else no = lineNo(handle);\n if (no == null) return null;\n if (op(line, no) && doc.cm) regLineChange(doc.cm, no, changeType);\n return line;\n }", "function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") line = getLine(doc, clipLine(doc, handle));\n else no = lineNo(handle);\n if (no == null) return null;\n if (op(line, no) && doc.cm) regLineChange(doc.cm, no, changeType);\n return line;\n }", "function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") line = getLine(doc, clipLine(doc, handle));\n else no = lineNo(handle);\n if (no == null) return null;\n if (op(line, no) && doc.cm) regLineChange(doc.cm, no, changeType);\n return line;\n }", "function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") line = getLine(doc, clipLine(doc, handle));\n else no = lineNo(handle);\n if (no == null) return null;\n if (op(line, no) && doc.cm) regLineChange(doc.cm, no, changeType);\n return line;\n }", "function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") line = getLine(doc, clipLine(doc, handle));\n else no = lineNo(handle);\n if (no == null) return null;\n if (op(line, no) && doc.cm) regLineChange(doc.cm, no, changeType);\n return line;\n }", "function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") line = getLine(doc, clipLine(doc, handle));\n else no = lineNo(handle);\n if (no == null) return null;\n if (op(line, no) && doc.cm) regLineChange(doc.cm, no, changeType);\n return line;\n }", "function changeLine(doc, handle, changeType, op) {\n\t\t var no = handle, line = handle;\n\t\t if (typeof handle == \"number\") { line = getLine(doc, clipLine(doc, handle)); }\n\t\t else { no = lineNo(handle); }\n\t\t if (no == null) { return null }\n\t\t if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }\n\t\t return line\n\t\t }", "function changeLine(doc, handle, changeType, op) {\n\t\t var no = handle, line = handle;\n\t\t if (typeof handle == \"number\") line = getLine(doc, clipLine(doc, handle));\n\t\t else no = lineNo(handle);\n\t\t if (no == null) return null;\n\t\t if (op(line, no) && doc.cm) regLineChange(doc.cm, no, changeType);\n\t\t return line;\n\t\t }", "function addLineClassToWraps(change) {\n var view = change.view;\n change.eachLine(function (info) {\n info.handles.all.forEach(function (handle) {\n view.addLineClass(handle, 'wrap', 'line');\n });\n });\n }", "function changeLine(doc, handle, changeType, op) {\n\t var no = handle, line = handle;\n\t if (typeof handle == \"number\") line = getLine(doc, clipLine(doc, handle));\n\t else no = lineNo(handle);\n\t if (no == null) return null;\n\t if (op(line, no) && doc.cm) regLineChange(doc.cm, no, changeType);\n\t return line;\n\t }", "function changeLine(doc, handle, changeType, op) {\n\t var no = handle, line = handle;\n\t if (typeof handle == \"number\") line = getLine(doc, clipLine(doc, handle));\n\t else no = lineNo(handle);\n\t if (no == null) return null;\n\t if (op(line, no) && doc.cm) regLineChange(doc.cm, no, changeType);\n\t return line;\n\t }", "function changeLine(doc, handle, changeType, op) {\n\t var no = handle, line = handle;\n\t if (typeof handle == \"number\") line = getLine(doc, clipLine(doc, handle));\n\t else no = lineNo(handle);\n\t if (no == null) return null;\n\t if (op(line, no) && doc.cm) regLineChange(doc.cm, no, changeType);\n\t return line;\n\t }", "function changeLine(doc, handle, changeType, op) {\n var no = handle,\n line = handle;\n\n if (typeof handle == \"number\") {\n line = getLine(doc, clipLine(doc, handle));\n } else {\n no = lineNo(handle);\n }\n\n if (no == null) {\n return null;\n }\n\n if (op(line, no) && doc.cm) {\n regLineChange(doc.cm, no, changeType);\n }\n\n return line;\n } // The document is represented as a BTree consisting of leaves, with", "function addComment(type, content, line) {\n this.addComments(type, [{\n type: line ? \"CommentLine\" : \"CommentBlock\",\n value: content\n }]);\n}", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j]\n if (type == \"text\") { updateLineText(cm, lineView) }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims) }\n else if (type == \"class\") { updateLineClasses(cm, lineView) }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims) }\n }\n lineView.changes = null\n}", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j]\n if (type == \"text\") { updateLineText(cm, lineView) }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims) }\n else if (type == \"class\") { updateLineClasses(lineView) }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims) }\n }\n lineView.changes = null\n}", "function updateLineForChanges(cm, lineView, lineN, dims) {\n\t\t for (var j = 0; j < lineView.changes.length; j++) {\n\t\t var type = lineView.changes[j];\n\t\t if (type == \"text\") updateLineText(cm, lineView);\n\t\t else if (type == \"gutter\") updateLineGutter(cm, lineView, lineN, dims);\n\t\t else if (type == \"class\") updateLineClasses(lineView);\n\t\t else if (type == \"widget\") updateLineWidgets(cm, lineView, dims);\n\t\t }\n\t\t lineView.changes = null;\n\t\t }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") updateLineText(cm, lineView);\n else if (type == \"gutter\") updateLineGutter(cm, lineView, lineN, dims);\n else if (type == \"class\") updateLineClasses(lineView);\n else if (type == \"widget\") updateLineWidgets(lineView, dims);\n }\n lineView.changes = null;\n }", "function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") updateLineText(cm, lineView);\n else if (type == \"gutter\") updateLineGutter(cm, lineView, lineN, dims);\n else if (type == \"class\") updateLineClasses(lineView);\n else if (type == \"widget\") updateLineWidgets(lineView, dims);\n }\n lineView.changes = null;\n }" ]
[ "0.7580796", "0.7120189", "0.7120189", "0.7101667", "0.7101667", "0.7101667", "0.7101667", "0.7101667", "0.7101667", "0.7101667", "0.7101667", "0.7101667", "0.7101667", "0.7101667", "0.7096139", "0.7096139", "0.7096139", "0.7096139", "0.7096139", "0.7096139", "0.7096139", "0.7096139", "0.7071554", "0.706734", "0.7065158", "0.7049184", "0.70462084", "0.70462084", "0.7030359", "0.63821787", "0.6238805", "0.62157726", "0.62157726", "0.62150097", "0.62150097", "0.62150097", "0.62150097", "0.62150097", "0.62150097", "0.62150097", "0.62150097", "0.62150097", "0.62150097", "0.62150097", "0.62150097", "0.62150097", "0.62150097", "0.62150097", "0.62150097", "0.62150097", "0.619167", "0.619167", "0.619167", "0.619167", "0.619167", "0.619167", "0.619167", "0.619167", "0.619167", "0.619167", "0.619167", "0.618909", "0.6182165", "0.61539054", "0.61518395", "0.61518395", "0.61518395", "0.61518395", "0.61518395", "0.61518395", "0.61518395", "0.61410445", "0.6119257", "0.6108725", "0.6106043", "0.6106043", "0.6106043", "0.6075613", "0.60506105", "0.60345924", "0.6031124", "0.60269105", "0.60245466", "0.60245466" ]
0.70884424
37
Force the view to cover a given range, adding empty view element or clipping off existing ones as needed.
function adjustView(cm, from, to) { var display = cm.display, view = display.view; if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) { display.view = buildViewArray(cm, from, to); display.viewFrom = from; } else { if (display.viewFrom > from) { display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view); } else if (display.viewFrom < from) { display.view = display.view.slice(findViewIndex(cm, from)); } display.viewFrom = from; if (display.viewTo < to) { display.view = display.view.concat(buildViewArray(cm, display.viewTo, to)); } else if (display.viewTo > to) { display.view = display.view.slice(0, findViewIndex(cm, to)); } } display.viewTo = to; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor(viewOf, qmin, qmax) {\n super(viewOf, (field, colLabel, colSchema, colData, df) =>\n _clipAnnoMatrix(field, colLabel, colSchema, colData, df, qmin, qmax)\n );\n this.isClipped = true;\n this.clipRange = [qmin, qmax];\n Object.seal(this);\n }", "setRenderedRange(range) {\n if (!rangesEqual(this._renderedRange, range)) {\n if (this.appendOnly) {\n range = {\n start: 0,\n end: Math.max(this._renderedRange.end, range.end)\n };\n }\n\n this._renderedRangeSubject.next(this._renderedRange = range);\n\n this._markChangeDetectionNeeded(() => this._scrollStrategy.onContentRendered());\n }\n }", "function ensureVisibleEventRange(range) {\n\t\tvar allDay;\n\n\t\tif (!range.end) {\n\n\t\t\tallDay = range.allDay; // range might be more event-ish than we think\n\t\t\tif (allDay == null) {\n\t\t\t\tallDay = !range.start.hasTime();\n\t\t\t}\n\n\t\t\trange = $.extend({}, range); // make a copy, copying over other misc properties\n\t\t\trange.end = t.getDefaultEventEnd(allDay, range.start);\n\t\t}\n\t\treturn range;\n\t}", "SetRange() {\n\n }", "static forRange(view, className, range) {\n if (range.empty) {\n let pos = view.coordsAtPos(range.head, range.assoc || 1);\n if (!pos)\n return [];\n let base = getBase(view);\n return [new RectangleMarker(className, pos.left - base.left, pos.top - base.top, null, pos.bottom - pos.top)];\n }\n else {\n return rectanglesForRange(view, className, range);\n }\n }", "function setBounds() {\n let el = angular.element(canvas);\n\n //set initial style\n if ( scope.options.layout.height === \"inherit\" ) {\n let viewHeight = view.getHeight();\n el.css(\"height\", `${viewHeight}px`);\n el.attr(\"height\", `${viewHeight * view.scale}px`);\n } else {\n el.css(\"height\", `${scope.options.layout.height}px`);\n el.attr(\"height\", `${scope.options.layout.height * view.scale}px`);\n }\n //set initial style\n if ( scope.options.layout.width === \"inherit\" ) {\n let viewWidth = view.getWidth();\n el.css(\"width\", `${viewWidth}px`);\n el.attr(\"width\", `${viewWidth * view.scale}px`);\n } else {\n el.css(\"width\", `${scope.options.layout.width}px`);\n el.attr(\"width\", `${scope.options.layout.width * view.scale}px`);\n }\n }", "_setRangeDebouced() {\n var range;\n if(this.orientation === 'vertical') {\n var h = Math.max(this._height, 0);\n range = [h, 0];\n\n } else {\n var w = Math.max(this._width, 0);\n range = [0, w];\n }\n\n this._scale.range(range);\n\n // force a recalc\n this._scaleChanged = !this._scaleChanged;\n }", "function ensureVisibleEventRange(range) {\n var allDay;\n\n if (!range.end) {\n\n allDay = range.allDay; // range might be more event-ish than we think\n if (allDay == null) {\n allDay = !range.start.hasTime();\n }\n\n range = $.extend({}, range); // make a copy, copying over other misc properties\n range.end = t.getDefaultEventEnd(allDay, range.start);\n }\n return range;\n }", "constructor() {\n super();\n this.offset = -10;\n this.fitToVisibleBounds = true;\n }", "viewFull() {\n this.designSheet.visibleRect = this.designSheet.getFBPBoundingRect();\n this.onViewChange();\n }", "function testRangeHighlightForZeroSizeSlider() {\n // Make sure range highlight spans whole slider before zeroing width.\n twoThumbSlider.setExtent(100);\n twoThumbSlider.getElement().style.width = 0;\n\n // The setVisible call is used to force a UI update.\n twoThumbSlider.setVisible(true);\n assertEquals(\n 'Range highlight size should be 0 when slider size is 0', 0,\n goog.dom.getElement('rangeHighlight').offsetWidth);\n}", "function prepareRanges($scope) {\n if (!$scope.hideCustomRange && $scope.ranges[$scope.ranges.length - 1].range !== CUSTOM)\n $scope.ranges.push({ label: 'Custom Range', range: CUSTOM });\n\n $scope.resetRangeClass();\n\n if (!$scope.hideCustomRange && $scope.ranges[$scope.ranges.length - 1].active)\n $scope.showCalendars = true;\n }", "inBounds(){\n if (this.pos.x <= 0) {\n this.pos.x = 0;\n }\n if (this.pos.y <= 0) {\n this.pos.y = 0;\n }\n if (this.pos.x >= width ) {\n this.pos.x = width;\n }\n if (this.pos.y >= height) {\n this.pos.y = height;\n }\n }", "function updateRangeSelection() {\n\td3.selectAll('#details div.range').style('display', function() {\n\t\treturn (d3.select(this).classed(sn.runtime.energyBarOverlapParameters.aggregate.toLowerCase()) ? 'block' : 'none');\n\t});\n}", "function supportRangeBounds() {\n var r, testElement, rangeBounds, rangeHeight, support = false;\n\n if (doc.createRange) {\n r = doc.createRange();\n if (r.getBoundingClientRect) {\n testElement = doc.createElement('boundtest');\n testElement.style.height = \"123px\";\n testElement.style.display = \"block\";\n doc.body.appendChild(testElement);\n\n r.selectNode(testElement);\n rangeBounds = r.getBoundingClientRect();\n rangeHeight = rangeBounds.height;\n\n if (rangeHeight === 123) {\n support = true;\n }\n doc.body.removeChild(testElement);\n }\n }\n\n return support;\n }", "function supportRangeBounds() {\n var r, testElement, rangeBounds, rangeHeight, support = false;\n\n if (doc.createRange) {\n r = doc.createRange();\n if (r.getBoundingClientRect) {\n testElement = doc.createElement('boundtest');\n testElement.style.height = \"123px\";\n testElement.style.display = \"block\";\n doc.body.appendChild(testElement);\n\n r.selectNode(testElement);\n rangeBounds = r.getBoundingClientRect();\n rangeHeight = rangeBounds.height;\n\n if (rangeHeight === 123) {\n support = true;\n }\n doc.body.removeChild(testElement);\n }\n }\n\n return support;\n }", "function supportRangeBounds() {\r\n var r, testElement, rangeBounds, rangeHeight, support = false;\r\n\r\n if (doc.createRange) {\r\n r = doc.createRange();\r\n if (r.getBoundingClientRect) {\r\n testElement = doc.createElement('boundtest');\r\n testElement.style.height = \"123px\";\r\n testElement.style.display = \"block\";\r\n doc.body.appendChild(testElement);\r\n\r\n r.selectNode(testElement);\r\n rangeBounds = r.getBoundingClientRect();\r\n rangeHeight = rangeBounds.height;\r\n\r\n if (rangeHeight === 123) {\r\n support = true;\r\n }\r\n doc.body.removeChild(testElement);\r\n }\r\n }\r\n\r\n return support;\r\n }", "function supportRangeBounds() {\r\n var r, testElement, rangeBounds, rangeHeight, support = false;\r\n\r\n if (doc.createRange) {\r\n r = doc.createRange();\r\n if (r.getBoundingClientRect) {\r\n testElement = doc.createElement('boundtest');\r\n testElement.style.height = \"123px\";\r\n testElement.style.display = \"block\";\r\n doc.body.appendChild(testElement);\r\n\r\n r.selectNode(testElement);\r\n rangeBounds = r.getBoundingClientRect();\r\n rangeHeight = rangeBounds.height;\r\n\r\n if (rangeHeight === 123) {\r\n support = true;\r\n }\r\n doc.body.removeChild(testElement);\r\n }\r\n }\r\n\r\n return support;\r\n }", "setRenderedRange(range) {\n if (!rangesEqual(this._renderedRange, range)) {\n this._renderedRangeSubject.next(this._renderedRange = range);\n this._markChangeDetectionNeeded(() => this._scrollStrategy.onContentRendered());\n }\n }", "setRenderedRange(range) {\n if (!rangesEqual(this._renderedRange, range)) {\n this._renderedRangeSubject.next(this._renderedRange = range);\n this._markChangeDetectionNeeded(() => this._scrollStrategy.onContentRendered());\n }\n }", "function keepInBounds(el){\n if(el.x + el.w >= canvas.width){\n el.x = canvas.width - el.w;\n }\n else if(el.x <= 0){\n el.x = 0;\n }\n if(el.y >= canvas.height - el.h){\n el.y = canvas.height - el.h;\n }\n else if(el.y <= 0){\n el.y = 0;\n }\n }", "add(range) {\n return new SubRange(\n Math.min(this.low, range.low),\n Math.max(this.high, range.high)\n );\n }", "addDefaultRange() {\n this.addRange(this.defaultMin, this.defaultMax, this.defaultDups);\n }", "_calculateBounds() {\n // FILL IN//\n }", "set bounds(value) {}", "touchesRange(from, to = from) {\n for (let i = 0, pos = 0; i < this.sections.length && pos <= to;) {\n let len = this.sections[i++], ins = this.sections[i++], end = pos + len;\n if (ins >= 0 && pos <= to && end >= from)\n return pos < from && end > to ? \"cover\" : true;\n pos = end;\n }\n return false;\n }", "set range(range) {\n this.topDate = range.topDate;\n this.bottomDate = range.bottomDate;\n this.refresh();\n }", "set localBounds(value) {}", "function updateRangeSelection() {\n\td3.selectAll('#details div.range').style('display', function() {\n\t\treturn (d3.select(this).classed(sn.runtime.powerIOAreaParameters.aggregate.toLowerCase()) ? 'block' : 'none');\n\t});\n}", "updateRange(start, end) {\n this.range.start = start\n this.range.end = end\n this.range.paddingTop = this.getPaddingTop()\n this.range.paddingBottom = this.getPaddingBottom()\n this.callUpdate(this.getRange())\n }", "extendToCover(min, max) {\r\n let x = this.min;\r\n while (min < x) {\r\n x = DateTimeSequence.ADD_INTERVAL(x, -this.interval, this.unit);\r\n this.sequence.splice(0, 0, x);\r\n }\r\n this.min = x;\r\n x = this.max;\r\n while (x < max) {\r\n x = DateTimeSequence.ADD_INTERVAL(x, this.interval, this.unit);\r\n this.sequence.push(x);\r\n }\r\n this.max = x;\r\n }", "function drawBounds() {\n noFill();\n stroke(75, 75, 75, 10);\n box(bounds.x, bounds.y, bounds.z)\n}", "add(range) {\n return new SubRange(Math.min((this || _global).low, range.low), Math.max((this || _global).high, range.high));\n }", "function Range() {\n\tthis._value = 0;\n\tthis._minimum = 0;\n\tthis._maximum = 100;\n\tthis._extent = 0;\n\t\n\tthis._isChanging = false;\n}", "set outerBounds(bounds) {\n this.floatingBounds = bounds;\n }", "function coverWin() {\n noStroke();\n fill(130, 206, 245);\n rect(0,0,190,85);\n}", "add(range) {\n this.list.push(range);\n this.addRangeToList();\n }", "setBounds() {\n let x = this.position.getX();\n let y = this.position.getY();\n let s = Game.Settings().UnitSize;\n let hs = s / 2;\n\n //generate Individual Bounds\n this.bounds = new Bounds(x - hs, y - hs, x + hs, y + hs);\n }", "RemoveRange() {\n\n }", "function createCoverNamedRange() {\n var d = DocumentApp.getActiveDocument();\n var rangeBuilder = d.newRange();\n var body = d.getBody();\n var startElem = body.findText(\"No\\.\").getElement();\n var endElem = body.findText(\"www.lookingglass.legal\").getElement();\n rangeBuilder.addElementsBetween(startElem, endElem);\n d.addNamedRange(\"cover\", rangeBuilder);\n}", "constrainTo(_rect) {\n if (this.x < _rect.left) {\n this.x = _rect.left;\n }\n if (this.y < _rect.top) {\n this.y = _rect.top;\n }\n if (this.x > _rect.right) {\n this.x = _rect.right;\n }\n if (this.y > _rect.bottom) {\n this.y = _rect.bottom;\n }\n return this;\n }", "keepInBounds() {\n let x = this.sprite.position.x;\n let y = this.sprite.position.y;\n let spriteHalfWidth = this.sprite.width / 2;\n let spriteHalfHeight = this.sprite.height / 2;\n let stageWidth = app.renderer.width;\n let stageHeight = app.renderer.height;\n\n if (x - spriteHalfWidth <= 0)\n this.sprite.position.x = spriteHalfWidth;\n\n if (x + spriteHalfWidth >= stageWidth)\n this.sprite.position.x = stageWidth - spriteHalfWidth;\n\n //Add the same padding that the other bounds have\n if (y + spriteHalfHeight >= stageHeight - 10)\n this.sprite.position.y = stageHeight - spriteHalfHeight - 10;\n\n if (y - spriteHalfHeight <= 0)\n this.sprite.position.y = spriteHalfHeight;\n }", "function resizeToTargetRange_(range1, range2) {\n var finalRange = range1\n var startHeight = finalRange.getNumRows()\n if (startHeight > range2.getNumRows()) {\n finalRange = finalRange.offset(0, 0, range2.getNumRows())\n finalRange.offset(range2.getNumRows() , 0, startHeight - range2.getNumRows()).clear()\n }\n var startWidth = finalRange.getNumColumns()\n if (startWidth > range2.getNumColumns()) {\n finalRange = finalRange.offset(0, 0, finalRange.getNumRows(), range2.getNumColumns())\n finalRange.offset(0 , range2.getNumColumns(),\n finalRange.getNumRows(), startWidth - range2.getNumColumns()\n ).clear()\n }\n return finalRange\n }", "function clearBounds() {\n latlngBounds = new google.maps.LatLngBounds();\n }", "function coverOn()\r\n{\r\n\r\n CoverRect.style(\"display\",\"block\")\r\n\r\n\r\n domElemG.setAttribute(\"pointer-events\",\"none\")\r\n\r\n\r\n}", "function clamp(pos){pos.top=Math.max(Math.min(pos.top,bounds.bottom-containerNode.offsetHeight),bounds.top);pos.left=Math.max(Math.min(pos.left,bounds.right-containerNode.offsetWidth),bounds.left);}", "function clearAndSetViewportByController() {\r\n viewportBounds = new google.maps.LatLngBounds();\r\n setViewportByController();\r\n map.fitBounds(viewportBounds);\r\n}", "outOfBounds() {\n const minX = this.x >= 0;\n const maxX = this.x < tileSizeFull * cols;\n const minY = this.y >= 0;\n const maxY = this.y < tileSizeFull * rows;\n\n if (!(minX && maxX && minY && maxY)) {\n this.removeSelf();\n }\n }", "function constrainRange(innerRange, outerRange) {\n\tinnerRange = cloneRange(innerRange);\n\n\tif (outerRange.start) {\n\t\t// needs to be inclusively before outerRange's end\n\t\tinnerRange.start = constrainDate(innerRange.start, outerRange);\n\t}\n\n\tif (outerRange.end) {\n\t\tinnerRange.end = minMoment(innerRange.end, outerRange.end);\n\t}\n\n\treturn innerRange;\n}", "function constrainRange(innerRange, outerRange) {\n\tinnerRange = cloneRange(innerRange);\n\n\tif (outerRange.start) {\n\t\t// needs to be inclusively before outerRange's end\n\t\tinnerRange.start = constrainDate(innerRange.start, outerRange);\n\t}\n\n\tif (outerRange.end) {\n\t\tinnerRange.end = minMoment(innerRange.end, outerRange.end);\n\t}\n\n\treturn innerRange;\n}", "function constrainRange(innerRange, outerRange) {\n\tinnerRange = cloneRange(innerRange);\n\n\tif (outerRange.start) {\n\t\t// needs to be inclusively before outerRange's end\n\t\tinnerRange.start = constrainDate(innerRange.start, outerRange);\n\t}\n\n\tif (outerRange.end) {\n\t\tinnerRange.end = minMoment(innerRange.end, outerRange.end);\n\t}\n\n\treturn innerRange;\n}", "_setRange() {\n this.debounce('_setRange', function() {\n if(this._scale && this._width && this._height) {\n this._setRangeDebouced();\n }\n }, 10);\n }", "range(from, to = from) { return Range.create(from, to, this); }", "resetUserBounds() {\n if (this.__userBounds) {\n delete this.__userBounds;\n\n var parent = this.$$parent;\n if (parent) {\n parent.updateLayoutProperties();\n }\n\n qx.ui.core.queue.Layout.add(this);\n }\n }", "handleConstraints() {\n if (this.x < 0) {\n this.x = 0;\n }\n if (this.x > width - 1) {\n this.x = width - this.size;\n }\n if (this.y < 0) {\n this.y = 0;\n }\n if (this.y > height - 1) {\n this.y = height - this.size;\n }\n\n\n }", "show(){\n noFill();\n rect(this.boundary.x, this.boundary.y, this.boundary.w, this.boundary.h);\n if(this.isParent){\n this.northeast.show();\n this.northwest.show();\n this.southeast.show();\n this.southwest.show();\n }\n }", "function outBounds() {\r\n if (x + 60 >= canvas.width + 10 || x <= 10 || y + 30 >= canvas.height || y - 15 <= 40) {\r\n cancelAnimationFrame();\r\n }\r\n}", "setRange(startX, endX) {\n // swap the range if needed\n if (startX > endX) {\n let xbuf = startX;\n startX = endX;\n endX = xbuf;\n }\n\n // correct the range\n startX = Math.max(startX, this.timeRange.startTime);\n endX = Math.min(endX, this.timeRange.endTime);\n\n // apply the new range\n if (startX !== endX) {\n let isZoomed = startX > this.timeRange.startTime || endX < this.timeRange.endTime;\n this._xAxisTag.min = startX;\n this._xAxisTag.max = endX;\n this._xAxisTag.alignToGrid = isZoomed;\n this._zoomMode = isZoomed;\n this._calcAllYRanges();\n this.draw();\n }\n }", "function noRange(){\n if (isFirefox === false){\n foo.appendChild(element);\n }\n }", "updateBounds() {\n this.bounds = getBounds(this);\n }", "adhereToRect(rect) {\n if (!util.containsPoint(rect, this)) {\n this.x = Math.min(Math.max(this.x, rect.x), rect.x + rect.width);\n this.y = Math.min(Math.max(this.y, rect.y), rect.y + rect.height);\n }\n return this;\n }", "set boundsValue(value) {}", "function adjustView(cm, from, to) {\n var display = cm.display, view = display.view;\n if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {\n display.view = buildViewArray(cm, from, to);\n display.viewFrom = from;\n } else {\n if (display.viewFrom > from)\n display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view);\n else if (display.viewFrom < from)\n display.view = display.view.slice(findViewIndex(cm, from));\n display.viewFrom = from;\n if (display.viewTo < to)\n display.view = display.view.concat(buildViewArray(cm, display.viewTo, to));\n else if (display.viewTo > to)\n display.view = display.view.slice(0, findViewIndex(cm, to));\n }\n display.viewTo = to;\n }", "function adjustView(cm, from, to) {\n var display = cm.display, view = display.view;\n if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {\n display.view = buildViewArray(cm, from, to);\n display.viewFrom = from;\n } else {\n if (display.viewFrom > from)\n display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view);\n else if (display.viewFrom < from)\n display.view = display.view.slice(findViewIndex(cm, from));\n display.viewFrom = from;\n if (display.viewTo < to)\n display.view = display.view.concat(buildViewArray(cm, display.viewTo, to));\n else if (display.viewTo > to)\n display.view = display.view.slice(0, findViewIndex(cm, to));\n }\n display.viewTo = to;\n }", "function adjustView(cm, from, to) {\n var display = cm.display, view = display.view;\n if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {\n display.view = buildViewArray(cm, from, to);\n display.viewFrom = from;\n } else {\n if (display.viewFrom > from)\n display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view);\n else if (display.viewFrom < from)\n display.view = display.view.slice(findViewIndex(cm, from));\n display.viewFrom = from;\n if (display.viewTo < to)\n display.view = display.view.concat(buildViewArray(cm, display.viewTo, to));\n else if (display.viewTo > to)\n display.view = display.view.slice(0, findViewIndex(cm, to));\n }\n display.viewTo = to;\n }", "function adjustView(cm, from, to) {\n var display = cm.display, view = display.view;\n if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {\n display.view = buildViewArray(cm, from, to);\n display.viewFrom = from;\n } else {\n if (display.viewFrom > from)\n display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view);\n else if (display.viewFrom < from)\n display.view = display.view.slice(findViewIndex(cm, from));\n display.viewFrom = from;\n if (display.viewTo < to)\n display.view = display.view.concat(buildViewArray(cm, display.viewTo, to));\n else if (display.viewTo > to)\n display.view = display.view.slice(0, findViewIndex(cm, to));\n }\n display.viewTo = to;\n }", "function adjustView(cm, from, to) {\n var display = cm.display, view = display.view;\n if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {\n display.view = buildViewArray(cm, from, to);\n display.viewFrom = from;\n } else {\n if (display.viewFrom > from)\n display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view);\n else if (display.viewFrom < from)\n display.view = display.view.slice(findViewIndex(cm, from));\n display.viewFrom = from;\n if (display.viewTo < to)\n display.view = display.view.concat(buildViewArray(cm, display.viewTo, to));\n else if (display.viewTo > to)\n display.view = display.view.slice(0, findViewIndex(cm, to));\n }\n display.viewTo = to;\n }", "function adjustView(cm, from, to) {\n var display = cm.display, view = display.view;\n if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {\n display.view = buildViewArray(cm, from, to);\n display.viewFrom = from;\n } else {\n if (display.viewFrom > from)\n display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view);\n else if (display.viewFrom < from)\n display.view = display.view.slice(findViewIndex(cm, from));\n display.viewFrom = from;\n if (display.viewTo < to)\n display.view = display.view.concat(buildViewArray(cm, display.viewTo, to));\n else if (display.viewTo > to)\n display.view = display.view.slice(0, findViewIndex(cm, to));\n }\n display.viewTo = to;\n }", "function adjustView(cm, from, to) {\n var display = cm.display, view = display.view;\n if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {\n display.view = buildViewArray(cm, from, to);\n display.viewFrom = from;\n } else {\n if (display.viewFrom > from)\n display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view);\n else if (display.viewFrom < from)\n display.view = display.view.slice(findViewIndex(cm, from));\n display.viewFrom = from;\n if (display.viewTo < to)\n display.view = display.view.concat(buildViewArray(cm, display.viewTo, to));\n else if (display.viewTo > to)\n display.view = display.view.slice(0, findViewIndex(cm, to));\n }\n display.viewTo = to;\n }", "function adjustView(cm, from, to) {\n var display = cm.display, view = display.view;\n if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {\n display.view = buildViewArray(cm, from, to);\n display.viewFrom = from;\n } else {\n if (display.viewFrom > from)\n display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view);\n else if (display.viewFrom < from)\n display.view = display.view.slice(findViewIndex(cm, from));\n display.viewFrom = from;\n if (display.viewTo < to)\n display.view = display.view.concat(buildViewArray(cm, display.viewTo, to));\n else if (display.viewTo > to)\n display.view = display.view.slice(0, findViewIndex(cm, to));\n }\n display.viewTo = to;\n }", "set overrideClip(value) {}", "stretchToParentBounds(_id, l, t, r, b) {\n if (this.isNullOrUndefined(l)) {\n [l, t, r, b] = [0, 0, 0, 0];\n }\n else if (this.isArray(l)) {\n [l, t, r, b] = l;\n }\n else if (this.isNullOrUndefined(t)) {\n [l, t, r, b] = [l, l, l, l];\n }\n this.setStyle(_id, 'position', 'absolute');\n this.setStyle(_id, 'display', 'block');\n this.setStyle(_id, 'left', `${l}px`);\n this.setStyle(_id, 'top', `${t}px`);\n this.setStyle(_id, 'width', 'auto');\n this.setStyle(_id, 'height', 'auto');\n this.setStyle(_id, 'right', `${r}px`);\n this.setStyle(_id, 'bottom', `${b}px`);\n }", "stretchToParentBounds(_id, l, t, r, b) {\n if (this.isNullOrUndefined(l)) {\n [l, t, r, b] = [0, 0, 0, 0];\n }\n else if (this.isArray(l)) {\n [l, t, r, b] = l;\n }\n else if (this.isNullOrUndefined(t)) {\n [l, t, r, b] = [l, l, l, l];\n }\n this.setStyle(_id, 'position', 'absolute');\n this.setStyle(_id, 'display', 'block');\n this.setStyle(_id, 'left', `${l}px`);\n this.setStyle(_id, 'top', `${t}px`);\n this.setStyle(_id, 'width', 'auto');\n this.setStyle(_id, 'height', 'auto');\n this.setStyle(_id, 'right', `${r}px`);\n this.setStyle(_id, 'bottom', `${b}px`);\n }", "_rangeDDSizer() {\n let txrec = this._text.getBoundingClientRect();\n let bdrec = document.body.getBoundingClientRect();\n let hddwn = bdrec.height - txrec.bottom - 20 + 'px';\n let wddwn = txrec.width + 'px';\n \n this._ddown.style.width = wddwn;\n this._ddown.style['max-height'] = hddwn;\n }", "function setThresholdClipAttributes() {\n \n var yMinMax = yScale.domain();\n var min = yMinMax[0];\n var max = yMinMax[1];\n if (typeof min == undefined|| typeof max == undefined) {\n // min/max is not set because there is no data for plottype\n return;\n }\n \n svg.select(\"#clip-good\").select(\"rect\")\n .transition().duration(DURATION)\n .attr(\"y\", function(d) { \n var y = 0;\n if (scope.thresholddata.severeData[scope.plottype] > scope.thresholddata.marginalData[scope.plottype]) {\n // Bottom of plot\n y = yScale(scope.thresholddata.marginalData[scope.plottype]);\n }\n else {\n // Top of plot\n y = yScale(max); \n }\n return y; }) \n .attr(\"width\", WIDTH)\n .attr(\"height\", function(d) { \n var height = 0;\n if (scope.thresholddata.severeData[scope.plottype] > scope.thresholddata.marginalData[scope.plottype]) {\n height = yScale(min) - yScale(scope.thresholddata.marginalData[scope.plottype]);\n }\n else {\n // Top of plot\n height = yScale(scope.thresholddata.marginalData[scope.plottype]) - yScale(max);\n }\n return height; });\n \n svg.select(\"#clip-marginal\").select(\"rect\")\n .transition().duration(DURATION)\n .attr(\"y\", function(d) { \n var y = 0;\n if (scope.thresholddata.severeData[scope.plottype] > scope.thresholddata.marginalData[scope.plottype]) {\n y = yScale(scope.thresholddata.severeData[scope.plottype]);\n }\n else {\n y = yScale(scope.thresholddata.marginalData[scope.plottype]);\n }\n return y;})\n .attr(\"width\", WIDTH)\n .attr(\"height\", Math.abs(yScale(scope.thresholddata.severeData[scope.plottype]) - yScale(scope.thresholddata.marginalData[scope.plottype])));\n\n svg.select(\"#clip-severe\").select(\"rect\")\n .transition().duration(DURATION)\n .attr(\"y\", function(d) { \n var y = 0;\n if (scope.thresholddata.severeData[scope.plottype] > scope.thresholddata.marginalData[scope.plottype]) {\n // Top of plot\n y = yScale(max); \n }\n else {\n y = yScale(scope.thresholddata.severeData[scope.plottype]);\n }\n return y;})\n .attr(\"width\", WIDTH)\n .attr(\"height\", function(d) { \n var height = 0;\n if (scope.thresholddata.severeData[scope.plottype] > scope.thresholddata.marginalData[scope.plottype]) {\n height = yScale(scope.thresholddata.severeData[scope.plottype]) - yScale(max);\n }\n else {\n // Bottom of plot\n height = yScale(min) - yScale(scope.thresholddata.severeData[scope.plottype]);\n }\n return height; });\n \n }", "function reset() {\n var bounds = d3.geo.bounds(collection),\n bottomLeft = project(bounds[0]),\n topRight = project(bounds[1]);\n \n bottomLeft[0] = bottomLeft[0]-50;\n bottomLeft[1] = bottomLeft[1]+50;\n topRight[0] = topRight[0]+50;\n topRight[1] = topRight[1]-50;\n \n svg .attr(\"width\", topRight[0] - bottomLeft[0]+100)\n .attr(\"height\", bottomLeft[1] - topRight[1]+100)\n .style(\"margin-left\", bottomLeft[0] + \"px\")\n .style(\"margin-top\", topRight[1] + \"px\");\n \n g .attr(\"transform\", \"translate(\" + -bottomLeft[0] + \",\" + -topRight[1] + \")\");\n \n feature.attr(\"d\", path);\n }", "function expandRangeToSurround(range) {\n if (range.canSurroundContents()) return;\n\n var common = range.commonAncestorContainer,\n start_depth = getDepth(common, range.startContainer),\n end_depth = getDepth(common, range.endContainer);\n\n while(!range.canSurroundContents()) {\n // In the following branches, we cannot just decrement the depth variables because the setStartBefore/setEndAfter may move the start or end of the range more than one level relative to ``common``. So we need to recompute the depth.\n if (start_depth > end_depth) {\n range.setStartBefore(range.startContainer);\n start_depth = getDepth(common, range.startContainer);\n }\n else {\n range.setEndAfter(range.endContainer);\n end_depth = getDepth(common, range.endContainer);\n }\n }\n }", "function expandRangeToSurround(range) {\n if (range.canSurroundContents()) return;\n\n var common = range.commonAncestorContainer,\n start_depth = getDepth(common, range.startContainer),\n end_depth = getDepth(common, range.endContainer);\n\n while(!range.canSurroundContents()) {\n // In the following branches, we cannot just decrement the depth variables because the setStartBefore/setEndAfter may move the start or end of the range more than one level relative to ``common``. So we need to recompute the depth.\n if (start_depth > end_depth) {\n range.setStartBefore(range.startContainer);\n start_depth = getDepth(common, range.startContainer);\n }\n else {\n range.setEndAfter(range.endContainer);\n end_depth = getDepth(common, range.endContainer);\n }\n }\n }", "function setupDefaultRange() {\n scope.threeLetterTimezoneLabel = service.browserTimezone();\n var timeResolution;\n // If it was initialized with a range, it will try to use it as a default setup\n if (scope.setRange && scope.setRange.label) {\n const option = _.find(scope.dictionary, { label: scope.setRange.label }) || scope.dictionary[0];\n timeResolution = TimeResolution.timeResolutionFromLocal(option);\n } else if (scope.setRange && scope.setRange.duration && scope.setRange.from) {\n const toHelper = moment(scope.setRange.from).add(scope.setRange.duration.value, scope.setRange.duration.unit);\n const helper = new TimeResolution(scope.setRange.from, toHelper.valueOf());\n const suggestion = helper.suggestedRange();\n timeResolution = new TimeResolution(suggestion.from, suggestion.to, helper.suggestedTimeUnit());\n } else if (scope.setRange && scope.setRange.duration) {\n const option = _.find(scope.dictionary, { duration: scope.setRange.duration });\n if (option) {\n timeResolution = TimeResolution.timeResolutionFromLocal(option);\n } else {\n timeResolution = TimeResolution.timeResolutionFromLocal({ duration: scope.setRange.duration }, scope.setRange.duration.unit);\n timeResolution.selectedRange = { label: 'Custom Range', custom: true };\n }\n } else if (scope.setRange && scope.mode == 'absolute' && scope.setRange.from && scope.setRange.to) {\n const from = moment(scope.setRange.from).seconds(0).milliseconds(0).valueOf();\n const to = moment(scope.setRange.to).seconds(0).milliseconds(0).valueOf();\n timeResolution = new TimeResolution(from, to);\n } else {\n timeResolution = TimeResolution.timeResolutionFromLocal(scope.dictionary[0]);\n }\n scope.internalRange = timeResolution;\n scope.observer.emit('dateTimePicker', timeResolution);\n buildRangeToSave();\n }", "function expandRangeToSurround(range) {\n if (range.canSurroundContents()) return;\n\n var common = range.commonAncestorContainer,\n start_depth = getDepth(common, range.startContainer),\n end_depth = getDepth(common, range.endContainer);\n\n while (!range.canSurroundContents()) {\n // In the following branches, we cannot just decrement the depth variables because the setStartBefore/setEndAfter may move the start or end of the range more than one level relative to ``common``. So we need to recompute the depth.\n if (start_depth > end_depth) {\n range.setStartBefore(range.startContainer);\n start_depth = getDepth(common, range.startContainer);\n }\n else {\n range.setEndAfter(range.endContainer);\n end_depth = getDepth(common, range.endContainer);\n }\n }\n }", "_setRange(range) {\n const min2Scale = this._toPixelScale(range.min);\n const max2Scale = this._toPixelScale(range.max);\n const minBounds = this._toPixelScale(this.props.min);\n const maxBounds = this._toPixelScale(this.props.max);\n if (min2Scale > max2Scale) {\n throw new Error(`Minimum slider value: ${range.min} is greater than max value: ${range.max}`);\n }\n if (min2Scale < minBounds || min2Scale > maxBounds) {\n throw new Error(`Minimum slider value: ${range.min} exceeds bounds:\n ${this.props.min} - ${this.props.max}`);\n }\n if (max2Scale < minBounds || max2Scale > maxBounds) {\n throw new Error(`Maximum slider value: ${range.max} exceeds bounds:\n ${this.props.min} - ${this.props.max}`);\n }\n this._range = {\n min: min2Scale || 0,\n max: max2Scale || 0,\n };\n return this._range;\n }", "reset() {\n\n // Set the initial crop to match any given fixed aspect ratio (or\n // default to a square crop 1:1).\n let aspectRatio = this._initialAspectRatio\n\n // Calculate the initial crop size such that it fits within the bounds\n let width = getWidth(this.bounds)\n let height = getWidth(this.bounds) / aspectRatio\n\n if (aspectRatio < width / getHeight(this.bounds)) {\n width = getHeight(this.bounds) * aspectRatio\n height = getHeight(this.bounds)\n }\n\n // Calculate the initial crop position to be central to the bounds\n const x = (getWidth(this.bounds) - width) / 2\n const y = (getHeight(this.bounds) - height) / 2\n\n // Set the region\n this.region = [\n [x, y],\n [x + width, y + height]\n ]\n }", "function fillLayer(fillLayer, bounds) {\r activeDocument.activeLayer = fillLayer;\r\r var a = [bounds[0], bounds[1]];\r var b = [bounds[2], bounds[1]];\r var c = [bounds[0], bounds[3]];\r var d = [bounds[2], bounds[3]];\r\r var fillColor = new SolidColor();\r fillColor.rgb.red = 255;\r fillColor.rgb.green = 0;\r fillColor.rgb.blue = 0;\r\r activeDocument.selection.select([c, d, b, a], SelectionType.REPLACE, 0, false);\r activeDocument.selection.expand('10 pixels');\r activeDocument.selection.fill(fillColor, ColorBlendMode.NORMAL, 80, false);\r}", "addRange(high, low, mid) {\n this.range.push({\n 'high': high,\n 'low': low,\n 'mid': mid,\n })\n //return this.range\n }" ]
[ "0.5556946", "0.5472256", "0.5384595", "0.537245", "0.5349878", "0.53442", "0.53263646", "0.5308165", "0.52663255", "0.52513677", "0.52321917", "0.5231704", "0.52292764", "0.5206579", "0.5195497", "0.5195497", "0.5187255", "0.5187255", "0.5183682", "0.5183682", "0.51568943", "0.5156306", "0.51553273", "0.5136142", "0.5133857", "0.5102465", "0.5071498", "0.5066056", "0.50629795", "0.5049875", "0.4935468", "0.49151215", "0.49099684", "0.4907901", "0.48940876", "0.48902336", "0.4883337", "0.48753017", "0.48652086", "0.4862756", "0.4862626", "0.4849031", "0.48450252", "0.48315057", "0.4825869", "0.48159683", "0.48090705", "0.48078316", "0.4800635", "0.4800635", "0.4800635", "0.47474608", "0.47419995", "0.47337714", "0.47237223", "0.47193468", "0.4708762", "0.46924484", "0.4687514", "0.4684881", "0.46842882", "0.46825033", "0.46817416", "0.46817416", "0.46817416", "0.46817416", "0.46817416", "0.46817416", "0.46817416", "0.46817416", "0.467147", "0.46694362", "0.46694362", "0.4667271", "0.4658405", "0.46505204", "0.46480238", "0.46480238", "0.46465933", "0.4643068", "0.4637724", "0.46330515", "0.46261543", "0.4604526" ]
0.46898982
72
Count the number of lines in the view whose DOM representation is out of date (or nonexistent).
function countDirtyView(cm) { var view = cm.display.view, dirty = 0; for (var i = 0; i < view.length; i++) { var lineView = view[i]; if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty; } } return dirty }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function countLines() {\n let page = document.getElementsByClassName(\"kix-zoomdocumentplugin-outer\")[0];\n if (page == null) {\n return (\"Element does not exist on the document.\")\n }\n let lineCount = 0;\n const pageText = page.innerText;\n\n for (let i = 0; i < pageText.length; i++) {\n if (pageText.charAt(i) == '\\n') {\n lineCount++;\n }\n }\n return lineCount;\n}", "function countDirtyView(cm) {\n var view = cm.display.view, dirty = 0;\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (!lineView.hidden && (!lineView.node || lineView.changes)) ++dirty;\n }\n return dirty;\n }", "function countDirtyView(cm) {\n var view = cm.display.view, dirty = 0;\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (!lineView.hidden && (!lineView.node || lineView.changes)) ++dirty;\n }\n return dirty;\n }", "function countDirtyView(cm) {\n var view = cm.display.view, dirty = 0;\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (!lineView.hidden && (!lineView.node || lineView.changes)) ++dirty;\n }\n return dirty;\n }", "function countDirtyView(cm) {\n var view = cm.display.view, dirty = 0;\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (!lineView.hidden && (!lineView.node || lineView.changes)) ++dirty;\n }\n return dirty;\n }", "function countDirtyView(cm) {\n var view = cm.display.view, dirty = 0;\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (!lineView.hidden && (!lineView.node || lineView.changes)) ++dirty;\n }\n return dirty;\n }", "function countDirtyView(cm) {\n var view = cm.display.view, dirty = 0;\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (!lineView.hidden && (!lineView.node || lineView.changes)) ++dirty;\n }\n return dirty;\n }", "function countDirtyView(cm) {\n var view = cm.display.view, dirty = 0;\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (!lineView.hidden && (!lineView.node || lineView.changes)) ++dirty;\n }\n return dirty;\n }", "function countDirtyView(cm) {\n var view = cm.display.view, dirty = 0;\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (!lineView.hidden && (!lineView.node || lineView.changes)) ++dirty;\n }\n return dirty;\n }", "function countDirtyView(cm) {\r\n var view = cm.display.view, dirty = 0;\r\n for (var i = 0; i < view.length; i++) {\r\n var lineView = view[i];\r\n if (!lineView.hidden && (!lineView.node || lineView.changes)) ++dirty;\r\n }\r\n return dirty;\r\n }", "function countDirtyView(cm) {\n var view = cm.display.view,\n dirty = 0;\n\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n\n if (!lineView.hidden && (!lineView.node || lineView.changes)) {\n ++dirty;\n }\n }\n\n return dirty;\n }", "function countDirtyView(cm) {\r\n var view = cm.display.view, dirty = 0;\r\n for (var i = 0; i < view.length; i++) {\r\n var lineView = view[i];\r\n if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty; }\r\n }\r\n return dirty\r\n}", "function countDirtyView(cm) {\n var view = cm.display.view, dirty = 0\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i]\n if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty }\n }\n return dirty\n}", "function countDirtyView(cm) {\n var view = cm.display.view, dirty = 0\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i]\n if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty }\n }\n return dirty\n}", "function countDirtyView(cm) {\n var view = cm.display.view, dirty = 0;\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty; }\n }\n return dirty\n}", "function countDirtyView(cm) {\n var view = cm.display.view, dirty = 0;\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty; }\n }\n return dirty\n}", "function countDirtyView(cm) {\n var view = cm.display.view, dirty = 0;\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty; }\n }\n return dirty\n}", "function countDirtyView(cm) {\n var view = cm.display.view, dirty = 0;\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty; }\n }\n return dirty\n}", "function countDirtyView(cm) {\n var view = cm.display.view, dirty = 0;\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty; }\n }\n return dirty\n}", "function countDirtyView(cm) {\n var view = cm.display.view, dirty = 0;\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty; }\n }\n return dirty\n}", "function countDirtyView(cm) {\n var view = cm.display.view, dirty = 0;\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty; }\n }\n return dirty\n}", "function countDirtyView(cm) {\n var view = cm.display.view, dirty = 0;\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty; }\n }\n return dirty\n}", "function countDirtyView(cm) {\n var view = cm.display.view, dirty = 0;\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty; }\n }\n return dirty\n}", "function countDirtyView(cm) {\n var view = cm.display.view, dirty = 0;\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty; }\n }\n return dirty\n}", "function countDirtyView(cm) {\n var view = cm.display.view, dirty = 0;\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty; }\n }\n return dirty\n}", "function countDirtyView(cm) {\n\t\t var view = cm.display.view, dirty = 0;\n\t\t for (var i = 0; i < view.length; i++) {\n\t\t var lineView = view[i];\n\t\t if (!lineView.hidden && (!lineView.node || lineView.changes)) ++dirty;\n\t\t }\n\t\t return dirty;\n\t\t }", "function countDirtyView(cm) {\n\t\t var view = cm.display.view, dirty = 0;\n\t\t for (var i = 0; i < view.length; i++) {\n\t\t var lineView = view[i];\n\t\t if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty; }\n\t\t }\n\t\t return dirty\n\t\t }", "function countDirtyView(cm) {\n\t var view = cm.display.view, dirty = 0;\n\t for (var i = 0; i < view.length; i++) {\n\t var lineView = view[i];\n\t if (!lineView.hidden && (!lineView.node || lineView.changes)) ++dirty;\n\t }\n\t return dirty;\n\t }", "function countDirtyView(cm) {\n\t var view = cm.display.view, dirty = 0;\n\t for (var i = 0; i < view.length; i++) {\n\t var lineView = view[i];\n\t if (!lineView.hidden && (!lineView.node || lineView.changes)) ++dirty;\n\t }\n\t return dirty;\n\t }", "function countDirtyView(cm) {\n\t var view = cm.display.view, dirty = 0;\n\t for (var i = 0; i < view.length; i++) {\n\t var lineView = view[i];\n\t if (!lineView.hidden && (!lineView.node || lineView.changes)) ++dirty;\n\t }\n\t return dirty;\n\t }", "function getNumLines(){\n if ($(\"#work_markup\").length !== 0){\n var num_lines = $(\"#work_markup\").val().split(/\\r\\n|\\r|\\n/).length;\n return num_lines;\n }\n return 0;\n}", "function Vi(t) {\n var e;\n if (t.document) e = t.document; else if (t.unknownDocument) e = t.unknownDocument; else {\n if (!t.noDocument) throw y();\n e = t.noDocument;\n }\n return JSON.stringify(e).length;\n}", "get line_count() {\n const newlines = this.code.match(/\\n/g) || [];\n return newlines.length + 1;\n }", "function Zr(t) {\n if (!t) return 0;\n var e;\n if (t.document) e = t.document; else if (t.unknownDocument) e = t.unknownDocument; else {\n if (!t.noDocument) throw C();\n e = t.noDocument;\n }\n return JSON.stringify(e).length;\n}", "function visualLineEndNo(doc, lineN) {\n\t\t if (lineN > doc.lastLine()) return lineN;\n\t\t var line = getLine(doc, lineN), merged;\n\t\t if (!lineIsHidden(doc, line)) return lineN;\n\t\t while (merged = collapsedSpanAtEnd(line))\n\t\t line = merged.find(1, true).line;\n\t\t return lineNo(line) + 1;\n\t\t }", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) return lineN;\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) return lineN;\n while (merged = collapsedSpanAtEnd(line))\n line = merged.find(1, true).line;\n return lineNo(line) + 1;\n }", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) return lineN;\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) return lineN;\n while (merged = collapsedSpanAtEnd(line))\n line = merged.find(1, true).line;\n return lineNo(line) + 1;\n }", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) return lineN;\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) return lineN;\n while (merged = collapsedSpanAtEnd(line))\n line = merged.find(1, true).line;\n return lineNo(line) + 1;\n }", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) return lineN;\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) return lineN;\n while (merged = collapsedSpanAtEnd(line))\n line = merged.find(1, true).line;\n return lineNo(line) + 1;\n }", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) return lineN;\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) return lineN;\n while (merged = collapsedSpanAtEnd(line))\n line = merged.find(1, true).line;\n return lineNo(line) + 1;\n }", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) return lineN;\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) return lineN;\n while (merged = collapsedSpanAtEnd(line))\n line = merged.find(1, true).line;\n return lineNo(line) + 1;\n }", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) return lineN;\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) return lineN;\n while (merged = collapsedSpanAtEnd(line))\n line = merged.find(1, true).line;\n return lineNo(line) + 1;\n }", "function visualLineEndNo(doc, lineN) {\n\t\t if (lineN > doc.lastLine()) { return lineN }\n\t\t var line = getLine(doc, lineN), merged;\n\t\t if (!lineIsHidden(doc, line)) { return lineN }\n\t\t while (merged = collapsedSpanAtEnd(line))\n\t\t { line = merged.find(1, true).line; }\n\t\t return lineNo(line) + 1\n\t\t }", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n }", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n }", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n }", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n }", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n }", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n }", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n }", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n }", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n }", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n }", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n }", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n }", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n }", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n }", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n }", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n }", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n }", "function visualLineEndNo(doc, lineN) {\n\t if (lineN > doc.lastLine()) return lineN;\n\t var line = getLine(doc, lineN), merged;\n\t if (!lineIsHidden(doc, line)) return lineN;\n\t while (merged = collapsedSpanAtEnd(line))\n\t line = merged.find(1, true).line;\n\t return lineNo(line) + 1;\n\t }", "function visualLineEndNo(doc, lineN) {\n\t if (lineN > doc.lastLine()) return lineN;\n\t var line = getLine(doc, lineN), merged;\n\t if (!lineIsHidden(doc, line)) return lineN;\n\t while (merged = collapsedSpanAtEnd(line))\n\t line = merged.find(1, true).line;\n\t return lineNo(line) + 1;\n\t }", "function visualLineEndNo(doc, lineN) {\n\t if (lineN > doc.lastLine()) return lineN;\n\t var line = getLine(doc, lineN), merged;\n\t if (!lineIsHidden(doc, line)) return lineN;\n\t while (merged = collapsedSpanAtEnd(line))\n\t line = merged.find(1, true).line;\n\t return lineNo(line) + 1;\n\t }", "size() {\n return this.lines.length;\n }", "getLineAfterViewZone() {\n // TODO: abstract away the data, ids etc.\n const range = this.data.model.getDecorationRange(this.data.startEditDecId);\n // if the first decoration is missing, this implies the region reaches the\n // start of the editor.\n return range ? range.endLineNumber + 1 : 1;\n }", "function visualLineEndNo(doc, lineN) {\r\n if (lineN > doc.lastLine()) return lineN;\r\n var line = getLine(doc, lineN), merged;\r\n if (!lineIsHidden(doc, line)) return lineN;\r\n while (merged = collapsedSpanAtEnd(line))\r\n line = merged.find(1, true).line;\r\n return lineNo(line) + 1;\r\n }", "function visualLineEndNo(doc, lineN) {\r\n if (lineN > doc.lastLine()) { return lineN }\r\n var line = getLine(doc, lineN), merged;\r\n if (!lineIsHidden(doc, line)) { return lineN }\r\n while (merged = collapsedSpanAtEnd(line))\r\n { line = merged.find(1, true).line; }\r\n return lineNo(line) + 1\r\n}", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n}", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n}", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n}", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n}", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n}", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n}", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n}", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n}", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n}", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n}", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n}", "function ii(t) {\n var e;\n if (t.document) e = t.document; else if (t.unknownDocument) e = t.unknownDocument; else {\n if (!t.noDocument) throw A();\n e = t.noDocument;\n }\n return JSON.stringify(e).length;\n}", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line }\n return lineNo(line) + 1\n}", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line }\n return lineNo(line) + 1\n}", "function ti(t) {\n if (!t) return 0;\n var e;\n if (t.document) e = t.document; else if (t.unknownDocument) e = t.unknownDocument; else {\n if (!t.noDocument) throw R();\n e = t.noDocument;\n }\n return JSON.stringify(e).length;\n}", "function fixOperaBug(e){return browser.opera?e.length-e.replace(/\\n*/g,\"\").length:0}", "function lineCount(value) {\n var count = 0;\n for (var _i = 0, value_1 = value; _i < value_1.length; _i++) {\n var char = value_1[_i];\n if (char === '\\n') {\n count++;\n }\n }\n return count;\n}" ]
[ "0.64792055", "0.639454", "0.639454", "0.639454", "0.639454", "0.639454", "0.639454", "0.639454", "0.639454", "0.63799185", "0.6371316", "0.636951", "0.6367281", "0.6367281", "0.636076", "0.636076", "0.636076", "0.636076", "0.636076", "0.636076", "0.636076", "0.636076", "0.636076", "0.636076", "0.636076", "0.63515174", "0.63478875", "0.6345565", "0.6345565", "0.6345565", "0.5845303", "0.57221454", "0.565421", "0.5618441", "0.55887204", "0.5576004", "0.5576004", "0.5576004", "0.5576004", "0.5576004", "0.5576004", "0.5576004", "0.55631965", "0.5562961", "0.5562961", "0.5562961", "0.5562961", "0.5562961", "0.5562961", "0.5562961", "0.5562961", "0.5562961", "0.5562961", "0.5562961", "0.5562961", "0.5562961", "0.5562961", "0.5562961", "0.5562961", "0.5562961", "0.55586135", "0.55586135", "0.55586135", "0.55551624", "0.5551903", "0.55501014", "0.5494251", "0.54793817", "0.54793817", "0.54793817", "0.54793817", "0.54793817", "0.54793817", "0.54793817", "0.54793817", "0.54793817", "0.54793817", "0.54793817", "0.5447025", "0.5436871", "0.5436871", "0.54364413", "0.53690994", "0.536399" ]
0.6395247
14
Draws a cursor for the given range
function drawSelectionCursor(cm, head, output) { var pos = cursorCoords(cm, head, "div", null, null, !cm.options.singleCursorHeightPerLine); var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor")); cursor.style.left = pos.left + "px"; cursor.style.top = pos.top + "px"; cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px"; if (pos.other) { // Secondary cursor, shown when on a 'jump' in bi-directional text var otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor")); otherCursor.style.display = ""; otherCursor.style.left = pos.other.left + "px"; otherCursor.style.top = pos.other.top + "px"; otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px"; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawSelectionCursor(cm, range, output) {\n var pos = cursorCoords(cm, range.head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n }", "function drawSelectionCursor(cm, range, output) {\n var pos = cursorCoords(cm, range.head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n }", "function drawSelectionCursor(cm, range, output) {\n var pos = cursorCoords(cm, range.head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n }", "function drawSelectionCursor(cm, range, output) {\n var pos = cursorCoords(cm, range.head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n }", "function drawSelectionCursor(cm, range, output) {\n var pos = cursorCoords(cm, range.head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n }", "function drawSelectionCursor(cm, range, output) {\n var pos = cursorCoords(cm, range.head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n }", "function drawSelectionCursor(cm, range, output) {\n var pos = cursorCoords(cm, range.head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n }", "function drawSelectionCursor(cm, range, output) {\r\n var pos = cursorCoords(cm, range.head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\r\n\r\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\r\n cursor.style.left = pos.left + \"px\";\r\n cursor.style.top = pos.top + \"px\";\r\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\r\n\r\n if (pos.other) {\r\n // Secondary cursor, shown when on a 'jump' in bi-directional text\r\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\r\n otherCursor.style.display = \"\";\r\n otherCursor.style.left = pos.other.left + \"px\";\r\n otherCursor.style.top = pos.other.top + \"px\";\r\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\r\n }\r\n }", "function drawSelectionRange(cm, range, output) {\n\t\t var display = cm.display, doc = cm.doc;\n\t\t var fragment = document.createDocumentFragment();\n\t\t var padding = paddingH(cm.display), leftSide = padding.left;\n\t\t var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n\t\t\n\t\t function add(left, top, width, bottom) {\n\t\t if (top < 0) top = 0;\n\t\t top = Math.round(top);\n\t\t bottom = Math.round(bottom);\n\t\t fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", \"position: absolute; left: \" + left +\n\t\t \"px; top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) +\n\t\t \"px; height: \" + (bottom - top) + \"px\"));\n\t\t }\n\t\t\n\t\t function drawForLine(line, fromArg, toArg) {\n\t\t var lineObj = getLine(doc, line);\n\t\t var lineLen = lineObj.text.length;\n\t\t var start, end;\n\t\t function coords(ch, bias) {\n\t\t return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias);\n\t\t }\n\t\t\n\t\t iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {\n\t\t var leftPos = coords(from, \"left\"), rightPos, left, right;\n\t\t if (from == to) {\n\t\t rightPos = leftPos;\n\t\t left = right = leftPos.left;\n\t\t } else {\n\t\t rightPos = coords(to - 1, \"right\");\n\t\t if (dir == \"rtl\") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }\n\t\t left = leftPos.left;\n\t\t right = rightPos.right;\n\t\t }\n\t\t if (fromArg == null && from == 0) left = leftSide;\n\t\t if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part\n\t\t add(left, leftPos.top, null, leftPos.bottom);\n\t\t left = leftSide;\n\t\t if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);\n\t\t }\n\t\t if (toArg == null && to == lineLen) right = rightSide;\n\t\t if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)\n\t\t start = leftPos;\n\t\t if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)\n\t\t end = rightPos;\n\t\t if (left < leftSide + 1) left = leftSide;\n\t\t add(left, rightPos.top, right - left, rightPos.bottom);\n\t\t });\n\t\t return {start: start, end: end};\n\t\t }\n\t\t\n\t\t var sFrom = range.from(), sTo = range.to();\n\t\t if (sFrom.line == sTo.line) {\n\t\t drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n\t\t } else {\n\t\t var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n\t\t var singleVLine = visualLine(fromLine) == visualLine(toLine);\n\t\t var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n\t\t var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n\t\t if (singleVLine) {\n\t\t if (leftEnd.top < rightStart.top - 2) {\n\t\t add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n\t\t add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n\t\t } else {\n\t\t add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n\t\t }\n\t\t }\n\t\t if (leftEnd.bottom < rightStart.top)\n\t\t add(leftSide, leftEnd.bottom, null, rightStart.top);\n\t\t }\n\t\t\n\t\t output.appendChild(fragment);\n\t\t }", "function drawSelectionRange(cm, range, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left, rightSide = display.lineSpace.offsetWidth - padding.right;\n\n function add(left, top, width, bottom) {\n if (top < 0) top = 0;\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", \"position: absolute; left: \" + left +\n \"px; top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) +\n \"px; height: \" + (bottom - top) + \"px\"));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias);\n }\n\n iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {\n var leftPos = coords(from, \"left\"), rightPos, left, right;\n if (from == to) {\n rightPos = leftPos;\n left = right = leftPos.left;\n } else {\n rightPos = coords(to - 1, \"right\");\n if (dir == \"rtl\") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }\n left = leftPos.left;\n right = rightPos.right;\n }\n if (fromArg == null && from == 0) left = leftSide;\n if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part\n add(left, leftPos.top, null, leftPos.bottom);\n left = leftSide;\n if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);\n }\n if (toArg == null && to == lineLen) right = rightSide;\n if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)\n start = leftPos;\n if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)\n end = rightPos;\n if (left < leftSide + 1) left = leftSide;\n add(left, rightPos.top, right - left, rightPos.bottom);\n });\n return {start: start, end: end};\n }\n\n var sFrom = range.from(), sTo = range.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n add(leftSide, leftEnd.bottom, null, rightStart.top);\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left, rightSide = display.lineSpace.offsetWidth - padding.right;\n\n function add(left, top, width, bottom) {\n if (top < 0) top = 0;\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", \"position: absolute; left: \" + left +\n \"px; top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) +\n \"px; height: \" + (bottom - top) + \"px\"));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias);\n }\n\n iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {\n var leftPos = coords(from, \"left\"), rightPos, left, right;\n if (from == to) {\n rightPos = leftPos;\n left = right = leftPos.left;\n } else {\n rightPos = coords(to - 1, \"right\");\n if (dir == \"rtl\") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }\n left = leftPos.left;\n right = rightPos.right;\n }\n if (fromArg == null && from == 0) left = leftSide;\n if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part\n add(left, leftPos.top, null, leftPos.bottom);\n left = leftSide;\n if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);\n }\n if (toArg == null && to == lineLen) right = rightSide;\n if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)\n start = leftPos;\n if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)\n end = rightPos;\n if (left < leftSide + 1) left = leftSide;\n add(left, rightPos.top, right - left, rightPos.bottom);\n });\n return {start: start, end: end};\n }\n\n var sFrom = range.from(), sTo = range.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n add(leftSide, leftEnd.bottom, null, rightStart.top);\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left, rightSide = display.lineSpace.offsetWidth - padding.right;\n\n function add(left, top, width, bottom) {\n if (top < 0) top = 0;\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", \"position: absolute; left: \" + left +\n \"px; top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) +\n \"px; height: \" + (bottom - top) + \"px\"));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias);\n }\n\n iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {\n var leftPos = coords(from, \"left\"), rightPos, left, right;\n if (from == to) {\n rightPos = leftPos;\n left = right = leftPos.left;\n } else {\n rightPos = coords(to - 1, \"right\");\n if (dir == \"rtl\") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }\n left = leftPos.left;\n right = rightPos.right;\n }\n if (fromArg == null && from == 0) left = leftSide;\n if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part\n add(left, leftPos.top, null, leftPos.bottom);\n left = leftSide;\n if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);\n }\n if (toArg == null && to == lineLen) right = rightSide;\n if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)\n start = leftPos;\n if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)\n end = rightPos;\n if (left < leftSide + 1) left = leftSide;\n add(left, rightPos.top, right - left, rightPos.bottom);\n });\n return {start: start, end: end};\n }\n\n var sFrom = range.from(), sTo = range.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n add(leftSide, leftEnd.bottom, null, rightStart.top);\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left, rightSide = display.lineSpace.offsetWidth - padding.right;\n\n function add(left, top, width, bottom) {\n if (top < 0) top = 0;\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", \"position: absolute; left: \" + left +\n \"px; top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) +\n \"px; height: \" + (bottom - top) + \"px\"));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias);\n }\n\n iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {\n var leftPos = coords(from, \"left\"), rightPos, left, right;\n if (from == to) {\n rightPos = leftPos;\n left = right = leftPos.left;\n } else {\n rightPos = coords(to - 1, \"right\");\n if (dir == \"rtl\") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }\n left = leftPos.left;\n right = rightPos.right;\n }\n if (fromArg == null && from == 0) left = leftSide;\n if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part\n add(left, leftPos.top, null, leftPos.bottom);\n left = leftSide;\n if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);\n }\n if (toArg == null && to == lineLen) right = rightSide;\n if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)\n start = leftPos;\n if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)\n end = rightPos;\n if (left < leftSide + 1) left = leftSide;\n add(left, rightPos.top, right - left, rightPos.bottom);\n });\n return {start: start, end: end};\n }\n\n var sFrom = range.from(), sTo = range.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n add(leftSide, leftEnd.bottom, null, rightStart.top);\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n\n function add(left, top, width, bottom) {\n if (top < 0) top = 0;\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", \"position: absolute; left: \" + left +\n \"px; top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) +\n \"px; height: \" + (bottom - top) + \"px\"));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias);\n }\n\n iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {\n var leftPos = coords(from, \"left\"), rightPos, left, right;\n if (from == to) {\n rightPos = leftPos;\n left = right = leftPos.left;\n } else {\n rightPos = coords(to - 1, \"right\");\n if (dir == \"rtl\") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }\n left = leftPos.left;\n right = rightPos.right;\n }\n if (fromArg == null && from == 0) left = leftSide;\n if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part\n add(left, leftPos.top, null, leftPos.bottom);\n left = leftSide;\n if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);\n }\n if (toArg == null && to == lineLen) right = rightSide;\n if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)\n start = leftPos;\n if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)\n end = rightPos;\n if (left < leftSide + 1) left = leftSide;\n add(left, rightPos.top, right - left, rightPos.bottom);\n });\n return {start: start, end: end};\n }\n\n var sFrom = range.from(), sTo = range.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n add(leftSide, leftEnd.bottom, null, rightStart.top);\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n\n function add(left, top, width, bottom) {\n if (top < 0) top = 0;\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", \"position: absolute; left: \" + left +\n \"px; top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) +\n \"px; height: \" + (bottom - top) + \"px\"));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias);\n }\n\n iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {\n var leftPos = coords(from, \"left\"), rightPos, left, right;\n if (from == to) {\n rightPos = leftPos;\n left = right = leftPos.left;\n } else {\n rightPos = coords(to - 1, \"right\");\n if (dir == \"rtl\") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }\n left = leftPos.left;\n right = rightPos.right;\n }\n if (fromArg == null && from == 0) left = leftSide;\n if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part\n add(left, leftPos.top, null, leftPos.bottom);\n left = leftSide;\n if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);\n }\n if (toArg == null && to == lineLen) right = rightSide;\n if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)\n start = leftPos;\n if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)\n end = rightPos;\n if (left < leftSide + 1) left = leftSide;\n add(left, rightPos.top, right - left, rightPos.bottom);\n });\n return {start: start, end: end};\n }\n\n var sFrom = range.from(), sTo = range.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n add(leftSide, leftEnd.bottom, null, rightStart.top);\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n\n function add(left, top, width, bottom) {\n if (top < 0) top = 0;\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", \"position: absolute; left: \" + left +\n \"px; top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) +\n \"px; height: \" + (bottom - top) + \"px\"));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias);\n }\n\n iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {\n var leftPos = coords(from, \"left\"), rightPos, left, right;\n if (from == to) {\n rightPos = leftPos;\n left = right = leftPos.left;\n } else {\n rightPos = coords(to - 1, \"right\");\n if (dir == \"rtl\") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }\n left = leftPos.left;\n right = rightPos.right;\n }\n if (fromArg == null && from == 0) left = leftSide;\n if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part\n add(left, leftPos.top, null, leftPos.bottom);\n left = leftSide;\n if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);\n }\n if (toArg == null && to == lineLen) right = rightSide;\n if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)\n start = leftPos;\n if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)\n end = rightPos;\n if (left < leftSide + 1) left = leftSide;\n add(left, rightPos.top, right - left, rightPos.bottom);\n });\n return {start: start, end: end};\n }\n\n var sFrom = range.from(), sTo = range.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n add(leftSide, leftEnd.bottom, null, rightStart.top);\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n\n function add(left, top, width, bottom) {\n if (top < 0) top = 0;\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", \"position: absolute; left: \" + left +\n \"px; top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) +\n \"px; height: \" + (bottom - top) + \"px\"));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias);\n }\n\n iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {\n var leftPos = coords(from, \"left\"), rightPos, left, right;\n if (from == to) {\n rightPos = leftPos;\n left = right = leftPos.left;\n } else {\n rightPos = coords(to - 1, \"right\");\n if (dir == \"rtl\") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }\n left = leftPos.left;\n right = rightPos.right;\n }\n if (fromArg == null && from == 0) left = leftSide;\n if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part\n add(left, leftPos.top, null, leftPos.bottom);\n left = leftSide;\n if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);\n }\n if (toArg == null && to == lineLen) right = rightSide;\n if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)\n start = leftPos;\n if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)\n end = rightPos;\n if (left < leftSide + 1) left = leftSide;\n add(left, rightPos.top, right - left, rightPos.bottom);\n });\n return {start: start, end: end};\n }\n\n var sFrom = range.from(), sTo = range.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n add(leftSide, leftEnd.bottom, null, rightStart.top);\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range, output) {\n\t var display = cm.display, doc = cm.doc;\n\t var fragment = document.createDocumentFragment();\n\t var padding = paddingH(cm.display), leftSide = padding.left;\n\t var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n\n\t function add(left, top, width, bottom) {\n\t if (top < 0) top = 0;\n\t top = Math.round(top);\n\t bottom = Math.round(bottom);\n\t fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", \"position: absolute; left: \" + left +\n\t \"px; top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) +\n\t \"px; height: \" + (bottom - top) + \"px\"));\n\t }\n\n\t function drawForLine(line, fromArg, toArg) {\n\t var lineObj = getLine(doc, line);\n\t var lineLen = lineObj.text.length;\n\t var start, end;\n\t function coords(ch, bias) {\n\t return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias);\n\t }\n\n\t iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {\n\t var leftPos = coords(from, \"left\"), rightPos, left, right;\n\t if (from == to) {\n\t rightPos = leftPos;\n\t left = right = leftPos.left;\n\t } else {\n\t rightPos = coords(to - 1, \"right\");\n\t if (dir == \"rtl\") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }\n\t left = leftPos.left;\n\t right = rightPos.right;\n\t }\n\t if (fromArg == null && from == 0) left = leftSide;\n\t if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part\n\t add(left, leftPos.top, null, leftPos.bottom);\n\t left = leftSide;\n\t if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);\n\t }\n\t if (toArg == null && to == lineLen) right = rightSide;\n\t if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)\n\t start = leftPos;\n\t if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)\n\t end = rightPos;\n\t if (left < leftSide + 1) left = leftSide;\n\t add(left, rightPos.top, right - left, rightPos.bottom);\n\t });\n\t return {start: start, end: end};\n\t }\n\n\t var sFrom = range.from(), sTo = range.to();\n\t if (sFrom.line == sTo.line) {\n\t drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n\t } else {\n\t var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n\t var singleVLine = visualLine(fromLine) == visualLine(toLine);\n\t var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n\t var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n\t if (singleVLine) {\n\t if (leftEnd.top < rightStart.top - 2) {\n\t add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n\t add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n\t } else {\n\t add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n\t }\n\t }\n\t if (leftEnd.bottom < rightStart.top)\n\t add(leftSide, leftEnd.bottom, null, rightStart.top);\n\t }\n\n\t output.appendChild(fragment);\n\t }", "function drawSelectionRange(cm, range, output) {\n\t var display = cm.display, doc = cm.doc;\n\t var fragment = document.createDocumentFragment();\n\t var padding = paddingH(cm.display), leftSide = padding.left;\n\t var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n\n\t function add(left, top, width, bottom) {\n\t if (top < 0) top = 0;\n\t top = Math.round(top);\n\t bottom = Math.round(bottom);\n\t fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", \"position: absolute; left: \" + left +\n\t \"px; top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) +\n\t \"px; height: \" + (bottom - top) + \"px\"));\n\t }\n\n\t function drawForLine(line, fromArg, toArg) {\n\t var lineObj = getLine(doc, line);\n\t var lineLen = lineObj.text.length;\n\t var start, end;\n\t function coords(ch, bias) {\n\t return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias);\n\t }\n\n\t iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {\n\t var leftPos = coords(from, \"left\"), rightPos, left, right;\n\t if (from == to) {\n\t rightPos = leftPos;\n\t left = right = leftPos.left;\n\t } else {\n\t rightPos = coords(to - 1, \"right\");\n\t if (dir == \"rtl\") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }\n\t left = leftPos.left;\n\t right = rightPos.right;\n\t }\n\t if (fromArg == null && from == 0) left = leftSide;\n\t if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part\n\t add(left, leftPos.top, null, leftPos.bottom);\n\t left = leftSide;\n\t if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);\n\t }\n\t if (toArg == null && to == lineLen) right = rightSide;\n\t if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)\n\t start = leftPos;\n\t if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)\n\t end = rightPos;\n\t if (left < leftSide + 1) left = leftSide;\n\t add(left, rightPos.top, right - left, rightPos.bottom);\n\t });\n\t return {start: start, end: end};\n\t }\n\n\t var sFrom = range.from(), sTo = range.to();\n\t if (sFrom.line == sTo.line) {\n\t drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n\t } else {\n\t var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n\t var singleVLine = visualLine(fromLine) == visualLine(toLine);\n\t var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n\t var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n\t if (singleVLine) {\n\t if (leftEnd.top < rightStart.top - 2) {\n\t add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n\t add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n\t } else {\n\t add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n\t }\n\t }\n\t if (leftEnd.bottom < rightStart.top)\n\t add(leftSide, leftEnd.bottom, null, rightStart.top);\n\t }\n\n\t output.appendChild(fragment);\n\t }", "function drawSelectionRange(cm, range, output) {\n var display = cm.display, doc = cm.doc\n var fragment = document.createDocumentFragment()\n var padding = paddingH(cm.display), leftSide = padding.left\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0 }\n top = Math.round(top)\n bottom = Math.round(bottom)\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")))\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line)\n var lineLen = lineObj.text.length\n var start, end\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir) {\n var leftPos = coords(from, \"left\"), rightPos, left, right\n if (from == to) {\n rightPos = leftPos\n left = right = leftPos.left\n } else {\n rightPos = coords(to - 1, \"right\")\n if (dir == \"rtl\") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp }\n left = leftPos.left\n right = rightPos.right\n }\n if (fromArg == null && from == 0) { left = leftSide }\n if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part\n add(left, leftPos.top, null, leftPos.bottom)\n left = leftSide\n if (leftPos.bottom < rightPos.top) { add(left, leftPos.bottom, null, rightPos.top) }\n }\n if (toArg == null && to == lineLen) { right = rightSide }\n if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)\n { start = leftPos }\n if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)\n { end = rightPos }\n if (left < leftSide + 1) { left = leftSide }\n add(left, rightPos.top, right - left, rightPos.bottom)\n })\n return {start: start, end: end}\n }\n\n var sFrom = range.from(), sTo = range.to()\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch)\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line)\n var singleVLine = visualLine(fromLine) == visualLine(toLine)\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom)\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom)\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom)\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top) }\n }\n\n output.appendChild(fragment)\n}", "function drawSelectionRange(cm, range, output) {\n\t\t var display = cm.display, doc = cm.doc;\n\t\t var fragment = document.createDocumentFragment();\n\t\t var padding = paddingH(cm.display), leftSide = padding.left;\n\t\t var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n\t\t var docLTR = doc.direction == \"ltr\";\n\n\t\t function add(left, top, width, bottom) {\n\t\t if (top < 0) { top = 0; }\n\t\t top = Math.round(top);\n\t\t bottom = Math.round(bottom);\n\t\t fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n\t\t }\n\n\t\t function drawForLine(line, fromArg, toArg) {\n\t\t var lineObj = getLine(doc, line);\n\t\t var lineLen = lineObj.text.length;\n\t\t var start, end;\n\t\t function coords(ch, bias) {\n\t\t return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n\t\t }\n\n\t\t function wrapX(pos, dir, side) {\n\t\t var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n\t\t var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n\t\t var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n\t\t return coords(ch, prop)[prop]\n\t\t }\n\n\t\t var order = getOrder(lineObj, doc.direction);\n\t\t iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n\t\t var ltr = dir == \"ltr\";\n\t\t var fromPos = coords(from, ltr ? \"left\" : \"right\");\n\t\t var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n\t\t var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n\t\t var first = i == 0, last = !order || i == order.length - 1;\n\t\t if (toPos.top - fromPos.top <= 3) { // Single line\n\t\t var openLeft = (docLTR ? openStart : openEnd) && first;\n\t\t var openRight = (docLTR ? openEnd : openStart) && last;\n\t\t var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n\t\t var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n\t\t add(left, fromPos.top, right - left, fromPos.bottom);\n\t\t } else { // Multiple lines\n\t\t var topLeft, topRight, botLeft, botRight;\n\t\t if (ltr) {\n\t\t topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n\t\t topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n\t\t botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n\t\t botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n\t\t } else {\n\t\t topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n\t\t topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n\t\t botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n\t\t botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n\t\t }\n\t\t add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n\t\t if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n\t\t add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n\t\t }\n\n\t\t if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n\t\t if (cmpCoords(toPos, start) < 0) { start = toPos; }\n\t\t if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n\t\t if (cmpCoords(toPos, end) < 0) { end = toPos; }\n\t\t });\n\t\t return {start: start, end: end}\n\t\t }\n\n\t\t var sFrom = range.from(), sTo = range.to();\n\t\t if (sFrom.line == sTo.line) {\n\t\t drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n\t\t } else {\n\t\t var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n\t\t var singleVLine = visualLine(fromLine) == visualLine(toLine);\n\t\t var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n\t\t var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n\t\t if (singleVLine) {\n\t\t if (leftEnd.top < rightStart.top - 2) {\n\t\t add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n\t\t add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n\t\t } else {\n\t\t add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n\t\t }\n\t\t }\n\t\t if (leftEnd.bottom < rightStart.top)\n\t\t { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n\t\t }\n\n\t\t output.appendChild(fragment);\n\t\t }", "function drawSelectionRange(cm, range, output) {\n var display = cm.display, doc = cm.doc\n var fragment = document.createDocumentFragment()\n var padding = paddingH(cm.display), leftSide = padding.left\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0 }\n top = Math.round(top)\n bottom = Math.round(bottom)\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")))\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line)\n var lineLen = lineObj.text.length\n var start, end\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n iterateBidiSections(getOrder(lineObj, doc.direction), fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir) {\n var leftPos = coords(from, \"left\"), rightPos, left, right\n if (from == to) {\n rightPos = leftPos\n left = right = leftPos.left\n } else {\n rightPos = coords(to - 1, \"right\")\n if (dir == \"rtl\") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp }\n left = leftPos.left\n right = rightPos.right\n }\n if (fromArg == null && from == 0) { left = leftSide }\n if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part\n add(left, leftPos.top, null, leftPos.bottom)\n left = leftSide\n if (leftPos.bottom < rightPos.top) { add(left, leftPos.bottom, null, rightPos.top) }\n }\n if (toArg == null && to == lineLen) { right = rightSide }\n if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)\n { start = leftPos }\n if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)\n { end = rightPos }\n if (left < leftSide + 1) { left = leftSide }\n add(left, rightPos.top, right - left, rightPos.bottom)\n })\n return {start: start, end: end}\n }\n\n var sFrom = range.from(), sTo = range.to()\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch)\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line)\n var singleVLine = visualLine(fromLine) == visualLine(toLine)\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom)\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom)\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom)\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top) }\n }\n\n output.appendChild(fragment)\n}", "function drawSelectionRange(cm, range, output) {\n\t var display = cm.display, doc = cm.doc;\n\t var fragment = document.createDocumentFragment();\n\t var padding = paddingH(cm.display), leftSide = padding.left;\n\t var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n\t\n\t function add(left, top, width, bottom) {\n\t if (top < 0) top = 0;\n\t top = Math.round(top);\n\t bottom = Math.round(bottom);\n\t fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", \"position: absolute; left: \" + left +\n\t \"px; top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) +\n\t \"px; height: \" + (bottom - top) + \"px\"));\n\t }\n\t\n\t function drawForLine(line, fromArg, toArg) {\n\t var lineObj = getLine(doc, line);\n\t var lineLen = lineObj.text.length;\n\t var start, end;\n\t function coords(ch, bias) {\n\t return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias);\n\t }\n\t\n\t iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {\n\t var leftPos = coords(from, \"left\"), rightPos, left, right;\n\t if (from == to) {\n\t rightPos = leftPos;\n\t left = right = leftPos.left;\n\t } else {\n\t rightPos = coords(to - 1, \"right\");\n\t if (dir == \"rtl\") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }\n\t left = leftPos.left;\n\t right = rightPos.right;\n\t }\n\t if (fromArg == null && from == 0) left = leftSide;\n\t if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part\n\t add(left, leftPos.top, null, leftPos.bottom);\n\t left = leftSide;\n\t if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);\n\t }\n\t if (toArg == null && to == lineLen) right = rightSide;\n\t if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)\n\t start = leftPos;\n\t if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)\n\t end = rightPos;\n\t if (left < leftSide + 1) left = leftSide;\n\t add(left, rightPos.top, right - left, rightPos.bottom);\n\t });\n\t return {start: start, end: end};\n\t }\n\t\n\t var sFrom = range.from(), sTo = range.to();\n\t if (sFrom.line == sTo.line) {\n\t drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n\t } else {\n\t var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n\t var singleVLine = visualLine(fromLine) == visualLine(toLine);\n\t var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n\t var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n\t if (singleVLine) {\n\t if (leftEnd.top < rightStart.top - 2) {\n\t add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n\t add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n\t } else {\n\t add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n\t }\n\t }\n\t if (leftEnd.bottom < rightStart.top)\n\t add(leftSide, leftEnd.bottom, null, rightStart.top);\n\t }\n\t\n\t output.appendChild(fragment);\n\t }", "function drawSelectionRange(cm, range, output) {\r\n var display = cm.display, doc = cm.doc;\r\n var fragment = document.createDocumentFragment();\r\n var padding = paddingH(cm.display), leftSide = padding.left, rightSide = display.lineSpace.offsetWidth - padding.right;\r\n\r\n function add(left, top, width, bottom) {\r\n if (top < 0) top = 0;\r\n top = Math.round(top);\r\n bottom = Math.round(bottom);\r\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", \"position: absolute; left: \" + left +\r\n \"px; top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) +\r\n \"px; height: \" + (bottom - top) + \"px\"));\r\n }\r\n\r\n function drawForLine(line, fromArg, toArg) {\r\n var lineObj = getLine(doc, line);\r\n var lineLen = lineObj.text.length;\r\n var start, end;\r\n function coords(ch, bias) {\r\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias);\r\n }\r\n\r\n iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {\r\n var leftPos = coords(from, \"left\"), rightPos, left, right;\r\n if (from == to) {\r\n rightPos = leftPos;\r\n left = right = leftPos.left;\r\n } else {\r\n rightPos = coords(to - 1, \"right\");\r\n if (dir == \"rtl\") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }\r\n left = leftPos.left;\r\n right = rightPos.right;\r\n }\r\n if (fromArg == null && from == 0) left = leftSide;\r\n if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part\r\n add(left, leftPos.top, null, leftPos.bottom);\r\n left = leftSide;\r\n if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);\r\n }\r\n if (toArg == null && to == lineLen) right = rightSide;\r\n if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)\r\n start = leftPos;\r\n if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)\r\n end = rightPos;\r\n if (left < leftSide + 1) left = leftSide;\r\n add(left, rightPos.top, right - left, rightPos.bottom);\r\n });\r\n return {start: start, end: end};\r\n }\r\n\r\n var sFrom = range.from(), sTo = range.to();\r\n if (sFrom.line == sTo.line) {\r\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\r\n } else {\r\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\r\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\r\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\r\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\r\n if (singleVLine) {\r\n if (leftEnd.top < rightStart.top - 2) {\r\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\r\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\r\n } else {\r\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\r\n }\r\n }\r\n if (leftEnd.bottom < rightStart.top)\r\n add(leftSide, leftEnd.bottom, null, rightStart.top);\r\n }\r\n\r\n output.appendChild(fragment);\r\n }", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n iterateBidiSections(getOrder(lineObj, doc.direction), fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir) {\n var leftPos = coords(from, \"left\"), rightPos, left, right;\n if (from == to) {\n rightPos = leftPos;\n left = right = leftPos.left;\n } else {\n rightPos = coords(to - 1, \"right\");\n if (dir == \"rtl\") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }\n left = leftPos.left;\n right = rightPos.right;\n }\n if (fromArg == null && from == 0) { left = leftSide; }\n if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part\n add(left, leftPos.top, null, leftPos.bottom);\n left = leftSide;\n if (leftPos.bottom < rightPos.top) { add(left, leftPos.bottom, null, rightPos.top); }\n }\n if (toArg == null && to == lineLen) { right = rightSide; }\n if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)\n { start = leftPos; }\n if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)\n { end = rightPos; }\n if (left < leftSide + 1) { left = leftSide; }\n add(left, rightPos.top, right - left, rightPos.bottom);\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n}", "function drawSelectionRange(cm, range, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range.from(), sTo = range.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range.from(), sTo = range.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range.from(), sTo = range.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range.from(), sTo = range.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range.from(), sTo = range.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range.from(), sTo = range.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range.from(), sTo = range.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range.from(), sTo = range.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range$$1, output) {\r\n var display = cm.display, doc = cm.doc;\r\n var fragment = document.createDocumentFragment();\r\n var padding = paddingH(cm.display), leftSide = padding.left;\r\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\r\n var docLTR = doc.direction == \"ltr\";\r\n\r\n function add(left, top, width, bottom) {\r\n if (top < 0) { top = 0; }\r\n top = Math.round(top);\r\n bottom = Math.round(bottom);\r\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\r\n }\r\n\r\n function drawForLine(line, fromArg, toArg) {\r\n var lineObj = getLine(doc, line);\r\n var lineLen = lineObj.text.length;\r\n var start, end;\r\n function coords(ch, bias) {\r\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\r\n }\r\n\r\n function wrapX(pos, dir, side) {\r\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\r\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\r\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\r\n return coords(ch, prop)[prop]\r\n }\r\n\r\n var order = getOrder(lineObj, doc.direction);\r\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\r\n var ltr = dir == \"ltr\";\r\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\r\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\r\n\r\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\r\n var first = i == 0, last = !order || i == order.length - 1;\r\n if (toPos.top - fromPos.top <= 3) { // Single line\r\n var openLeft = (docLTR ? openStart : openEnd) && first;\r\n var openRight = (docLTR ? openEnd : openStart) && last;\r\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\r\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\r\n add(left, fromPos.top, right - left, fromPos.bottom);\r\n } else { // Multiple lines\r\n var topLeft, topRight, botLeft, botRight;\r\n if (ltr) {\r\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\r\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\r\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\r\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\r\n } else {\r\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\r\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\r\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\r\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\r\n }\r\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\r\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\r\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\r\n }\r\n\r\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\r\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\r\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\r\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\r\n });\r\n return {start: start, end: end}\r\n }\r\n\r\n var sFrom = range$$1.from(), sTo = range$$1.to();\r\n if (sFrom.line == sTo.line) {\r\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\r\n } else {\r\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\r\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\r\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\r\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\r\n if (singleVLine) {\r\n if (leftEnd.top < rightStart.top - 2) {\r\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\r\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\r\n } else {\r\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\r\n }\r\n }\r\n if (leftEnd.bottom < rightStart.top)\r\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\r\n }\r\n\r\n output.appendChild(fragment);\r\n}", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n}", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n}", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n}", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n}", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n}", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n}", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n}", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n}", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n}", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var fromPos = coords(from, dir == \"ltr\" ? \"left\" : \"right\");\n var toPos = coords(to - 1, dir == \"ltr\" ? \"right\" : \"left\");\n if (dir == \"ltr\") {\n var fromLeft = fromArg == null && from == 0 ? leftSide : fromPos.left;\n var toRight = toArg == null && to == lineLen ? rightSide : toPos.right;\n if (toPos.top - fromPos.top <= 3) { // Single line\n add(fromLeft, toPos.top, toRight - fromLeft, toPos.bottom);\n } else { // Multiple lines\n add(fromLeft, fromPos.top, null, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(leftSide, toPos.top, toPos.right, toPos.bottom);\n }\n } else if (from < to) { // RTL\n var fromRight = fromArg == null && from == 0 ? rightSide : fromPos.right;\n var toLeft = toArg == null && to == lineLen ? leftSide : toPos.left;\n if (toPos.top - fromPos.top <= 3) { // Single line\n add(toLeft, toPos.top, fromRight - toLeft, toPos.bottom);\n } else { // Multiple lines\n var topLeft = leftSide;\n if (i) {\n var topEnd = wrappedLineExtentChar(cm, lineObj, null, from).end;\n // The coordinates returned for an RTL wrapped space tend to\n // be complete bogus, so try to skip that here.\n topLeft = coords(topEnd - (/\\s/.test(lineObj.text.charAt(topEnd - 1)) ? 2 : 1), \"left\").left;\n }\n add(topLeft, fromPos.top, fromRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n var botWidth = null;\n if (i < order.length - 1 || true) {\n var botStart = wrappedLineExtentChar(cm, lineObj, null, to).begin;\n botWidth = coords(botStart, \"right\").right - toLeft;\n }\n add(toLeft, toPos.top, botWidth, toPos.bottom);\n }\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n}", "showCursor() {\n this.canvas.style.cursor = CURRENT_CURSOR;\n }", "function Cursor (position, selectionEnd) {\n this.position = position;\n this.selectionEnd = selectionEnd;\n }", "function Cursor (position, selectionEnd) {\n this.position = position;\n this.selectionEnd = selectionEnd;\n }", "function drawCursor() {\n cursorContext.clearRect(0, 0, cursorCanvas.width, cursorCanvas.height);\n\n cursorContext.beginPath();\n cursorContext.arc(mouseX, mouseY, mouseWidth, 0, 2 * Math.PI, true);\n cursorContext.fillStyle = '#FF6A6A'\n cursorContext.fill();\n cursorContext.lineWidth = 1;\n cursorContext.strokeStyle = \"black\"\n cursorContext.stroke();\n }", "function drawCursor(x,y,w,h){\n\tvar canvas = document.getElementById(\"myCanvas\");\n\tif (canvas.getContext) {\n\t\tvar ctx = canvas.getContext(\"2d\");\n\t\tctx.strokeStyle = \"red\";\n\t\tctx.lineWidth = 1;\n\t\tctx.strokeRect(x,y,w,h);\n\t}\n}", "function updateCursor() {\n var start, end, x, y, i, el, cls;\n\n if (typeof cursor === 'undefined') {\n return;\n }\n\n if (cursor.getAttribute('id') !== 'cursor') {\n return;\n }\n\n start = input.selectionStart;\n end = input.selectionEnd;\n if (start > end) {\n end = input.selectionStart;\n start = input.selectionEnd;\n }\n\n if (editor.childNodes.length <= start) {\n return;\n }\n\n el = editor.childNodes[start];\n if (el) {\n x = el.offsetLeft;\n y = el.offsetTop;\n cursor.style.left = x + 'px';\n cursor.style.top = y + 'px';\n cursor.style.opacity = 1;\n }\n\n // If there is a selection, add the CSS class 'selected'\n // to all nodes inside the selection range.\n cursor.style.opacity = (start === end) ? 1 : 0;\n for (i = 0; i < editor.childNodes.length; i += 1) {\n el = editor.childNodes[i];\n cls = el.getAttribute('class');\n if (cls !== null) {\n cls = cls.replace(' selected', '');\n if (i >= start && i < end) {\n cls += ' selected';\n }\n el.setAttribute('class', cls);\n }\n }\n }", "function drawSelectionCursor(cm, head, output) {\n\t var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n\t var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n\t cursor.style.left = pos.left + \"px\";\n\t cursor.style.top = pos.top + \"px\";\n\t cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n\t if (pos.other) {\n\t // Secondary cursor, shown when on a 'jump' in bi-directional text\n\t var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n\t otherCursor.style.display = \"\";\n\t otherCursor.style.left = pos.other.left + \"px\";\n\t otherCursor.style.top = pos.other.top + \"px\";\n\t otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n\t }\n\t }", "function drawSelectionCursor(cm, head, output) {\n\t var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n\t var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n\t cursor.style.left = pos.left + \"px\";\n\t cursor.style.top = pos.top + \"px\";\n\t cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n\t if (pos.other) {\n\t // Secondary cursor, shown when on a 'jump' in bi-directional text\n\t var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n\t otherCursor.style.display = \"\";\n\t otherCursor.style.left = pos.other.left + \"px\";\n\t otherCursor.style.top = pos.other.top + \"px\";\n\t otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n\t }\n\t }", "function drawSelectionCursor(cm, head, output) {\n\t\t var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\t\t\n\t\t var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n\t\t cursor.style.left = pos.left + \"px\";\n\t\t cursor.style.top = pos.top + \"px\";\n\t\t cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\t\t\n\t\t if (pos.other) {\n\t\t // Secondary cursor, shown when on a 'jump' in bi-directional text\n\t\t var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n\t\t otherCursor.style.display = \"\";\n\t\t otherCursor.style.left = pos.other.left + \"px\";\n\t\t otherCursor.style.top = pos.other.top + \"px\";\n\t\t otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n\t\t }\n\t\t }", "function drawSelectionCursor(cm, head, output) {\n\t var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\t\n\t var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n\t cursor.style.left = pos.left + \"px\";\n\t cursor.style.top = pos.top + \"px\";\n\t cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\t\n\t if (pos.other) {\n\t // Secondary cursor, shown when on a 'jump' in bi-directional text\n\t var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n\t otherCursor.style.display = \"\";\n\t otherCursor.style.left = pos.other.left + \"px\";\n\t otherCursor.style.top = pos.other.top + \"px\";\n\t otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n\t }\n\t }", "function changeCursor(newCursor) {\n canvas.style.cursor = newCursor\n}", "function drawSelectionCursor(cm, head, output) {\n\t\t var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n\t\t var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n\t\t cursor.style.left = pos.left + \"px\";\n\t\t cursor.style.top = pos.top + \"px\";\n\t\t cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n\t\t if (/\\bcm-fat-cursor\\b/.test(cm.getWrapperElement().className)) {\n\t\t var charPos = charCoords(cm, head, \"div\", null, null);\n\t\t var width = charPos.right - charPos.left;\n\t\t cursor.style.width = (width > 0 ? width : cm.defaultCharWidth()) + \"px\";\n\t\t }\n\n\t\t if (pos.other) {\n\t\t // Secondary cursor, shown when on a 'jump' in bi-directional text\n\t\t var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n\t\t otherCursor.style.display = \"\";\n\t\t otherCursor.style.left = pos.other.left + \"px\";\n\t\t otherCursor.style.top = pos.other.top + \"px\";\n\t\t otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n\t\t }\n\t\t }", "function putCursor (color) {\r\n return \"<font color='\" + color + \"'>\" + this.cursor + \"</font>\";\r\n}", "cursorTo() {}", "function drawSelectionCursor(cm, head, output) {\n var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine)\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"))\n cursor.style.left = pos.left + \"px\"\n cursor.style.top = pos.top + \"px\"\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\"\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"))\n otherCursor.style.display = \"\"\n otherCursor.style.left = pos.other.left + \"px\"\n otherCursor.style.top = pos.other.top + \"px\"\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\"\n }\n}", "function drawSelectionCursor(cm, head, output) {\n var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine)\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"))\n cursor.style.left = pos.left + \"px\"\n cursor.style.top = pos.top + \"px\"\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\"\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"))\n otherCursor.style.display = \"\"\n otherCursor.style.left = pos.other.left + \"px\"\n otherCursor.style.top = pos.other.top + \"px\"\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\"\n }\n}", "function drawSelectionCursor(cm, head, output) {\n var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (/\\bcm-fat-cursor\\b/.test(cm.getWrapperElement().className)) {\n var charPos = charCoords(cm, head, \"div\", null, null);\n var width = charPos.right - charPos.left;\n cursor.style.width = (width > 0 ? width : cm.defaultCharWidth()) + \"px\";\n }\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n }", "function drawSelectionCursor(cm, head, output) {\n var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (/\\bcm-fat-cursor\\b/.test(cm.getWrapperElement().className)) {\n var charPos = charCoords(cm, head, \"div\", null, null);\n var width = charPos.right - charPos.left;\n cursor.style.width = (width > 0 ? width : cm.defaultCharWidth()) + \"px\";\n }\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n }", "startDraw() {\n\t\tif (this.cursorVisible != false) {\n\t\t\tthis.write(\"\\x1B[?25l\");\n\t\t\tthis.cursorVisible = false;\n\t\t}\n\t\tthis.write(\"\\x1B7\"); //save cursor pos\n\t}", "function drawSelectionCursor(cm, head, output) {\r\n var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\r\n\r\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\r\n cursor.style.left = pos.left + \"px\";\r\n cursor.style.top = pos.top + \"px\";\r\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\r\n\r\n if (pos.other) {\r\n // Secondary cursor, shown when on a 'jump' in bi-directional text\r\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\r\n otherCursor.style.display = \"\";\r\n otherCursor.style.left = pos.other.left + \"px\";\r\n otherCursor.style.top = pos.other.top + \"px\";\r\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\r\n }\r\n}", "function addAlongLine(startX, startY, range, xstep, ystep){\n for (let i = 0; i <= range; i++){\n mouseAddAt(startX + int(i * xstep), startY + int(i * ystep));\n }\n}", "function drawSelectionCursor(cm, head, output) {\n var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n}", "function drawSelectionCursor(cm, head, output) {\n var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n}", "function drawSelectionCursor(cm, head, output) {\n var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n}", "function drawSelectionCursor(cm, head, output) {\n var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n}", "function drawSelectionCursor(cm, head, output) {\n var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n}", "function drawSelectionCursor(cm, head, output) {\n var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n}", "function drawSelectionCursor(cm, head, output) {\n var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n}", "function drawSelectionCursor(cm, head, output) {\n var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n}", "function drawSelectionCursor(cm, head, output) {\n var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n}", "function drawSelectionCursor(cm, head, output) {\n var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n}", "function drawSelectionCursor(cm, head, output) {\n var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n}" ]
[ "0.69801736", "0.69801736", "0.69801736", "0.69801736", "0.69801736", "0.69801736", "0.69801736", "0.6950206", "0.68451244", "0.6837227", "0.6837227", "0.6837227", "0.6837227", "0.6835953", "0.6835953", "0.6835953", "0.6835953", "0.68251777", "0.68251777", "0.6819444", "0.68056154", "0.6804944", "0.6797155", "0.6787714", "0.6781747", "0.6753853", "0.6753853", "0.6753853", "0.6753853", "0.6753853", "0.6753853", "0.6753853", "0.6753853", "0.67530084", "0.6729603", "0.6729603", "0.6729603", "0.6729603", "0.6729603", "0.6729603", "0.6729603", "0.6729603", "0.6729603", "0.6727764", "0.6727764", "0.6727764", "0.6727764", "0.6727764", "0.6727764", "0.6727764", "0.6727764", "0.6727764", "0.6692844", "0.66042197", "0.6592314", "0.6592314", "0.63183033", "0.6267487", "0.62303406", "0.62059176", "0.62059176", "0.6200272", "0.61887014", "0.6167166", "0.614072", "0.61360097", "0.6110773", "0.6097496", "0.6097496", "0.6091285", "0.6091285", "0.6080175", "0.6078235", "0.60752225", "0.6073428", "0.6073428", "0.6073428", "0.6073428", "0.6073428", "0.6073428", "0.6073428", "0.6073428", "0.6073428", "0.6073428", "0.6073428" ]
0.6168477
75
Draws the given range as a highlighted selection
function drawSelectionRange(cm, range, output) { var display = cm.display, doc = cm.doc; var fragment = document.createDocumentFragment(); var padding = paddingH(cm.display), leftSide = padding.left; var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right; var docLTR = doc.direction == "ltr"; function add(left, top, width, bottom) { if (top < 0) { top = 0; } top = Math.round(top); bottom = Math.round(bottom); fragment.appendChild(elt("div", null, "CodeMirror-selected", ("position: absolute; left: " + left + "px;\n top: " + top + "px; width: " + (width == null ? rightSide - left : width) + "px;\n height: " + (bottom - top) + "px"))); } function drawForLine(line, fromArg, toArg) { var lineObj = getLine(doc, line); var lineLen = lineObj.text.length; var start, end; function coords(ch, bias) { return charCoords(cm, Pos(line, ch), "div", lineObj, bias) } function wrapX(pos, dir, side) { var extent = wrappedLineExtentChar(cm, lineObj, null, pos); var prop = (dir == "ltr") == (side == "after") ? "left" : "right"; var ch = side == "after" ? extent.begin : extent.end - (/\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1); return coords(ch, prop)[prop] } var order = getOrder(lineObj, doc.direction); iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) { var ltr = dir == "ltr"; var fromPos = coords(from, ltr ? "left" : "right"); var toPos = coords(to - 1, ltr ? "right" : "left"); var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen; var first = i == 0, last = !order || i == order.length - 1; if (toPos.top - fromPos.top <= 3) { // Single line var openLeft = (docLTR ? openStart : openEnd) && first; var openRight = (docLTR ? openEnd : openStart) && last; var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left; var right = openRight ? rightSide : (ltr ? toPos : fromPos).right; add(left, fromPos.top, right - left, fromPos.bottom); } else { // Multiple lines var topLeft, topRight, botLeft, botRight; if (ltr) { topLeft = docLTR && openStart && first ? leftSide : fromPos.left; topRight = docLTR ? rightSide : wrapX(from, dir, "before"); botLeft = docLTR ? leftSide : wrapX(to, dir, "after"); botRight = docLTR && openEnd && last ? rightSide : toPos.right; } else { topLeft = !docLTR ? leftSide : wrapX(from, dir, "before"); topRight = !docLTR && openStart && first ? rightSide : fromPos.right; botLeft = !docLTR && openEnd && last ? leftSide : toPos.left; botRight = !docLTR ? rightSide : wrapX(to, dir, "after"); } add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom); if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); } add(botLeft, toPos.top, botRight - botLeft, toPos.bottom); } if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; } if (cmpCoords(toPos, start) < 0) { start = toPos; } if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; } if (cmpCoords(toPos, end) < 0) { end = toPos; } }); return {start: start, end: end} } var sFrom = range.from(), sTo = range.to(); if (sFrom.line == sTo.line) { drawForLine(sFrom.line, sFrom.ch, sTo.ch); } else { var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line); var singleVLine = visualLine(fromLine) == visualLine(toLine); var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end; var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start; if (singleVLine) { if (leftEnd.top < rightStart.top - 2) { add(leftEnd.right, leftEnd.top, null, leftEnd.bottom); add(leftSide, rightStart.top, rightStart.left, rightStart.bottom); } else { add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom); } } if (leftEnd.bottom < rightStart.top) { add(leftSide, leftEnd.bottom, null, rightStart.top); } } output.appendChild(fragment); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawSelectionRange(cm, range, output) {\n\t\t var display = cm.display, doc = cm.doc;\n\t\t var fragment = document.createDocumentFragment();\n\t\t var padding = paddingH(cm.display), leftSide = padding.left;\n\t\t var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n\t\t var docLTR = doc.direction == \"ltr\";\n\n\t\t function add(left, top, width, bottom) {\n\t\t if (top < 0) { top = 0; }\n\t\t top = Math.round(top);\n\t\t bottom = Math.round(bottom);\n\t\t fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n\t\t }\n\n\t\t function drawForLine(line, fromArg, toArg) {\n\t\t var lineObj = getLine(doc, line);\n\t\t var lineLen = lineObj.text.length;\n\t\t var start, end;\n\t\t function coords(ch, bias) {\n\t\t return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n\t\t }\n\n\t\t function wrapX(pos, dir, side) {\n\t\t var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n\t\t var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n\t\t var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n\t\t return coords(ch, prop)[prop]\n\t\t }\n\n\t\t var order = getOrder(lineObj, doc.direction);\n\t\t iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n\t\t var ltr = dir == \"ltr\";\n\t\t var fromPos = coords(from, ltr ? \"left\" : \"right\");\n\t\t var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n\t\t var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n\t\t var first = i == 0, last = !order || i == order.length - 1;\n\t\t if (toPos.top - fromPos.top <= 3) { // Single line\n\t\t var openLeft = (docLTR ? openStart : openEnd) && first;\n\t\t var openRight = (docLTR ? openEnd : openStart) && last;\n\t\t var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n\t\t var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n\t\t add(left, fromPos.top, right - left, fromPos.bottom);\n\t\t } else { // Multiple lines\n\t\t var topLeft, topRight, botLeft, botRight;\n\t\t if (ltr) {\n\t\t topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n\t\t topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n\t\t botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n\t\t botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n\t\t } else {\n\t\t topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n\t\t topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n\t\t botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n\t\t botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n\t\t }\n\t\t add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n\t\t if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n\t\t add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n\t\t }\n\n\t\t if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n\t\t if (cmpCoords(toPos, start) < 0) { start = toPos; }\n\t\t if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n\t\t if (cmpCoords(toPos, end) < 0) { end = toPos; }\n\t\t });\n\t\t return {start: start, end: end}\n\t\t }\n\n\t\t var sFrom = range.from(), sTo = range.to();\n\t\t if (sFrom.line == sTo.line) {\n\t\t drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n\t\t } else {\n\t\t var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n\t\t var singleVLine = visualLine(fromLine) == visualLine(toLine);\n\t\t var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n\t\t var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n\t\t if (singleVLine) {\n\t\t if (leftEnd.top < rightStart.top - 2) {\n\t\t add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n\t\t add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n\t\t } else {\n\t\t add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n\t\t }\n\t\t }\n\t\t if (leftEnd.bottom < rightStart.top)\n\t\t { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n\t\t }\n\n\t\t output.appendChild(fragment);\n\t\t }", "function drawSelectionRange(cm, range, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left, rightSide = display.lineSpace.offsetWidth - padding.right;\n\n function add(left, top, width, bottom) {\n if (top < 0) top = 0;\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", \"position: absolute; left: \" + left +\n \"px; top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) +\n \"px; height: \" + (bottom - top) + \"px\"));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias);\n }\n\n iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {\n var leftPos = coords(from, \"left\"), rightPos, left, right;\n if (from == to) {\n rightPos = leftPos;\n left = right = leftPos.left;\n } else {\n rightPos = coords(to - 1, \"right\");\n if (dir == \"rtl\") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }\n left = leftPos.left;\n right = rightPos.right;\n }\n if (fromArg == null && from == 0) left = leftSide;\n if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part\n add(left, leftPos.top, null, leftPos.bottom);\n left = leftSide;\n if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);\n }\n if (toArg == null && to == lineLen) right = rightSide;\n if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)\n start = leftPos;\n if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)\n end = rightPos;\n if (left < leftSide + 1) left = leftSide;\n add(left, rightPos.top, right - left, rightPos.bottom);\n });\n return {start: start, end: end};\n }\n\n var sFrom = range.from(), sTo = range.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n add(leftSide, leftEnd.bottom, null, rightStart.top);\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left, rightSide = display.lineSpace.offsetWidth - padding.right;\n\n function add(left, top, width, bottom) {\n if (top < 0) top = 0;\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", \"position: absolute; left: \" + left +\n \"px; top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) +\n \"px; height: \" + (bottom - top) + \"px\"));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias);\n }\n\n iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {\n var leftPos = coords(from, \"left\"), rightPos, left, right;\n if (from == to) {\n rightPos = leftPos;\n left = right = leftPos.left;\n } else {\n rightPos = coords(to - 1, \"right\");\n if (dir == \"rtl\") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }\n left = leftPos.left;\n right = rightPos.right;\n }\n if (fromArg == null && from == 0) left = leftSide;\n if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part\n add(left, leftPos.top, null, leftPos.bottom);\n left = leftSide;\n if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);\n }\n if (toArg == null && to == lineLen) right = rightSide;\n if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)\n start = leftPos;\n if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)\n end = rightPos;\n if (left < leftSide + 1) left = leftSide;\n add(left, rightPos.top, right - left, rightPos.bottom);\n });\n return {start: start, end: end};\n }\n\n var sFrom = range.from(), sTo = range.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n add(leftSide, leftEnd.bottom, null, rightStart.top);\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left, rightSide = display.lineSpace.offsetWidth - padding.right;\n\n function add(left, top, width, bottom) {\n if (top < 0) top = 0;\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", \"position: absolute; left: \" + left +\n \"px; top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) +\n \"px; height: \" + (bottom - top) + \"px\"));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias);\n }\n\n iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {\n var leftPos = coords(from, \"left\"), rightPos, left, right;\n if (from == to) {\n rightPos = leftPos;\n left = right = leftPos.left;\n } else {\n rightPos = coords(to - 1, \"right\");\n if (dir == \"rtl\") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }\n left = leftPos.left;\n right = rightPos.right;\n }\n if (fromArg == null && from == 0) left = leftSide;\n if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part\n add(left, leftPos.top, null, leftPos.bottom);\n left = leftSide;\n if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);\n }\n if (toArg == null && to == lineLen) right = rightSide;\n if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)\n start = leftPos;\n if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)\n end = rightPos;\n if (left < leftSide + 1) left = leftSide;\n add(left, rightPos.top, right - left, rightPos.bottom);\n });\n return {start: start, end: end};\n }\n\n var sFrom = range.from(), sTo = range.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n add(leftSide, leftEnd.bottom, null, rightStart.top);\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left, rightSide = display.lineSpace.offsetWidth - padding.right;\n\n function add(left, top, width, bottom) {\n if (top < 0) top = 0;\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", \"position: absolute; left: \" + left +\n \"px; top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) +\n \"px; height: \" + (bottom - top) + \"px\"));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias);\n }\n\n iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {\n var leftPos = coords(from, \"left\"), rightPos, left, right;\n if (from == to) {\n rightPos = leftPos;\n left = right = leftPos.left;\n } else {\n rightPos = coords(to - 1, \"right\");\n if (dir == \"rtl\") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }\n left = leftPos.left;\n right = rightPos.right;\n }\n if (fromArg == null && from == 0) left = leftSide;\n if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part\n add(left, leftPos.top, null, leftPos.bottom);\n left = leftSide;\n if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);\n }\n if (toArg == null && to == lineLen) right = rightSide;\n if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)\n start = leftPos;\n if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)\n end = rightPos;\n if (left < leftSide + 1) left = leftSide;\n add(left, rightPos.top, right - left, rightPos.bottom);\n });\n return {start: start, end: end};\n }\n\n var sFrom = range.from(), sTo = range.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n add(leftSide, leftEnd.bottom, null, rightStart.top);\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range, output) {\n\t\t var display = cm.display, doc = cm.doc;\n\t\t var fragment = document.createDocumentFragment();\n\t\t var padding = paddingH(cm.display), leftSide = padding.left;\n\t\t var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n\t\t\n\t\t function add(left, top, width, bottom) {\n\t\t if (top < 0) top = 0;\n\t\t top = Math.round(top);\n\t\t bottom = Math.round(bottom);\n\t\t fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", \"position: absolute; left: \" + left +\n\t\t \"px; top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) +\n\t\t \"px; height: \" + (bottom - top) + \"px\"));\n\t\t }\n\t\t\n\t\t function drawForLine(line, fromArg, toArg) {\n\t\t var lineObj = getLine(doc, line);\n\t\t var lineLen = lineObj.text.length;\n\t\t var start, end;\n\t\t function coords(ch, bias) {\n\t\t return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias);\n\t\t }\n\t\t\n\t\t iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {\n\t\t var leftPos = coords(from, \"left\"), rightPos, left, right;\n\t\t if (from == to) {\n\t\t rightPos = leftPos;\n\t\t left = right = leftPos.left;\n\t\t } else {\n\t\t rightPos = coords(to - 1, \"right\");\n\t\t if (dir == \"rtl\") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }\n\t\t left = leftPos.left;\n\t\t right = rightPos.right;\n\t\t }\n\t\t if (fromArg == null && from == 0) left = leftSide;\n\t\t if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part\n\t\t add(left, leftPos.top, null, leftPos.bottom);\n\t\t left = leftSide;\n\t\t if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);\n\t\t }\n\t\t if (toArg == null && to == lineLen) right = rightSide;\n\t\t if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)\n\t\t start = leftPos;\n\t\t if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)\n\t\t end = rightPos;\n\t\t if (left < leftSide + 1) left = leftSide;\n\t\t add(left, rightPos.top, right - left, rightPos.bottom);\n\t\t });\n\t\t return {start: start, end: end};\n\t\t }\n\t\t\n\t\t var sFrom = range.from(), sTo = range.to();\n\t\t if (sFrom.line == sTo.line) {\n\t\t drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n\t\t } else {\n\t\t var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n\t\t var singleVLine = visualLine(fromLine) == visualLine(toLine);\n\t\t var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n\t\t var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n\t\t if (singleVLine) {\n\t\t if (leftEnd.top < rightStart.top - 2) {\n\t\t add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n\t\t add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n\t\t } else {\n\t\t add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n\t\t }\n\t\t }\n\t\t if (leftEnd.bottom < rightStart.top)\n\t\t add(leftSide, leftEnd.bottom, null, rightStart.top);\n\t\t }\n\t\t\n\t\t output.appendChild(fragment);\n\t\t }", "function drawSelectionRange(cm, range, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n\n function add(left, top, width, bottom) {\n if (top < 0) top = 0;\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", \"position: absolute; left: \" + left +\n \"px; top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) +\n \"px; height: \" + (bottom - top) + \"px\"));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias);\n }\n\n iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {\n var leftPos = coords(from, \"left\"), rightPos, left, right;\n if (from == to) {\n rightPos = leftPos;\n left = right = leftPos.left;\n } else {\n rightPos = coords(to - 1, \"right\");\n if (dir == \"rtl\") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }\n left = leftPos.left;\n right = rightPos.right;\n }\n if (fromArg == null && from == 0) left = leftSide;\n if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part\n add(left, leftPos.top, null, leftPos.bottom);\n left = leftSide;\n if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);\n }\n if (toArg == null && to == lineLen) right = rightSide;\n if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)\n start = leftPos;\n if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)\n end = rightPos;\n if (left < leftSide + 1) left = leftSide;\n add(left, rightPos.top, right - left, rightPos.bottom);\n });\n return {start: start, end: end};\n }\n\n var sFrom = range.from(), sTo = range.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n add(leftSide, leftEnd.bottom, null, rightStart.top);\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n\n function add(left, top, width, bottom) {\n if (top < 0) top = 0;\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", \"position: absolute; left: \" + left +\n \"px; top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) +\n \"px; height: \" + (bottom - top) + \"px\"));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias);\n }\n\n iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {\n var leftPos = coords(from, \"left\"), rightPos, left, right;\n if (from == to) {\n rightPos = leftPos;\n left = right = leftPos.left;\n } else {\n rightPos = coords(to - 1, \"right\");\n if (dir == \"rtl\") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }\n left = leftPos.left;\n right = rightPos.right;\n }\n if (fromArg == null && from == 0) left = leftSide;\n if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part\n add(left, leftPos.top, null, leftPos.bottom);\n left = leftSide;\n if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);\n }\n if (toArg == null && to == lineLen) right = rightSide;\n if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)\n start = leftPos;\n if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)\n end = rightPos;\n if (left < leftSide + 1) left = leftSide;\n add(left, rightPos.top, right - left, rightPos.bottom);\n });\n return {start: start, end: end};\n }\n\n var sFrom = range.from(), sTo = range.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n add(leftSide, leftEnd.bottom, null, rightStart.top);\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n\n function add(left, top, width, bottom) {\n if (top < 0) top = 0;\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", \"position: absolute; left: \" + left +\n \"px; top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) +\n \"px; height: \" + (bottom - top) + \"px\"));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias);\n }\n\n iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {\n var leftPos = coords(from, \"left\"), rightPos, left, right;\n if (from == to) {\n rightPos = leftPos;\n left = right = leftPos.left;\n } else {\n rightPos = coords(to - 1, \"right\");\n if (dir == \"rtl\") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }\n left = leftPos.left;\n right = rightPos.right;\n }\n if (fromArg == null && from == 0) left = leftSide;\n if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part\n add(left, leftPos.top, null, leftPos.bottom);\n left = leftSide;\n if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);\n }\n if (toArg == null && to == lineLen) right = rightSide;\n if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)\n start = leftPos;\n if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)\n end = rightPos;\n if (left < leftSide + 1) left = leftSide;\n add(left, rightPos.top, right - left, rightPos.bottom);\n });\n return {start: start, end: end};\n }\n\n var sFrom = range.from(), sTo = range.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n add(leftSide, leftEnd.bottom, null, rightStart.top);\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n\n function add(left, top, width, bottom) {\n if (top < 0) top = 0;\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", \"position: absolute; left: \" + left +\n \"px; top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) +\n \"px; height: \" + (bottom - top) + \"px\"));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias);\n }\n\n iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {\n var leftPos = coords(from, \"left\"), rightPos, left, right;\n if (from == to) {\n rightPos = leftPos;\n left = right = leftPos.left;\n } else {\n rightPos = coords(to - 1, \"right\");\n if (dir == \"rtl\") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }\n left = leftPos.left;\n right = rightPos.right;\n }\n if (fromArg == null && from == 0) left = leftSide;\n if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part\n add(left, leftPos.top, null, leftPos.bottom);\n left = leftSide;\n if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);\n }\n if (toArg == null && to == lineLen) right = rightSide;\n if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)\n start = leftPos;\n if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)\n end = rightPos;\n if (left < leftSide + 1) left = leftSide;\n add(left, rightPos.top, right - left, rightPos.bottom);\n });\n return {start: start, end: end};\n }\n\n var sFrom = range.from(), sTo = range.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n add(leftSide, leftEnd.bottom, null, rightStart.top);\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range$$1, output) {\r\n var display = cm.display, doc = cm.doc;\r\n var fragment = document.createDocumentFragment();\r\n var padding = paddingH(cm.display), leftSide = padding.left;\r\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\r\n var docLTR = doc.direction == \"ltr\";\r\n\r\n function add(left, top, width, bottom) {\r\n if (top < 0) { top = 0; }\r\n top = Math.round(top);\r\n bottom = Math.round(bottom);\r\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\r\n }\r\n\r\n function drawForLine(line, fromArg, toArg) {\r\n var lineObj = getLine(doc, line);\r\n var lineLen = lineObj.text.length;\r\n var start, end;\r\n function coords(ch, bias) {\r\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\r\n }\r\n\r\n function wrapX(pos, dir, side) {\r\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\r\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\r\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\r\n return coords(ch, prop)[prop]\r\n }\r\n\r\n var order = getOrder(lineObj, doc.direction);\r\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\r\n var ltr = dir == \"ltr\";\r\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\r\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\r\n\r\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\r\n var first = i == 0, last = !order || i == order.length - 1;\r\n if (toPos.top - fromPos.top <= 3) { // Single line\r\n var openLeft = (docLTR ? openStart : openEnd) && first;\r\n var openRight = (docLTR ? openEnd : openStart) && last;\r\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\r\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\r\n add(left, fromPos.top, right - left, fromPos.bottom);\r\n } else { // Multiple lines\r\n var topLeft, topRight, botLeft, botRight;\r\n if (ltr) {\r\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\r\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\r\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\r\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\r\n } else {\r\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\r\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\r\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\r\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\r\n }\r\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\r\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\r\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\r\n }\r\n\r\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\r\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\r\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\r\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\r\n });\r\n return {start: start, end: end}\r\n }\r\n\r\n var sFrom = range$$1.from(), sTo = range$$1.to();\r\n if (sFrom.line == sTo.line) {\r\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\r\n } else {\r\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\r\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\r\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\r\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\r\n if (singleVLine) {\r\n if (leftEnd.top < rightStart.top - 2) {\r\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\r\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\r\n } else {\r\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\r\n }\r\n }\r\n if (leftEnd.bottom < rightStart.top)\r\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\r\n }\r\n\r\n output.appendChild(fragment);\r\n}", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n iterateBidiSections(getOrder(lineObj, doc.direction), fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir) {\n var leftPos = coords(from, \"left\"), rightPos, left, right;\n if (from == to) {\n rightPos = leftPos;\n left = right = leftPos.left;\n } else {\n rightPos = coords(to - 1, \"right\");\n if (dir == \"rtl\") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }\n left = leftPos.left;\n right = rightPos.right;\n }\n if (fromArg == null && from == 0) { left = leftSide; }\n if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part\n add(left, leftPos.top, null, leftPos.bottom);\n left = leftSide;\n if (leftPos.bottom < rightPos.top) { add(left, leftPos.bottom, null, rightPos.top); }\n }\n if (toArg == null && to == lineLen) { right = rightSide; }\n if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)\n { start = leftPos; }\n if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)\n { end = rightPos; }\n if (left < leftSide + 1) { left = leftSide; }\n add(left, rightPos.top, right - left, rightPos.bottom);\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n}", "function drawSelectionRange(cm, range, output) {\r\n var display = cm.display, doc = cm.doc;\r\n var fragment = document.createDocumentFragment();\r\n var padding = paddingH(cm.display), leftSide = padding.left, rightSide = display.lineSpace.offsetWidth - padding.right;\r\n\r\n function add(left, top, width, bottom) {\r\n if (top < 0) top = 0;\r\n top = Math.round(top);\r\n bottom = Math.round(bottom);\r\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", \"position: absolute; left: \" + left +\r\n \"px; top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) +\r\n \"px; height: \" + (bottom - top) + \"px\"));\r\n }\r\n\r\n function drawForLine(line, fromArg, toArg) {\r\n var lineObj = getLine(doc, line);\r\n var lineLen = lineObj.text.length;\r\n var start, end;\r\n function coords(ch, bias) {\r\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias);\r\n }\r\n\r\n iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {\r\n var leftPos = coords(from, \"left\"), rightPos, left, right;\r\n if (from == to) {\r\n rightPos = leftPos;\r\n left = right = leftPos.left;\r\n } else {\r\n rightPos = coords(to - 1, \"right\");\r\n if (dir == \"rtl\") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }\r\n left = leftPos.left;\r\n right = rightPos.right;\r\n }\r\n if (fromArg == null && from == 0) left = leftSide;\r\n if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part\r\n add(left, leftPos.top, null, leftPos.bottom);\r\n left = leftSide;\r\n if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);\r\n }\r\n if (toArg == null && to == lineLen) right = rightSide;\r\n if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)\r\n start = leftPos;\r\n if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)\r\n end = rightPos;\r\n if (left < leftSide + 1) left = leftSide;\r\n add(left, rightPos.top, right - left, rightPos.bottom);\r\n });\r\n return {start: start, end: end};\r\n }\r\n\r\n var sFrom = range.from(), sTo = range.to();\r\n if (sFrom.line == sTo.line) {\r\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\r\n } else {\r\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\r\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\r\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\r\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\r\n if (singleVLine) {\r\n if (leftEnd.top < rightStart.top - 2) {\r\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\r\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\r\n } else {\r\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\r\n }\r\n }\r\n if (leftEnd.bottom < rightStart.top)\r\n add(leftSide, leftEnd.bottom, null, rightStart.top);\r\n }\r\n\r\n output.appendChild(fragment);\r\n }", "function drawSelectionRange(cm, range, output) {\n\t var display = cm.display, doc = cm.doc;\n\t var fragment = document.createDocumentFragment();\n\t var padding = paddingH(cm.display), leftSide = padding.left;\n\t var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n\n\t function add(left, top, width, bottom) {\n\t if (top < 0) top = 0;\n\t top = Math.round(top);\n\t bottom = Math.round(bottom);\n\t fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", \"position: absolute; left: \" + left +\n\t \"px; top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) +\n\t \"px; height: \" + (bottom - top) + \"px\"));\n\t }\n\n\t function drawForLine(line, fromArg, toArg) {\n\t var lineObj = getLine(doc, line);\n\t var lineLen = lineObj.text.length;\n\t var start, end;\n\t function coords(ch, bias) {\n\t return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias);\n\t }\n\n\t iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {\n\t var leftPos = coords(from, \"left\"), rightPos, left, right;\n\t if (from == to) {\n\t rightPos = leftPos;\n\t left = right = leftPos.left;\n\t } else {\n\t rightPos = coords(to - 1, \"right\");\n\t if (dir == \"rtl\") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }\n\t left = leftPos.left;\n\t right = rightPos.right;\n\t }\n\t if (fromArg == null && from == 0) left = leftSide;\n\t if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part\n\t add(left, leftPos.top, null, leftPos.bottom);\n\t left = leftSide;\n\t if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);\n\t }\n\t if (toArg == null && to == lineLen) right = rightSide;\n\t if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)\n\t start = leftPos;\n\t if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)\n\t end = rightPos;\n\t if (left < leftSide + 1) left = leftSide;\n\t add(left, rightPos.top, right - left, rightPos.bottom);\n\t });\n\t return {start: start, end: end};\n\t }\n\n\t var sFrom = range.from(), sTo = range.to();\n\t if (sFrom.line == sTo.line) {\n\t drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n\t } else {\n\t var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n\t var singleVLine = visualLine(fromLine) == visualLine(toLine);\n\t var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n\t var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n\t if (singleVLine) {\n\t if (leftEnd.top < rightStart.top - 2) {\n\t add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n\t add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n\t } else {\n\t add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n\t }\n\t }\n\t if (leftEnd.bottom < rightStart.top)\n\t add(leftSide, leftEnd.bottom, null, rightStart.top);\n\t }\n\n\t output.appendChild(fragment);\n\t }", "function drawSelectionRange(cm, range, output) {\n\t var display = cm.display, doc = cm.doc;\n\t var fragment = document.createDocumentFragment();\n\t var padding = paddingH(cm.display), leftSide = padding.left;\n\t var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n\n\t function add(left, top, width, bottom) {\n\t if (top < 0) top = 0;\n\t top = Math.round(top);\n\t bottom = Math.round(bottom);\n\t fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", \"position: absolute; left: \" + left +\n\t \"px; top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) +\n\t \"px; height: \" + (bottom - top) + \"px\"));\n\t }\n\n\t function drawForLine(line, fromArg, toArg) {\n\t var lineObj = getLine(doc, line);\n\t var lineLen = lineObj.text.length;\n\t var start, end;\n\t function coords(ch, bias) {\n\t return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias);\n\t }\n\n\t iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {\n\t var leftPos = coords(from, \"left\"), rightPos, left, right;\n\t if (from == to) {\n\t rightPos = leftPos;\n\t left = right = leftPos.left;\n\t } else {\n\t rightPos = coords(to - 1, \"right\");\n\t if (dir == \"rtl\") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }\n\t left = leftPos.left;\n\t right = rightPos.right;\n\t }\n\t if (fromArg == null && from == 0) left = leftSide;\n\t if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part\n\t add(left, leftPos.top, null, leftPos.bottom);\n\t left = leftSide;\n\t if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);\n\t }\n\t if (toArg == null && to == lineLen) right = rightSide;\n\t if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)\n\t start = leftPos;\n\t if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)\n\t end = rightPos;\n\t if (left < leftSide + 1) left = leftSide;\n\t add(left, rightPos.top, right - left, rightPos.bottom);\n\t });\n\t return {start: start, end: end};\n\t }\n\n\t var sFrom = range.from(), sTo = range.to();\n\t if (sFrom.line == sTo.line) {\n\t drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n\t } else {\n\t var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n\t var singleVLine = visualLine(fromLine) == visualLine(toLine);\n\t var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n\t var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n\t if (singleVLine) {\n\t if (leftEnd.top < rightStart.top - 2) {\n\t add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n\t add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n\t } else {\n\t add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n\t }\n\t }\n\t if (leftEnd.bottom < rightStart.top)\n\t add(leftSide, leftEnd.bottom, null, rightStart.top);\n\t }\n\n\t output.appendChild(fragment);\n\t }", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n }", "function drawSelectionRange(cm, range, output) {\n var display = cm.display, doc = cm.doc\n var fragment = document.createDocumentFragment()\n var padding = paddingH(cm.display), leftSide = padding.left\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0 }\n top = Math.round(top)\n bottom = Math.round(bottom)\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")))\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line)\n var lineLen = lineObj.text.length\n var start, end\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir) {\n var leftPos = coords(from, \"left\"), rightPos, left, right\n if (from == to) {\n rightPos = leftPos\n left = right = leftPos.left\n } else {\n rightPos = coords(to - 1, \"right\")\n if (dir == \"rtl\") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp }\n left = leftPos.left\n right = rightPos.right\n }\n if (fromArg == null && from == 0) { left = leftSide }\n if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part\n add(left, leftPos.top, null, leftPos.bottom)\n left = leftSide\n if (leftPos.bottom < rightPos.top) { add(left, leftPos.bottom, null, rightPos.top) }\n }\n if (toArg == null && to == lineLen) { right = rightSide }\n if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)\n { start = leftPos }\n if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)\n { end = rightPos }\n if (left < leftSide + 1) { left = leftSide }\n add(left, rightPos.top, right - left, rightPos.bottom)\n })\n return {start: start, end: end}\n }\n\n var sFrom = range.from(), sTo = range.to()\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch)\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line)\n var singleVLine = visualLine(fromLine) == visualLine(toLine)\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom)\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom)\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom)\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top) }\n }\n\n output.appendChild(fragment)\n}", "function drawSelectionRange(cm, range, output) {\n\t var display = cm.display, doc = cm.doc;\n\t var fragment = document.createDocumentFragment();\n\t var padding = paddingH(cm.display), leftSide = padding.left;\n\t var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n\t\n\t function add(left, top, width, bottom) {\n\t if (top < 0) top = 0;\n\t top = Math.round(top);\n\t bottom = Math.round(bottom);\n\t fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", \"position: absolute; left: \" + left +\n\t \"px; top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) +\n\t \"px; height: \" + (bottom - top) + \"px\"));\n\t }\n\t\n\t function drawForLine(line, fromArg, toArg) {\n\t var lineObj = getLine(doc, line);\n\t var lineLen = lineObj.text.length;\n\t var start, end;\n\t function coords(ch, bias) {\n\t return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias);\n\t }\n\t\n\t iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {\n\t var leftPos = coords(from, \"left\"), rightPos, left, right;\n\t if (from == to) {\n\t rightPos = leftPos;\n\t left = right = leftPos.left;\n\t } else {\n\t rightPos = coords(to - 1, \"right\");\n\t if (dir == \"rtl\") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }\n\t left = leftPos.left;\n\t right = rightPos.right;\n\t }\n\t if (fromArg == null && from == 0) left = leftSide;\n\t if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part\n\t add(left, leftPos.top, null, leftPos.bottom);\n\t left = leftSide;\n\t if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);\n\t }\n\t if (toArg == null && to == lineLen) right = rightSide;\n\t if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)\n\t start = leftPos;\n\t if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)\n\t end = rightPos;\n\t if (left < leftSide + 1) left = leftSide;\n\t add(left, rightPos.top, right - left, rightPos.bottom);\n\t });\n\t return {start: start, end: end};\n\t }\n\t\n\t var sFrom = range.from(), sTo = range.to();\n\t if (sFrom.line == sTo.line) {\n\t drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n\t } else {\n\t var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n\t var singleVLine = visualLine(fromLine) == visualLine(toLine);\n\t var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n\t var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n\t if (singleVLine) {\n\t if (leftEnd.top < rightStart.top - 2) {\n\t add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n\t add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n\t } else {\n\t add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n\t }\n\t }\n\t if (leftEnd.bottom < rightStart.top)\n\t add(leftSide, leftEnd.bottom, null, rightStart.top);\n\t }\n\t\n\t output.appendChild(fragment);\n\t }", "function drawSelectionRange(cm, range, output) {\n var display = cm.display, doc = cm.doc\n var fragment = document.createDocumentFragment()\n var padding = paddingH(cm.display), leftSide = padding.left\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0 }\n top = Math.round(top)\n bottom = Math.round(bottom)\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")))\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line)\n var lineLen = lineObj.text.length\n var start, end\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n iterateBidiSections(getOrder(lineObj, doc.direction), fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir) {\n var leftPos = coords(from, \"left\"), rightPos, left, right\n if (from == to) {\n rightPos = leftPos\n left = right = leftPos.left\n } else {\n rightPos = coords(to - 1, \"right\")\n if (dir == \"rtl\") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp }\n left = leftPos.left\n right = rightPos.right\n }\n if (fromArg == null && from == 0) { left = leftSide }\n if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part\n add(left, leftPos.top, null, leftPos.bottom)\n left = leftSide\n if (leftPos.bottom < rightPos.top) { add(left, leftPos.bottom, null, rightPos.top) }\n }\n if (toArg == null && to == lineLen) { right = rightSide }\n if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)\n { start = leftPos }\n if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)\n { end = rightPos }\n if (left < leftSide + 1) { left = leftSide }\n add(left, rightPos.top, right - left, rightPos.bottom)\n })\n return {start: start, end: end}\n }\n\n var sFrom = range.from(), sTo = range.to()\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch)\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line)\n var singleVLine = visualLine(fromLine) == visualLine(toLine)\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom)\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom)\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom)\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top) }\n }\n\n output.appendChild(fragment)\n}", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n}", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n}", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n}", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n}", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n}", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n}", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n}", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n}", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n}", "function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var fromPos = coords(from, dir == \"ltr\" ? \"left\" : \"right\");\n var toPos = coords(to - 1, dir == \"ltr\" ? \"right\" : \"left\");\n if (dir == \"ltr\") {\n var fromLeft = fromArg == null && from == 0 ? leftSide : fromPos.left;\n var toRight = toArg == null && to == lineLen ? rightSide : toPos.right;\n if (toPos.top - fromPos.top <= 3) { // Single line\n add(fromLeft, toPos.top, toRight - fromLeft, toPos.bottom);\n } else { // Multiple lines\n add(fromLeft, fromPos.top, null, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(leftSide, toPos.top, toPos.right, toPos.bottom);\n }\n } else if (from < to) { // RTL\n var fromRight = fromArg == null && from == 0 ? rightSide : fromPos.right;\n var toLeft = toArg == null && to == lineLen ? leftSide : toPos.left;\n if (toPos.top - fromPos.top <= 3) { // Single line\n add(toLeft, toPos.top, fromRight - toLeft, toPos.bottom);\n } else { // Multiple lines\n var topLeft = leftSide;\n if (i) {\n var topEnd = wrappedLineExtentChar(cm, lineObj, null, from).end;\n // The coordinates returned for an RTL wrapped space tend to\n // be complete bogus, so try to skip that here.\n topLeft = coords(topEnd - (/\\s/.test(lineObj.text.charAt(topEnd - 1)) ? 2 : 1), \"left\").left;\n }\n add(topLeft, fromPos.top, fromRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n var botWidth = null;\n if (i < order.length - 1 || true) {\n var botStart = wrappedLineExtentChar(cm, lineObj, null, to).begin;\n botWidth = coords(botStart, \"right\").right - toLeft;\n }\n add(toLeft, toPos.top, botWidth, toPos.bottom);\n }\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n}", "highlightRange(range) {\n let span = document.createElement('span');\n span.classList.add(SELECTED_CLS);\n let spans = [span];\n\n // If the selection starts and ends in different containers\n if (range.startContainer !== range.endContainer) {\n let startRange = new Range();\n let startSpan = span.cloneNode();\n startRange.setStart(range.startContainer, range.startOffset);\n startRange.setEnd(range.startContainer, range.startContainer.length);\n startRange.surroundContents(startSpan);\n spans.push(startSpan);\n\n let endRange = new Range();\n let endSpan = span.cloneNode();\n endRange.setStart(range.endContainer, 0);\n endRange.setEnd(range.endContainer, range.endOffset);\n endRange.surroundContents(endSpan);\n spans.push(endSpan);\n\n // Get nodes between the start and end containers\n let betweenNodes = getBetweenNodes(startSpan, endSpan, range.commonAncestorContainer);\n betweenNodes.forEach((n) => {\n let range = new Range();\n if (n instanceof Text) {\n let s = span.cloneNode();\n range.setStart(n, 0);\n range.setEnd(n, n.length);\n range.surroundContents(s);\n spans.push(s);\n } else {\n // Just re-use existing span\n n.classList.add(SELECTED_CLS);\n [...n.querySelectorAll('span')].forEach((s) => {\n s.classList.add(SELECTED_CLS);\n });\n }\n });\n } else {\n range.surroundContents(span);\n }\n return spans;\n }", "function highlight() {\n if (window.getSelection) {\n var selection = window.getSelection();\n if (selection.rangeCount) {\n var range = selection.getRangeAt(0).cloneRange();\n var highlightNode = document.createElement(\"span\");\n highlightNode.setAttribute(\"id\", \"highlighted\");\n highlightNode.setAttribute(\"style\", \"background-color:#FFFF00\");\n range.surroundContents(highlightNode);\n selection.removeAllRanges();\n }\n }\n}", "function selectRange(range, window) {\n var selection = window.getSelection();\n selection.removeAllRanges();\n selection.addRange(range);\n }", "function drawSelections() {\n\t\thideSelectionRect();\n\t}", "highlight_correct() {\n\t\t\tthis.selection_board.get_shape(this.shape).set_highlight('green');\n\t\t\tthis.selection_board.draw();\n\t\t}", "function applySelection(data){\n\n if(data.user != username){\n\n var editorSession = editor.getSession();\n var start = data.range.start;\n var end = data.range.end;\n var r = new Range(start.row, start.column, end.row, end.column);\n var lineStyle = isDriver ? \"navigator\" : \"driver\";\n\n for(var i in editorSession.getMarkers(false)){\n editorSession.removeMarker(i);\n }\n\n editorSession.addMarker(r, \"line-style-\" + lineStyle, \"text\", false);\n }\n}", "function drawSelection() {\n\t\t\tif(prevSelection != null &&\n\t\t\t\tselection.first.x == prevSelection.first.x &&\n\t\t\t\tselection.first.y == prevSelection.first.y && \n\t\t\t\tselection.second.x == prevSelection.second.x &&\n\t\t\t\tselection.second.y == prevSelection.second.y)\n\t\t\t\treturn;\n\t\t\t\n\t\t\toctx.strokeStyle = parseColor(options.selection.color).scale(null, null, null, 0.8).toString();\n\t\t\toctx.lineWidth = 1;\n\t\t\tctx.lineJoin = 'round';\n\t\t\toctx.fillStyle = parseColor(options.selection.color).scale(null, null, null, 0.4).toString();\n\n\t\t\tprevSelection = { first: { x: selection.first.x,\n\t\t\t\t\t\t\t\t\t\ty: selection.first.y },\n\t\t\t\t\t\t\t second: { x: selection.second.x,\n\t\t\t\t\t\t\t\t\t\ty: selection.second.y } };\n\n\t\t\tvar x = Math.min(selection.first.x, selection.second.x),\n\t\t\t\ty = Math.min(selection.first.y, selection.second.y),\n\t\t\t\tw = Math.abs(selection.second.x - selection.first.x),\n\t\t\t\th = Math.abs(selection.second.y - selection.first.y);\n\t\t\t\n\t\t\toctx.fillRect(x + plotOffset.left, y + plotOffset.top, w, h);\n\t\t\toctx.strokeRect(x + plotOffset.left, y + plotOffset.top, w, h);\n\t\t}", "function updateDrawSelectionRectangle(x, y, w, h) {\r\n d3.selectAll(\".selection\")\r\n .attr(\"x\", x)\r\n .attr(\"y\", y)\r\n .attr(\"width\", w)\r\n .attr(\"height\", h);\r\n return;\r\n}", "function render_range(selection, i, max, opacity) {\n\t\tvar j=0;\n\t\tvar k=null;\n\t\t\n\t\tangular.forEach(selection.slice(i,max),function(d) {\n\t\t var o = {}; \n\t\t for(key in d){\n\t\t\t\t o[key]=d[key];\n\t\t\t break;\n\t\t }\n\t\t for(k in o){\n\t\t\t path(d, foreground, color(o[k],opacity));\n\t\t }\n\t\t j++;\n\t });\n\t}", "function SelectionRegion() {}", "function SelectionRegion() {}", "function drawSelectionCursor(cm, range, output) {\n var pos = cursorCoords(cm, range.head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n }", "function drawSelectionCursor(cm, range, output) {\n var pos = cursorCoords(cm, range.head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n }", "function drawSelectionCursor(cm, range, output) {\n var pos = cursorCoords(cm, range.head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n }", "function drawSelectionCursor(cm, range, output) {\n var pos = cursorCoords(cm, range.head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n }", "function drawSelectionCursor(cm, range, output) {\n var pos = cursorCoords(cm, range.head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n }", "function drawSelectionCursor(cm, range, output) {\n var pos = cursorCoords(cm, range.head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n }", "function drawSelectionCursor(cm, range, output) {\n var pos = cursorCoords(cm, range.head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n }", "function selectionChange(e) {\n var pointRng;\n\n // Check if the button is down or not\n if (e.button) {\n // Create range from mouse position\n pointRng = rngFromPoint(e.pageX, e.pageY);\n\n if (pointRng) {\n // Check if pointRange is before/after selection then change the endPoint\n if (pointRng.compareEndPoints('StartToStart', startRng) > 0)\n pointRng.setEndPoint('StartToStart', startRng);\n else\n pointRng.setEndPoint('EndToEnd', startRng);\n\n pointRng.select();\n }\n } else {\n endSelection();\n }\n }", "function drawSelectionCursor(cm, range, output) {\r\n var pos = cursorCoords(cm, range.head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\r\n\r\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\r\n cursor.style.left = pos.left + \"px\";\r\n cursor.style.top = pos.top + \"px\";\r\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\r\n\r\n if (pos.other) {\r\n // Secondary cursor, shown when on a 'jump' in bi-directional text\r\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\r\n otherCursor.style.display = \"\";\r\n otherCursor.style.left = pos.other.left + \"px\";\r\n otherCursor.style.top = pos.other.top + \"px\";\r\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\r\n }\r\n }", "function render_range(selection, i, max, opacity) {\n selection.slice(i,max).forEach(function(d) {\n path(d, foreground, color(d.group,opacity));\n });\n}", "function updateRangeSelection() {\n\td3.selectAll('#details div.range').style('display', function() {\n\t\treturn (d3.select(this).classed(sn.runtime.powerIOAreaParameters.aggregate.toLowerCase()) ? 'block' : 'none');\n\t});\n}", "function highlight(target){\n var opts = $.data(target, 'timespinner').options;\n var start = 0, end = 0;\n if (opts.highlight == 0){\n start = 0;\n end = 2;\n } else if (opts.highlight == 1){\n start = 3;\n end = 5;\n } else if (opts.highlight == 2){\n start = 6;\n end = 8;\n }\n if (target.selectionStart != null){\n target.setSelectionRange(start, end);\n } else if (target.createTextRange){\n var range = target.createTextRange();\n range.collapse();\n range.moveEnd('character', end);\n range.moveStart('character', start);\n range.select();\n }\n $(target).focus();\n }", "setSelectionRange(range) {\n this.editor.selection = new vscode.Selection(range.start.row, range.start.column, range.end.row, range.end.column);\n }", "function updateRangeSelection() {\n\td3.selectAll('#details div.range').style('display', function() {\n\t\treturn (d3.select(this).classed(sn.runtime.energyBarOverlapParameters.aggregate.toLowerCase()) ? 'block' : 'none');\n\t});\n}", "function highlight() {\n d3.select(this).classed('selected', true)\n }", "function unHighlight() {\n if (window.getSelection) {\n var selection = window.getSelection();\n if (selection.rangeCount) {\n\n var highlightNode = document.createElement(\"span\");\n highlightNode.setAttribute(\"id\", \"highlighted\");\n highlightNode.setAttribute(\"style\", \"background-color:#FFFF00\");\n\n var range = selection.getRangeAt(0).cloneRange();\n var node = $(range.commonAncestorContainer);\n\n var previousRange = document.createRange();\n previousRange.setStart(range.startContainer, 0);\n previousRange.setEnd(range.startContainer, range.startOffset);\n\n var nextRange = document.createRange();\n nextRange.setStart(range.endContainer, range.endOffset);\n nextRange.setEnd(range.endContainer, 0);\n\n node.unwrap();\n previousRange.surroundContents(highlightNode);\n nextRange.surroundContents(highlightNode);\n\n selection.removeAllRanges();\n selection.addRange(previousRange);\n selection.addRange(nextRange);\n }\n }\n}", "function drawSelectionSquare() {\n // Draw directly on the main graphics\n graphics2D.lineStyle(2, 0x00FF00, 1);\n graphics2D.drawRect(rendererGeneralState.eventState.lastDownPoint.x, rendererGeneralState.eventState.lastDownPoint.y, (rendererGeneralState.eventState.currentPoint.x - rendererGeneralState.eventState.lastDownPoint.x), (rendererGeneralState.eventState.currentPoint.y - rendererGeneralState.eventState.lastDownPoint.y));\n }", "function notifyRangeCoords() {\n var coords = getSelectionCoords();\n window.TextSelection.jsLog(\"logRangeCoords \" + coords.left + \"-\" + coords.top + \"-\" + coords.bottom + \"-\" + coords.right);\n\n var sel = getSelectionColorAndFontSize();\n var fontSize = 0;\n if (sel) {\n fontSize = sel.fontSize;\n window.TextSelection.jsLog(\"logRangeCoords font \" + fontSize);\n }\n\n window.TextSelection.notifyRangeCoords(parseInt(coords.left, 10),\n parseInt(coords.top, 10),\n parseInt(coords.bottom, 10),\n parseInt(coords.right, 10),\n parseInt(fontSize, 10));\n}", "function highlightAnnotation(range, role){\n var s = range.start;\n var e = range.end;\n var r = new Range(s.row, s.column, e.row, e.column);\n currentHighlight = editor.getSession().addMarker(r,\"line-style-\" + role, \"text\");\n}", "function restoreSelection(range) {\n if (range) {\n if (window.getSelection) {\n sel = window.getSelection();\n sel.removeAllRanges();\n sel.addRange(range);\n } else if (document.selection && range.select) {\n range.select();\n }\n }\n }", "highlightSelection(isSelectionChanged) {\n if (this.owner.enableImageResizerMode) {\n this.owner.imageResizerModule.hideImageResizer();\n }\n if (this.isEmpty) {\n if (this.isHideSelection(this.start.paragraph)) {\n this.hideCaret();\n return;\n }\n this.updateCaretPosition();\n }\n else {\n if (this.isForward) {\n this.highlightSelectedContent(this.start, this.end);\n }\n else {\n this.highlightSelectedContent(this.end, this.start);\n }\n if (this.viewer.isComposingIME) {\n this.updateCaretPosition();\n }\n }\n this.viewer.updateTouchMarkPosition();\n if (isSelectionChanged) {\n this.viewer.scrollToPosition(this.start, this.end);\n }\n }", "function selectionChange(e) {\n\t\t\t\tvar pointRng;\n\n\t\t\t\t// Check if the button is down or not\n\t\t\t\tif (e.button) {\n\t\t\t\t\t// Create range from mouse position\n\t\t\t\t\tpointRng = rngFromPoint(e.x, e.y);\n\n\t\t\t\t\tif (pointRng) {\n\t\t\t\t\t\t// Check if pointRange is before/after selection then change the endPoint\n\t\t\t\t\t\tif (pointRng.compareEndPoints('StartToStart', startRng) > 0) {\n\t\t\t\t\t\t\tpointRng.setEndPoint('StartToStart', startRng);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpointRng.setEndPoint('EndToEnd', startRng);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tpointRng.select();\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tendSelection();\n\t\t\t\t}\n\t\t\t}", "function selectionChange(e) {\n\t\t\t\tvar pointRng;\n\n\t\t\t\t// Check if the button is down or not\n\t\t\t\tif (e.button) {\n\t\t\t\t\t// Create range from mouse position\n\t\t\t\t\tpointRng = rngFromPoint(e.x, e.y);\n\n\t\t\t\t\tif (pointRng) {\n\t\t\t\t\t\t// Check if pointRange is before/after selection then change the endPoint\n\t\t\t\t\t\tif (pointRng.compareEndPoints('StartToStart', startRng) > 0) {\n\t\t\t\t\t\t\tpointRng.setEndPoint('StartToStart', startRng);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpointRng.setEndPoint('EndToEnd', startRng);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tpointRng.select();\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tendSelection();\n\t\t\t\t}\n\t\t\t}", "function selectionChange(e) {\n\t\t\t\tvar pointRng;\n\n\t\t\t\t// Check if the button is down or not\n\t\t\t\tif (e.button) {\n\t\t\t\t\t// Create range from mouse position\n\t\t\t\t\tpointRng = rngFromPoint(e.x, e.y);\n\n\t\t\t\t\tif (pointRng) {\n\t\t\t\t\t\t// Check if pointRange is before/after selection then change the endPoint\n\t\t\t\t\t\tif (pointRng.compareEndPoints('StartToStart', startRng) > 0) {\n\t\t\t\t\t\t\tpointRng.setEndPoint('StartToStart', startRng);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpointRng.setEndPoint('EndToEnd', startRng);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tpointRng.select();\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tendSelection();\n\t\t\t\t}\n\t\t\t}", "function TStylingRange() {}", "function TStylingRange() {}", "selectRange(startPosition, endPosition) {\n this.start.setPositionInternal(startPosition);\n this.end.setPositionInternal(endPosition);\n this.upDownSelectionLength = this.end.location.x;\n this.fireSelectionChanged(true);\n }", "function TStylingRange() { }", "function highlight_period(x_start, x_end, color) {\n var width = x_end - x_start;\n canvas.fillStyle = color;\n canvas.fillRect(x_start, area.y, width, area.h);\n }", "function createHighlight() {\n\n let highlightElement = document.createElement(\"div\");\n highlightElement.style.zIndex = 0;\n\n let boundingClientRect = window.getSelection().getRangeAt(0).getBoundingClientRect();\n\n highlightElement.style.position = \"absolute\";\n highlightElement.style.left = `${boundingClientRect.left}px`;\n highlightElement.style.top = `${boundingClientRect.top}px`;\n highlightElement.style.width = `${boundingClientRect.width}px`;\n highlightElement.style.height = `${boundingClientRect.height}px`;\n\n highlightElement.style.backgroundColor = 'yellow';\n highlightElement.style.opacity=\"0.3\";\n\n // FIXME: insert this into the page element.. to the parent div... there is a\n // get common parent method that I should probably use.\n\n document.body.appendChild(highlightElement);\n\n // FIXME: now clear the selection once this is done.\n\n // FIXME: the highlight should/could be BELOW the text and probably should\n // be until it's deleted I think.\n\n}", "function setSelectionRange( rangeStart, rangeEnd )\n {\n // Check which way we need to define the text range.\n if( this.createTextRange )\n {\n var range = this.createTextRange();\n range.collapse( true );\n range.moveStart( 'character',\trangeStart );\n range.moveEnd( 'character',\t\trangeEnd-rangeStart );\n range.select();\n }\n\n // Alternate setSelectionRange method for supporting browsers.\n else if( this.setSelectionRange )\n {\n this.focus();\n this.setSelectionRange( rangeStart, rangeEnd );\n }\n }", "function highlightMultiple(start, end, passage, id) {\n // ignore margins between elements\n $(passage).find('#selection').contents().unwrap();\n if(start.is(end)) { // single element\n $(start).wrapAll(\"<span class='term event\" + id + \"term' id='selection'/>\");\n } else { // if range of elements\n if($(passage).find('span').index(start) > $(passage).find('span').index(end)) { // swap if end is before start\n var temp = end;\n end = start;\n start = temp;\n }\n \n \n if(!start.parent().not($('#selection')).is(end.parent().not($('#selection')))) {\n // common parent element\n var common = end.parents().not($('#selection')).has(start).first();\n \n if(start.parent('.term').not(common).length) { // if word has a parent term\n start = $(common).children().has(start);\n // $(start).parent('.term');\n }\n \n if(end.parent('.term').not(common).length) {\n end = $(common).children().has(end);\n //end = $(end).parent('.term');\n }\n }\n // highlight range\n $(start).nextUntil(end.next()).andSelf().wrapAll(\"<span class='term event\" + id + \"term' id='selection' />\");\n }\n }", "function drawHighlights() {\n for (let i = 0; i < currentScenario.sceneObjects.length; i++) {\n let object = currentScenario.sceneObjects[i];\n if (object.isSelected(mousePosX, mousePosY)) {\n context.beginPath();\n context.strokeStyle = 'red';\n context.strokeRect(object.x, object.y, object.width, object.height);\n context.closePath();\n return;\n }\n }\n}", "highlight(on) { }", "function selectRange() {\n var frstSelect = selectedEles[0];\n var lstSelect = selectedEles[selectedEles.length - 1];\n if (cols) {\n var flipStart = flipFlipIdx(Math.min(flipIdx(selectionMinPivot), flipIdx(selectionMaxPivot),\n flipIdx(frstSelect), flipIdx(lstSelect)));\n var flipEnd = flipFlipIdx(Math.max(flipIdx(selectionMinPivot), flipIdx(selectionMaxPivot),\n flipIdx(frstSelect), flipIdx(lstSelect)));\n selectElemsDownRows(Math.min(flipStart, flipEnd), Math.max(flipStart, flipEnd));\n } else {\n var start = Math.min(selectionMinPivot, frstSelect);\n var end = Math.max(selectionMaxPivot, lstSelect);\n selectElemRange(start, end);\n }\n }", "function createSelectionRect() {\r\n selectionRect = that.surface.createRect({\r\n x: that.width, y: that.height, \r\n width: 1, height: 1}).\r\n setFill(\"yellow\");\r\n }", "function rangeMouseOver(color) {\n $(\"#rangeMouseOver\").html(makeSwatch(color, principal, principal));\n}", "function highlight_rects() {\n var all = qt.query(null, null);\n var mouse = stage.getMousePosition();\n // specifically ask for no filtering\n var ids = qt.query({x:mouse.x, y:mouse.y, w:1, h:1}, null, true);\n\n // recolor everything\n for (var i = 0; i < all.length; i++) {\n var obj = qt.obj_ids[all[i]];\n obj.rect.clear();\n obj.rect.beginFill(0x0077AA);\n obj.rect.drawRect(obj.x, obj.y, obj.w, obj.h);\n }\n // 'highlight' moused-over nodes\n for (var i = 0; i < ids.length; i++) {\n var obj = qt.obj_ids[ids[i]];\n obj.rect.clear();\n obj.rect.beginFill(0xFF0000);\n obj.rect.drawRect(obj.x, obj.y, obj.w, obj.h);\n }\n}", "function setSelectionRange(input, selectionStart, selectionEnd) {\n if (input.setSelectionRange) {\n input.focus();\n //input.setSelectionRange(selectionStart, selectionEnd);\n input.selectionStart=selectionStart;\n input.selectionEnd=selectionEnd;\n }\n else if (input.createTextRange) {\n var range = input.createTextRange();\n range.collapse(true);\n range.moveEnd('character', selectionEnd);\n range.moveStart('character', selectionStart);\n range.select();\n }\n}", "function Selection (ranges) {\n this.ranges = ranges || [];\n }", "function reselect(myWindow, startOffset, endOffset, startIndex, endIndex) {\n //scroll to the position\n //myWindow.document.getElementById(\"document\").scrollTo(0, yPosition);\n\n //reselect the selection using startIndex and endIndex\n let documentNode = myWindow.document.getElementById(\"document\");\n let node = documentNode.firstElementChild;\n let i = 0;\n let startNode;\n let endNode;\n\n while (node) {\n if (i == startIndex) {\n startNode = node;\n }\n if (i == endIndex) {\n endNode = node;\n }\n i++;\n node = node.nextElementSibling || node.nextSibling;\n }\n console.log(startNode);\n console.log(endNode);\n\n //re-create the selection using offset\n const newRange = new Range();\n console.log(startNode.firstChild.firstChild);\n\n if (startNode.firstChild.nodeName == \"STRONG\") {\n console.log(\"start strong\");\n newRange.setStart(startNode.firstChild.firstChild, startOffset);\n } else {\n newRange.setStart(startNode.firstChild, startOffset);\n }\n\n if (endNode.firstChild.nodeName == \"STRONG\") {\n console.log(\"end strong\");\n newRange.setEnd(endNode.firstChild.firstChild, endOffset);\n } else {\n console.log(endNode.firstChild);\n newRange.setEnd(endNode.firstChild, endOffset);\n }\n\n let selection = myWindow.window.getSelection();\n selection.removeAllRanges();\n selection.addRange(newRange);\n}", "function highlightSelection(e) \n{\n selection = window.getSelection();\n \n //Skip this section if mouse event is undefined\n if (e != undefined)\n {\n \n //Ignore right clicks; avoids odd behavior with CTRL key\n if (e.button == 2)\n {\n return;\n }\n\n //Exit if CTRL key is held while auto highlight is checked on\n if(imedBool && e.ctrlKey)\n {\n return;\n }\n \n //Exit if CTRL key not held and auto highlight is checked off\n if(!imedBool && !e.ctrlKey)\n {\n return;\n }\n }\n \n var selectionTagName;\n //Avoid inputs like the plague..\n try {\n selectionTagName = selection.anchorNode.childNodes[0].tagName.toLowerCase();\n } catch (err) {\n //fail silently :-D\n }\n if (selectionTagName == \"input\") {\n return;\n }\n \n // Clear all highlights if requested\n if (clearBetweenSelections && highlightedPage == true)\n {\n clearHighlightsOnPage();\n }\n \n var selectedText = window.getSelection().toString().replace(/^\\s+|\\s+$/g, \"\");\n var testText = selectedText.toLowerCase();\n \n //Exit if selection is whitespace or what was previously selected\n if (selectedText == '' || lastText == testText)\n {\n return;\n }\n \n if (selection.toString() != '') {\n var mySpan = document.createElement(\"span\");\n var prevSpan = document.getElementById(\"mySelectedSpan\");\n if (prevSpan != null) {\n prevSpan.removeAttribute(\"id\");\n }\n mySpan.id = \"mySelectedSpan\";\n var range = selection.getRangeAt(0).cloneRange();\n mySpan.appendChild(range.extractContents());\n range.insertNode(mySpan);\n }\n \n //Perform highlighting\n localSearchHighlight(selectedText, singleSearch);\n highlightedPage = true;\n \n //Store processed selection for next time this method is called\n lastText = testText;\n if (selection.toString() != '') {\n if (!triggeredOnce) {\n triggeredOnce = !triggeredOnce;\n }\n }\n}", "function highlight(target, index){\n\t\tvar opts = $.data(target, 'timespinner').options;\n\t\tif (index != undefined){\n\t\t\topts.highlight = index;\n\t\t}\n\t\tvar range = opts.selections[opts.highlight];\n\t\tif (range){\n\t\t\tvar tb = $(target).timespinner('textbox');\n\t\t\t$(target).timespinner('setSelectionRange', {start:range[0],end:range[1]});\n\t\t\ttb.focus();\n\t\t}\n\t}", "function displaySelections(){\r\n //defaults\r\n Session.set('breaksOption','origOption');\r\n Session.set('highlightElement','line');\r\n Session.set('boldElement','boldLine');\r\n Session.set('syllablesVisible','true');\r\n Session.set('stressVisible', 'true');\r\n \r\n var selectionsCursor = Selections.find({poem_id:Session.get('currentPoem')});\r\n selectionsCursor.observe({\r\n //when something is added to the Selections Collection\r\n added: function (selection, beforeIndex) {\r\n var location = selection.location;\r\n var styleID = selection.style_id;\r\n var style = Styles.find({_id:styleID}).fetch();\r\n //used to catch errors\r\n if (style.length > 0){\r\n var layerNodeID = style[0].layer_id;\r\n var layerID = Layers.findOne({poem_id: Session.get('currentPoem'), id: layerNodeID})._id;\r\n //if selection is from highlighting style/layer\r\n if ((style[0].background_color !== null)&&(typeof style[0].background_color !== \"undefined\")) {\r\n var rgba = style[0].background_color;\r\n var lastIndex = rgba.lastIndexOf(\",\");\r\n var substring = rgba.substr(0, lastIndex+1);\r\n //check opacity of layer that made the selection\r\n var curRGBA = substring+' ';\r\n var op = Layers.findOne(layerID).opacity;\r\n var newRGBA = curRGBA+op+\")\";\r\n console.log(newRGBA);\r\n $(\".\"+location).css(\r\n {\r\n \"background\": newRGBA\r\n });\r\n }\r\n //if selection is from bolding style/layer\r\n if ((style[0].font_color !== null)&&(typeof style[0].font_color !== \"undefined\")) {\r\n var substring = style[0].font_color;\r\n $(\".\"+location).css(\r\n {\r\n \"color\": substring\r\n }\r\n );\r\n }\r\n //if selection is from bolding style/layer\r\n if ((style[0].bold !== null)&&(typeof style[0].bold !== \"undefined\")) {\r\n var substring = style[0].bold;\r\n if (substring){\r\n $(\".\"+location).css(\r\n {\r\n \"font-weight\": \"bold\"\r\n }\r\n );\r\n $(\".\"+location).addClass(\"bold\"+style[0].font_color);\r\n }\r\n }\r\n //if selection is from stressing style/layer\r\n if((style[0].verticalAlign !== null)&&(typeof style[0].verticalAlign !== \"undefined\")){\r\n location = location.substr(1);\r\n if (Session.get('stressVisible')==\"true\"){\r\n $('.'+location).css('vertical-align','super');\r\n }\r\n $('.'+location).addClass('stressStyle');\r\n }\r\n }\r\n },\r\n //when something is removed from the Selections Collection\r\n removed: function (selection, beforeIndex) {\r\n var location = selection.location;\r\n var styleID = selection.style_id;\r\n var curLayerNodeID = selection.layerNode_id;\r\n var style = Styles.find({_id:styleID}).fetch();\r\n console.log(style);\r\n //used to catch errors\r\n if (style.length > 0){\r\n //if removed is highlighting\r\n if ((style[0].background_color !== undefined)) {\r\n //must go through all selections that may have colored line/word/character to check and\r\n //see if after one background-color is turned off, there is another (from another layer)\r\n //still coloring that line/word/character\r\n var curRGBA = \"transparent\";\r\n var allSelections = Selections.find({poem_id: Session.get('currentPoem'), location: location}).fetch();\r\n console.log(allSelections);\r\n _.each(allSelections, function(sel){\r\n var piece = sel.style_id; \r\n var otherStyle = Styles.findOne({_id: piece});\r\n if ((otherStyle !== undefined)){\r\n if ((otherStyle.background_color !== undefined)){\r\n op = Layers.findOne({id:otherStyle.layer_id}).opacity;\r\n var rgba = otherStyle.background_color;\r\n var lastIndex = rgba.lastIndexOf(\",\");\r\n var substring = rgba.substr(0, lastIndex+1);\r\n //check opacity of layer that made the selection\r\n curRGBA = substring;\r\n var newRGBA = curRGBA+op+\")\";\r\n if (otherStyle.layer_id != curLayerNodeID){\r\n curRGBA = newRGBA;\r\n console.log(curRGBA);\r\n }\r\n }\r\n }\r\n });\r\n $(\".\"+location).css(\r\n {\r\n \"background-color\": curRGBA\r\n }\r\n );\r\n\r\n }\r\n //if removed selection is bolding\r\n if ((style[0].font_color !== null)&&(typeof style[0].font_color !== \"undefined\")) {\r\n $(\".\"+location).css(\r\n {\r\n \"color\": \"black\"\r\n }\r\n );\r\n $(\".\"+location).removeClass(\"bold\"+style[0].font_color);\r\n }\r\n //if removed selection is bolding\r\n if ((style[0].bold !== null)&&(typeof style[0].bold !== \"undefined\")) {\r\n //so that word can be bolded if line is bolded\r\n $(\".\"+location).css(\"font-weight\",\"\");\r\n $(\".\"+location).css(\"color\",\"\");\r\n }\r\n //if removed selection is stressing\r\n if((style[0].verticalAlign !== null)&&(typeof style[0].verticalAlign !== \"undefined\")){\r\n location = location.substr(1);\r\n $('.'+location).css('vertical-align','baseline');\r\n $('.'+location).removeClass('stressStyle');\r\n }\r\n }\r\n }\r\n });\r\n //handles additions/removals from SyllableMarkers Collection\r\n var syllablesCursor = SyllableMarkers.find({poem_id:Session.get('currentPoem')});\r\n syllablesCursor.observe({\r\n added: function (selection, beforeIndex) {\r\n var location = selection.location;\r\n if (Session.get('syllablesVisible')==\"true\"){\r\n $(\".\"+location).css(\r\n {\r\n \"border-left\": \"2px solid black\"\r\n });\r\n }\r\n $(\".\"+location).addClass('syllableStyle');\r\n //updates natural syllables\r\n var lineSpan = $('#'+location).closest('.line');\r\n var countSpan = $(lineSpan).find('.lineCount');\r\n var wordCount=$(lineSpan).find('.word').length;\r\n var sylCount=0;\r\n $(lineSpan).find('.letter').each(function(){\r\n if ($(this).hasClass(\"syllableStyle\")){\r\n sylCount++; \r\n }\r\n })\r\n $(countSpan).text(wordCount+sylCount);\r\n //updates other versions' syllable markers \r\n var lineSpanArray = $('.'+location).closest('.unnaturalLine');\r\n var countSpan1 = $(lineSpanArray[0]).find('.lineCount');\r\n var countSpan2 = $(lineSpanArray[1]).find('.lineCount');\r\n var wordArray1=$(lineSpanArray[0]).find('.word');\r\n var wordArray2=$(lineSpanArray[1]).find('.word');\r\n var wordCount1 = 0;\r\n var wordCount2 = 0;\r\n //don't count the awkward spaces created by new lines\r\n _.each(wordArray1, function(elem) {\r\n if ($(elem).text().trim() == \"\"){\r\n }\r\n else{\r\n wordCount1++;\r\n }\r\n });\r\n _.each(wordArray2, function(elem) {\r\n if ($(elem).text().trim() == \"\"){\r\n }\r\n else{\r\n wordCount2++;\r\n }\r\n });\r\n var sylCount1=0;\r\n var sylCount2=0; \r\n $(lineSpanArray[0]).find('.letter').each(function(){\r\n if ($(this).hasClass(\"syllableStyle\")){\r\n sylCount1++; \r\n }\r\n });\r\n $(lineSpanArray[1]).find('.letter').each(function(){\r\n if ($(this).hasClass(\"syllableStyle\")){\r\n sylCount2++; \r\n }\r\n });\r\n $(countSpan1).text(wordCount1+sylCount1);\r\n $(countSpan2).text(wordCount2+sylCount2);\r\n if ($('.syllablesGrid').data('gridded')===true){\r\n grid();\r\n grid();\r\n }\r\n },\r\n removed: function (selection, beforeIndex) {\r\n var location = selection.location;\r\n $(\".\"+location).css(\r\n {\r\n \"border-left\": \"none\"\r\n });\r\n $(\".\"+location).removeClass('syllableStyle');\r\n var lineSpan = $('#'+location).closest('.line');\r\n var countSpan = $(lineSpan).find('.lineCount');\r\n var wordCount=$(lineSpan).find('.word').length;\r\n var sylCount=0;\r\n $(lineSpan).find('.letter').each(function(){\r\n console.log($(this).css(\"border-left\"));\r\n if ($(this).hasClass(\"syllableStyle\")){\r\n sylCount++; \r\n }\r\n })\r\n $(countSpan).text(wordCount+sylCount);\r\n //updates other versions' syllable markers \r\n var lineSpanArray = $('.'+location).closest('.unnaturalLine');\r\n var countSpan1 = $(lineSpanArray[0]).find('.lineCount');\r\n var countSpan2 = $(lineSpanArray[1]).find('.lineCount');\r\n var wordArray1=$(lineSpanArray[0]).find('.word');\r\n var wordArray2=$(lineSpanArray[1]).find('.word');\r\n var wordCount1 = 0;\r\n var wordCount2 = 0;\r\n //don't count the awkward spaces created by new lines\r\n _.each(wordArray1, function(elem) {\r\n if ($(elem).text().trim() == \"\"){\r\n }\r\n else{\r\n wordCount1++;\r\n }\r\n });\r\n _.each(wordArray2, function(elem) {\r\n if ($(elem).text().trim() == \"\"){\r\n }\r\n else{\r\n wordCount2++;\r\n }\r\n });\r\n var sylCount1=0;\r\n var sylCount2=0; \r\n $(lineSpanArray[0]).find('.letter').each(function(){\r\n if ($(this).hasClass(\"syllableStyle\")){\r\n sylCount1++; \r\n }\r\n });\r\n $(lineSpanArray[1]).find('.letter').each(function(){\r\n if ($(this).hasClass(\"syllableStyle\")){\r\n sylCount2++; \r\n }\r\n });\r\n $(countSpan1).text(wordCount1+sylCount1);\r\n $(countSpan2).text(wordCount2+sylCount2);\r\n if ($('.syllablesGrid').data('gridded')===true){\r\n grid();\r\n grid();\r\n }\r\n },\r\n });\r\n //handles changes from Layers Collection\r\n var layersCursor = Layers.find({poem_id:Session.get('currentPoem')});\r\n layersCursor.observe({ \r\n added: function (selection, beforeIndex) {\r\n var sessionObj = Session.get(\"layersArray\");\r\n //if layer just created, user probably wants to use it, so default \"visible\"\r\n sessionObj[selection._id] = \"visible\";\r\n Session.set(\"layersArray\", sessionObj);\r\n },\r\n });\r\n\r\n}", "function showRange() {\n\n for (var i = 0; i < N; i += 1) {\n\n var state = algo.render.kS_GRAY;\n\n if (i >= LEFT && i <= RIGHT) {\n state = algo.render.kS_BLUE;\n }\n if (i === LEFT || i === RIGHT) {\n state = algo.render.kS_RED;\n }\n if (i === M1 || i === M2) {\n state = algo.render.kS_GREEN;\n }\n A[i].element.set({\n state: state\n });\n }\n }" ]
[ "0.75184023", "0.75181", "0.75181", "0.75181", "0.75181", "0.7513441", "0.74920034", "0.74920034", "0.74920034", "0.74920034", "0.7467525", "0.74552387", "0.7454378", "0.7444069", "0.7444069", "0.7443119", "0.7443119", "0.7443119", "0.7443119", "0.7443119", "0.7443119", "0.7443119", "0.7443119", "0.7443119", "0.7439339", "0.7436493", "0.7432574", "0.7427752", "0.7427752", "0.7427752", "0.7427752", "0.7427752", "0.7427752", "0.7427752", "0.7427752", "0.7427752", "0.7399921", "0.72212607", "0.6973309", "0.66130334", "0.65514356", "0.6508633", "0.64762145", "0.6397218", "0.6378151", "0.6361208", "0.63524157", "0.63524157", "0.62977153", "0.62977153", "0.62977153", "0.62977153", "0.62977153", "0.62977153", "0.62977153", "0.6283986", "0.62748826", "0.6268899", "0.6249493", "0.62108284", "0.6193132", "0.6183601", "0.6172091", "0.61465055", "0.6115824", "0.61103594", "0.60443556", "0.59995985", "0.59934866", "0.59930843", "0.59930843", "0.59930843", "0.59872156", "0.59872156", "0.5970719", "0.59645367", "0.59589833", "0.5957021", "0.59365314", "0.5924409", "0.5921713", "0.59212166", "0.5917612", "0.59094006", "0.5908348", "0.5903912", "0.5898029", "0.58790046", "0.5868868", "0.58362824", "0.5833152", "0.5829415", "0.5822382" ]
0.74210626
43
Read the actual heights of the rendered lines, and update their stored heights to match.
function updateHeightsInViewport(cm) { var display = cm.display; var prevBottom = display.lineDiv.offsetTop; for (var i = 0; i < display.view.length; i++) { var cur = display.view[i], wrapping = cm.options.lineWrapping; var height = (void 0), width = 0; if (cur.hidden) { continue } if (ie && ie_version < 8) { var bot = cur.node.offsetTop + cur.node.offsetHeight; height = bot - prevBottom; prevBottom = bot; } else { var box = cur.node.getBoundingClientRect(); height = box.bottom - box.top; // Check that lines don't extend past the right of the current // editor width if (!wrapping && cur.text.firstChild) { width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1; } } var diff = cur.line.height - height; if (diff > .005 || diff < -.005) { updateLineHeight(cur.line, height); updateWidgetHeight(cur.line); if (cur.rest) { for (var j = 0; j < cur.rest.length; j++) { updateWidgetHeight(cur.rest[j]); } } } if (width > cm.display.sizerWidth) { var chWidth = Math.ceil(width / charWidth(cm.display)); if (chWidth > cm.display.maxLineLength) { cm.display.maxLineLength = chWidth; cm.display.maxLine = cur.line; cm.display.maxLineChanged = true; } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function lineHeight(){\n\t\thistoryLine.each(function(index, element){\n\t\t\tif(index == $('.line').length - 1){\n\t\t\t\treturn false;\n\t\t\t} else{\n\t\t\t\tvar thisBlock = $(this).closest('.history-item').height()/2;\n\t\t\t\tvar nextBlock = $(this).closest('.history-item').next().height()/2;\n\t\t\t\tvar h = thisBlock+nextBlock;\n\t\t\t\t$(this).height(h);\n\t\t\t}\n\t\t\t\n\t\t})\n\t}", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n\n if (diff) {\n for (var n = line; n; n = n.parent) {\n n.height += diff;\n }\n }\n } // Given a line object, find its line number by walking up through", "function updateWidgetHeight(line) {\n if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)\n line.widgets[i].height = line.widgets[i].node.offsetHeight;\n }", "function updateWidgetHeight(line) {\n if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)\n line.widgets[i].height = line.widgets[i].node.offsetHeight;\n }", "function updateWidgetHeight(line) {\n if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)\n line.widgets[i].height = line.widgets[i].node.offsetHeight;\n }", "function updateWidgetHeight(line) {\n if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)\n line.widgets[i].height = line.widgets[i].node.offsetHeight;\n }", "function updateWidgetHeight(line) {\n if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)\n line.widgets[i].height = line.widgets[i].node.offsetHeight;\n }", "function updateWidgetHeight(line) {\n if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)\n line.widgets[i].height = line.widgets[i].node.offsetHeight;\n }", "function updateWidgetHeight(line) {\n if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)\n line.widgets[i].height = line.widgets[i].node.offsetHeight;\n }", "function updateWidgetHeight(line) {\n if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)\n line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight;\n }", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i)\n { line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight } }\n}", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i)\n { line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight } }\n}", "function updateWidgetHeight(line) {\n\t if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)\n\t line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight;\n\t }", "function updateWidgetHeight(line) {\n\t if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)\n\t line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight;\n\t }", "function updateWidgetHeight(line) {\n\t if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)\n\t line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight;\n\t }", "function updateWidgetHeight(line) {\n\t\t if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)\n\t\t line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight;\n\t\t }", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i)\n { line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight; } }\n}", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i)\n { line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight; } }\n}", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i)\n { line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight; } }\n}", "function updateWidgetHeight(line) {\r\n if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)\r\n line.widgets[i].height = line.widgets[i].node.offsetHeight;\r\n }", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n }", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n }", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n }", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n }", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n }", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n }", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n }", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n }", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n }", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n }", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n }", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n }", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n }", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n }", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n }", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n }", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n }", "function updateHeightsInViewport(cm) {\n var display = cm.display;\n var prevBottom = display.lineDiv.offsetTop;\n\n for (var i = 0; i < display.view.length; i++) {\n var cur = display.view[i],\n wrapping = cm.options.lineWrapping;\n var height = void 0,\n width = 0;\n\n if (cur.hidden) {\n continue;\n }\n\n if (ie && ie_version < 8) {\n var bot = cur.node.offsetTop + cur.node.offsetHeight;\n height = bot - prevBottom;\n prevBottom = bot;\n } else {\n var box = cur.node.getBoundingClientRect();\n height = box.bottom - box.top; // Check that lines don't extend past the right of the current\n // editor width\n\n if (!wrapping && cur.text.firstChild) {\n width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1;\n }\n }\n\n var diff = cur.line.height - height;\n\n if (diff > .005 || diff < -.005) {\n updateLineHeight(cur.line, height);\n updateWidgetHeight(cur.line);\n\n if (cur.rest) {\n for (var j = 0; j < cur.rest.length; j++) {\n updateWidgetHeight(cur.rest[j]);\n }\n }\n }\n\n if (width > cm.display.sizerWidth) {\n var chWidth = Math.ceil(width / charWidth(cm.display));\n\n if (chWidth > cm.display.maxLineLength) {\n cm.display.maxLineLength = chWidth;\n cm.display.maxLine = cur.line;\n cm.display.maxLineChanged = true;\n }\n }\n }\n } // Read and store the height of line widgets associated with the", "function updateLineHeight(line, height) {\n\t\t var diff = height - line.height;\n\t\t if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n\t\t }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) for (var n = line; n; n = n.parent) n.height += diff;\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) for (var n = line; n; n = n.parent) n.height += diff;\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) for (var n = line; n; n = n.parent) n.height += diff;\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) for (var n = line; n; n = n.parent) n.height += diff;\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) for (var n = line; n; n = n.parent) n.height += diff;\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) for (var n = line; n; n = n.parent) n.height += diff;\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) for (var n = line; n; n = n.parent) n.height += diff;\n }", "function updateWidgetHeight(line) {\n\t\t if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n\t\t var w = line.widgets[i], parent = w.node.parentNode;\n\t\t if (parent) { w.height = parent.offsetHeight; }\n\t\t } }\n\t\t }", "function updateWidgetHeight(line) {\r\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\r\n var w = line.widgets[i], parent = w.node.parentNode;\r\n if (parent) { w.height = parent.offsetHeight; }\r\n } }\r\n}", "function updateLineHeight(line, height) {\n\t\t var diff = height - line.height;\n\t\t if (diff) for (var n = line; n; n = n.parent) n.height += diff;\n\t\t }", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n}", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n}", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n}", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n}", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n}", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n}", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n}", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n}", "function updateLineHeight(line, height) {\r\n var diff = height - line.height;\r\n if (diff) for (var n = line; n; n = n.parent) n.height += diff;\r\n }", "function updateLineHeight(line, height) {\n\t var diff = height - line.height;\n\t if (diff) for (var n = line; n; n = n.parent) n.height += diff;\n\t }", "function updateLineHeight(line, height) {\n\t var diff = height - line.height;\n\t if (diff) for (var n = line; n; n = n.parent) n.height += diff;\n\t }", "function updateLineHeight(line, height) {\n\t var diff = height - line.height;\n\t if (diff) for (var n = line; n; n = n.parent) n.height += diff;\n\t }", "function updateHeightsInViewport(cm) {\n var display = cm.display;\n var prevBottom = display.lineDiv.offsetTop;\n for (var i = 0; i < display.view.length; i++) {\n var cur = display.view[i], height = (void 0);\n if (cur.hidden) { continue }\n if (ie && ie_version < 8) {\n var bot = cur.node.offsetTop + cur.node.offsetHeight;\n height = bot - prevBottom;\n prevBottom = bot;\n } else {\n var box = cur.node.getBoundingClientRect();\n height = box.bottom - box.top;\n }\n var diff = cur.line.height - height;\n if (height < 2) { height = textHeight(display); }\n if (diff > .005 || diff < -.005) {\n updateLineHeight(cur.line, height);\n updateWidgetHeight(cur.line);\n if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)\n { updateWidgetHeight(cur.rest[j]); } }\n }\n }\n }", "function updateHeightsInViewport(cm) {\n var display = cm.display;\n var prevBottom = display.lineDiv.offsetTop;\n for (var i = 0; i < display.view.length; i++) {\n var cur = display.view[i], height = (void 0);\n if (cur.hidden) { continue }\n if (ie && ie_version < 8) {\n var bot = cur.node.offsetTop + cur.node.offsetHeight;\n height = bot - prevBottom;\n prevBottom = bot;\n } else {\n var box = cur.node.getBoundingClientRect();\n height = box.bottom - box.top;\n }\n var diff = cur.line.height - height;\n if (height < 2) { height = textHeight(display); }\n if (diff > .005 || diff < -.005) {\n updateLineHeight(cur.line, height);\n updateWidgetHeight(cur.line);\n if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)\n { updateWidgetHeight(cur.rest[j]); } }\n }\n }\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff } }\n}", "function updateLineHeight(line, height) {\n var diff = height - line.height\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff } }\n}", "function updateLineHeight(line, height) {\r\n var diff = height - line.height;\r\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\r\n}", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n}", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n}", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n}", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n}", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n}", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n}", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n}", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n}", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n}", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n}", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n}" ]
[ "0.6847615", "0.6575622", "0.6532162", "0.6532162", "0.6532162", "0.6532162", "0.6532162", "0.6532162", "0.6532162", "0.6520374", "0.6517116", "0.6517116", "0.6511045", "0.6511045", "0.6511045", "0.6507662", "0.64917886", "0.64917886", "0.64917886", "0.6491407", "0.64767325", "0.64767325", "0.64767325", "0.64767325", "0.64767325", "0.64767325", "0.64767325", "0.64767325", "0.64767325", "0.64767325", "0.64767325", "0.64767325", "0.64767325", "0.64767325", "0.64767325", "0.64767325", "0.64767325", "0.64587665", "0.64527076", "0.6448829", "0.6448829", "0.6448829", "0.6448829", "0.6448829", "0.6448829", "0.6448829", "0.6448829", "0.6448829", "0.6448829", "0.6448829", "0.6448829", "0.6448829", "0.6448829", "0.6448829", "0.6448829", "0.6448829", "0.64340377", "0.64340377", "0.64340377", "0.64340377", "0.64340377", "0.64340377", "0.64340377", "0.6429388", "0.6425526", "0.6420173", "0.64099437", "0.64099437", "0.64099437", "0.64099437", "0.64099437", "0.64099437", "0.64099437", "0.64099437", "0.63924086", "0.6377747", "0.6377747", "0.6377747", "0.62943816", "0.62943816", "0.62933725", "0.62933725", "0.62825704", "0.62638444", "0.62638444", "0.62638444", "0.62638444", "0.62638444", "0.62638444", "0.62638444", "0.62638444", "0.62638444", "0.62638444", "0.62638444" ]
0.0
-1
Read and store the height of line widgets associated with the given line.
function updateWidgetHeight(line) { if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) { var w = line.widgets[i], parent = w.node.parentNode; if (parent) { w.height = parent.offsetHeight; } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateWidgetHeight(line) {\n if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)\n line.widgets[i].height = line.widgets[i].node.offsetHeight;\n }", "function updateWidgetHeight(line) {\n if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)\n line.widgets[i].height = line.widgets[i].node.offsetHeight;\n }", "function updateWidgetHeight(line) {\n if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)\n line.widgets[i].height = line.widgets[i].node.offsetHeight;\n }", "function updateWidgetHeight(line) {\n if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)\n line.widgets[i].height = line.widgets[i].node.offsetHeight;\n }", "function updateWidgetHeight(line) {\n if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)\n line.widgets[i].height = line.widgets[i].node.offsetHeight;\n }", "function updateWidgetHeight(line) {\n if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)\n line.widgets[i].height = line.widgets[i].node.offsetHeight;\n }", "function updateWidgetHeight(line) {\n if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)\n line.widgets[i].height = line.widgets[i].node.offsetHeight;\n }", "function updateWidgetHeight(line) {\r\n if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)\r\n line.widgets[i].height = line.widgets[i].node.offsetHeight;\r\n }", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i)\n { line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight } }\n}", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i)\n { line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight } }\n}", "function updateWidgetHeight(line) {\n if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)\n line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight;\n }", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i)\n { line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight; } }\n}", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i)\n { line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight; } }\n}", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i)\n { line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight; } }\n}", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n}", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n}", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n}", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n}", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n}", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n}", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n}", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n}", "function updateWidgetHeight(line) {\r\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\r\n var w = line.widgets[i], parent = w.node.parentNode;\r\n if (parent) { w.height = parent.offsetHeight; }\r\n } }\r\n}", "function updateWidgetHeight(line) {\n\t if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)\n\t line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight;\n\t }", "function updateWidgetHeight(line) {\n\t if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)\n\t line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight;\n\t }", "function updateWidgetHeight(line) {\n\t if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)\n\t line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight;\n\t }", "function updateWidgetHeight(line) {\n\t\t if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)\n\t\t line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight;\n\t\t }", "function updateWidgetHeight(line) {\n\t\t if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n\t\t var w = line.widgets[i], parent = w.node.parentNode;\n\t\t if (parent) { w.height = parent.offsetHeight; }\n\t\t } }\n\t\t }", "function heightAtLine(lineObj) {\n\t\t lineObj = visualLine(lineObj);\n\t\t\n\t\t var h = 0, chunk = lineObj.parent;\n\t\t for (var i = 0; i < chunk.lines.length; ++i) {\n\t\t var line = chunk.lines[i];\n\t\t if (line == lineObj) break;\n\t\t else h += line.height;\n\t\t }\n\t\t for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n\t\t for (var i = 0; i < p.children.length; ++i) {\n\t\t var cur = p.children[i];\n\t\t if (cur == chunk) break;\n\t\t else h += cur.height;\n\t\t }\n\t\t }\n\t\t return h;\n\t\t }", "function heightAtLine(lineObj) {\n\t\t lineObj = visualLine(lineObj);\n\n\t\t var h = 0, chunk = lineObj.parent;\n\t\t for (var i = 0; i < chunk.lines.length; ++i) {\n\t\t var line = chunk.lines[i];\n\t\t if (line == lineObj) { break }\n\t\t else { h += line.height; }\n\t\t }\n\t\t for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n\t\t for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n\t\t var cur = p.children[i$1];\n\t\t if (cur == chunk) { break }\n\t\t else { h += cur.height; }\n\t\t }\n\t\t }\n\t\t return h\n\t\t }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n\n if (diff) {\n for (var n = line; n; n = n.parent) {\n n.height += diff;\n }\n }\n } // Given a line object, find its line number by walking up through", "function heightAtLine(lineObj) {\n\t lineObj = visualLine(lineObj);\n\n\t var h = 0, chunk = lineObj.parent;\n\t for (var i = 0; i < chunk.lines.length; ++i) {\n\t var line = chunk.lines[i];\n\t if (line == lineObj) break;\n\t else h += line.height;\n\t }\n\t for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n\t for (var i = 0; i < p.children.length; ++i) {\n\t var cur = p.children[i];\n\t if (cur == chunk) break;\n\t else h += cur.height;\n\t }\n\t }\n\t return h;\n\t }", "function heightAtLine(lineObj) {\n\t lineObj = visualLine(lineObj);\n\n\t var h = 0, chunk = lineObj.parent;\n\t for (var i = 0; i < chunk.lines.length; ++i) {\n\t var line = chunk.lines[i];\n\t if (line == lineObj) break;\n\t else h += line.height;\n\t }\n\t for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n\t for (var i = 0; i < p.children.length; ++i) {\n\t var cur = p.children[i];\n\t if (cur == chunk) break;\n\t else h += cur.height;\n\t }\n\t }\n\t return h;\n\t }", "function heightAtLine(lineObj) {\n\t lineObj = visualLine(lineObj);\n\t\n\t var h = 0, chunk = lineObj.parent;\n\t for (var i = 0; i < chunk.lines.length; ++i) {\n\t var line = chunk.lines[i];\n\t if (line == lineObj) break;\n\t else h += line.height;\n\t }\n\t for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n\t for (var i = 0; i < p.children.length; ++i) {\n\t var cur = p.children[i];\n\t if (cur == chunk) break;\n\t else h += cur.height;\n\t }\n\t }\n\t return h;\n\t }", "function updateLineHeight(line, height) {\r\n var diff = height - line.height;\r\n if (diff) for (var n = line; n; n = n.parent) n.height += diff;\r\n }", "function heightAtLine(lineObj) {\r\n lineObj = visualLine(lineObj);\r\n\r\n var h = 0, chunk = lineObj.parent;\r\n for (var i = 0; i < chunk.lines.length; ++i) {\r\n var line = chunk.lines[i];\r\n if (line == lineObj) break;\r\n else h += line.height;\r\n }\r\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\r\n for (var i = 0; i < p.children.length; ++i) {\r\n var cur = p.children[i];\r\n if (cur == chunk) break;\r\n else h += cur.height;\r\n }\r\n }\r\n return h;\r\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n }", "function updateLineHeight(line, height) {\n\t\t var diff = height - line.height;\n\t\t if (diff) for (var n = line; n; n = n.parent) n.height += diff;\n\t\t }", "function updateLineHeight(line, height) {\n\t\t var diff = height - line.height;\n\t\t if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n\t\t }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) for (var n = line; n; n = n.parent) n.height += diff;\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) for (var n = line; n; n = n.parent) n.height += diff;\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) for (var n = line; n; n = n.parent) n.height += diff;\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) for (var n = line; n; n = n.parent) n.height += diff;\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) for (var n = line; n; n = n.parent) n.height += diff;\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) for (var n = line; n; n = n.parent) n.height += diff;\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) for (var n = line; n; n = n.parent) n.height += diff;\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) break;\n else h += line.height;\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i = 0; i < p.children.length; ++i) {\n var cur = p.children[i];\n if (cur == chunk) break;\n else h += cur.height;\n }\n }\n return h;\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) break;\n else h += line.height;\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i = 0; i < p.children.length; ++i) {\n var cur = p.children[i];\n if (cur == chunk) break;\n else h += cur.height;\n }\n }\n return h;\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) break;\n else h += line.height;\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i = 0; i < p.children.length; ++i) {\n var cur = p.children[i];\n if (cur == chunk) break;\n else h += cur.height;\n }\n }\n return h;\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) break;\n else h += line.height;\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i = 0; i < p.children.length; ++i) {\n var cur = p.children[i];\n if (cur == chunk) break;\n else h += cur.height;\n }\n }\n return h;\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) break;\n else h += line.height;\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i = 0; i < p.children.length; ++i) {\n var cur = p.children[i];\n if (cur == chunk) break;\n else h += cur.height;\n }\n }\n return h;\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) break;\n else h += line.height;\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i = 0; i < p.children.length; ++i) {\n var cur = p.children[i];\n if (cur == chunk) break;\n else h += cur.height;\n }\n }\n return h;\n }", "function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) break;\n else h += line.height;\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i = 0; i < p.children.length; ++i) {\n var cur = p.children[i];\n if (cur == chunk) break;\n else h += cur.height;\n }\n }\n return h;\n }", "function updateLineHeight(line, height) {\n\t var diff = height - line.height;\n\t if (diff) for (var n = line; n; n = n.parent) n.height += diff;\n\t }", "function updateLineHeight(line, height) {\n\t var diff = height - line.height;\n\t if (diff) for (var n = line; n; n = n.parent) n.height += diff;\n\t }", "function updateLineHeight(line, height) {\n\t var diff = height - line.height;\n\t if (diff) for (var n = line; n; n = n.parent) n.height += diff;\n\t }", "function heightAtLine(lineObj) {\r\n lineObj = visualLine(lineObj);\r\n\r\n var h = 0, chunk = lineObj.parent;\r\n for (var i = 0; i < chunk.lines.length; ++i) {\r\n var line = chunk.lines[i];\r\n if (line == lineObj) { break }\r\n else { h += line.height; }\r\n }\r\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\r\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\r\n var cur = p.children[i$1];\r\n if (cur == chunk) { break }\r\n else { h += cur.height; }\r\n }\r\n }\r\n return h\r\n}", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }", "function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }" ]
[ "0.79593384", "0.79593384", "0.79593384", "0.79593384", "0.79593384", "0.79593384", "0.79593384", "0.795811", "0.79317176", "0.79317176", "0.7928275", "0.7913349", "0.7913349", "0.7913349", "0.7899005", "0.7899005", "0.7899005", "0.7899005", "0.7899005", "0.7899005", "0.7899005", "0.7899005", "0.78651875", "0.7858608", "0.7858608", "0.7858608", "0.7833106", "0.7778278", "0.71251243", "0.7124817", "0.7109829", "0.7071338", "0.7071338", "0.7070821", "0.7054283", "0.70536506", "0.705098", "0.705098", "0.705098", "0.705098", "0.705098", "0.705098", "0.705098", "0.705098", "0.705098", "0.705098", "0.705098", "0.705098", "0.705098", "0.705098", "0.705098", "0.705098", "0.705098", "0.70434415", "0.704157", "0.7038561", "0.7038561", "0.7038561", "0.7038561", "0.7038561", "0.7038561", "0.7038561", "0.7037833", "0.7037833", "0.7037833", "0.7037833", "0.7037833", "0.7037833", "0.7037833", "0.70199823", "0.70199823", "0.70199823", "0.7002856", "0.70027906", "0.70027906", "0.70027906", "0.70027906", "0.70027906", "0.70027906", "0.70027906", "0.70027906", "0.70027906", "0.70027906", "0.70027906" ]
0.7864872
39
Compute the lines that are visible in a given viewport (defaults the the current scroll position). viewport may contain top, height, and ensure (see op.scrollToPos) properties.
function visibleLines(display, doc, viewport) { var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop; top = Math.floor(top - paddingTop(display)); var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight; var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom); // Ensure is a {from: {line, ch}, to: {line, ch}} object, and // forces those lines into the viewport (if possible). if (viewport && viewport.ensure) { var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line; if (ensureFrom < from) { from = ensureFrom; to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight); } else if (Math.min(ensureTo, doc.lastLine()) >= to) { from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight); to = ensureTo; } } return {from: from, to: Math.max(to, from + 1)} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function visibleLines(display, doc, viewport) {\n\t var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n\t top = Math.floor(top - paddingTop(display));\n\t var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\t\n\t var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n\t // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n\t // forces those lines into the viewport (if possible).\n\t if (viewport && viewport.ensure) {\n\t var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n\t if (ensureFrom < from) {\n\t from = ensureFrom;\n\t to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n\t } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n\t from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n\t to = ensureTo;\n\t }\n\t }\n\t return {from: from, to: Math.max(to, from + 1)};\n\t }", "function visibleLines(display, doc, viewport) {\n\t var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n\t top = Math.floor(top - paddingTop(display));\n\t var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n\t var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n\t // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n\t // forces those lines into the viewport (if possible).\n\t if (viewport && viewport.ensure) {\n\t var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n\t if (ensureFrom < from) {\n\t from = ensureFrom;\n\t to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n\t } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n\t from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n\t to = ensureTo;\n\t }\n\t }\n\t return {from: from, to: Math.max(to, from + 1)};\n\t }", "function visibleLines(display, doc, viewport) {\n\t var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n\t top = Math.floor(top - paddingTop(display));\n\t var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n\t var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n\t // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n\t // forces those lines into the viewport (if possible).\n\t if (viewport && viewport.ensure) {\n\t var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n\t if (ensureFrom < from) {\n\t from = ensureFrom;\n\t to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n\t } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n\t from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n\t to = ensureTo;\n\t }\n\t }\n\t return {from: from, to: Math.max(to, from + 1)};\n\t }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = _lineAtHeight(doc, top),\n to = _lineAtHeight(doc, bottom); // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n\n\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line,\n ensureTo = viewport.ensure.to.line;\n\n if (ensureFrom < from) {\n from = ensureFrom;\n to = _lineAtHeight(doc, _heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = _lineAtHeight(doc, _heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n\n return {\n from: from,\n to: Math.max(to, from + 1)\n };\n } // SCROLLING THINGS INTO VIEW", "function visibleLines(display, doc, viewport) {\n\t\t var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n\t\t top = Math.floor(top - paddingTop(display));\n\t\t var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\t\t\n\t\t var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n\t\t // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n\t\t // forces those lines into the viewport (if possible).\n\t\t if (viewport && viewport.ensure) {\n\t\t var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n\t\t if (ensureFrom < from) {\n\t\t from = ensureFrom;\n\t\t to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n\t\t } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n\t\t from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n\t\t to = ensureTo;\n\t\t }\n\t\t }\n\t\t return {from: from, to: Math.max(to, from + 1)};\n\t\t }", "function visibleLines(display, doc, viewport) {\n\t\t var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n\t\t top = Math.floor(top - paddingTop(display));\n\t\t var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n\t\t var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n\t\t // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n\t\t // forces those lines into the viewport (if possible).\n\t\t if (viewport && viewport.ensure) {\n\t\t var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n\t\t if (ensureFrom < from) {\n\t\t from = ensureFrom;\n\t\t to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n\t\t } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n\t\t from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n\t\t to = ensureTo;\n\t\t }\n\t\t }\n\t\t return {from: from, to: Math.max(to, from + 1)}\n\t\t }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)};\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)};\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)};\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)};\n }", "function visibleLines(display, doc, viewport) {\r\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\r\n top = Math.floor(top - paddingTop(display));\r\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\r\n\r\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\r\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\r\n // forces those lines into the viewport (if possible).\r\n if (viewport && viewport.ensure) {\r\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\r\n if (ensureFrom < from) {\r\n from = ensureFrom;\r\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\r\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\r\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\r\n to = ensureTo;\r\n }\r\n }\r\n return {from: from, to: Math.max(to, from + 1)}\r\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop\n top = Math.floor(top - paddingTop(display))\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom)\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line\n if (ensureFrom < from) {\n from = ensureFrom\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight)\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight)\n to = ensureTo\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop\n top = Math.floor(top - paddingTop(display))\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom)\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line\n if (ensureFrom < from) {\n from = ensureFrom\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight)\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight)\n to = ensureTo\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from)\n return {from: ensureFrom,\n to: lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight)};\n if (Math.min(ensureTo, doc.lastLine()) >= to)\n return {from: lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight),\n to: ensureTo};\n }\n return {from: from, to: Math.max(to, from + 1)};\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from)\n return {from: ensureFrom,\n to: lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight)};\n if (Math.min(ensureTo, doc.lastLine()) >= to)\n return {from: lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight),\n to: ensureTo};\n }\n return {from: from, to: Math.max(to, from + 1)};\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from)\n return {from: ensureFrom,\n to: lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight)};\n if (Math.min(ensureTo, doc.lastLine()) >= to)\n return {from: lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight),\n to: ensureTo};\n }\n return {from: from, to: Math.max(to, from + 1)};\n }", "function visibleLines(display, doc, viewport) {\r\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\r\n top = Math.floor(top - paddingTop(display));\r\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\r\n\r\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\r\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\r\n // forces those lines into the viewport (if possible).\r\n if (viewport && viewport.ensure) {\r\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\r\n if (ensureFrom < from)\r\n return {from: ensureFrom,\r\n to: lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight)};\r\n if (Math.min(ensureTo, doc.lastLine()) >= to)\r\n return {from: lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight),\r\n to: ensureTo};\r\n }\r\n return {from: from, to: Math.max(to, from + 1)};\r\n }", "function visibleLines(display, doc, viewPort) {\n var top = viewPort && viewPort.top != null ? Math.max(0, viewPort.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewPort && viewPort.bottom != null ? viewPort.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewPort && viewPort.ensure) {\n var ensureFrom = viewPort.ensure.from.line, ensureTo = viewPort.ensure.to.line;\n if (ensureFrom < from)\n return {from: ensureFrom,\n to: lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight)};\n if (Math.min(ensureTo, doc.lastLine()) >= to)\n return {from: lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight),\n to: ensureTo};\n }\n return {from: from, to: Math.max(to, from + 1)};\n }", "_calcVisibleLines() {\n this._lines.qtMaxVisible = Math.floor(this._matrixHeight / this._cell.heightMin);\n if (this._lines.qtMaxVisible > 3)\n this._lines.qtMinVisible = 3;\n else\n this._lines.qtMinVisible = 1;\n if (this._lines.qtMaxVisible > this._lines.qtTotal)\n this._lines.qtMaxVisible = this._lines.qtTotal;\n if (this._lines.qtMaxVisible < this._lines.qtVisible && this._lines.qtMaxVisible != 0)\n this._lines.qtVisible = this._lines.qtMaxVisible;\n }", "get viewportLineBlocks() {\n return this.viewState.viewportLines;\n }", "function getNumLinesOnScreen() {\n\t\treturn camera.topAtZZero * 2. / getWorldLineHeight()\n\t}", "function ViewportScrollPosition() {}", "function ViewportScrollPosition() {}", "function ViewportScrollPosition() {}", "function ViewportScrollPosition() {}", "function ViewportScrollPosition() { }", "function ViewportScrollPosition() { }", "function linesOnScroll() {\n $('.line-container').each(function () {\n w_h = $(window).height();\n winTop = $(window).scrollTop();\n elOffTop = $(this).offset().top;\n line = $(this).find('.vertical-line');\n elOffTop < winTop + w_h - 300 ? ($(this).addClass('active'), line.css({height: line.attr('data-height') + 'px'})) : ($(this).removeClass('active'), line.css({height: 0 + 'px'}));\n });\n}", "buildScrollMap() {\n if (!this.totalLineCount) {\n return null;\n }\n const scrollMap = [];\n const nonEmptyList = [];\n for (let i = 0; i < this.totalLineCount; i++) {\n scrollMap.push(-1);\n }\n nonEmptyList.push(0);\n scrollMap[0] = 0;\n // write down the offsetTop of element that has 'data-line' property to scrollMap\n const lineElements = this.previewElement.getElementsByClassName(\"sync-line\");\n for (let i = 0; i < lineElements.length; i++) {\n let el = lineElements[i];\n let t = el.getAttribute(\"data-line\");\n if (!t) {\n continue;\n }\n t = parseInt(t, 10);\n if (!t) {\n continue;\n }\n // this is for ignoring footnote scroll match\n if (t < nonEmptyList[nonEmptyList.length - 1]) {\n el.removeAttribute(\"data-line\");\n }\n else {\n nonEmptyList.push(t);\n let offsetTop = 0;\n while (el && el !== this.previewElement) {\n offsetTop += el.offsetTop;\n el = el.offsetParent;\n }\n scrollMap[t] = Math.round(offsetTop);\n }\n }\n nonEmptyList.push(this.totalLineCount);\n scrollMap.push(this.previewElement.scrollHeight);\n let pos = 0;\n for (let i = 0; i < this.totalLineCount; i++) {\n if (scrollMap[i] !== -1) {\n pos++;\n continue;\n }\n const a = nonEmptyList[pos - 1];\n const b = nonEmptyList[pos];\n scrollMap[i] = Math.round((scrollMap[b] * (i - a) + scrollMap[a] * (b - i)) / (b - a));\n }\n return scrollMap; // scrollMap's length == screenLineCount (vscode can't get screenLineCount... sad)\n }", "viewportIsAppropriate({ from, to }, bias = 0) {\n if (!this.inView)\n return true;\n let { top } = this.heightMap.lineAt(from, QueryType.ByPos, this.heightOracle, 0, 0);\n let { bottom } = this.heightMap.lineAt(to, QueryType.ByPos, this.heightOracle, 0, 0);\n let { visibleTop, visibleBottom } = this;\n return (from == 0 || top <= visibleTop - Math.max(10 /* MinCoverMargin */, Math.min(-bias, 250 /* MaxCoverMargin */))) &&\n (to == this.state.doc.length ||\n bottom >= visibleBottom + Math.max(10 /* MinCoverMargin */, Math.min(bias, 250 /* MaxCoverMargin */))) &&\n (top > visibleTop - 2 * 1000 /* Margin */ && bottom < visibleBottom + 2 * 1000 /* Margin */);\n }", "_getNarrowedViewportRect() {\n // We recalculate the viewport rect here ourselves, rather than using the ViewportRuler,\n // because we want to use the `clientWidth` and `clientHeight` as the base. The difference\n // being that the client properties don't include the scrollbar, as opposed to `innerWidth`\n // and `innerHeight` that do. This is necessary, because the overlay container uses\n // 100% `width` and `height` which don't include the scrollbar either.\n const width = this._document.documentElement.clientWidth;\n const height = this._document.documentElement.clientHeight;\n const scrollPosition = this._viewportRuler.getViewportScrollPosition();\n return {\n top: scrollPosition.top + this._viewportMargin,\n left: scrollPosition.left + this._viewportMargin,\n right: scrollPosition.left + width - this._viewportMargin,\n bottom: scrollPosition.top + height - this._viewportMargin,\n width: width - (2 * this._viewportMargin),\n height: height - (2 * this._viewportMargin),\n };\n }", "function getViewPort() {\n var\n scrollTop = body_container[0].scrollTop,\n bodyHeight = body_container[0].offsetHeight,\n // calculate the start index\n from = parseInt(scrollTop / (options.rowHeight + options.borderHeight), 10),\n // calculate the end index\n to = from + parseInt((body_container[0].offsetHeight / (options.rowHeight + options.borderHeight)) * 1.5, 10);\n return {\n from: Math.max(from - options.threshold, 0),\n to: to + options.threshold,\n height: from + to\n };\n }", "function viewport_line(e){\n\tsettings.colors.line=e.srcElement.value;\n\tvp.line=settings.colors.line;\t\n}", "async isIntersectingViewport() {\n return await this.evaluate(async (element) => {\n const visibleRatio = await new Promise((resolve) => {\n const observer = new IntersectionObserver((entries) => {\n resolve(entries[0].intersectionRatio);\n observer.disconnect();\n });\n observer.observe(element);\n });\n return visibleRatio > 0;\n });\n }", "async isIntersectingViewport() {\n return await this.evaluate(async (element) => {\n const visibleRatio = await new Promise((resolve) => {\n const observer = new IntersectionObserver((entries) => {\n resolve(entries[0].intersectionRatio);\n observer.disconnect();\n });\n observer.observe(element);\n });\n return visibleRatio > 0;\n });\n }", "async isIntersectingViewport() {\n return await this.evaluate(async (element) => {\n const visibleRatio = await new Promise((resolve) => {\n const observer = new IntersectionObserver((entries) => {\n resolve(entries[0].intersectionRatio);\n observer.disconnect();\n });\n observer.observe(element);\n });\n return visibleRatio > 0;\n });\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line; // Continuing lines, if any\n\n this.rest = visualLineContinued(line); // Number of logical lines in this visual line\n\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n } // Create a range of LineView objects for the given lines.", "scrollSyncToLine(line, topRatio = 0.372) {\n if (!this.scrollMap) {\n this.scrollMap = this.buildScrollMap();\n }\n if (!this.scrollMap || line >= this.scrollMap.length) {\n return;\n }\n if (line + 1 === this.totalLineCount) {\n // last line\n this.scrollToPos(this.previewElement.scrollHeight);\n }\n else {\n /**\n * Since I am not able to access the viewport of the editor\n * I used `golden section` (0.372) here for scrollTop.\n */\n this.scrollToPos(Math.max(this.scrollMap[line] - this.previewElement.offsetHeight * topRatio, 0));\n }\n }", "getLinesScrolled(ev) {\n // Do nothing if it's not a vertical scroll event\n if (ev.deltaY === 0) {\n return 0;\n }\n // Fallback to WheelEvent.DOM_DELTA_LINE\n let amount = this._applyScrollModifier(ev.deltaY, ev);\n if (ev.deltaMode === WheelEvent.DOM_DELTA_PIXEL) {\n amount /= this._currentRowHeight + 0.0; // Prevent integer division\n this._wheelPartialScroll += amount;\n amount = Math.floor(Math.abs(this._wheelPartialScroll)) * (this._wheelPartialScroll > 0 ? 1 : -1);\n this._wheelPartialScroll %= 1;\n }\n else if (ev.deltaMode === WheelEvent.DOM_DELTA_PAGE) {\n amount *= this._bufferService.rows;\n }\n return amount;\n }", "_onScroll(ev) {\n // Record current scroll top position\n this._lastScrollTop = this._viewportElement.scrollTop;\n // Don't attempt to scroll if the element is not visible, otherwise scrollTop will be corrupt\n // which causes the terminal to scroll the buffer to the top\n if (!this._viewportElement.offsetParent) {\n return;\n }\n // Ignore the event if it was flagged to ignore (when the source of the event is from Viewport)\n if (this._ignoreNextScrollEvent) {\n this._ignoreNextScrollEvent = false;\n return;\n }\n const newRow = Math.round(this._lastScrollTop / this._currentRowHeight);\n const diff = newRow - this._bufferService.buffer.ydisp;\n this._scrollLines(diff, true);\n }", "function calcViewport() {\n var scrollTop = $window.scrollTop(),\n scrollLeft = window.pageXOffset || 0,\n edgeX = options.edgeX,\n edgeY = options.edgeY;\n\n viewportTop = scrollTop - edgeY;\n viewportBottom = scrollTop + (window.innerHeight || $window.height()) + edgeY;\n viewportLeft = scrollLeft - edgeX;\n viewportRight = scrollLeft + (window.innerWidth || $window.width()) + edgeX;\n }", "function viewportSize(){\n\tvar size = document.querySelectorAll( \"section\" );\n\n\tsize.style.cssText = \"position: fixed;top: 0;left: 0;bottom: 0;right: 0;\";\n\tdocument.documentElement.insertBefore( size, document.documentElement.firstChild );\n\t\n\tvar dims = { width: size.offsetWidth, height: size.offsetHeight };\n\tdocument.documentElement.removeChild( size );\n\tlet coords = dims.height;\n return coords;\n}", "get viewport() {\n\t\treturn this._viewport;\n\t}", "function updateHeightsInViewport(cm) {\n var display = cm.display;\n var prevBottom = display.lineDiv.offsetTop;\n var viewTop = Math.max(0, display.scroller.getBoundingClientRect().top);\n var oldHeight = display.lineDiv.getBoundingClientRect().top;\n var mustScroll = 0;\n for (var i = 0; i < display.view.length; i++) {\n var cur = display.view[i], wrapping = cm.options.lineWrapping;\n var height = (void 0), width = 0;\n if (cur.hidden) { continue }\n oldHeight += cur.line.height;\n if (ie && ie_version < 8) {\n var bot = cur.node.offsetTop + cur.node.offsetHeight;\n height = bot - prevBottom;\n prevBottom = bot;\n } else {\n var box = cur.node.getBoundingClientRect();\n height = box.bottom - box.top;\n // Check that lines don't extend past the right of the current\n // editor width\n if (!wrapping && cur.text.firstChild)\n { width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1; }\n }\n var diff = cur.line.height - height;\n if (diff > .005 || diff < -.005) {\n if (oldHeight < viewTop) { mustScroll -= diff; }\n updateLineHeight(cur.line, height);\n updateWidgetHeight(cur.line);\n if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)\n { updateWidgetHeight(cur.rest[j]); } }\n }\n if (width > cm.display.sizerWidth) {\n var chWidth = Math.ceil(width / charWidth(cm.display));\n if (chWidth > cm.display.maxLineLength) {\n cm.display.maxLineLength = chWidth;\n cm.display.maxLine = cur.line;\n cm.display.maxLineChanged = true;\n }\n }\n }\n if (Math.abs(mustScroll) > 2) { display.scroller.scrollTop += mustScroll; }\n }", "function updateHeightsInViewport(cm) {\n var display = cm.display;\n var prevBottom = display.lineDiv.offsetTop;\n var viewTop = Math.max(0, display.scroller.getBoundingClientRect().top);\n var oldHeight = display.lineDiv.getBoundingClientRect().top;\n var mustScroll = 0;\n for (var i = 0; i < display.view.length; i++) {\n var cur = display.view[i], wrapping = cm.options.lineWrapping;\n var height = (void 0), width = 0;\n if (cur.hidden) { continue }\n oldHeight += cur.line.height;\n if (ie && ie_version < 8) {\n var bot = cur.node.offsetTop + cur.node.offsetHeight;\n height = bot - prevBottom;\n prevBottom = bot;\n } else {\n var box = cur.node.getBoundingClientRect();\n height = box.bottom - box.top;\n // Check that lines don't extend past the right of the current\n // editor width\n if (!wrapping && cur.text.firstChild)\n { width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1; }\n }\n var diff = cur.line.height - height;\n if (diff > .005 || diff < -.005) {\n if (oldHeight < viewTop) { mustScroll -= diff; }\n updateLineHeight(cur.line, height);\n updateWidgetHeight(cur.line);\n if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)\n { updateWidgetHeight(cur.rest[j]); } }\n }\n if (width > cm.display.sizerWidth) {\n var chWidth = Math.ceil(width / charWidth(cm.display));\n if (chWidth > cm.display.maxLineLength) {\n cm.display.maxLineLength = chWidth;\n cm.display.maxLine = cur.line;\n cm.display.maxLineChanged = true;\n }\n }\n }\n if (Math.abs(mustScroll) > 2) { display.scroller.scrollTop += mustScroll; }\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line\n // Continuing lines, if any\n this.rest = visualLineContinued(line)\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1\n this.node = this.text = null\n this.hidden = lineIsHidden(doc, line)\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line\n // Continuing lines, if any\n this.rest = visualLineContinued(line)\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1\n this.node = this.text = null\n this.hidden = lineIsHidden(doc, line)\n}", "_updateRenderedRange() {\n if (!this._viewport) {\n return;\n }\n const renderedRange = this._viewport.getRenderedRange();\n const newRange = { start: renderedRange.start, end: renderedRange.end };\n const viewportSize = this._viewport.getViewportSize();\n const dataLength = this._viewport.getDataLength();\n let scrollOffset = this._viewport.measureScrollOffset();\n // Prevent NaN as result when dividing by zero.\n let firstVisibleIndex = (this._itemSize > 0) ? scrollOffset / this._itemSize : 0;\n // If user scrolls to the bottom of the list and data changes to a smaller list\n if (newRange.end > dataLength) {\n // We have to recalculate the first visible index based on new data length and viewport size.\n const maxVisibleItems = Math.ceil(viewportSize / this._itemSize);\n const newVisibleIndex = Math.max(0, Math.min(firstVisibleIndex, dataLength - maxVisibleItems));\n // If first visible index changed we must update scroll offset to handle start/end buffers\n // Current range must also be adjusted to cover the new position (bottom of new list).\n if (firstVisibleIndex != newVisibleIndex) {\n firstVisibleIndex = newVisibleIndex;\n scrollOffset = newVisibleIndex * this._itemSize;\n newRange.start = Math.floor(firstVisibleIndex);\n }\n newRange.end = Math.max(0, Math.min(dataLength, newRange.start + maxVisibleItems));\n }\n const startBuffer = scrollOffset - newRange.start * this._itemSize;\n if (startBuffer < this._minBufferPx && newRange.start != 0) {\n const expandStart = Math.ceil((this._maxBufferPx - startBuffer) / this._itemSize);\n newRange.start = Math.max(0, newRange.start - expandStart);\n newRange.end = Math.min(dataLength, Math.ceil(firstVisibleIndex + (viewportSize + this._minBufferPx) / this._itemSize));\n }\n else {\n const endBuffer = newRange.end * this._itemSize - (scrollOffset + viewportSize);\n if (endBuffer < this._minBufferPx && newRange.end != dataLength) {\n const expandEnd = Math.ceil((this._maxBufferPx - endBuffer) / this._itemSize);\n if (expandEnd > 0) {\n newRange.end = Math.min(dataLength, newRange.end + expandEnd);\n newRange.start = Math.max(0, Math.floor(firstVisibleIndex - this._minBufferPx / this._itemSize));\n }\n }\n }\n this._viewport.setRenderedRange(newRange);\n this._viewport.setRenderedContentOffset(this._itemSize * newRange.start);\n this._scrolledIndexChange.next(Math.floor(firstVisibleIndex));\n }", "get viewport() { return this.viewState.viewport; }", "_updateRenderedRange() {\n if (!this._viewport) {\n return;\n }\n\n const renderedRange = this._viewport.getRenderedRange();\n\n const newRange = {\n start: renderedRange.start,\n end: renderedRange.end\n };\n\n const viewportSize = this._viewport.getViewportSize();\n\n const dataLength = this._viewport.getDataLength();\n\n let scrollOffset = this._viewport.measureScrollOffset(); // Prevent NaN as result when dividing by zero.\n\n\n let firstVisibleIndex = this._itemSize > 0 ? scrollOffset / this._itemSize : 0; // If user scrolls to the bottom of the list and data changes to a smaller list\n\n if (newRange.end > dataLength) {\n // We have to recalculate the first visible index based on new data length and viewport size.\n const maxVisibleItems = Math.ceil(viewportSize / this._itemSize);\n const newVisibleIndex = Math.max(0, Math.min(firstVisibleIndex, dataLength - maxVisibleItems)); // If first visible index changed we must update scroll offset to handle start/end buffers\n // Current range must also be adjusted to cover the new position (bottom of new list).\n\n if (firstVisibleIndex != newVisibleIndex) {\n firstVisibleIndex = newVisibleIndex;\n scrollOffset = newVisibleIndex * this._itemSize;\n newRange.start = Math.floor(firstVisibleIndex);\n }\n\n newRange.end = Math.max(0, Math.min(dataLength, newRange.start + maxVisibleItems));\n }\n\n const startBuffer = scrollOffset - newRange.start * this._itemSize;\n\n if (startBuffer < this._minBufferPx && newRange.start != 0) {\n const expandStart = Math.ceil((this._maxBufferPx - startBuffer) / this._itemSize);\n newRange.start = Math.max(0, newRange.start - expandStart);\n newRange.end = Math.min(dataLength, Math.ceil(firstVisibleIndex + (viewportSize + this._minBufferPx) / this._itemSize));\n } else {\n const endBuffer = newRange.end * this._itemSize - (scrollOffset + viewportSize);\n\n if (endBuffer < this._minBufferPx && newRange.end != dataLength) {\n const expandEnd = Math.ceil((this._maxBufferPx - endBuffer) / this._itemSize);\n\n if (expandEnd > 0) {\n newRange.end = Math.min(dataLength, newRange.end + expandEnd);\n newRange.start = Math.max(0, Math.floor(firstVisibleIndex - this._minBufferPx / this._itemSize));\n }\n }\n }\n\n this._viewport.setRenderedRange(newRange);\n\n this._viewport.setRenderedContentOffset(this._itemSize * newRange.start);\n\n this._scrolledIndexChange.next(Math.floor(firstVisibleIndex));\n }", "function updateHeightsInViewport(cm) {\n\t\t var display = cm.display;\n\t\t var prevBottom = display.lineDiv.offsetTop;\n\t\t var viewTop = Math.max(0, display.scroller.getBoundingClientRect().top);\n\t\t var oldHeight = display.lineDiv.getBoundingClientRect().top;\n\t\t var mustScroll = 0;\n\t\t for (var i = 0; i < display.view.length; i++) {\n\t\t var cur = display.view[i], wrapping = cm.options.lineWrapping;\n\t\t var height = (void 0), width = 0;\n\t\t if (cur.hidden) { continue }\n\t\t oldHeight += cur.line.height;\n\t\t if (ie && ie_version < 8) {\n\t\t var bot = cur.node.offsetTop + cur.node.offsetHeight;\n\t\t height = bot - prevBottom;\n\t\t prevBottom = bot;\n\t\t } else {\n\t\t var box = cur.node.getBoundingClientRect();\n\t\t height = box.bottom - box.top;\n\t\t // Check that lines don't extend past the right of the current\n\t\t // editor width\n\t\t if (!wrapping && cur.text.firstChild)\n\t\t { width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1; }\n\t\t }\n\t\t var diff = cur.line.height - height;\n\t\t if (diff > .005 || diff < -.005) {\n\t\t if (oldHeight < viewTop) { mustScroll -= diff; }\n\t\t updateLineHeight(cur.line, height);\n\t\t updateWidgetHeight(cur.line);\n\t\t if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)\n\t\t { updateWidgetHeight(cur.rest[j]); } }\n\t\t }\n\t\t if (width > cm.display.sizerWidth) {\n\t\t var chWidth = Math.ceil(width / charWidth(cm.display));\n\t\t if (chWidth > cm.display.maxLineLength) {\n\t\t cm.display.maxLineLength = chWidth;\n\t\t cm.display.maxLine = cur.line;\n\t\t cm.display.maxLineChanged = true;\n\t\t }\n\t\t }\n\t\t }\n\t\t if (Math.abs(mustScroll) > 2) { display.scroller.scrollTop += mustScroll; }\n\t\t }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}", "function isClippedInViewport(domElement) {\n var rect = domElement.getBoundingClientRect();\n return rect.top < 0 || rect.bottom > document.documentElement.clientHeight || rect.left < 0 || rect.right > document.documentElement.clientWidth;\n } // don't need to check for \"both items null/empty\", and don't need to null-check item, since item required to be length-1 JQ object", "_updateRenderedRange() {\n if (!this._viewport) {\n return;\n }\n const renderedRange = this._viewport.getRenderedRange();\n const newRange = { start: renderedRange.start, end: renderedRange.end };\n const viewportSize = this._viewport.getViewportSize();\n const dataLength = this._viewport.getDataLength();\n let scrollOffset = this._viewport.measureScrollOffset();\n let firstVisibleIndex = scrollOffset / this._itemSize;\n // If user scrolls to the bottom of the list and data changes to a smaller list\n if (newRange.end > dataLength) {\n // We have to recalculate the first visible index based on new data length and viewport size.\n const maxVisibleItems = Math.ceil(viewportSize / this._itemSize);\n const newVisibleIndex = Math.max(0, Math.min(firstVisibleIndex, dataLength - maxVisibleItems));\n // If first visible index changed we must update scroll offset to handle start/end buffers\n // Current range must also be adjusted to cover the new position (bottom of new list).\n if (firstVisibleIndex != newVisibleIndex) {\n firstVisibleIndex = newVisibleIndex;\n scrollOffset = newVisibleIndex * this._itemSize;\n newRange.start = Math.floor(firstVisibleIndex);\n }\n newRange.end = Math.max(0, Math.min(dataLength, newRange.start + maxVisibleItems));\n }\n const startBuffer = scrollOffset - newRange.start * this._itemSize;\n if (startBuffer < this._minBufferPx && newRange.start != 0) {\n const expandStart = Math.ceil((this._maxBufferPx - startBuffer) / this._itemSize);\n newRange.start = Math.max(0, newRange.start - expandStart);\n newRange.end = Math.min(dataLength, Math.ceil(firstVisibleIndex + (viewportSize + this._minBufferPx) / this._itemSize));\n }\n else {\n const endBuffer = newRange.end * this._itemSize - (scrollOffset + viewportSize);\n if (endBuffer < this._minBufferPx && newRange.end != dataLength) {\n const expandEnd = Math.ceil((this._maxBufferPx - endBuffer) / this._itemSize);\n if (expandEnd > 0) {\n newRange.end = Math.min(dataLength, newRange.end + expandEnd);\n newRange.start = Math.max(0, Math.floor(firstVisibleIndex - this._minBufferPx / this._itemSize));\n }\n }\n }\n this._viewport.setRenderedRange(newRange);\n this._viewport.setRenderedContentOffset(this._itemSize * newRange.start);\n this._scrolledIndexChange.next(Math.floor(firstVisibleIndex));\n }", "getLines({ start, end, strictIndexing } = { start: 0, end: -1, strictIndexing: true }) {\n const indexing = typeof strictIndexing === 'undefined' ? true : strictIndexing;\n return this.request(`${this.prefix}get_lines`, [\n start,\n end,\n indexing,\n ]);\n }", "function clientViewportRect() {\n var elem = document.documentElement;\n var x = window.pageXOffset;\n var y = window.pageYOffset;\n var width = elem.clientWidth;\n var height = elem.clientHeight;\n return { x: x, y: y, width: width, height: height };\n}", "function buildViewArray(cm, from, to) {\n\t\t var array = [], nextPos;\n\t\t for (var pos = from; pos < to; pos = nextPos) {\n\t\t var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n\t\t nextPos = pos + view.size;\n\t\t array.push(view);\n\t\t }\n\t\t return array\n\t\t }", "function buildViewArray(cm, from, to) {\n\t\t var array = [], nextPos;\n\t\t for (var pos = from; pos < to; pos = nextPos) {\n\t\t var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n\t\t nextPos = pos + view.size;\n\t\t array.push(view);\n\t\t }\n\t\t return array;\n\t\t }", "function isInViewport($item, returnRect) {\n var rect = $item[0].getBoundingClientRect();\n var result = 1;\n\n if (rect.right <= 0 || rect.left >= wndW) {\n result = 0;\n } else if (rect.bottom < 0 && rect.top <= wndH) {\n result = 0;\n } else {\n var beforeTopEnd = Math.max(0, rect.height + rect.top);\n var beforeBottomEnd = Math.max(0, rect.height - (rect.top + rect.height - wndH));\n var afterTop = Math.max(0, -rect.top);\n var beforeBottom = Math.max(0, rect.top + rect.height - wndH);\n if (rect.height < wndH) {\n result = 1 - (afterTop || beforeBottom) / rect.height;\n } else if (beforeTopEnd <= wndH) {\n result = beforeTopEnd / wndH;\n } else if (beforeBottomEnd <= wndH) {\n result = beforeBottomEnd / wndH;\n }\n result = result < 0 ? 0 : result;\n }\n if (returnRect) {\n return [result, rect];\n }\n return result;\n}", "function LineView(doc, line, lineN) {\r\n // The starting line\r\n this.line = line;\r\n // Continuing lines, if any\r\n this.rest = visualLineContinued(line);\r\n // Number of logical lines in this visual line\r\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\r\n this.node = this.text = null;\r\n this.hidden = lineIsHidden(doc, line);\r\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }" ]
[ "0.74272996", "0.74230975", "0.74230975", "0.7401155", "0.73803174", "0.7377409", "0.7353546", "0.7353546", "0.7353546", "0.7353546", "0.731544", "0.7312608", "0.7312608", "0.7312608", "0.7312608", "0.7312608", "0.7312608", "0.7312608", "0.7312608", "0.7312608", "0.7312608", "0.7312608", "0.73074466", "0.73074466", "0.72325194", "0.72325194", "0.72325194", "0.72283643", "0.66864634", "0.6269517", "0.6227224", "0.5838048", "0.5820093", "0.5820093", "0.5820093", "0.5820093", "0.56670934", "0.56670934", "0.56439143", "0.56287605", "0.5578122", "0.53491396", "0.53332543", "0.5328284", "0.5327419", "0.5327419", "0.5327419", "0.52968323", "0.5291474", "0.5227583", "0.5189816", "0.50862455", "0.50796735", "0.50795007", "0.504371", "0.504371", "0.50432974", "0.50432974", "0.50400716", "0.5033165", "0.50268966", "0.5005263", "0.49923337", "0.49923337", "0.49923337", "0.49923337", "0.49923337", "0.49923337", "0.49923337", "0.49923337", "0.49923337", "0.49923337", "0.49923337", "0.49920517", "0.49912357", "0.49803105", "0.49720174", "0.49715084", "0.49614987", "0.49602333", "0.49531442", "0.49521503", "0.49521503", "0.49521503" ]
0.7355309
22
SCROLLING THINGS INTO VIEW If an editor sits on the top or bottom of the window, partially scrolled out of view, this ensures that the cursor is visible.
function maybeScrollWindow(cm, rect) { if (signalDOMEvent(cm, "scrollCursorIntoView")) { return } var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null; if (rect.top + box.top < 0) { doScroll = true; } else if (rect.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) { doScroll = false; } if (doScroll != null && !phantom) { var scrollNode = elt("div", "\u200b", null, ("position: absolute;\n top: " + (rect.top - display.viewOffset - paddingTop(cm.display)) + "px;\n height: " + (rect.bottom - rect.top + scrollGap(cm) + display.barHeight) + "px;\n left: " + (rect.left) + "px; width: " + (Math.max(2, rect.right - rect.left)) + "px;")); cm.display.lineSpace.appendChild(scrollNode); scrollNode.scrollIntoView(doScroll); cm.display.lineSpace.removeChild(scrollNode); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updateView(selection, editor) {\n let path = editor.getPath();\n let i = 0;\n // We check that the selection is actually a point\n // We use selection because for the moment we think it's better not to update the view when the user selects a large part of text\n if (\n selection.newScreenRange.start.row == selection.newScreenRange.end.row &&\n selection.newScreenRange.start.column ==\n selection.newScreenRange.end.column\n ) {\n // we create some alias to clean the code\n let row = selection.newScreenRange.start.row;\n let column = selection.newScreenRange.start.column;\n let none_objective = 0; // if no FocusView is associated with the cursor position\n\n for (i = 0; i < this.FocusView.length; i++) {\n // we find the focusView associated with the cursor position\n if (\n this.rangewithin(\n this.FocusView[i].path,\n this.FocusView[i].range.start.line,\n this.FocusView[i].range.end.line,\n this.FocusView[i].range.start.character,\n this.FocusView[i].range.end.character,\n path,\n row,\n column\n )\n ) {\n // we display the information contained in the focusView.\n this.setCurrentObjectif(this.FocusView[i].goal);\n this.setHypothesis(this.FocusView[i].hypothesis);\n this.setGoals(this.FocusView[i].goals);\n this.markGoal(this.FocusView[i]); // we want to provide some visual information to the user.\n none_objective = 1; // We can now consider that we found a data within our tab that correspond to the situation\n }\n }\n if (none_objective === 0) {\n //If no FocusView is associated with the cursor position\n this.setCurrentObjectif(\"\"); // The currentObjective is set to null.\n this.cleanHypothesis(); //We clean every hypothesis.\n this.cleanGoals(); //We clean every goals.\n }\n }\n }", "function ensureVisible()\r\n{\r\n var selectedTop = selected.position().top;\r\n var selectedBottom = selectedTop + selected.outerHeight();\r\n\r\n var $wnd = $(wnd);\r\n var wndTop = $wnd.scrollTop();\r\n var wndBottom = wndTop + $wnd.height();\r\n\r\n if(selectedBottom > wndBottom)\r\n {\r\n $wnd.scrollTop(wndTop + (selectedBottom-wndBottom));\r\n }\r\n else if(selectedTop < wndTop)\r\n {\r\n $wnd.scrollTop(selectedTop);\r\n }\r\n}", "function updateRangePosition() {\n // Using setTimeout to avoid flicker.\n // setTimeout() causes at least 4ms delay, which seems to skip flickering.\n window.setTimeout(function() {\n var selection = window.getSelection();\n var range = selection.getRangeAt(0);\n var boundingRect;\n var cloneRange = range.cloneRange();\n cloneRange.setStart(selection.focusNode, selection.focusOffset);\n cloneRange.setEnd(selection.focusNode, selection.focusOffset);\n var rects = cloneRange.getClientRects();\n // rects.length is 0 when focusNode is an element node.\n if (rects.length == 0) {\n // Find the closest element node that we can get the\n // boundingClientRect from.\n boundingRect = findElementNodeFrom(selection.focusNode)\n .getBoundingClientRect();\n // But it is not good enough, the div could be the whole body.\n // A too big scroll rectangle would not allow scrolling.\n // Now, find if there is bounding rect at the focusOffset of\n // focusNode.\n if (selection.focusNode.nodeType == Node.ELEMENT_NODE) {\n var node =\n selection.focusNode.childNodes[selection.focusOffset];\n if (node && node.nodeType == Node.ELEMENT_NODE\n && node.getClientRects().length > 0) {\n boundingRect = node.getBoundingClientRect();\n }\n }\n } else if (rects.length == 1) {\n // This is needed instead of using getBoundingClientRect().\n // See b/33416019\n boundingRect = rects[0];\n } else {\n boundingRect = cloneRange.getBoundingClientRect();\n }\n\n EditWebView.updateRangePosition(\n boundingRect.left, boundingRect.top,\n boundingRect.right, boundingRect.bottom);\n });\n}", "checkForCursorVisibility() {\n this.showCaret();\n }", "function ensureCursorVisible(cm) {\n\t\t resolveScrollToPos(cm);\n\t\t var cur = cm.getCursor();\n\t\t cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n\t\t }", "get scrolledIntoView() {\n return (this.updated & UPDATED_SCROLL) > 0;\n }", "function ensureCursorVisible(cm) {\n\t\t resolveScrollToPos(cm);\n\t\t var cur = cm.getCursor(), from = cur, to = cur;\n\t\t if (!cm.options.lineWrapping) {\n\t\t from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;\n\t\t to = Pos(cur.line, cur.ch + 1);\n\t\t }\n\t\t cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true};\n\t\t }", "function ensureCursorVisible(cm) {\n\t resolveScrollToPos(cm);\n\t var cur = cm.getCursor(), from = cur, to = cur;\n\t if (!cm.options.lineWrapping) {\n\t from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;\n\t to = Pos(cur.line, cur.ch + 1);\n\t }\n\t cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true};\n\t }", "function ensureCursorVisible(cm) {\n\t resolveScrollToPos(cm);\n\t var cur = cm.getCursor(), from = cur, to = cur;\n\t if (!cm.options.lineWrapping) {\n\t from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;\n\t to = Pos(cur.line, cur.ch + 1);\n\t }\n\t cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true};\n\t }", "function ensureCursorVisible(cm) {\n\t resolveScrollToPos(cm);\n\t var cur = cm.getCursor(), from = cur, to = cur;\n\t if (!cm.options.lineWrapping) {\n\t from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;\n\t to = Pos(cur.line, cur.ch + 1);\n\t }\n\t cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true};\n\t }", "_dragScroll() {\n if (!this._model.selectionEnd || !this._model.selectionStart) {\n return;\n }\n if (this._dragScrollAmount) {\n this._onRequestScrollLines.fire({ amount: this._dragScrollAmount, suppressScrollEvent: false });\n // Re-evaluate selection\n // If the cursor was above or below the viewport, make sure it's at the\n // start or end of the viewport respectively. This should only happen when\n // NOT in column select mode.\n const buffer = this._bufferService.buffer;\n if (this._dragScrollAmount > 0) {\n if (this._activeSelectionMode !== 3 /* COLUMN */) {\n this._model.selectionEnd[0] = this._bufferService.cols;\n }\n this._model.selectionEnd[1] = Math.min(buffer.ydisp + this._bufferService.rows, buffer.lines.length - 1);\n }\n else {\n if (this._activeSelectionMode !== 3 /* COLUMN */) {\n this._model.selectionEnd[0] = 0;\n }\n this._model.selectionEnd[1] = buffer.ydisp;\n }\n this.refresh();\n }\n }", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor(), from = cur, to = cur;\n if (!cm.options.lineWrapping) {\n from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;\n to = Pos(cur.line, cur.ch + 1);\n }\n cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true};\n }", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor(), from = cur, to = cur;\n if (!cm.options.lineWrapping) {\n from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;\n to = Pos(cur.line, cur.ch + 1);\n }\n cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true};\n }", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor(), from = cur, to = cur;\n if (!cm.options.lineWrapping) {\n from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;\n to = Pos(cur.line, cur.ch + 1);\n }\n cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true};\n }", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor(), from = cur, to = cur;\n if (!cm.options.lineWrapping) {\n from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;\n to = Pos(cur.line, cur.ch + 1);\n }\n cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true};\n }", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor(), from = cur, to = cur;\n if (!cm.options.lineWrapping) {\n from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;\n to = Pos(cur.line, cur.ch + 1);\n }\n cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true};\n }", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor(), from = cur, to = cur;\n if (!cm.options.lineWrapping) {\n from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;\n to = Pos(cur.line, cur.ch + 1);\n }\n cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true};\n }", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor(), from = cur, to = cur;\n if (!cm.options.lineWrapping) {\n from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;\n to = Pos(cur.line, cur.ch + 1);\n }\n cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true};\n }", "function maybeScrollWindow(cm, rect) {\n\t\t if (signalDOMEvent(cm, \"scrollCursorIntoView\")) { return }\n\n\t\t var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null;\n\t\t var doc = display.wrapper.ownerDocument;\n\t\t if (rect.top + box.top < 0) { doScroll = true; }\n\t\t else if (rect.bottom + box.top > (doc.defaultView.innerHeight || doc.documentElement.clientHeight)) { doScroll = false; }\n\t\t if (doScroll != null && !phantom) {\n\t\t var scrollNode = elt(\"div\", \"\\u200b\", null, (\"position: absolute;\\n top: \" + (rect.top - display.viewOffset - paddingTop(cm.display)) + \"px;\\n height: \" + (rect.bottom - rect.top + scrollGap(cm) + display.barHeight) + \"px;\\n left: \" + (rect.left) + \"px; width: \" + (Math.max(2, rect.right - rect.left)) + \"px;\"));\n\t\t cm.display.lineSpace.appendChild(scrollNode);\n\t\t scrollNode.scrollIntoView(doScroll);\n\t\t cm.display.lineSpace.removeChild(scrollNode);\n\t\t }\n\t\t }", "function ensureCursorVisible(cm) {\r\n resolveScrollToPos(cm);\r\n var cur = cm.getCursor(), from = cur, to = cur;\r\n if (!cm.options.lineWrapping) {\r\n from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;\r\n to = Pos(cur.line, cur.ch + 1);\r\n }\r\n cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true};\r\n }", "function ensureCursorVisible(cm) {\r\n resolveScrollToPos(cm);\r\n var cur = cm.getCursor();\r\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\r\n}", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n }", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n }", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n }", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n }", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n }", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n }", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n }", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n }", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n }", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n }", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n }", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n }", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n }", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n }", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n }", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n }", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n }", "function containScroll() {\n\n var targetX = startX + deltaX;\n var targetY = startY + deltaY;\n\n if (targetY < 0)\n deltaY += -targetY;\n else {\n var containerVisibleHeight = focus ? focus.clientHeight : root.innerHeight;\n var containerRealHeight = focus ? focus.scrollHeight : document.body.scrollHeight;\n if (targetY + containerVisibleHeight > containerRealHeight)\n deltaY -= targetY + containerVisibleHeight - containerRealHeight;\n }\n\n if (targetX < 0)\n deltaX += -targetX;\n else {\n var containerVisibleWidth = focus ? focus.clientWidth : root.innerWidth;\n var containerRealWidth = focus ? focus.scrollWidth : document.body.scrollWidth;\n if (targetX + containerVisibleWidth > containerRealWidth)\n deltaX -= targetX + containerVisibleWidth - containerRealWidth;\n }\n\n }", "_checkScrollPosition() {\n\n var isVisible = this._isVisible;\n var isAtBottom = this._isAtBottom;\n var scrollTop = typeof window.scrollY !== 'undefined' ? window.scrollY : window.pageYOffset;\n var bottomThreshold = scrollTop + this._windowHeight;\n\n this._isVisible = scrollTop + this._windowHeight >= this._visibleThreshold ? true : false;\n this._isAtBottom = this._containerBottom <= bottomThreshold ? true : false;\n\n if (this._isAtBottom !== isAtBottom || this._isVisible !== isVisible) {\n this._updateBindings();\n }\n }", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n}", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n}", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n}", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n}", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n}", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n}", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n}", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n}", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n}", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n}", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n}", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm)\n var cur = cm.getCursor(), from = cur, to = cur\n if (!cm.options.lineWrapping) {\n from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur\n to = Pos(cur.line, cur.ch + 1)\n }\n cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin}\n}", "_handleScrolledClassOnEditor() {\n __querySelectorLive(`.${this.utils.cls('_editor-wrapper')}`, ($wrapper) => {\n $wrapper.addEventListener('scroll', (e) => {\n if (Math.abs($wrapper.scrollTop) >= 100) {\n this._$editor.classList.add('scrolled');\n }\n else {\n this._$editor.classList.remove('scrolled');\n }\n });\n });\n }", "scrollIntoView() {\n this.updated |= UPDATED_SCROLL;\n return this;\n }", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm)\n var cur = cm.getCursor(), from = cur, to = cur\n if (!cm.options.lineWrapping) {\n from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur\n to = Pos(cur.line, cur.ch + 1)\n }\n cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true}\n}", "function maybeScrollWindow(cm, rect) {\n if (signalDOMEvent(cm, \"scrollCursorIntoView\")) {\n return;\n }\n\n var display = cm.display,\n box = display.sizer.getBoundingClientRect(),\n doScroll = null;\n\n if (rect.top + box.top < 0) {\n doScroll = true;\n } else if (rect.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) {\n doScroll = false;\n }\n\n if (doScroll != null && !phantom) {\n var scrollNode = elt(\"div\", \"\\u200B\", null, \"position: absolute;\\n top: \" + (rect.top - display.viewOffset - paddingTop(cm.display)) + \"px;\\n height: \" + (rect.bottom - rect.top + scrollGap(cm) + display.barHeight) + \"px;\\n left: \" + rect.left + \"px; width: \" + Math.max(2, rect.right - rect.left) + \"px;\");\n cm.display.lineSpace.appendChild(scrollNode);\n scrollNode.scrollIntoView(doScroll);\n cm.display.lineSpace.removeChild(scrollNode);\n }\n } // Scroll a given position into view (immediately), verifying that", "function maybeScrollWindow(cm, rect) {\n if (signalDOMEvent(cm, \"scrollCursorIntoView\")) { return }\n\n var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null;\n var doc = display.wrapper.ownerDocument;\n if (rect.top + box.top < 0) { doScroll = true; }\n else if (rect.bottom + box.top > (doc.defaultView.innerHeight || doc.documentElement.clientHeight)) { doScroll = false; }\n if (doScroll != null && !phantom) {\n var scrollNode = elt(\"div\", \"\\u200b\", null, (\"position: absolute;\\n top: \" + (rect.top - display.viewOffset - paddingTop(cm.display)) + \"px;\\n height: \" + (rect.bottom - rect.top + scrollGap(cm) + display.barHeight) + \"px;\\n left: \" + (rect.left) + \"px; width: \" + (Math.max(2, rect.right - rect.left)) + \"px;\"));\n cm.display.lineSpace.appendChild(scrollNode);\n scrollNode.scrollIntoView(doScroll);\n cm.display.lineSpace.removeChild(scrollNode);\n }\n }", "function maybeScrollWindow(cm, rect) {\n if (signalDOMEvent(cm, \"scrollCursorIntoView\")) { return }\n\n var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null;\n var doc = display.wrapper.ownerDocument;\n if (rect.top + box.top < 0) { doScroll = true; }\n else if (rect.bottom + box.top > (doc.defaultView.innerHeight || doc.documentElement.clientHeight)) { doScroll = false; }\n if (doScroll != null && !phantom) {\n var scrollNode = elt(\"div\", \"\\u200b\", null, (\"position: absolute;\\n top: \" + (rect.top - display.viewOffset - paddingTop(cm.display)) + \"px;\\n height: \" + (rect.bottom - rect.top + scrollGap(cm) + display.barHeight) + \"px;\\n left: \" + (rect.left) + \"px; width: \" + (Math.max(2, rect.right - rect.left)) + \"px;\"));\n cm.display.lineSpace.appendChild(scrollNode);\n scrollNode.scrollIntoView(doScroll);\n cm.display.lineSpace.removeChild(scrollNode);\n }\n }", "function Va(e){Qa(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}", "function scrollToObject() {\n\t\t\t$q.all([\n\t\t\t FindElement.byId(\"resultTableWrapper\"),\n\t\t\t FindElement.byQuery(\"#resultsTable .selectedRow\")\n\t\t\t ]).then(function(elements) {\n\t\t\t\t var table = angular.element(elements[0]);\n\t\t\t\t var selected = angular.element(elements[1]);\n\t\t\t\t var offset = 30;\n\t\t\t\t table.scrollToElement(selected, offset, 0);\n\t\t\t });\n\t\t\tsetFocus();\n\t\t}", "function scrollToObject() {\n\t\t\t$q.all([\n\t\t\t FindElement.byId(\"resultTableWrapper\"),\n\t\t\t FindElement.byQuery(\"#resultsTable .selectedRow\")\n\t\t\t ]).then(function(elements) {\n\t\t\t\t var table = angular.element(elements[0]);\n\t\t\t\t var selected = angular.element(elements[1]);\n\t\t\t\t var offset = 30;\n\t\t\t\t table.scrollToElement(selected, offset, 0);\n\t\t\t });\n\t\t\t//setFocus();\n\t\t}", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n }", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n }", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n }", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n }", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n }", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n }", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n }", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n }", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n }", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n }", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n }", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n }", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n }", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n }", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n }", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n }", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n }", "function scrollPosIntoView(cm, pos, end, margin) {\n\t\t if (margin == null) { margin = 0; }\n\t\t var rect;\n\t\t if (!cm.options.lineWrapping && pos == end) {\n\t\t // Set pos and end to the cursor positions around the character pos sticks to\n\t\t // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n\t\t // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n\t\t end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n\t\t pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n\t\t }\n\t\t for (var limit = 0; limit < 5; limit++) {\n\t\t var changed = false;\n\t\t var coords = cursorCoords(cm, pos);\n\t\t var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n\t\t rect = {left: Math.min(coords.left, endCoords.left),\n\t\t top: Math.min(coords.top, endCoords.top) - margin,\n\t\t right: Math.max(coords.left, endCoords.left),\n\t\t bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n\t\t var scrollPos = calculateScrollPos(cm, rect);\n\t\t var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n\t\t if (scrollPos.scrollTop != null) {\n\t\t updateScrollTop(cm, scrollPos.scrollTop);\n\t\t if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n\t\t }\n\t\t if (scrollPos.scrollLeft != null) {\n\t\t setScrollLeft(cm, scrollPos.scrollLeft);\n\t\t if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n\t\t }\n\t\t if (!changed) { break }\n\t\t }\n\t\t return rect\n\t\t }", "function Mn(e,a){var n=e.display,r=e.doc;if(a.editorIsHidden)return vn(e),!1;\n // Bail out if the visible area is already rendered and nothing changed.\n if(!a.force&&a.visible.from>=n.viewFrom&&a.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==En(e))return!1;za(e)&&(vn(e),a.dims=wa(e));\n // Compute a suitable new viewport (from & to)\n var f=r.first+r.size,o=Math.max(a.visible.from-e.options.viewportMargin,r.first),i=Math.min(f,a.visible.to+e.options.viewportMargin);n.viewFrom<o&&o-n.viewFrom<20&&(o=Math.max(r.first,n.viewFrom)),n.viewTo>i&&n.viewTo-i<20&&(i=Math.min(f,n.viewTo)),Jo&&(o=pe(e.doc,o),i=ge(e.doc,i));var s=o!=n.viewFrom||i!=n.viewTo||n.lastWrapHeight!=a.wrapperHeight||n.lastWrapWidth!=a.wrapperWidth;xn(e,o,i),n.viewOffset=ye(T(e.doc,n.viewFrom)),\n // Position the mover div to align with the current scroll position\n e.display.mover.style.top=n.viewOffset+\"px\";var c=En(e);if(!s&&0==c&&!a.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var u=Tn(e);\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n return c>4&&(n.lineDiv.style.display=\"none\"),An(e,n.updateLineNumbers,a.dims),c>4&&(n.lineDiv.style.display=\"\"),n.renderedView=n.view,Nn(u),t(n.cursorDiv),t(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,s&&(n.lastWrapHeight=a.wrapperHeight,n.lastWrapWidth=a.wrapperWidth,Sn(e,400)),n.updateLineNumbers=null,!0}", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n}", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n}", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n}", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n}", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n}", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n}" ]
[ "0.6382399", "0.62962425", "0.61368537", "0.6136764", "0.60798055", "0.6077412", "0.6056208", "0.60094726", "0.60094726", "0.60094726", "0.6004994", "0.5907688", "0.5907688", "0.5907688", "0.5907688", "0.5907688", "0.5907688", "0.5907688", "0.59062874", "0.5891157", "0.5891155", "0.5882469", "0.5882469", "0.5882469", "0.5882469", "0.5882469", "0.5882469", "0.5882469", "0.5882469", "0.5882469", "0.5882469", "0.5882469", "0.5882469", "0.5882469", "0.5882469", "0.5882469", "0.5882469", "0.5882469", "0.588111", "0.58463705", "0.5825057", "0.5825057", "0.5825057", "0.5825057", "0.5825057", "0.5825057", "0.5825057", "0.5825057", "0.5825057", "0.5825057", "0.5825057", "0.5818832", "0.58160114", "0.58058655", "0.5797227", "0.57949156", "0.57788616", "0.57788616", "0.5777665", "0.5774053", "0.5773615", "0.5768764", "0.5768764", "0.5768764", "0.5768764", "0.5768764", "0.5768764", "0.5768764", "0.5768764", "0.5768764", "0.5768764", "0.5768764", "0.5768764", "0.5768764", "0.5768764", "0.5766678", "0.5766678", "0.5766678", "0.5763328", "0.5758688", "0.57514125", "0.57514125", "0.57514125", "0.57514125", "0.57514125", "0.57514125" ]
0.5791165
66
Scroll a given position into view (immediately), verifying that it actually became visible (as line heights are accurately measured, the position of something may 'drift' during drawing).
function scrollPosIntoView(cm, pos, end, margin) { if (margin == null) { margin = 0; } var rect; if (!cm.options.lineWrapping && pos == end) { // Set pos and end to the cursor positions around the character pos sticks to // If pos.sticky == "before", that is around pos.ch - 1, otherwise around pos.ch // If pos == Pos(_, 0, "before"), pos and end are unchanged pos = pos.ch ? Pos(pos.line, pos.sticky == "before" ? pos.ch - 1 : pos.ch, "after") : pos; end = pos.sticky == "before" ? Pos(pos.line, pos.ch + 1, "before") : pos; } for (var limit = 0; limit < 5; limit++) { var changed = false; var coords = cursorCoords(cm, pos); var endCoords = !end || end == pos ? coords : cursorCoords(cm, end); rect = {left: Math.min(coords.left, endCoords.left), top: Math.min(coords.top, endCoords.top) - margin, right: Math.max(coords.left, endCoords.left), bottom: Math.max(coords.bottom, endCoords.bottom) + margin}; var scrollPos = calculateScrollPos(cm, rect); var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft; if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; } } if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; } } if (!changed) { break } } return rect }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ifVisible(pos) {\n var bottomLine = html.clientHeight + html.scrollTop;\n\n if (pos < bottomLine) {\n return true;\n }\n }", "_checkScrollPosition() {\n\n var isVisible = this._isVisible;\n var isAtBottom = this._isAtBottom;\n var scrollTop = typeof window.scrollY !== 'undefined' ? window.scrollY : window.pageYOffset;\n var bottomThreshold = scrollTop + this._windowHeight;\n\n this._isVisible = scrollTop + this._windowHeight >= this._visibleThreshold ? true : false;\n this._isAtBottom = this._containerBottom <= bottomThreshold ? true : false;\n\n if (this._isAtBottom !== isAtBottom || this._isVisible !== isVisible) {\n this._updateBindings();\n }\n }", "_scrollSpy() {\n const currentScrollPosition = scrollPosition();\n if (currentScrollPosition.top > this.props.scrollStart) {\n if (!this.state.isVisible) {\n this.setState({ isVisible: true });\n }\n } else {\n if (this.state.isVisible) {\n this.setState({ isVisible: false });\n }\n }\n }", "function ensureVisible()\r\n{\r\n var selectedTop = selected.position().top;\r\n var selectedBottom = selectedTop + selected.outerHeight();\r\n\r\n var $wnd = $(wnd);\r\n var wndTop = $wnd.scrollTop();\r\n var wndBottom = wndTop + $wnd.height();\r\n\r\n if(selectedBottom > wndBottom)\r\n {\r\n $wnd.scrollTop(wndTop + (selectedBottom-wndBottom));\r\n }\r\n else if(selectedTop < wndTop)\r\n {\r\n $wnd.scrollTop(selectedTop);\r\n }\r\n}", "function checkPosition() {\n const offset = reposition(prevFocused);\n if (offset.top !== prevOffset.top || offset.left !== prevOffset.left || offset.width !== prevOffset.width || offset.height !== prevOffset.height) {\n // console.log(\"Changed focus position\", offset, prevFocused);\n prevOffset = offset;\n staticCounter = 0;\n } else {\n staticCounter++;\n }\n if (staticCounter < 3) {\n // at the beginning and as long as we see position changes\n // we will check the position/bounds more often\n positionTimeout = setTimeout(checkPosition, 100);\n } else {\n // we want to measure at least every 2 seconds\n positionTimeout = setTimeout(checkPosition, 1000);\n }\n }", "function checkScrollPosition() {\n clearTimeout(scrollPosCheck);\n scrollPosCheck = setTimeout(function () {\n if ($(window).scrollTop() >= scrollIndicatorThreshold) {\n if (animating) {\n animating = 0;\n $('.scroll-indicator-shadow').css({ \"display\": \"none\" });\n }\n setTimeout(() => {\n $('.scroll-indicator').addClass(\"scroll-indicator-up\");\n }, 1);\n\n } else {\n $('.scroll-indicator').removeClass(\"scroll-indicator-up\");\n }\n }, 100);\n }", "function checkPosition () {\n if (!$el.is(':visible')) return;\n \n var height = $el.height(),\n // offset = options.offset\n scrollHeight = Math.max($(document).height(), $(document.body).height()),\n\n // position y of target compared to our scroll position\n\n scrollTop = $el.scrollTop(),\n position = $el.offset(),\n targetHeight = $el.height();\n\n console.log($el, height, scrollTop, position, targetHeight);\n\n $el.removeClass('affix-top affix-bottom affix');\n if (scrollTop <= offsetTop) {\n // top position\n $el.addClass('affix-top');\n } else if (position.top + height >= scrollHeight - offsetBottom) {\n // bottom position\n $el.addClass('affix-bottom');\n } else {\n // centered affixed position\n $el.addClass('affix');\n }\n\n }", "function checkVisible(elm) {\n var rect = elm.getBoundingClientRect();\n var viewHeight = Math.max(document.documentElement.clientHeight, window.innerHeight);\n return !(rect.bottom < 0 || rect.top + 20 - viewHeight >= 0);\n}", "function inViewport(position) {\n if(position.x > viewport.x && position.y > viewport.y &&\n position.x < viewport.x + 1 && position.y < viewport.y + 1) {\n return true; \n } else { return false; }\n }", "function ScrollPosition() {}", "function ensureVisible(e)\n{\n\tvar posTop = findPosY(e);\n\tvar posBot = posTop + e.offsetHeight;\n\tvar winTop = findScrollY();\n\tvar winHeight = findWindowHeight();\n\tvar winBot = winTop + winHeight;\n\tif(posTop < winTop)\n\t\treturn(posTop);\n\telse if(posBot > winBot)\n\t\t{\n\t\tif(e.offsetHeight < winHeight)\n\t\t\treturn(posTop - (winHeight - e.offsetHeight));\n\t\telse\n\t\t\treturn(posTop);\n\t\t}\n\telse\n\t\treturn(winTop);\n}", "function isElementVisible(elementToBeChecked)\n{\n var TopView = $(window).scrollTop();\n var BotView = TopView + $(window).height();\n var TopElement = $(elementToBeChecked).offset().top;\n var BotElement = TopElement + $(elementToBeChecked).height()-150;\n return ((BotElement <= BotView) && (TopElement >= TopView));\n}", "function checkScrollHeight() {\n let pos = window.scrollY\n let button = document.querySelector('.goto')\n\n if (pos > 50) {\n button.style.display = \"block\"\n } else {\n button.style.display = \"none\"\n }\n}", "function isScrolledIntoView(elem){\n\t// New & Improved Check\n\tvar docViewTop = $(window).scrollTop(),\n\tdocViewBottom = docViewTop + $(window).height(),\n\telemTop = $(elem).offset().top,\n\telemBottom = elemTop + $(elem).height();\n\t\n\t// Is more than half of the element visible\n\treturn ((elemTop + ((elemBottom - elemTop)/2)) >= docViewTop && ((elemTop + ((elemBottom - elemTop)/2)) <= docViewBottom));\n}", "function checkIfVisible(elem, offset) {\n var docViewBottom = $(window).scrollTop() + $(window).height();\n var elemTop = $(elem).offset().top;\n var offset = offset | 0;\n return( (elemTop + offset) <= docViewBottom );\n}", "function checkView(e) {\n\n const scroll = window.scrollY || window.pageYOffset,\n boundsTop = e.getBoundingClientRect().top + scroll;\n\n\n const viewport = {\n top: scroll,\n bottom: scroll + window.innerHeight,\n }\n\n const bounds = {\n top: boundsTop,\n bottom: boundsTop + e.clientHeight,\n }\n\n\n return (bounds.top + 300) < viewport.top;\n\n }", "_listenToScroll() {\n this.setState({\n visible: window.pageYOffset > 0\n });\n }", "function makeVisible(element) {\n /* Find the location of element relative to document top. */\n var posY = element.offsetTop;\n var parent = element.offsetParent;\n while (parent) {\n posY += parent.offsetTop;\n parent = parent.offsetParent;\n }\n /* Define the range of values that we want to be onscreen (you can add\n * margins here). */\n var margin = 8;\n var top = posY - margin;\n var bottom = posY + element.offsetHeight + margin;\n /* Determine the range of values that currently are onscreen\n * (Note: might fail to deduce the height of a horizontal scrollbar)\n */\n var visible_top = window.scrollY;\n var visible_bottom = window.scrollY + window.innerHeight;\n var tc = $('#touch-controls');\n if (tc.is(\":visible\")) {\n visible_bottom -= tc[0].offsetHeight;\n }\n /* Calculate the amount to scroll */\n var amount = 0;\n if (visible_top > top) {\n /* Top of our desired range is obscured. */\n amount = top - visible_top;\n } else if (bottom > visible_bottom) {\n /* Bottom of our desired range is obscured. */\n amount = bottom - visible_bottom;\n if (visible_top + amount > top) {\n /* The element doesn't fit on screen, make the topmost part of it\n * visible */\n amount = top - visible_top;\n }\n }\n if (amount) window.scrollBy(0, amount);\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = _lineAtHeight(doc, top),\n to = _lineAtHeight(doc, bottom); // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n\n\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line,\n ensureTo = viewport.ensure.to.line;\n\n if (ensureFrom < from) {\n from = ensureFrom;\n to = _lineAtHeight(doc, _heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = _lineAtHeight(doc, _heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n\n return {\n from: from,\n to: Math.max(to, from + 1)\n };\n } // SCROLLING THINGS INTO VIEW", "function checkScrollPosition() {\n if ($(window).scrollTop() + $(window).height() == $(document).height()) {\n $.ajax({\n url: replaceURLName(nextURL),\n success: function (data) {\n var results = extractInfoFromData(data);\n renderResultsWithHandlebarTemplate(results.items);\n nextURL = results.next;\n if (nextURL) {\n setTimeout(checkScrollPosition, 500);\n }\n },\n });\n } else {\n setTimeout(checkScrollPosition, 500);\n }\n}", "function scrolledVisibleView(elem) {\n var docViewTop = $(window).scrollTop(); //top of browser window\n var docViewBottom = docViewTop + $(window).height(); //bottom of browser window\n var elemTop = $(elem).offset().top; //top of element\n var elemBottom = elemTop + $(elem).height(); //bottom of element\n return ((elemBottom <= docViewBottom) || (elemTop >= docViewTop)); //return the value when element is outside browser window\n }", "function scrolledVisibleView(elem) {\n var docViewTop = $(window).scrollTop(); //top of browser window\n var docViewBottom = docViewTop + $(window).height(); //bottom of browser window\n var elemTop = $(elem).offset().top; //top of element\n var elemBottom = elemTop + $(elem).height(); //bottom of element\n return ((elemBottom <= docViewBottom) || (elemTop >= docViewTop)); //return the value when element is outside browser window\n }", "function show() {\r\n showThis.forEach(function(e) {\r\n if (isElementInViewport(e)) {\r\n e.classList.add(\"showing\");\r\n } else {\r\n e.classList.remove(\"showing\");\r\n }\r\n });\r\n scroll(show); //request point and apply/remove classes\r\n}", "function appearsOnScroll() {\n $('.row').on('inview', function(event, visible) {\n if (visible === true) {\n $(this).addClass('visible');\n };\n });\n // $(window).scrollTop(1); //move scroll to fires inview events\n}", "function positionCheck(clientRect) {\n return event.originalEvent.clientY <= clientRect.top + 10;\n }", "function move(pos) {\n if (element) {\n var x = element.scrollLeft\n var y = element.scrollTop\n try {\n scrolling = true\n element.scrollLeft = scrollOrigin[0] + pos[0] * scrollMultiplier[0];\n element.scrollTop = scrollOrigin[1] + pos[1] * scrollMultiplier[1];\n } finally {\n scrolling = false\n }\n return element.scrollLeft != x || element.scrollTop != y\n }\n }", "function checkVisibility(message)\n{\n\t// Scroll the view down a certain amount\n\t$chatlogs.stop().animate({scrollTop: $chatlogs[0].scrollHeight});\n}", "function checkVisible(){\n\t\tif (firedAnimation){\n\t\t\t// animation has already fired, detach the event listeners\n\t\t\tdocument.removeEventListener(\"scroll\", checkVisible, false);\n\t\t\twindow.removeEventListener(\"resize\", checkVisible, false);\n\t\t\treturn;\n\t\t}\n\t\tvar rect = chart.getBoundingClientRect();\n\t\tvar top = window.pageYOffset || document.documentElement.scrollTop;\n\t\tvar left = window.pageXOffset || document.documentElement.scrollLeft;\n\n\t\tif ((rect.top>=0)&&(rect.top <window.innerHeight) && \n\t\t\t(rect.left>=0)&&(rect.left <window.innerWidth)){\n\t\t\t// this means that we partly see the chart\n\t\t\t// fire the animation (only once)\n\t\t\tfiredAnimation = true;\n\t\t\tsetAnimate(startValue, endValue, (500/animationSpeed));\t\t\t\t\t\n\t\t}\n\t}", "function checkVisibility(message) {\n\n\t// Scroll the view down a certain amount\n\t$chatlogs.stop().animate({scrollTop: $chatlogs[0].scrollHeight});\n}", "function checkPosition(elemsToShow, callback) {\n // if (!elemsToShow.length === undefined) {\n // elemsToShow.forEach(function (elem) {\n // if (isElementInViewport(elem)) {\n // callback();\n // }\n // });\n // onScroll(checkPosition);\n // } else {\n if (isElementInViewport(elemsToShow)) {\n callback();\n return;\n }\n onScroll(() => checkPosition(elemsToShow, callback));\n // }\n}", "function ensureCursorVisible(cm) {\n\t\t resolveScrollToPos(cm);\n\t\t var cur = cm.getCursor(), from = cur, to = cur;\n\t\t if (!cm.options.lineWrapping) {\n\t\t from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;\n\t\t to = Pos(cur.line, cur.ch + 1);\n\t\t }\n\t\t cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true};\n\t\t }", "function isVisible(topFoldOffset, bottomFoldOffset) {\n\n // If the element is not visible because it\n // is hidden, don't bother testing it.\n if (! element.is(\":visible\")) {\n\n return (false );\n\n }\n\n // If the height has not yet been calculated,\n // the cache it for the duration of the page.\n if (height === null) {\n\n height = element.height() || 215;\n\n }\n // Update the dimensions of the element.\n var top = element.offset().top;\n var bottom = (top + height );\n // Return true if the element is:\n // 1. The top offset is in view.\n // 2. The bottom offset is in view.\n // 3. The element is overlapping the viewport.\n return (((top <= bottomFoldOffset ) && (top >= topFoldOffset )\n ) || ((bottom <= bottomFoldOffset ) && (bottom >= topFoldOffset )\n ) || ((top <= topFoldOffset ) && (bottom >= bottomFoldOffset )\n )\n );\n }", "function viewVisible(element){\n var windowHeight = $(window).height();\n var windowTop = $(window).scrollTop() + (windowHeight * .10);\n var windowBottom = (windowHeight - windowTop) - (windowHeight * .10);\n var targetElement = element.offset().top;\n var coffee = daysFromGenerator(2, \"3/15/16\");\n var coding = daysFromGenerator(12, \"3/15/16\");\n\n if(targetElement < windowBottom && targetElement > windowTop && set === false){\n timeAdd($('.coffee-drink'), coffee - 100, coffee);\n timeAdd($('.hours-code'), coding - 100, coding);\n set = true;\n }\n}", "function scrollToView($el) {\n\t\t\t// get the current position\n\t\t\tvar p = position($el, true);\n\t\t\t// get the screen dimensions\n\t\t\tvar sd = getScreenDimensions();\n\n\t\t\t// if we're hidden off the bottom of the page, move up\n\t\t\tif (p.bottom > sd.y) {\n\t\t\t\t$(\"html,body\").animate({\n\t\t\t\t\t\"scrollTop\"\t: \"+=\"\n\t\t\t\t\t\t\t+ ((p.bottom - sd.y) + settings.screenPadding)\n\t\t\t\t\t\t\t+ \"px\"\n\t\t\t\t})\n\t\t\t}\n\t\t}", "get scrolledIntoView() {\n return (this.updated & UPDATED_SCROLL) > 0;\n }", "function ensureCursorVisible(cm) {\n\t resolveScrollToPos(cm);\n\t var cur = cm.getCursor(), from = cur, to = cur;\n\t if (!cm.options.lineWrapping) {\n\t from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;\n\t to = Pos(cur.line, cur.ch + 1);\n\t }\n\t cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true};\n\t }", "function ensureCursorVisible(cm) {\n\t resolveScrollToPos(cm);\n\t var cur = cm.getCursor(), from = cur, to = cur;\n\t if (!cm.options.lineWrapping) {\n\t from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;\n\t to = Pos(cur.line, cur.ch + 1);\n\t }\n\t cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true};\n\t }", "function ensureCursorVisible(cm) {\n\t resolveScrollToPos(cm);\n\t var cur = cm.getCursor(), from = cur, to = cur;\n\t if (!cm.options.lineWrapping) {\n\t from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;\n\t to = Pos(cur.line, cur.ch + 1);\n\t }\n\t cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true};\n\t }", "checkScrollPos() {\n let fromTop = window.scrollY;\n this.links.forEach(link => {\n let section = document.querySelector(`#${link.el.dataset.section}`);\n if (section.offsetTop <= fromTop && section.offsetTop + section.offsetHeight > fromTop) {\n link.setCurrent();\n } else {\n link.setCurrent(false);\n }\n })\n }", "function checkForParallaxInView(parallaxItem) {\n var isVisible = false;\n var yScrollPosition = window.scrollY;\n var header = document.querySelector('header');\n var headerHeight = header.offsetHeight; \n var startScrollFn = parallaxItem.offsetTop - parallaxItem.offsetHeight + headerHeight;\n var endScrollFn = parallaxItem.offsetTop + parallaxItem.offsetHeight + headerHeight;\n // console.log('--------------------------');\n // console.log(`ypos is ${yScrollPosition}`);\n // console.log(`start is ${startScrollFn}`);\n // console.log(`end is ${endScrollFn}`);\n // console.log('--------------------------');\n\n if(yScrollPosition > startScrollFn && yScrollPosition < endScrollFn) {\n return isVisible = true;\n } else {\n return isVisible = false\n }\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)};\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)};\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)};\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)};\n }", "isVisible() {\n\t\tlet y = this.getY();\n\t\treturn y >= -100 && y <= dh + 100;\n\t}", "function isScrolledIntoView(el) {\n var elemTop = el.getBoundingClientRect().top;\n var elemBottom = el.getBoundingClientRect().bottom;\n var isVisible = (elemTop >= 0) && (elemBottom <= window.innerHeight);\n return isVisible;\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }", "handleScroll() {\n const { scrollPos } = this.state;\n this.setState({\n scrollPos: document.body.getBoundingClientRect().top,\n show: document.body.getBoundingClientRect().top > scrollPos\n });\n }", "function isScrolledIntoView(element) {\n\tvar $element = $(element);\n\tif( $element.is(\":visible\") ) {\n\t\tvar scrollTop = $window.scrollTop();\n\t\tvar bottomView = scrollTop + $window.height();\n\t\tvar elementOffsetTop = $element.offset().top;\n\t\tvar elementBottomView = elementOffsetTop + $element.height();\n\t\treturn((( elementOffsetTop >= scrollTop) && (elementOffsetTop <= bottomView)) || ((elementBottomView >= scrollTop) && (elementBottomView <= bottomView)));\n\t}\n}", "function inView() {\n // get window height\n var windowHeight = window.innerHeight;\n // get number of pixels that the document is scrolled\n var scrollY = window.scrollY || window.pageYOffset;\n\n // get current scroll position (distance from the top of the page to the bottom of the current viewport)\n var scrollPosition = scrollY + windowHeight;\n // get element position (distance from the top of the page to the bottom of the element)\n var elementPosition =\n element.getBoundingClientRect().top + scrollY + elementHeight;\n\n // is scroll position greater than element position? (is element in view?)\n if (scrollPosition > elementPosition) {\n return true;\n }\n\n return false;\n}", "function isVisible(topFoldOffset, bottomFoldOffset) {\n\n\t\t\t// If the element is not visible because it\n\t\t\t// is hidden, don't bother testing it.\n\t\t\tif (! element.is(\":visible\")) {\n\n\t\t\t\t//return (false );\n\n\t\t\t}\n\n\t\t\t// If the height has not yet been calculated,\n\t\t\t// the cache it for the duration of the page.\n\t\t\tif (height === null) {\n\n\t\t\t\theight = element.height();\n\n\t\t\t}\n\t\t\t// Update the dimensions of the element.\n\t\t\tvar top = element.offset().top;\n\t\t\tvar bottom = (top + height );\n\t\t\t// Return true if the element is:\n\t\t\t// 1. The top offset is in view.\n\t\t\t// 2. The bottom offset is in view.\n\t\t\t// 3. The element is overlapping the viewport.\n\t\t\treturn (((top <= bottomFoldOffset ) && (top >= topFoldOffset )\n\t\t\t) || ((bottom <= bottomFoldOffset ) && (bottom >= topFoldOffset )\n\t\t\t) || ((top <= topFoldOffset ) && (bottom >= bottomFoldOffset )\n\t\t\t)\n\t\t\t);\n\n\t\t}", "function containScroll() {\n\n var targetX = startX + deltaX;\n var targetY = startY + deltaY;\n\n if (targetY < 0)\n deltaY += -targetY;\n else {\n var containerVisibleHeight = focus ? focus.clientHeight : root.innerHeight;\n var containerRealHeight = focus ? focus.scrollHeight : document.body.scrollHeight;\n if (targetY + containerVisibleHeight > containerRealHeight)\n deltaY -= targetY + containerVisibleHeight - containerRealHeight;\n }\n\n if (targetX < 0)\n deltaX += -targetX;\n else {\n var containerVisibleWidth = focus ? focus.clientWidth : root.innerWidth;\n var containerRealWidth = focus ? focus.scrollWidth : document.body.scrollWidth;\n if (targetX + containerVisibleWidth > containerRealWidth)\n deltaX -= targetX + containerVisibleWidth - containerRealWidth;\n }\n\n }", "function isVisible(elem){var coords=elem.getBoundingClientRect();var windowHeight=document.documentElement.clientHeight;var extendedTop=-windowHeight;var extendedBottom=2*windowHeight;// верхняя граница elem в пределах видимости ИЛИ нижняя граница видима\nvar topVisible=coords.top>extendedTop&&coords.top<extendedBottom;var bottomVisible=coords.bottom<extendedBottom&&coords.bottom>extendedTop;return topVisible||bottomVisible;}", "scrollBehavior (to, from, savedPosition) {\n return new Promise((resolve, reject) => {\n setTimeout(() => {\n if (savedPosition) {\n resolve(savedPosition);\n } else {\n resolve({ x: 0, y: 0 })\n }\n }, 500);\n })\n }", "function visibleLines(display, doc, viewport) {\n\t\t var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n\t\t top = Math.floor(top - paddingTop(display));\n\t\t var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\t\t\n\t\t var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n\t\t // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n\t\t // forces those lines into the viewport (if possible).\n\t\t if (viewport && viewport.ensure) {\n\t\t var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n\t\t if (ensureFrom < from) {\n\t\t from = ensureFrom;\n\t\t to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n\t\t } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n\t\t from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n\t\t to = ensureTo;\n\t\t }\n\t\t }\n\t\t return {from: from, to: Math.max(to, from + 1)};\n\t\t }", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) {\n margin = 0;\n }\n\n var rect;\n\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n\n var coords = _cursorCoords(cm, pos);\n\n var endCoords = !end || end == pos ? coords : _cursorCoords(cm, end);\n rect = {\n left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin\n };\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop,\n startLeft = cm.doc.scrollLeft;\n\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) {\n changed = true;\n }\n }\n\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) {\n changed = true;\n }\n }\n\n if (!changed) {\n break;\n }\n }\n\n return rect;\n } // Scroll a given set of coordinates into view (immediately).", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop\n top = Math.floor(top - paddingTop(display))\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom)\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line\n if (ensureFrom < from) {\n from = ensureFrom\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight)\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight)\n to = ensureTo\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop\n top = Math.floor(top - paddingTop(display))\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom)\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line\n if (ensureFrom < from) {\n from = ensureFrom\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight)\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight)\n to = ensureTo\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}", "function visibleLines(display, doc, viewport) {\n\t\t var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n\t\t top = Math.floor(top - paddingTop(display));\n\t\t var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n\t\t var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n\t\t // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n\t\t // forces those lines into the viewport (if possible).\n\t\t if (viewport && viewport.ensure) {\n\t\t var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n\t\t if (ensureFrom < from) {\n\t\t from = ensureFrom;\n\t\t to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n\t\t } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n\t\t from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n\t\t to = ensureTo;\n\t\t }\n\t\t }\n\t\t return {from: from, to: Math.max(to, from + 1)}\n\t\t }", "function checkPosition() {\n for (let i = 0; i < elements.length; i++) {\n // getBoundingClientRect returns the size of the element and its position relative to the viewport\n // so basically, look how far the element is from the top of the viewport, if it gets close in view \n // add the fade in animation\n let positionFromTop = elements[i].getBoundingClientRect().top;\n if (positionFromTop - windowHeight <= 0) {\n elements[i].className = elements[i].className.replace(\n 'hidden',\n 'fade-in-element'\n );\n }\n }\n }", "function IsScrolledIntoView(elem, bottom_buffer) {\n var docViewTop = $(window).scrollTop();\n var docViewBottom = docViewTop + $(window).height();\n var elemTop = $(elem).offset().top;\n var elemBottom = elemTop + $(elem).height();\n if (bottom_buffer) docViewBottom -= bottom_buffer;\n return ((elemBottom >= docViewTop) && (elemTop <= docViewBottom));\n}", "setScrollPosition(position) {\n // Set the new scrollTop/scrollLeft to all scrollViews elements\n return this.pageScrollOptions.scrollViews.reduce((oneAlreadyWorked, scrollingView) => {\n const startScrollPropertyValue = this.getScrollPropertyValue(scrollingView);\n\n if (scrollingView && startScrollPropertyValue !== undefined && startScrollPropertyValue !== null) {\n const scrollDistance = Math.abs(startScrollPropertyValue - position); // The movement we need to perform is less than 2px\n // This we consider a small movement which some browser may not perform when\n // changing the scrollTop/scrollLeft property\n // Thus in this cases we do not stop the scroll animation, although setting the\n // scrollTop/scrollLeft value \"fails\"\n\n const isSmallMovement = scrollDistance < this.pageScrollOptions._minScrollDistance;\n\n if (!this.pageScrollOptions.verticalScrolling) {\n scrollingView.scrollLeft = position;\n } else {\n scrollingView.scrollTop = position;\n } // Return true if setting the new scrollTop/scrollLeft value worked\n // We consider that it worked if the new scrollTop/scrollLeft value is closer to the\n // desired scrollTop/scrollLeft than before (it might not be exactly the value we\n // set due to dpi or rounding irregularities)\n\n\n if (isSmallMovement || scrollDistance > Math.abs(this.getScrollPropertyValue(scrollingView) - position)) {\n return true;\n }\n }\n\n return oneAlreadyWorked;\n }, false);\n }", "function visibleLines(display, doc, viewport) {\n\t var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n\t top = Math.floor(top - paddingTop(display));\n\t var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\t\n\t var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n\t // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n\t // forces those lines into the viewport (if possible).\n\t if (viewport && viewport.ensure) {\n\t var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n\t if (ensureFrom < from) {\n\t from = ensureFrom;\n\t to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n\t } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n\t from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n\t to = ensureTo;\n\t }\n\t }\n\t return {from: from, to: Math.max(to, from + 1)};\n\t }", "function visibleLines(display, doc, viewport) {\r\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\r\n top = Math.floor(top - paddingTop(display));\r\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\r\n\r\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\r\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\r\n // forces those lines into the viewport (if possible).\r\n if (viewport && viewport.ensure) {\r\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\r\n if (ensureFrom < from) {\r\n from = ensureFrom;\r\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\r\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\r\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\r\n to = ensureTo;\r\n }\r\n }\r\n return {from: from, to: Math.max(to, from + 1)}\r\n}", "function loop(){\n DisplayedEl.forEach(function(elem){\n if(IsElementInViewport(elem)){\n elem.classList.add(\"visible\");\n }else{\n elem.classList.remove(\"visible\");\n }\n });\n scroll(loop);\n}", "function check(e) {\n var pos = getPos(e), posAbs = { x: e.clientX, y: e.clientY }; // div is fixed, so use clientX/Y\n if (!visible &&\n pos.x >= region.x && pos.x < region.x + region.w &&\n pos.y >= region.y && pos.y < region.y + region.h) {\n me.show(posAbs); // show tool-tip at this pos\n }\n else\n setDivPos(posAbs); // otherwise, update position\n }", "function checkScrollState() {\r\n\tif (yPos2 > yPos) {\r\n\t\tscrolling.state = true; // this will make it stop\r\n\t}\r\n\tif (scrolling.state) {\r\n\t\tstopScroll();\r\n\t} else if (!scrolling.state) {\r\n\t\tstartScroll();\r\n\t}\r\n}", "function visibleLines(display, doc, viewport) {\n\t var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n\t top = Math.floor(top - paddingTop(display));\n\t var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n\t var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n\t // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n\t // forces those lines into the viewport (if possible).\n\t if (viewport && viewport.ensure) {\n\t var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n\t if (ensureFrom < from) {\n\t from = ensureFrom;\n\t to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n\t } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n\t from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n\t to = ensureTo;\n\t }\n\t }\n\t return {from: from, to: Math.max(to, from + 1)};\n\t }", "function visibleLines(display, doc, viewport) {\n\t var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n\t top = Math.floor(top - paddingTop(display));\n\t var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n\t var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n\t // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n\t // forces those lines into the viewport (if possible).\n\t if (viewport && viewport.ensure) {\n\t var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n\t if (ensureFrom < from) {\n\t from = ensureFrom;\n\t to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n\t } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n\t from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n\t to = ensureTo;\n\t }\n\t }\n\t return {from: from, to: Math.max(to, from + 1)};\n\t }", "function _checkInView() {\n var viewport = {\n top: 0,\n bottom: getViewportHeight()\n };\n var callbacks = [];\n\n watchingItems.forEach(function (item) {\n var bounds = getBoundingClientRect(item.element[0]);\n\n if (bounds.top < viewport.bottom && bounds.bottom >= viewport.top) {\n callbacks.push(item.callback);\n }\n });\n\n callbacks.forEach(function (callback) {\n callback();\n });\n }", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor(), from = cur, to = cur;\n if (!cm.options.lineWrapping) {\n from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;\n to = Pos(cur.line, cur.ch + 1);\n }\n cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true};\n }", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor(), from = cur, to = cur;\n if (!cm.options.lineWrapping) {\n from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;\n to = Pos(cur.line, cur.ch + 1);\n }\n cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true};\n }", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor(), from = cur, to = cur;\n if (!cm.options.lineWrapping) {\n from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;\n to = Pos(cur.line, cur.ch + 1);\n }\n cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true};\n }", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor(), from = cur, to = cur;\n if (!cm.options.lineWrapping) {\n from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;\n to = Pos(cur.line, cur.ch + 1);\n }\n cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true};\n }" ]
[ "0.6941846", "0.6569337", "0.62933385", "0.61800575", "0.61191726", "0.6019441", "0.59948593", "0.597039", "0.5944806", "0.58684546", "0.58561337", "0.5852364", "0.58486384", "0.58313596", "0.5824516", "0.5813296", "0.5812549", "0.57976955", "0.57970214", "0.5781929", "0.57782346", "0.57782346", "0.5761345", "0.5757818", "0.57545406", "0.57443506", "0.57400644", "0.57309836", "0.57243", "0.572362", "0.5708853", "0.5705236", "0.57022053", "0.5696348", "0.5692857", "0.567603", "0.567603", "0.567603", "0.567452", "0.5671511", "0.5662029", "0.5662029", "0.5662029", "0.5662029", "0.56595737", "0.56526136", "0.56428933", "0.56428933", "0.56428933", "0.56428933", "0.56428933", "0.56428933", "0.56428933", "0.56428933", "0.56428933", "0.56428933", "0.56428933", "0.56428933", "0.56428933", "0.56428933", "0.56428933", "0.56428933", "0.56428933", "0.56392574", "0.5636401", "0.56335926", "0.5627783", "0.5619151", "0.5617841", "0.5617802", "0.5615045", "0.56088567", "0.56088567", "0.56088567", "0.56088567", "0.56088567", "0.56088567", "0.56088567", "0.56088567", "0.56088567", "0.56088567", "0.56088567", "0.5602951", "0.5598695", "0.5598695", "0.55968446", "0.5589082", "0.55889785", "0.55795795", "0.5578133", "0.5576085", "0.55714005", "0.55613315", "0.5554844", "0.5545412", "0.5545412", "0.55346996", "0.5534255", "0.5534255", "0.5534255", "0.5534255" ]
0.0
-1
Scroll a given set of coordinates into view (immediately).
function scrollIntoView(cm, rect) { var scrollPos = calculateScrollPos(cm, rect); if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); } if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function scrollIntoView(cm, x1, y1, x2, y2) {\n\t\t var scrollPos = calculateScrollPos(cm, x1, y1, x2, y2);\n\t\t if (scrollPos.scrollTop != null) setScrollTop(cm, scrollPos.scrollTop);\n\t\t if (scrollPos.scrollLeft != null) setScrollLeft(cm, scrollPos.scrollLeft);\n\t\t }", "function scrollIntoView(cm, x1, y1, x2, y2) {\n\t var scrollPos = calculateScrollPos(cm, x1, y1, x2, y2);\n\t if (scrollPos.scrollTop != null) setScrollTop(cm, scrollPos.scrollTop);\n\t if (scrollPos.scrollLeft != null) setScrollLeft(cm, scrollPos.scrollLeft);\n\t }", "function scrollIntoView(cm, x1, y1, x2, y2) {\n\t var scrollPos = calculateScrollPos(cm, x1, y1, x2, y2);\n\t if (scrollPos.scrollTop != null) setScrollTop(cm, scrollPos.scrollTop);\n\t if (scrollPos.scrollLeft != null) setScrollLeft(cm, scrollPos.scrollLeft);\n\t }", "function scrollIntoView(cm, x1, y1, x2, y2) {\n\t var scrollPos = calculateScrollPos(cm, x1, y1, x2, y2);\n\t if (scrollPos.scrollTop != null) setScrollTop(cm, scrollPos.scrollTop);\n\t if (scrollPos.scrollLeft != null) setScrollLeft(cm, scrollPos.scrollLeft);\n\t }", "function scrollIntoView(cm, x1, y1, x2, y2) {\n var scrollPos = calculateScrollPos(cm, x1, y1, x2, y2);\n if (scrollPos.scrollTop != null) setScrollTop(cm, scrollPos.scrollTop);\n if (scrollPos.scrollLeft != null) setScrollLeft(cm, scrollPos.scrollLeft);\n }", "function scrollIntoView(cm, x1, y1, x2, y2) {\n var scrollPos = calculateScrollPos(cm, x1, y1, x2, y2);\n if (scrollPos.scrollTop != null) setScrollTop(cm, scrollPos.scrollTop);\n if (scrollPos.scrollLeft != null) setScrollLeft(cm, scrollPos.scrollLeft);\n }", "function scrollIntoView(cm, x1, y1, x2, y2) {\n var scrollPos = calculateScrollPos(cm, x1, y1, x2, y2);\n if (scrollPos.scrollTop != null) setScrollTop(cm, scrollPos.scrollTop);\n if (scrollPos.scrollLeft != null) setScrollLeft(cm, scrollPos.scrollLeft);\n }", "function scrollIntoView(cm, x1, y1, x2, y2) {\n var scrollPos = calculateScrollPos(cm, x1, y1, x2, y2);\n if (scrollPos.scrollTop != null) setScrollTop(cm, scrollPos.scrollTop);\n if (scrollPos.scrollLeft != null) setScrollLeft(cm, scrollPos.scrollLeft);\n }", "function scrollIntoView(cm, x1, y1, x2, y2) {\n var scrollPos = calculateScrollPos(cm, x1, y1, x2, y2);\n if (scrollPos.scrollTop != null) setScrollTop(cm, scrollPos.scrollTop);\n if (scrollPos.scrollLeft != null) setScrollLeft(cm, scrollPos.scrollLeft);\n }", "function scrollIntoView(cm, x1, y1, x2, y2) {\n var scrollPos = calculateScrollPos(cm, x1, y1, x2, y2);\n if (scrollPos.scrollTop != null) setScrollTop(cm, scrollPos.scrollTop);\n if (scrollPos.scrollLeft != null) setScrollLeft(cm, scrollPos.scrollLeft);\n }", "function scrollIntoView(cm, x1, y1, x2, y2) {\n var scrollPos = calculateScrollPos(cm, x1, y1, x2, y2);\n if (scrollPos.scrollTop != null) setScrollTop(cm, scrollPos.scrollTop);\n if (scrollPos.scrollLeft != null) setScrollLeft(cm, scrollPos.scrollLeft);\n }", "function scrollIntoView(cm, x1, y1, x2, y2) {\r\n var scrollPos = calculateScrollPos(cm, x1, y1, x2, y2);\r\n if (scrollPos.scrollTop != null) setScrollTop(cm, scrollPos.scrollTop);\r\n if (scrollPos.scrollLeft != null) setScrollLeft(cm, scrollPos.scrollLeft);\r\n }", "function scrollIntoView(cm, x1, y1, x2, y2) {\n var scrollPos = calculateScrollPos(cm, x1, y1, x2, y2)\n if (scrollPos.scrollTop != null) { setScrollTop(cm, scrollPos.scrollTop) }\n if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft) }\n}", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) margin = 0;\n for (var limit = 0; limit < 5; limit++) {\n var changed = false, coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n var scrollPos = calculateScrollPos(cm, Math.min(coords.left, endCoords.left),\n Math.min(coords.top, endCoords.top) - margin,\n Math.max(coords.left, endCoords.left),\n Math.max(coords.bottom, endCoords.bottom) + margin);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n setScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) changed = true;\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) changed = true;\n }\n if (!changed) break;\n }\n return coords;\n }", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) margin = 0;\n for (var limit = 0; limit < 5; limit++) {\n var changed = false, coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n var scrollPos = calculateScrollPos(cm, Math.min(coords.left, endCoords.left),\n Math.min(coords.top, endCoords.top) - margin,\n Math.max(coords.left, endCoords.left),\n Math.max(coords.bottom, endCoords.bottom) + margin);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n setScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) changed = true;\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) changed = true;\n }\n if (!changed) break;\n }\n return coords;\n }", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) margin = 0;\n for (var limit = 0; limit < 5; limit++) {\n var changed = false, coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n var scrollPos = calculateScrollPos(cm, Math.min(coords.left, endCoords.left),\n Math.min(coords.top, endCoords.top) - margin,\n Math.max(coords.left, endCoords.left),\n Math.max(coords.bottom, endCoords.bottom) + margin);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n setScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) changed = true;\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) changed = true;\n }\n if (!changed) break;\n }\n return coords;\n }", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) margin = 0;\n for (var limit = 0; limit < 5; limit++) {\n var changed = false, coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n var scrollPos = calculateScrollPos(cm, Math.min(coords.left, endCoords.left),\n Math.min(coords.top, endCoords.top) - margin,\n Math.max(coords.left, endCoords.left),\n Math.max(coords.bottom, endCoords.bottom) + margin);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n setScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) changed = true;\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) changed = true;\n }\n if (!changed) break;\n }\n return coords;\n }", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) margin = 0;\n for (var limit = 0; limit < 5; limit++) {\n var changed = false, coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n var scrollPos = calculateScrollPos(cm, Math.min(coords.left, endCoords.left),\n Math.min(coords.top, endCoords.top) - margin,\n Math.max(coords.left, endCoords.left),\n Math.max(coords.bottom, endCoords.bottom) + margin);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n setScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) changed = true;\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) changed = true;\n }\n if (!changed) return coords;\n }\n }", "function scrollPosIntoView(cm, pos, end, margin) {\n\t\t if (margin == null) margin = 0;\n\t\t for (var limit = 0; limit < 5; limit++) {\n\t\t var changed = false, coords = cursorCoords(cm, pos);\n\t\t var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n\t\t var scrollPos = calculateScrollPos(cm, Math.min(coords.left, endCoords.left),\n\t\t Math.min(coords.top, endCoords.top) - margin,\n\t\t Math.max(coords.left, endCoords.left),\n\t\t Math.max(coords.bottom, endCoords.bottom) + margin);\n\t\t var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n\t\t if (scrollPos.scrollTop != null) {\n\t\t setScrollTop(cm, scrollPos.scrollTop);\n\t\t if (Math.abs(cm.doc.scrollTop - startTop) > 1) changed = true;\n\t\t }\n\t\t if (scrollPos.scrollLeft != null) {\n\t\t setScrollLeft(cm, scrollPos.scrollLeft);\n\t\t if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) changed = true;\n\t\t }\n\t\t if (!changed) break;\n\t\t }\n\t\t return coords;\n\t\t }", "function scrollPosIntoView(cm, pos, end, margin) {\n\t if (margin == null) margin = 0;\n\t for (var limit = 0; limit < 5; limit++) {\n\t var changed = false, coords = cursorCoords(cm, pos);\n\t var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n\t var scrollPos = calculateScrollPos(cm, Math.min(coords.left, endCoords.left),\n\t Math.min(coords.top, endCoords.top) - margin,\n\t Math.max(coords.left, endCoords.left),\n\t Math.max(coords.bottom, endCoords.bottom) + margin);\n\t var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n\t if (scrollPos.scrollTop != null) {\n\t setScrollTop(cm, scrollPos.scrollTop);\n\t if (Math.abs(cm.doc.scrollTop - startTop) > 1) changed = true;\n\t }\n\t if (scrollPos.scrollLeft != null) {\n\t setScrollLeft(cm, scrollPos.scrollLeft);\n\t if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) changed = true;\n\t }\n\t if (!changed) break;\n\t }\n\t return coords;\n\t }", "function scrollPosIntoView(cm, pos, end, margin) {\n\t if (margin == null) margin = 0;\n\t for (var limit = 0; limit < 5; limit++) {\n\t var changed = false, coords = cursorCoords(cm, pos);\n\t var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n\t var scrollPos = calculateScrollPos(cm, Math.min(coords.left, endCoords.left),\n\t Math.min(coords.top, endCoords.top) - margin,\n\t Math.max(coords.left, endCoords.left),\n\t Math.max(coords.bottom, endCoords.bottom) + margin);\n\t var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n\t if (scrollPos.scrollTop != null) {\n\t setScrollTop(cm, scrollPos.scrollTop);\n\t if (Math.abs(cm.doc.scrollTop - startTop) > 1) changed = true;\n\t }\n\t if (scrollPos.scrollLeft != null) {\n\t setScrollLeft(cm, scrollPos.scrollLeft);\n\t if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) changed = true;\n\t }\n\t if (!changed) break;\n\t }\n\t return coords;\n\t }", "function scrollPosIntoView(cm, pos, end, margin) {\n\t if (margin == null) margin = 0;\n\t for (var limit = 0; limit < 5; limit++) {\n\t var changed = false, coords = cursorCoords(cm, pos);\n\t var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n\t var scrollPos = calculateScrollPos(cm, Math.min(coords.left, endCoords.left),\n\t Math.min(coords.top, endCoords.top) - margin,\n\t Math.max(coords.left, endCoords.left),\n\t Math.max(coords.bottom, endCoords.bottom) + margin);\n\t var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n\t if (scrollPos.scrollTop != null) {\n\t setScrollTop(cm, scrollPos.scrollTop);\n\t if (Math.abs(cm.doc.scrollTop - startTop) > 1) changed = true;\n\t }\n\t if (scrollPos.scrollLeft != null) {\n\t setScrollLeft(cm, scrollPos.scrollLeft);\n\t if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) changed = true;\n\t }\n\t if (!changed) break;\n\t }\n\t return coords;\n\t }", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0 }\n var coords\n for (var limit = 0; limit < 5; limit++) {\n var changed = false\n coords = cursorCoords(cm, pos)\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end)\n var scrollPos = calculateScrollPos(cm, Math.min(coords.left, endCoords.left),\n Math.min(coords.top, endCoords.top) - margin,\n Math.max(coords.left, endCoords.left),\n Math.max(coords.bottom, endCoords.bottom) + margin)\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft\n if (scrollPos.scrollTop != null) {\n setScrollTop(cm, scrollPos.scrollTop)\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft)\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true }\n }\n if (!changed) { break }\n }\n return coords\n}", "function scrollIntoView(cm, rect) {\n\t\t var scrollPos = calculateScrollPos(cm, rect);\n\t\t if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); }\n\t\t if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }\n\t\t }", "async scrollIntoView() {\n await this.assertConnectedElement();\n await this.evaluate(async (element) => {\n element.scrollIntoView({\n block: 'center',\n inline: 'center',\n behavior: 'instant',\n });\n });\n }", "function move(sel) {\ndocument.querySelector(sel).scrollIntoView({ \n behavior: 'smooth' \n});\n}", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) {\n margin = 0;\n }\n\n var rect;\n\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n\n var coords = _cursorCoords(cm, pos);\n\n var endCoords = !end || end == pos ? coords : _cursorCoords(cm, end);\n rect = {\n left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin\n };\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop,\n startLeft = cm.doc.scrollLeft;\n\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) {\n changed = true;\n }\n }\n\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) {\n changed = true;\n }\n }\n\n if (!changed) {\n break;\n }\n }\n\n return rect;\n } // Scroll a given set of coordinates into view (immediately).", "function scrollPosIntoView(cm, pos, end, margin) {\r\n if (margin == null) margin = 0;\r\n for (;;) {\r\n var changed = false, coords = cursorCoords(cm, pos);\r\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\r\n var scrollPos = calculateScrollPos(cm, Math.min(coords.left, endCoords.left),\r\n Math.min(coords.top, endCoords.top) - margin,\r\n Math.max(coords.left, endCoords.left),\r\n Math.max(coords.bottom, endCoords.bottom) + margin);\r\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\r\n if (scrollPos.scrollTop != null) {\r\n setScrollTop(cm, scrollPos.scrollTop);\r\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) changed = true;\r\n }\r\n if (scrollPos.scrollLeft != null) {\r\n setScrollLeft(cm, scrollPos.scrollLeft);\r\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) changed = true;\r\n }\r\n if (!changed) return coords;\r\n }\r\n }", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) margin = 0;\n for (;;) {\n var changed = false, coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n var scrollPos = calculateScrollPos(cm, Math.min(coords.left, endCoords.left),\n Math.min(coords.top, endCoords.top) - margin,\n Math.max(coords.left, endCoords.left),\n Math.max(coords.bottom, endCoords.bottom) + margin);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n setScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) changed = true;\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) changed = true;\n }\n if (!changed) return coords;\n }\n }", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) margin = 0;\n for (;;) {\n var changed = false, coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n var scrollPos = calculateScrollPos(cm, Math.min(coords.left, endCoords.left),\n Math.min(coords.top, endCoords.top) - margin,\n Math.max(coords.left, endCoords.left),\n Math.max(coords.bottom, endCoords.bottom) + margin);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n setScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) changed = true;\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) changed = true;\n }\n if (!changed) return coords;\n }\n }", "function jumpto(coordinates, zoom){\n let position = fromLonLat(coordinates)\n if (zoom)\n view.animate({zoom: zoom, center: position});\n else\n view.animate({center: position});\n}", "function scroll() {\n\t\telement.scrollIntoView({behavior: \"smooth\"});\n\t\t\n\t}", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0 }\n var rect\n for (var limit = 0; limit < 5; limit++) {\n var changed = false\n var coords = cursorCoords(cm, pos)\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end)\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin}\n var scrollPos = calculateScrollPos(cm, rect)\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft\n if (scrollPos.scrollTop != null) {\n setScrollTop(cm, scrollPos.scrollTop)\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft)\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true }\n }\n if (!changed) { break }\n }\n return rect\n}", "function scrollIntoView(cm, rect) {\n var scrollPos = calculateScrollPos(cm, rect)\n if (scrollPos.scrollTop != null) { setScrollTop(cm, scrollPos.scrollTop) }\n if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft) }\n}", "function scrollIntoView(cm, rect) {\r\n var scrollPos = calculateScrollPos(cm, rect);\r\n if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); }\r\n if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }\r\n}", "function scrollMapTo(x, y) {\n\t\tvar scl = eval(x) / this.minimap.xRate;\n\t\tvar sct = eval(y) / this.minimap.yRate;\n\t\tdocument.getElementById(MAP).scrollLeft = scl;\n\t\tdocument.getElementById(MAP).scrollTop = sct;\n\t}", "function ScrollAll(_X,_Y,_ms){\n\t\t\t//Scroll both appropriately within the same animation\n\t\t\tanimateScroll(_X);\n\t\t}", "function scrollToObject() {\n\t\t\t$q.all([\n\t\t\t FindElement.byId(\"resultTableWrapper\"),\n\t\t\t FindElement.byQuery(\"#resultsTable .selectedRow\")\n\t\t\t ]).then(function(elements) {\n\t\t\t\t var table = angular.element(elements[0]);\n\t\t\t\t var selected = angular.element(elements[1]);\n\t\t\t\t var offset = 30;\n\t\t\t\t table.scrollToElement(selected, offset, 0);\n\t\t\t });\n\t\t\tsetFocus();\n\t\t}", "function scrollIntoView(cm, rect) {\n var scrollPos = calculateScrollPos(cm, rect);\n if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); }\n if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }\n}", "function scrollIntoView(cm, rect) {\n var scrollPos = calculateScrollPos(cm, rect);\n if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); }\n if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }\n}", "function scrollIntoView(cm, rect) {\n var scrollPos = calculateScrollPos(cm, rect);\n if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); }\n if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }\n}", "function scrollIntoView(cm, rect) {\n var scrollPos = calculateScrollPos(cm, rect);\n if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); }\n if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }\n}", "function scrollIntoView(cm, rect) {\n var scrollPos = calculateScrollPos(cm, rect);\n if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); }\n if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }\n}", "function scrollIntoView(cm, rect) {\n var scrollPos = calculateScrollPos(cm, rect);\n if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); }\n if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }\n}", "function scrollIntoView(cm, rect) {\n var scrollPos = calculateScrollPos(cm, rect);\n if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); }\n if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }\n}", "function scrollIntoView(cm, rect) {\n var scrollPos = calculateScrollPos(cm, rect);\n if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); }\n if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }\n}", "function scrollIntoView(cm, rect) {\n var scrollPos = calculateScrollPos(cm, rect);\n if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); }\n if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }\n}", "function scrollIntoView(cm, rect) {\n var scrollPos = calculateScrollPos(cm, rect);\n if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); }\n if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }\n}", "function scrollIntoView(cm, rect) {\n var scrollPos = calculateScrollPos(cm, rect);\n if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); }\n if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }\n}", "function scrollToObject() {\n\t\t\t$q.all([\n\t\t\t FindElement.byId(\"resultTableWrapper\"),\n\t\t\t FindElement.byQuery(\"#resultsTable .selectedRow\")\n\t\t\t ]).then(function(elements) {\n\t\t\t\t var table = angular.element(elements[0]);\n\t\t\t\t var selected = angular.element(elements[1]);\n\t\t\t\t var offset = 30;\n\t\t\t\t table.scrollToElement(selected, offset, 0);\n\t\t\t });\n\t\t\t//setFocus();\n\t\t}", "function scroll(els) {\n sections = els;\n\n // when window is scrolled call\n // position. When it is resized\n // call resize.\n d3.select(window)\n .on('scroll.scroller', position)\n .on('resize.scroller', resize);\n\n // manually call resize\n // initially to setup\n // scroller.\n resize();\n\n // hack to get position\n // to be called once for\n // the scroll position on\n // load.\n // @v4 timer no longer stops if you\n // return true at the end of the callback\n // function - so here we stop it explicitly.\n var timer = d3.timer(function () {\n position();\n timer.stop();\n });\n }", "function scrollTo(e,d){if(d>=0){var h=document.documentElement;if(h.scrollTop===0){var t=h.scrollTop;++h.scrollTop;h=t+1===h.scrollTop--?h:document.body}typeof e===\"object\"&&(e=e.offsetTop);scrollToX(h,h.scrollTop,e,0,1/d,20)}}", "function scrolldiv() {\n window.scroll(0, findPosition(matches[i]));\n }", "function ScrollPosition() {}", "setScrollPosition() {\n var step = this.state.step;\n var isVertical = this.props.vertical;\n var left = !isVertical ? step * this.state.width : 0;\n var top = isVertical ? step * this.state.height : 0;\n\n this.scroller.setPosition(left, top);\n this.scroller.scrollTo(left, top, false);\n }", "function scrollPosIntoView(cm, pos, end, margin) {\r\n if (margin == null) { margin = 0; }\r\n var rect;\r\n if (!cm.options.lineWrapping && pos == end) {\r\n // Set pos and end to the cursor positions around the character pos sticks to\r\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\r\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\r\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\r\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\r\n }\r\n for (var limit = 0; limit < 5; limit++) {\r\n var changed = false;\r\n var coords = cursorCoords(cm, pos);\r\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\r\n rect = {left: Math.min(coords.left, endCoords.left),\r\n top: Math.min(coords.top, endCoords.top) - margin,\r\n right: Math.max(coords.left, endCoords.left),\r\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\r\n var scrollPos = calculateScrollPos(cm, rect);\r\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\r\n if (scrollPos.scrollTop != null) {\r\n updateScrollTop(cm, scrollPos.scrollTop);\r\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\r\n }\r\n if (scrollPos.scrollLeft != null) {\r\n setScrollLeft(cm, scrollPos.scrollLeft);\r\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\r\n }\r\n if (!changed) { break }\r\n }\r\n return rect\r\n}", "function scrollToPoint(x, y) {\n Reporter_1.Reporter.debug(`Scrolling to point: (${x},${y})`);\n tryBlock(() => browser.scroll(x, y), `Failed scroll to point (${x},${y})`);\n }", "function scrollIntoView(element) {\n var scrollerBounds = scroller.getBoundingClientRect();\n var elementBounds = element.getBoundingClientRect();\n var extra = 7;\n var scrollX = Math.min(0, elementBounds.left - scrollerBounds.left - extra) || Math.max(0, elementBounds.right - scrollerBounds.right + extra + (scroller.offsetWidth - scroller.clientWidth));\n var scrollY = Math.min(0, elementBounds.top - scrollerBounds.top - extra) || Math.max(0, elementBounds.bottom - scrollerBounds.bottom + extra + (scroller.offsetHeight - scroller.clientHeight));\n scroller.scrollLeft += scrollX;\n scroller.scrollTop += scrollY;\n }", "function resolveScrollToPos(cm) {\n\t\t var range = cm.curOp.scrollToPos;\n\t\t if (range) {\n\t\t cm.curOp.scrollToPos = null;\n\t\t var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to);\n\t\t scrollToCoordsRange(cm, from, to, range.margin);\n\t\t }\n\t\t }", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n}", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n}", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n}", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n}", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n}", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n}", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n}", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n}", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n}", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n}", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n}", "function scroll (element) {\r\n element.scrollIntoView({behavior: \"smooth\", block: \"start\", inline: \"nearest\"});\r\n}", "function scrollTo(el, d, n) { // element, diff(-/+), number\n if (d !== undefined) { // If offset is provided\n if (d === \"pos\") {\n $('html, body').animate({\n scrollTop: $(el).offset().top + n\n }, 800)\n } else {\n $('html, body').animate({\n scrollTop: $(el).offset().top - n\n }, 800)\n }\n } else { // If no offset is defined\n $('html, body').animate({\n scrollTop: $(el).offset().top\n }, 800)\n }\n }", "function updateScroll(event) {\n moveElements();\n}", "function scroll(els) {\n sections = els;\n\n // when window is scrolled call\n // position. When it is resized\n // call resize.\n\n d3.select(ReactDOM.findDOMNode(this))\n .on('scroll.scroller', position)\n .on('resize.scroller', resize);\n\n // manually call resize\n // initially to setup\n // scroller.\n resize();\n\n // hack to get position\n // to be called once for\n // the scroll position on\n // load.\n // @v4 timer no longer stops if you\n // return true at the end of the callback\n // function - so here we stop it explicitly.\n var timer = d3.timer(function () {\n position();\n timer.stop();\n });\n }", "function scroll() {\n d3.select(window)\n .on('scroll.scroller', position)\n .on('resize.scroller', resize)\n resize();\n let timer = d3.timer(function() {\n position();\n timer.stop();\n });\n }", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n }", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n }", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n }", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n }", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n }", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n }", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n }", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n }", "function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n }" ]
[ "0.6669822", "0.6622224", "0.6622224", "0.6622224", "0.65621066", "0.65621066", "0.65621066", "0.65621066", "0.65621066", "0.65621066", "0.65621066", "0.6510055", "0.64823157", "0.61906785", "0.61906785", "0.61906785", "0.61906785", "0.6184818", "0.61735964", "0.6156998", "0.6156998", "0.6156998", "0.6156579", "0.60284275", "0.5997927", "0.5943731", "0.5940164", "0.58667004", "0.58467674", "0.58467674", "0.58405584", "0.5836136", "0.58236396", "0.5821728", "0.581645", "0.5812979", "0.5801789", "0.5759933", "0.57552826", "0.57552826", "0.57552826", "0.57552826", "0.57552826", "0.57552826", "0.57552826", "0.57552826", "0.57552826", "0.57552826", "0.57552826", "0.57368475", "0.5708806", "0.5677217", "0.5674699", "0.56649095", "0.565387", "0.561623", "0.56038046", "0.55867076", "0.55737716", "0.5572411", "0.5572411", "0.5572411", "0.5572411", "0.5572411", "0.5572411", "0.5572411", "0.5572411", "0.5572411", "0.5572411", "0.5572411", "0.55584806", "0.5555401", "0.55472803", "0.55451494", "0.5533564", "0.55323976", "0.55323976", "0.55323976", "0.55323976", "0.55323976", "0.55323976", "0.55323976", "0.55323976", "0.55323976" ]
0.5908387
39
Calculate a new scroll position needed to scroll the given rectangle into view. Returns an object with scrollTop and scrollLeft properties. When these are undefined, the vertical/horizontal position does not need to be adjusted.
function calculateScrollPos(cm, rect) { var display = cm.display, snapMargin = textHeight(cm.display); if (rect.top < 0) { rect.top = 0; } var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop; var screen = displayHeight(cm), result = {}; if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; } var docBottom = cm.doc.height + paddingVert(display); var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin; if (rect.top < screentop) { result.scrollTop = atTop ? 0 : rect.top; } else if (rect.bottom > screentop + screen) { var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen); if (newTop != screentop) { result.scrollTop = newTop; } } var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft; var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0); var tooWide = rect.right - rect.left > screenw; if (tooWide) { rect.right = rect.left + screenw; } if (rect.left < 10) { result.scrollLeft = 0; } else if (rect.left < screenleft) { result.scrollLeft = Math.max(0, rect.left - (tooWide ? 0 : 10)); } else if (rect.right > screenw + screenleft - 3) { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; } return result }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getPosition(rect) {\r\n return {\r\n \"top\" : window.scrollY + Math.round(rect.top),\r\n \"right\" : Math.round(rect.left + rect.width),\r\n \"bottom\" : window.scrollY + Math.round(rect.top + rect.height),\r\n \"left\" : Math.round(rect.left),\r\n \"leftCenter\" : Math.round(rect.left + rect.width/2)\r\n };\r\n }", "function calculateScrollPos(cm, rect) {\n var display = cm.display, snapMargin = textHeight(cm.display);\n if (rect.top < 0) { rect.top = 0; }\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = displayHeight(cm), result = {};\n if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;\n if (rect.top < screentop) {\n result.scrollTop = atTop ? 0 : rect.top;\n } else if (rect.bottom > screentop + screen) {\n var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);\n if (newTop != screentop) { result.scrollTop = newTop; }\n }\n\n var gutterSpace = cm.options.fixedGutter ? 0 : display.gutters.offsetWidth;\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft - gutterSpace;\n var screenw = displayWidth(cm) - display.gutters.offsetWidth;\n var tooWide = rect.right - rect.left > screenw;\n if (tooWide) { rect.right = rect.left + screenw; }\n if (rect.left < 10)\n { result.scrollLeft = 0; }\n else if (rect.left < screenleft)\n { result.scrollLeft = Math.max(0, rect.left + gutterSpace - (tooWide ? 0 : 10)); }\n else if (rect.right > screenw + screenleft - 3)\n { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }\n return result\n }", "function calculateScrollPos(cm, rect) {\n var display = cm.display, snapMargin = textHeight(cm.display);\n if (rect.top < 0) { rect.top = 0; }\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = displayHeight(cm), result = {};\n if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;\n if (rect.top < screentop) {\n result.scrollTop = atTop ? 0 : rect.top;\n } else if (rect.bottom > screentop + screen) {\n var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);\n if (newTop != screentop) { result.scrollTop = newTop; }\n }\n\n var gutterSpace = cm.options.fixedGutter ? 0 : display.gutters.offsetWidth;\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft - gutterSpace;\n var screenw = displayWidth(cm) - display.gutters.offsetWidth;\n var tooWide = rect.right - rect.left > screenw;\n if (tooWide) { rect.right = rect.left + screenw; }\n if (rect.left < 10)\n { result.scrollLeft = 0; }\n else if (rect.left < screenleft)\n { result.scrollLeft = Math.max(0, rect.left + gutterSpace - (tooWide ? 0 : 10)); }\n else if (rect.right > screenw + screenleft - 3)\n { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }\n return result\n }", "function calculateScrollPos(cm, rect) {\n var display = cm.display, snapMargin = textHeight(cm.display);\n if (rect.top < 0) { rect.top = 0; }\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = displayHeight(cm), result = {};\n if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;\n if (rect.top < screentop) {\n result.scrollTop = atTop ? 0 : rect.top;\n } else if (rect.bottom > screentop + screen) {\n var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);\n if (newTop != screentop) { result.scrollTop = newTop; }\n }\n\n var gutterSpace = cm.options.fixedGutter ? 0 : display.gutters.offsetWidth;\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft - gutterSpace;\n var screenw = displayWidth(cm) - display.gutters.offsetWidth;\n var tooWide = rect.right - rect.left > screenw;\n if (tooWide) { rect.right = rect.left + screenw; }\n if (rect.left < 10)\n { result.scrollLeft = 0; }\n else if (rect.left < screenleft)\n { result.scrollLeft = Math.max(0, rect.left + gutterSpace - (tooWide ? 0 : 10)); }\n else if (rect.right > screenw + screenleft - 3)\n { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }\n return result\n }", "function calculateScrollPos(cm, rect) {\n var display = cm.display, snapMargin = textHeight(cm.display);\n if (rect.top < 0) { rect.top = 0; }\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = displayHeight(cm), result = {};\n if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;\n if (rect.top < screentop) {\n result.scrollTop = atTop ? 0 : rect.top;\n } else if (rect.bottom > screentop + screen) {\n var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);\n if (newTop != screentop) { result.scrollTop = newTop; }\n }\n\n var gutterSpace = cm.options.fixedGutter ? 0 : display.gutters.offsetWidth;\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft - gutterSpace;\n var screenw = displayWidth(cm) - display.gutters.offsetWidth;\n var tooWide = rect.right - rect.left > screenw;\n if (tooWide) { rect.right = rect.left + screenw; }\n if (rect.left < 10)\n { result.scrollLeft = 0; }\n else if (rect.left < screenleft)\n { result.scrollLeft = Math.max(0, rect.left + gutterSpace - (tooWide ? 0 : 10)); }\n else if (rect.right > screenw + screenleft - 3)\n { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }\n return result\n }", "function calculateScrollPos(cm, rect) {\n var display = cm.display, snapMargin = textHeight(cm.display);\n if (rect.top < 0) { rect.top = 0; }\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = displayHeight(cm), result = {};\n if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;\n if (rect.top < screentop) {\n result.scrollTop = atTop ? 0 : rect.top;\n } else if (rect.bottom > screentop + screen) {\n var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);\n if (newTop != screentop) { result.scrollTop = newTop; }\n }\n\n var gutterSpace = cm.options.fixedGutter ? 0 : display.gutters.offsetWidth;\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft - gutterSpace;\n var screenw = displayWidth(cm) - display.gutters.offsetWidth;\n var tooWide = rect.right - rect.left > screenw;\n if (tooWide) { rect.right = rect.left + screenw; }\n if (rect.left < 10)\n { result.scrollLeft = 0; }\n else if (rect.left < screenleft)\n { result.scrollLeft = Math.max(0, rect.left + gutterSpace - (tooWide ? 0 : 10)); }\n else if (rect.right > screenw + screenleft - 3)\n { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }\n return result\n }", "function calculateScrollPos(cm, rect) {\n var display = cm.display, snapMargin = textHeight(cm.display);\n if (rect.top < 0) { rect.top = 0; }\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = displayHeight(cm), result = {};\n if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;\n if (rect.top < screentop) {\n result.scrollTop = atTop ? 0 : rect.top;\n } else if (rect.bottom > screentop + screen) {\n var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);\n if (newTop != screentop) { result.scrollTop = newTop; }\n }\n\n var gutterSpace = cm.options.fixedGutter ? 0 : display.gutters.offsetWidth;\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft - gutterSpace;\n var screenw = displayWidth(cm) - display.gutters.offsetWidth;\n var tooWide = rect.right - rect.left > screenw;\n if (tooWide) { rect.right = rect.left + screenw; }\n if (rect.left < 10)\n { result.scrollLeft = 0; }\n else if (rect.left < screenleft)\n { result.scrollLeft = Math.max(0, rect.left + gutterSpace - (tooWide ? 0 : 10)); }\n else if (rect.right > screenw + screenleft - 3)\n { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }\n return result\n }", "getViewportScrollPosition() {\n // While we can get a reference to the fake document\n // during SSR, it doesn't have getBoundingClientRect.\n if (!this._platform.isBrowser) {\n return { top: 0, left: 0 };\n }\n // The top-left-corner of the viewport is determined by the scroll position of the document\n // body, normally just (scrollLeft, scrollTop). However, Chrome and Firefox disagree about\n // whether `document.body` or `document.documentElement` is the scrolled element, so reading\n // `scrollTop` and `scrollLeft` is inconsistent. However, using the bounding rect of\n // `document.documentElement` works consistently, where the `top` and `left` values will\n // equal negative the scroll position.\n const document = this._getDocument();\n const window = this._getWindow();\n const documentElement = document.documentElement;\n const documentRect = documentElement.getBoundingClientRect();\n const top = -documentRect.top || document.body.scrollTop || window.scrollY ||\n documentElement.scrollTop || 0;\n const left = -documentRect.left || document.body.scrollLeft || window.scrollX ||\n documentElement.scrollLeft || 0;\n return { top, left };\n }", "getViewportScrollPosition() {\n // While we can get a reference to the fake document\n // during SSR, it doesn't have getBoundingClientRect.\n if (!this._platform.isBrowser) {\n return { top: 0, left: 0 };\n }\n // The top-left-corner of the viewport is determined by the scroll position of the document\n // body, normally just (scrollLeft, scrollTop). However, Chrome and Firefox disagree about\n // whether `document.body` or `document.documentElement` is the scrolled element, so reading\n // `scrollTop` and `scrollLeft` is inconsistent. However, using the bounding rect of\n // `document.documentElement` works consistently, where the `top` and `left` values will\n // equal negative the scroll position.\n const document = this._document;\n const window = this._getWindow();\n const documentElement = document.documentElement;\n const documentRect = documentElement.getBoundingClientRect();\n const top = -documentRect.top || document.body.scrollTop || window.scrollY ||\n documentElement.scrollTop || 0;\n const left = -documentRect.left || document.body.scrollLeft || window.scrollX ||\n documentElement.scrollLeft || 0;\n return { top, left };\n }", "function calculateScrollPos(cm, rect) {\n var display = cm.display,\n snapMargin = textHeight(cm.display);\n\n if (rect.top < 0) {\n rect.top = 0;\n }\n\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = displayHeight(cm),\n result = {};\n\n if (rect.bottom - rect.top > screen) {\n rect.bottom = rect.top + screen;\n }\n\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = rect.top < snapMargin,\n atBottom = rect.bottom > docBottom - snapMargin;\n\n if (rect.top < screentop) {\n result.scrollTop = atTop ? 0 : rect.top;\n } else if (rect.bottom > screentop + screen) {\n var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);\n\n if (newTop != screentop) {\n result.scrollTop = newTop;\n }\n }\n\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;\n var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);\n var tooWide = rect.right - rect.left > screenw;\n\n if (tooWide) {\n rect.right = rect.left + screenw;\n }\n\n if (rect.left < 10) {\n result.scrollLeft = 0;\n } else if (rect.left < screenleft) {\n result.scrollLeft = Math.max(0, rect.left - (tooWide ? 0 : 10));\n } else if (rect.right > screenw + screenleft - 3) {\n result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw;\n }\n\n return result;\n } // Store a relative adjustment to the scroll position in the current", "function calculateScrollPos(cm, rect) {\r\n var display = cm.display, snapMargin = textHeight(cm.display);\r\n if (rect.top < 0) { rect.top = 0; }\r\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\r\n var screen = displayHeight(cm), result = {};\r\n if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }\r\n var docBottom = cm.doc.height + paddingVert(display);\r\n var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;\r\n if (rect.top < screentop) {\r\n result.scrollTop = atTop ? 0 : rect.top;\r\n } else if (rect.bottom > screentop + screen) {\r\n var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);\r\n if (newTop != screentop) { result.scrollTop = newTop; }\r\n }\r\n\r\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;\r\n var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);\r\n var tooWide = rect.right - rect.left > screenw;\r\n if (tooWide) { rect.right = rect.left + screenw; }\r\n if (rect.left < 10)\r\n { result.scrollLeft = 0; }\r\n else if (rect.left < screenleft)\r\n { result.scrollLeft = Math.max(0, rect.left - (tooWide ? 0 : 10)); }\r\n else if (rect.right > screenw + screenleft - 3)\r\n { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }\r\n return result\r\n}", "function calculateScrollPos(cm, rect) {\n var display = cm.display, snapMargin = textHeight(cm.display);\n if (rect.top < 0) { rect.top = 0; }\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = displayHeight(cm), result = {};\n if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;\n if (rect.top < screentop) {\n result.scrollTop = atTop ? 0 : rect.top;\n } else if (rect.bottom > screentop + screen) {\n var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);\n if (newTop != screentop) { result.scrollTop = newTop; }\n }\n\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;\n var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);\n var tooWide = rect.right - rect.left > screenw;\n if (tooWide) { rect.right = rect.left + screenw; }\n if (rect.left < 10)\n { result.scrollLeft = 0; }\n else if (rect.left < screenleft)\n { result.scrollLeft = Math.max(0, rect.left - (tooWide ? 0 : 10)); }\n else if (rect.right > screenw + screenleft - 3)\n { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }\n return result\n}", "function calculateScrollPos(cm, rect) {\n var display = cm.display, snapMargin = textHeight(cm.display);\n if (rect.top < 0) { rect.top = 0; }\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = displayHeight(cm), result = {};\n if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;\n if (rect.top < screentop) {\n result.scrollTop = atTop ? 0 : rect.top;\n } else if (rect.bottom > screentop + screen) {\n var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);\n if (newTop != screentop) { result.scrollTop = newTop; }\n }\n\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;\n var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);\n var tooWide = rect.right - rect.left > screenw;\n if (tooWide) { rect.right = rect.left + screenw; }\n if (rect.left < 10)\n { result.scrollLeft = 0; }\n else if (rect.left < screenleft)\n { result.scrollLeft = Math.max(0, rect.left - (tooWide ? 0 : 10)); }\n else if (rect.right > screenw + screenleft - 3)\n { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }\n return result\n}", "function calculateScrollPos(cm, rect) {\n var display = cm.display, snapMargin = textHeight(cm.display);\n if (rect.top < 0) { rect.top = 0; }\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = displayHeight(cm), result = {};\n if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;\n if (rect.top < screentop) {\n result.scrollTop = atTop ? 0 : rect.top;\n } else if (rect.bottom > screentop + screen) {\n var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);\n if (newTop != screentop) { result.scrollTop = newTop; }\n }\n\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;\n var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);\n var tooWide = rect.right - rect.left > screenw;\n if (tooWide) { rect.right = rect.left + screenw; }\n if (rect.left < 10)\n { result.scrollLeft = 0; }\n else if (rect.left < screenleft)\n { result.scrollLeft = Math.max(0, rect.left - (tooWide ? 0 : 10)); }\n else if (rect.right > screenw + screenleft - 3)\n { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }\n return result\n}", "function calculateScrollPos(cm, rect) {\n var display = cm.display, snapMargin = textHeight(cm.display);\n if (rect.top < 0) { rect.top = 0; }\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = displayHeight(cm), result = {};\n if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;\n if (rect.top < screentop) {\n result.scrollTop = atTop ? 0 : rect.top;\n } else if (rect.bottom > screentop + screen) {\n var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);\n if (newTop != screentop) { result.scrollTop = newTop; }\n }\n\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;\n var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);\n var tooWide = rect.right - rect.left > screenw;\n if (tooWide) { rect.right = rect.left + screenw; }\n if (rect.left < 10)\n { result.scrollLeft = 0; }\n else if (rect.left < screenleft)\n { result.scrollLeft = Math.max(0, rect.left - (tooWide ? 0 : 10)); }\n else if (rect.right > screenw + screenleft - 3)\n { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }\n return result\n}", "function calculateScrollPos(cm, rect) {\n var display = cm.display, snapMargin = textHeight(cm.display);\n if (rect.top < 0) { rect.top = 0; }\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = displayHeight(cm), result = {};\n if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;\n if (rect.top < screentop) {\n result.scrollTop = atTop ? 0 : rect.top;\n } else if (rect.bottom > screentop + screen) {\n var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);\n if (newTop != screentop) { result.scrollTop = newTop; }\n }\n\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;\n var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);\n var tooWide = rect.right - rect.left > screenw;\n if (tooWide) { rect.right = rect.left + screenw; }\n if (rect.left < 10)\n { result.scrollLeft = 0; }\n else if (rect.left < screenleft)\n { result.scrollLeft = Math.max(0, rect.left - (tooWide ? 0 : 10)); }\n else if (rect.right > screenw + screenleft - 3)\n { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }\n return result\n}", "function calculateScrollPos(cm, rect) {\n var display = cm.display, snapMargin = textHeight(cm.display);\n if (rect.top < 0) { rect.top = 0; }\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = displayHeight(cm), result = {};\n if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;\n if (rect.top < screentop) {\n result.scrollTop = atTop ? 0 : rect.top;\n } else if (rect.bottom > screentop + screen) {\n var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);\n if (newTop != screentop) { result.scrollTop = newTop; }\n }\n\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;\n var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);\n var tooWide = rect.right - rect.left > screenw;\n if (tooWide) { rect.right = rect.left + screenw; }\n if (rect.left < 10)\n { result.scrollLeft = 0; }\n else if (rect.left < screenleft)\n { result.scrollLeft = Math.max(0, rect.left - (tooWide ? 0 : 10)); }\n else if (rect.right > screenw + screenleft - 3)\n { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }\n return result\n}", "function calculateScrollPos(cm, rect) {\n var display = cm.display, snapMargin = textHeight(cm.display);\n if (rect.top < 0) { rect.top = 0; }\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = displayHeight(cm), result = {};\n if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;\n if (rect.top < screentop) {\n result.scrollTop = atTop ? 0 : rect.top;\n } else if (rect.bottom > screentop + screen) {\n var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);\n if (newTop != screentop) { result.scrollTop = newTop; }\n }\n\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;\n var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);\n var tooWide = rect.right - rect.left > screenw;\n if (tooWide) { rect.right = rect.left + screenw; }\n if (rect.left < 10)\n { result.scrollLeft = 0; }\n else if (rect.left < screenleft)\n { result.scrollLeft = Math.max(0, rect.left - (tooWide ? 0 : 10)); }\n else if (rect.right > screenw + screenleft - 3)\n { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }\n return result\n}", "function calculateScrollPos(cm, rect) {\n var display = cm.display, snapMargin = textHeight(cm.display);\n if (rect.top < 0) { rect.top = 0; }\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = displayHeight(cm), result = {};\n if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;\n if (rect.top < screentop) {\n result.scrollTop = atTop ? 0 : rect.top;\n } else if (rect.bottom > screentop + screen) {\n var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);\n if (newTop != screentop) { result.scrollTop = newTop; }\n }\n\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;\n var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);\n var tooWide = rect.right - rect.left > screenw;\n if (tooWide) { rect.right = rect.left + screenw; }\n if (rect.left < 10)\n { result.scrollLeft = 0; }\n else if (rect.left < screenleft)\n { result.scrollLeft = Math.max(0, rect.left - (tooWide ? 0 : 10)); }\n else if (rect.right > screenw + screenleft - 3)\n { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }\n return result\n}", "function calculateScrollPos(cm, rect) {\n var display = cm.display, snapMargin = textHeight(cm.display);\n if (rect.top < 0) { rect.top = 0; }\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = displayHeight(cm), result = {};\n if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;\n if (rect.top < screentop) {\n result.scrollTop = atTop ? 0 : rect.top;\n } else if (rect.bottom > screentop + screen) {\n var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);\n if (newTop != screentop) { result.scrollTop = newTop; }\n }\n\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;\n var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);\n var tooWide = rect.right - rect.left > screenw;\n if (tooWide) { rect.right = rect.left + screenw; }\n if (rect.left < 10)\n { result.scrollLeft = 0; }\n else if (rect.left < screenleft)\n { result.scrollLeft = Math.max(0, rect.left - (tooWide ? 0 : 10)); }\n else if (rect.right > screenw + screenleft - 3)\n { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }\n return result\n}", "function calculateScrollPos(cm, rect) {\n var display = cm.display, snapMargin = textHeight(cm.display);\n if (rect.top < 0) { rect.top = 0; }\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = displayHeight(cm), result = {};\n if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;\n if (rect.top < screentop) {\n result.scrollTop = atTop ? 0 : rect.top;\n } else if (rect.bottom > screentop + screen) {\n var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);\n if (newTop != screentop) { result.scrollTop = newTop; }\n }\n\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;\n var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);\n var tooWide = rect.right - rect.left > screenw;\n if (tooWide) { rect.right = rect.left + screenw; }\n if (rect.left < 10)\n { result.scrollLeft = 0; }\n else if (rect.left < screenleft)\n { result.scrollLeft = Math.max(0, rect.left - (tooWide ? 0 : 10)); }\n else if (rect.right > screenw + screenleft - 3)\n { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }\n return result\n}", "function calculateScrollPos(cm, rect) {\n var display = cm.display, snapMargin = textHeight(cm.display);\n if (rect.top < 0) { rect.top = 0; }\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = displayHeight(cm), result = {};\n if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;\n if (rect.top < screentop) {\n result.scrollTop = atTop ? 0 : rect.top;\n } else if (rect.bottom > screentop + screen) {\n var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);\n if (newTop != screentop) { result.scrollTop = newTop; }\n }\n\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;\n var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);\n var tooWide = rect.right - rect.left > screenw;\n if (tooWide) { rect.right = rect.left + screenw; }\n if (rect.left < 10)\n { result.scrollLeft = 0; }\n else if (rect.left < screenleft)\n { result.scrollLeft = Math.max(0, rect.left - (tooWide ? 0 : 10)); }\n else if (rect.right > screenw + screenleft - 3)\n { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }\n return result\n}", "function calculateScrollPos(cm, rect) {\n var display = cm.display, snapMargin = textHeight(cm.display)\n if (rect.top < 0) { rect.top = 0 }\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop\n var screen = displayHeight(cm), result = {}\n if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen }\n var docBottom = cm.doc.height + paddingVert(display)\n var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin\n if (rect.top < screentop) {\n result.scrollTop = atTop ? 0 : rect.top\n } else if (rect.bottom > screentop + screen) {\n var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen)\n if (newTop != screentop) { result.scrollTop = newTop }\n }\n\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft\n var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0)\n var tooWide = rect.right - rect.left > screenw\n if (tooWide) { rect.right = rect.left + screenw }\n if (rect.left < 10)\n { result.scrollLeft = 0 }\n else if (rect.left < screenleft)\n { result.scrollLeft = Math.max(0, rect.left - (tooWide ? 0 : 10)) }\n else if (rect.right > screenw + screenleft - 3)\n { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw }\n return result\n}", "function calculateScrollPos(cm, rect) {\n\t\t var display = cm.display, snapMargin = textHeight(cm.display);\n\t\t if (rect.top < 0) { rect.top = 0; }\n\t\t var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n\t\t var screen = displayHeight(cm), result = {};\n\t\t if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }\n\t\t var docBottom = cm.doc.height + paddingVert(display);\n\t\t var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;\n\t\t if (rect.top < screentop) {\n\t\t result.scrollTop = atTop ? 0 : rect.top;\n\t\t } else if (rect.bottom > screentop + screen) {\n\t\t var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);\n\t\t if (newTop != screentop) { result.scrollTop = newTop; }\n\t\t }\n\n\t\t var gutterSpace = cm.options.fixedGutter ? 0 : display.gutters.offsetWidth;\n\t\t var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft - gutterSpace;\n\t\t var screenw = displayWidth(cm) - display.gutters.offsetWidth;\n\t\t var tooWide = rect.right - rect.left > screenw;\n\t\t if (tooWide) { rect.right = rect.left + screenw; }\n\t\t if (rect.left < 10)\n\t\t { result.scrollLeft = 0; }\n\t\t else if (rect.left < screenleft)\n\t\t { result.scrollLeft = Math.max(0, rect.left + gutterSpace - (tooWide ? 0 : 10)); }\n\t\t else if (rect.right > screenw + screenleft - 3)\n\t\t { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }\n\t\t return result\n\t\t }", "getScroll() {\n if (!(this.frame instanceof HTMLElement)) {\n return {\n x: undefined,\n y: undefined\n };\n }\n return {\n x: this.frame.contentWindow.scrollX,\n y: this.frame.contentWindow.scrollY\n };\n }", "function getScrollToShow(doc, boundingBox) {\n const scroll = getScroll(doc);\n const win = getWindow(doc);\n // vertical\n // if(scroll.y > boundingBox.top - SCROLL_ZONE_SIZE) {\n if (scroll.y > boundingBox.top) {\n scroll.y = boundingBox.top - exports.SCROLL_ZONE_SIZE;\n }\n // else if(scroll.y < boundingBox.bottom + SCROLL_ZONE_SIZE - win.innerHeight) {\n else if (scroll.y < boundingBox.bottom - win.innerHeight) {\n scroll.y = boundingBox.bottom + exports.SCROLL_ZONE_SIZE - win.innerHeight;\n }\n // horizontal\n // if(scroll.x > boundingBox.left - SCROLL_ZONE_SIZE) {\n if (scroll.x > boundingBox.left) {\n scroll.x = boundingBox.left - exports.SCROLL_ZONE_SIZE;\n }\n // else if(scroll.x < boundingBox.right + SCROLL_ZONE_SIZE - win.innerWidth) {\n else if (scroll.x < boundingBox.right - win.innerWidth) {\n scroll.x = boundingBox.right + exports.SCROLL_ZONE_SIZE - win.innerWidth;\n }\n return {\n x: Math.max(0, scroll.x),\n y: Math.max(0, scroll.y),\n };\n }", "function calcScrollPosition() {\n const positionBracket = calcPositionBracket();\n const scrollY = window.scrollY;\n const r = ((scrollY - positionBracket.copy.prev) / (positionBracket.copy.next - positionBracket.copy.prev));\n\n const visualsScrollTarget = Math.round(positionBracket.visual.prev + ((positionBracket.visual.next - positionBracket.visual.prev) * r));\n\n return visualsScrollTarget;\n}", "function calculateScrollPos(cm, x1, y1, x2, y2) {\n var display = cm.display, snapMargin = textHeight(cm.display);\n if (y1 < 0) y1 = 0;\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = display.scroller.clientHeight - scrollerCutOff, result = {};\n if (y2 - y1 > screen) y2 = y1 + screen;\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = y1 < snapMargin, atBottom = y2 > docBottom - snapMargin;\n if (y1 < screentop) {\n result.scrollTop = atTop ? 0 : y1;\n } else if (y2 > screentop + screen) {\n var newTop = Math.min(y1, (atBottom ? docBottom : y2) - screen);\n if (newTop != screentop) result.scrollTop = newTop;\n }\n\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;\n var screenw = display.scroller.clientWidth - scrollerCutOff - display.gutters.offsetWidth;\n var tooWide = x2 - x1 > screenw;\n if (tooWide) x2 = x1 + screenw;\n if (x1 < 10)\n result.scrollLeft = 0;\n else if (x1 < screenleft)\n result.scrollLeft = Math.max(0, x1 - (tooWide ? 0 : 10));\n else if (x2 > screenw + screenleft - 3)\n result.scrollLeft = x2 + (tooWide ? 0 : 10) - screenw;\n\n return result;\n }", "function calculateScrollPos(cm, x1, y1, x2, y2) {\n var display = cm.display, snapMargin = textHeight(cm.display);\n if (y1 < 0) y1 = 0;\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = display.scroller.clientHeight - scrollerCutOff, result = {};\n if (y2 - y1 > screen) y2 = y1 + screen;\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = y1 < snapMargin, atBottom = y2 > docBottom - snapMargin;\n if (y1 < screentop) {\n result.scrollTop = atTop ? 0 : y1;\n } else if (y2 > screentop + screen) {\n var newTop = Math.min(y1, (atBottom ? docBottom : y2) - screen);\n if (newTop != screentop) result.scrollTop = newTop;\n }\n\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;\n var screenw = display.scroller.clientWidth - scrollerCutOff - display.gutters.offsetWidth;\n var tooWide = x2 - x1 > screenw;\n if (tooWide) x2 = y1 + screen;\n if (x1 < 10)\n result.scrollLeft = 0;\n else if (x1 < screenleft)\n result.scrollLeft = Math.max(0, x1 - (tooWide ? 0 : 10));\n else if (x2 > screenw + screenleft - 3)\n result.scrollLeft = x2 + (tooWide ? 0 : 10) - screenw;\n\n return result;\n }", "getViewportScrollPosition() {\n // While we can get a reference to the fake document\n // during SSR, it doesn't have getBoundingClientRect.\n if (!this._platform.isBrowser) {\n return {\n top: 0,\n left: 0\n };\n } // The top-left-corner of the viewport is determined by the scroll position of the document\n // body, normally just (scrollLeft, scrollTop). However, Chrome and Firefox disagree about\n // whether `document.body` or `document.documentElement` is the scrolled element, so reading\n // `scrollTop` and `scrollLeft` is inconsistent. However, using the bounding rect of\n // `document.documentElement` works consistently, where the `top` and `left` values will\n // equal negative the scroll position.\n\n\n const document = this._document;\n\n const window = this._getWindow();\n\n const documentElement = document.documentElement;\n const documentRect = documentElement.getBoundingClientRect();\n const top = -documentRect.top || document.body.scrollTop || window.scrollY || documentElement.scrollTop || 0;\n const left = -documentRect.left || document.body.scrollLeft || window.scrollX || documentElement.scrollLeft || 0;\n return {\n top,\n left\n };\n }", "function calculateScrollPos(cm, x1, y1, x2, y2) {\r\n var display = cm.display, snapMargin = textHeight(cm.display);\r\n if (y1 < 0) y1 = 0;\r\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\r\n var screen = display.scroller.clientHeight - scrollerCutOff, result = {};\r\n if (y2 - y1 > screen) y2 = y1 + screen;\r\n var docBottom = cm.doc.height + paddingVert(display);\r\n var atTop = y1 < snapMargin, atBottom = y2 > docBottom - snapMargin;\r\n if (y1 < screentop) {\r\n result.scrollTop = atTop ? 0 : y1;\r\n } else if (y2 > screentop + screen) {\r\n var newTop = Math.min(y1, (atBottom ? docBottom : y2) - screen);\r\n if (newTop != screentop) result.scrollTop = newTop;\r\n }\r\n\r\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;\r\n var screenw = display.scroller.clientWidth - scrollerCutOff - display.gutters.offsetWidth;\r\n var tooWide = x2 - x1 > screenw;\r\n if (tooWide) x2 = y1 + screen;\r\n if (x1 < 10)\r\n result.scrollLeft = 0;\r\n else if (x1 < screenleft)\r\n result.scrollLeft = Math.max(0, x1 - (tooWide ? 0 : 10));\r\n else if (x2 > screenw + screenleft - 3)\r\n result.scrollLeft = x2 + (tooWide ? 0 : 10) - screenw;\r\n\r\n return result;\r\n }", "getScrollPosition() {\n if (this.supportsScrolling()) {\n return [this.window.pageXOffset, this.window.pageYOffset];\n } else {\n return [0, 0];\n }\n }", "function getScrollPosition(win) {\n var x = 0, y = 0;\n if (typeof win.pageXOffset == NUMBER && typeof win.pageYOffset == NUMBER) {\n x = win.pageXOffset;\n y = win.pageYOffset;\n } else {\n var doc = win.document;\n var docEl = doc.documentElement;\n var compatMode = doc.compatMode;\n var scrollEl = (typeof compatMode == \"string\" && compatMode.indexOf(\"CSS\") >= 0 && docEl)\n ? docEl : dom.getBody(doc);\n\n if (scrollEl && typeof scrollEl.scrollLeft == NUMBER && typeof scrollEl.scrollTop == NUMBER) {\n try {\n x = scrollEl.scrollLeft;\n y = scrollEl.scrollTop;\n } catch (ex) {}\n }\n }\n return { x: x, y: y };\n }", "function getScrollPosition(win) {\n var x = 0, y = 0;\n if (typeof win.pageXOffset == NUMBER && typeof win.pageYOffset == NUMBER) {\n x = win.pageXOffset;\n y = win.pageYOffset;\n } else {\n var doc = win.document;\n var docEl = doc.documentElement;\n var compatMode = doc.compatMode;\n var scrollEl = (typeof compatMode == \"string\" && compatMode.indexOf(\"CSS\") >= 0 && docEl)\n ? docEl : dom.getBody(doc);\n\n if (scrollEl && typeof scrollEl.scrollLeft == NUMBER && typeof scrollEl.scrollTop == NUMBER) {\n try {\n x = scrollEl.scrollLeft;\n y = scrollEl.scrollTop;\n } catch (ex) {}\n }\n }\n return { x: x, y: y };\n }", "function calculateScrollPos(cm, x1, y1, x2, y2) {\n var display = cm.display, snapMargin = textHeight(cm.display);\n if (y1 < 0) y1 = 0;\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = display.scroller.clientHeight - scrollerCutOff, result = {};\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = y1 < snapMargin, atBottom = y2 > docBottom - snapMargin;\n if (y1 < screentop) {\n result.scrollTop = atTop ? 0 : y1;\n } else if (y2 > screentop + screen) {\n var newTop = Math.min(y1, (atBottom ? docBottom : y2) - screen);\n if (newTop != screentop) result.scrollTop = newTop;\n }\n\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;\n var screenw = display.scroller.clientWidth - scrollerCutOff;\n x1 += display.gutters.offsetWidth; x2 += display.gutters.offsetWidth;\n var gutterw = display.gutters.offsetWidth;\n var atLeft = x1 < gutterw + 10;\n if (x1 < screenleft + gutterw || atLeft) {\n if (atLeft) x1 = 0;\n result.scrollLeft = Math.max(0, x1 - 10 - gutterw);\n } else if (x2 > screenw + screenleft - 3) {\n result.scrollLeft = x2 + 10 - screenw;\n }\n return result;\n }", "getScrollPosition() {\n if (this.supportsScrolling()) {\n return [this.window.pageXOffset, this.window.pageYOffset];\n }\n else {\n return [0, 0];\n }\n }", "getScrollPosition() {\n if (this.supportsScrolling()) {\n return [this.window.pageXOffset, this.window.pageYOffset];\n }\n else {\n return [0, 0];\n }\n }", "getScrollPosition() {\n if (this.supportsScrolling()) {\n return [this.window.pageXOffset, this.window.pageYOffset];\n }\n else {\n return [0, 0];\n }\n }", "getScrollPosition() {\n if (this.supportsScrolling()) {\n return [this.window.pageXOffset, this.window.pageYOffset];\n }\n else {\n return [0, 0];\n }\n }", "getScrollPosition() {\n if (this.supportsScrolling()) {\n return [this.window.pageXOffset, this.window.pageYOffset];\n }\n else {\n return [0, 0];\n }\n }", "function calculateScrollPos(cm, x1, y1, x2, y2) {\n var display = cm.display, snapMargin = textHeight(cm.display);\n if (y1 < 0) y1 = 0;\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = displayHeight(cm), result = {};\n if (y2 - y1 > screen) y2 = y1 + screen;\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = y1 < snapMargin, atBottom = y2 > docBottom - snapMargin;\n if (y1 < screentop) {\n result.scrollTop = atTop ? 0 : y1;\n } else if (y2 > screentop + screen) {\n var newTop = Math.min(y1, (atBottom ? docBottom : y2) - screen);\n if (newTop != screentop) result.scrollTop = newTop;\n }\n\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;\n var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);\n var tooWide = x2 - x1 > screenw;\n if (tooWide) x2 = x1 + screenw;\n if (x1 < 10)\n result.scrollLeft = 0;\n else if (x1 < screenleft)\n result.scrollLeft = Math.max(0, x1 - (tooWide ? 0 : 10));\n else if (x2 > screenw + screenleft - 3)\n result.scrollLeft = x2 + (tooWide ? 0 : 10) - screenw;\n return result;\n }", "function calculateScrollPos(cm, x1, y1, x2, y2) {\n var display = cm.display, snapMargin = textHeight(cm.display);\n if (y1 < 0) y1 = 0;\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = displayHeight(cm), result = {};\n if (y2 - y1 > screen) y2 = y1 + screen;\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = y1 < snapMargin, atBottom = y2 > docBottom - snapMargin;\n if (y1 < screentop) {\n result.scrollTop = atTop ? 0 : y1;\n } else if (y2 > screentop + screen) {\n var newTop = Math.min(y1, (atBottom ? docBottom : y2) - screen);\n if (newTop != screentop) result.scrollTop = newTop;\n }\n\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;\n var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);\n var tooWide = x2 - x1 > screenw;\n if (tooWide) x2 = x1 + screenw;\n if (x1 < 10)\n result.scrollLeft = 0;\n else if (x1 < screenleft)\n result.scrollLeft = Math.max(0, x1 - (tooWide ? 0 : 10));\n else if (x2 > screenw + screenleft - 3)\n result.scrollLeft = x2 + (tooWide ? 0 : 10) - screenw;\n return result;\n }", "function calculateScrollPos(cm, x1, y1, x2, y2) {\n var display = cm.display, snapMargin = textHeight(cm.display);\n if (y1 < 0) y1 = 0;\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = displayHeight(cm), result = {};\n if (y2 - y1 > screen) y2 = y1 + screen;\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = y1 < snapMargin, atBottom = y2 > docBottom - snapMargin;\n if (y1 < screentop) {\n result.scrollTop = atTop ? 0 : y1;\n } else if (y2 > screentop + screen) {\n var newTop = Math.min(y1, (atBottom ? docBottom : y2) - screen);\n if (newTop != screentop) result.scrollTop = newTop;\n }\n\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;\n var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);\n var tooWide = x2 - x1 > screenw;\n if (tooWide) x2 = x1 + screenw;\n if (x1 < 10)\n result.scrollLeft = 0;\n else if (x1 < screenleft)\n result.scrollLeft = Math.max(0, x1 - (tooWide ? 0 : 10));\n else if (x2 > screenw + screenleft - 3)\n result.scrollLeft = x2 + (tooWide ? 0 : 10) - screenw;\n return result;\n }", "function calculateScrollPos(cm, x1, y1, x2, y2) {\n var display = cm.display, snapMargin = textHeight(cm.display);\n if (y1 < 0) y1 = 0;\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = displayHeight(cm), result = {};\n if (y2 - y1 > screen) y2 = y1 + screen;\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = y1 < snapMargin, atBottom = y2 > docBottom - snapMargin;\n if (y1 < screentop) {\n result.scrollTop = atTop ? 0 : y1;\n } else if (y2 > screentop + screen) {\n var newTop = Math.min(y1, (atBottom ? docBottom : y2) - screen);\n if (newTop != screentop) result.scrollTop = newTop;\n }\n\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;\n var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);\n var tooWide = x2 - x1 > screenw;\n if (tooWide) x2 = x1 + screenw;\n if (x1 < 10)\n result.scrollLeft = 0;\n else if (x1 < screenleft)\n result.scrollLeft = Math.max(0, x1 - (tooWide ? 0 : 10));\n else if (x2 > screenw + screenleft - 3)\n result.scrollLeft = x2 + (tooWide ? 0 : 10) - screenw;\n return result;\n }", "extractScrollTargetPosition() {\n const scrollTargetElement = this.getScrollTargetElement();\n\n if (scrollTargetElement === null || scrollTargetElement === undefined) {\n // Scroll target not found\n return {\n top: NaN,\n left: NaN\n };\n }\n\n if (this.isInlineScrolling) {\n return PageScrollInstance.getInlineScrollingTargetPosition(this.pageScrollOptions, scrollTargetElement);\n }\n\n return PageScrollInstance.getScrollingTargetPosition(this.pageScrollOptions, scrollTargetElement);\n }", "function calculateScrollPos(cm, x1, y1, x2, y2) {\n\t var display = cm.display, snapMargin = textHeight(cm.display);\n\t if (y1 < 0) y1 = 0;\n\t var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n\t var screen = displayHeight(cm), result = {};\n\t if (y2 - y1 > screen) y2 = y1 + screen;\n\t var docBottom = cm.doc.height + paddingVert(display);\n\t var atTop = y1 < snapMargin, atBottom = y2 > docBottom - snapMargin;\n\t if (y1 < screentop) {\n\t result.scrollTop = atTop ? 0 : y1;\n\t } else if (y2 > screentop + screen) {\n\t var newTop = Math.min(y1, (atBottom ? docBottom : y2) - screen);\n\t if (newTop != screentop) result.scrollTop = newTop;\n\t }\n\t\n\t var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;\n\t var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);\n\t var tooWide = x2 - x1 > screenw;\n\t if (tooWide) x2 = x1 + screenw;\n\t if (x1 < 10)\n\t result.scrollLeft = 0;\n\t else if (x1 < screenleft)\n\t result.scrollLeft = Math.max(0, x1 - (tooWide ? 0 : 10));\n\t else if (x2 > screenw + screenleft - 3)\n\t result.scrollLeft = x2 + (tooWide ? 0 : 10) - screenw;\n\t return result;\n\t }", "function calculateScrollPos(cm, x1, y1, x2, y2) {\n\t\t var display = cm.display, snapMargin = textHeight(cm.display);\n\t\t if (y1 < 0) y1 = 0;\n\t\t var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n\t\t var screen = displayHeight(cm), result = {};\n\t\t if (y2 - y1 > screen) y2 = y1 + screen;\n\t\t var docBottom = cm.doc.height + paddingVert(display);\n\t\t var atTop = y1 < snapMargin, atBottom = y2 > docBottom - snapMargin;\n\t\t if (y1 < screentop) {\n\t\t result.scrollTop = atTop ? 0 : y1;\n\t\t } else if (y2 > screentop + screen) {\n\t\t var newTop = Math.min(y1, (atBottom ? docBottom : y2) - screen);\n\t\t if (newTop != screentop) result.scrollTop = newTop;\n\t\t }\n\t\t\n\t\t var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;\n\t\t var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);\n\t\t var tooWide = x2 - x1 > screenw;\n\t\t if (tooWide) x2 = x1 + screenw;\n\t\t if (x1 < 10)\n\t\t result.scrollLeft = 0;\n\t\t else if (x1 < screenleft)\n\t\t result.scrollLeft = Math.max(0, x1 - (tooWide ? 0 : 10));\n\t\t else if (x2 > screenw + screenleft - 3)\n\t\t result.scrollLeft = x2 + (tooWide ? 0 : 10) - screenw;\n\t\t return result;\n\t\t }", "function calculateScrollPos(cm, x1, y1, x2, y2) {\n\t var display = cm.display, snapMargin = textHeight(cm.display);\n\t if (y1 < 0) y1 = 0;\n\t var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n\t var screen = displayHeight(cm), result = {};\n\t if (y2 - y1 > screen) y2 = y1 + screen;\n\t var docBottom = cm.doc.height + paddingVert(display);\n\t var atTop = y1 < snapMargin, atBottom = y2 > docBottom - snapMargin;\n\t if (y1 < screentop) {\n\t result.scrollTop = atTop ? 0 : y1;\n\t } else if (y2 > screentop + screen) {\n\t var newTop = Math.min(y1, (atBottom ? docBottom : y2) - screen);\n\t if (newTop != screentop) result.scrollTop = newTop;\n\t }\n\n\t var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;\n\t var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);\n\t var tooWide = x2 - x1 > screenw;\n\t if (tooWide) x2 = x1 + screenw;\n\t if (x1 < 10)\n\t result.scrollLeft = 0;\n\t else if (x1 < screenleft)\n\t result.scrollLeft = Math.max(0, x1 - (tooWide ? 0 : 10));\n\t else if (x2 > screenw + screenleft - 3)\n\t result.scrollLeft = x2 + (tooWide ? 0 : 10) - screenw;\n\t return result;\n\t }", "function calculateScrollPos(cm, x1, y1, x2, y2) {\n\t var display = cm.display, snapMargin = textHeight(cm.display);\n\t if (y1 < 0) y1 = 0;\n\t var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n\t var screen = displayHeight(cm), result = {};\n\t if (y2 - y1 > screen) y2 = y1 + screen;\n\t var docBottom = cm.doc.height + paddingVert(display);\n\t var atTop = y1 < snapMargin, atBottom = y2 > docBottom - snapMargin;\n\t if (y1 < screentop) {\n\t result.scrollTop = atTop ? 0 : y1;\n\t } else if (y2 > screentop + screen) {\n\t var newTop = Math.min(y1, (atBottom ? docBottom : y2) - screen);\n\t if (newTop != screentop) result.scrollTop = newTop;\n\t }\n\n\t var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;\n\t var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);\n\t var tooWide = x2 - x1 > screenw;\n\t if (tooWide) x2 = x1 + screenw;\n\t if (x1 < 10)\n\t result.scrollLeft = 0;\n\t else if (x1 < screenleft)\n\t result.scrollLeft = Math.max(0, x1 - (tooWide ? 0 : 10));\n\t else if (x2 > screenw + screenleft - 3)\n\t result.scrollLeft = x2 + (tooWide ? 0 : 10) - screenw;\n\t return result;\n\t }", "_getNarrowedViewportRect() {\n // We recalculate the viewport rect here ourselves, rather than using the ViewportRuler,\n // because we want to use the `clientWidth` and `clientHeight` as the base. The difference\n // being that the client properties don't include the scrollbar, as opposed to `innerWidth`\n // and `innerHeight` that do. This is necessary, because the overlay container uses\n // 100% `width` and `height` which don't include the scrollbar either.\n const width = this._document.documentElement.clientWidth;\n const height = this._document.documentElement.clientHeight;\n const scrollPosition = this._viewportRuler.getViewportScrollPosition();\n return {\n top: scrollPosition.top + this._viewportMargin,\n left: scrollPosition.left + this._viewportMargin,\n right: scrollPosition.left + width - this._viewportMargin,\n bottom: scrollPosition.top + height - this._viewportMargin,\n width: width - (2 * this._viewportMargin),\n height: height - (2 * this._viewportMargin),\n };\n }", "scrollBehavior(to, from, savedPosition) {\n if (savedPosition) return savedPosition;\n else return { left: 0, top: 0 };\n }", "static adjustScroll(box,scroll) {\n // WIP...\n if (typeof(box) == 'undefined' || typeof(scroll) == 'undefined') {\n console.log('bad values to scroll thing');\n return;\n }\n return svgHelpers.boxPoints(box.x - scroll.x,box.y-scroll.y,box.width,box.height);\n // return box;\n }", "function calculateScrollPos(cm, x1, y1, x2, y2) {\n var display = cm.display, snapMargin = textHeight(cm.display)\n if (y1 < 0) { y1 = 0 }\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop\n var screen = displayHeight(cm), result = {}\n if (y2 - y1 > screen) { y2 = y1 + screen }\n var docBottom = cm.doc.height + paddingVert(display)\n var atTop = y1 < snapMargin, atBottom = y2 > docBottom - snapMargin\n if (y1 < screentop) {\n result.scrollTop = atTop ? 0 : y1\n } else if (y2 > screentop + screen) {\n var newTop = Math.min(y1, (atBottom ? docBottom : y2) - screen)\n if (newTop != screentop) { result.scrollTop = newTop }\n }\n\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft\n var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0)\n var tooWide = x2 - x1 > screenw\n if (tooWide) { x2 = x1 + screenw }\n if (x1 < 10)\n { result.scrollLeft = 0 }\n else if (x1 < screenleft)\n { result.scrollLeft = Math.max(0, x1 - (tooWide ? 0 : 10)) }\n else if (x2 > screenw + screenleft - 3)\n { result.scrollLeft = x2 + (tooWide ? 0 : 10) - screenw }\n return result\n}", "function ViewportScrollPosition() {}", "function ViewportScrollPosition() {}", "function ViewportScrollPosition() {}", "function ViewportScrollPosition() {}", "function getScrollOffsets(w) {\n // Use the specified window or the current window if no argument\n w = w || window;\n\n // This works for all browsers except IE versions 8 and before\n if (w.pageXOffset != null)\n return {x: w.pageXOffset, y:w.pageYOffset};\n\n // For IE (or any browser) in Standards mode\n var d = w.document;\n if (document.compatMode == \"CSS1Compat\")\n return {x:d.documentElement.scrollLeft, y:d.documentElement.scrollTop};\n\n // For browsers in Quirks mode\n return { x: d.body.scrollLeft, y: d.body.scrollTop };\n}", "scrollBehavior (to, from, savedPosition) {\n return { x: 0, y: 0 }\n }", "scrollBehavior(_, _2, savedPosition) {\n if (savedPosition) {\n return savedPosition;\n }\n return { top: 0, left: 0 };\n }", "function ScrollPosition() {}", "scrollBehavior (to, from, savedPosition) {\n if (savedPosition) {\n return savedPosition\n } else {\n return { x: 0, y: 0 }\n }\n }", "function scrollIntoView(cm, rect) {\n\t\t var scrollPos = calculateScrollPos(cm, rect);\n\t\t if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); }\n\t\t if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }\n\t\t }", "scrollBehavior (to, from, savedPosition) {\n if (savedPosition) {\n return savedPosition\n } else {\n return { x: 0, y: 0 }\n }\n }", "scrollBehavior(to, from, savedPosition) {\n return {x: 0, y: 0};\n }", "scrollBehavior(to, from, savedPosition) {\n return { x: 0, y: 0 };\n }", "function getScrollingPosition()\r\n\t\t{\r\n\t\t\tvar position = [0, 0];\r\n\t\t\t\tif (typeof window.pageYOffset != 'undefined')\r\n\t\t\t\t\t{\r\n\t\t\t\t\tposition = [\r\n\t\t\t\t\twindow.pageXOffset,\r\n\t\t\t\t\twindow.pageYOffset\r\n\t\t\t\t\t];\r\n\t\t\t\t\t}\r\n\t\t\t\telse if (typeof document.documentElement.scrollTop != 'undefined' && document.documentElement.scrollTop > 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\tposition = [\r\n\t\t\t\t\tdocument.documentElement.scrollLeft,\r\n\t\t\t\t\tdocument.documentElement.scrollTop\r\n\t\t\t\t\t];\r\n\t\t\t\t}\r\n\t\t\t\telse if (typeof document.body.scrollTop != 'undefined')\r\n\t\t\t\t{\r\n\t\t\t\t\tposition = [\r\n\t\t\t\t\tdocument.body.scrollLeft,\r\n\t\t\t\t\tdocument.body.scrollTop\r\n\t\t\t\t\t];\r\n\t\t\t\t}\r\n\t\t\treturn position;\r\n\t\t}", "function Cr(e){var t=e.container;return[t.scrollLeft,t.scrollTop]}", "scrollBehavior (to, from, savedPosition) {\r\n if (savedPosition) {\r\n return savedPosition\r\n } else {\r\n return { x: 0, y: 0 }\r\n }\r\n }", "scrollBehavior(to, from, savedPosition) {\n return { x: 0, y: 0 };\n }", "function ViewportScrollPosition() { }", "function ViewportScrollPosition() { }", "scrollBehavior (to, from, savedPosition) {\n\t\treturn { x: 0, y: 0 }\n\t}", "getViewportRect() {\n // Use the document element's bounding rect rather than the window scroll properties\n // (e.g. pageYOffset, scrollY) due to in issue in Chrome and IE where window scroll\n // properties and client coordinates (boundingClientRect, clientX/Y, etc.) are in different\n // conceptual viewports. Under most circumstances these viewports are equivalent, but they\n // can disagree when the page is pinch-zoomed (on devices that support touch).\n // See https://bugs.chromium.org/p/chromium/issues/detail?id=489206#c4\n // We use the documentElement instead of the body because, by default (without a css reset)\n // browsers typically give the document body an 8px margin, which is not included in\n // getBoundingClientRect().\n const scrollPosition = this.getViewportScrollPosition();\n const {\n width,\n height\n } = this.getViewportSize();\n return {\n top: scrollPosition.top,\n left: scrollPosition.left,\n bottom: scrollPosition.top + height,\n right: scrollPosition.left + width,\n height,\n width\n };\n }", "function getPosition(el) {\n while (el) {\n if (el.tagName == \"ball\") {\n // deal with browser quirks with body/window/document and page scroll\n var xScroll = el.scrollLeft || document.documentElement.scrollLeft;\n var yScroll = el.scrollTop || document.documentElement.scrollTop;\n\n xPos += el.offsetLeft - xScroll + el.clientLeft;\n current.left = xPos;\n yPos += el.offsetTop - yScroll + el.clientTop;\n current.top = yPos;\n } else {\n // for all other non-BODY elements\n xPos += el.offsetLeft - el.scrollLeft + el.clientLeft;\n current.left = xPos;\n yPos += el.offsetTop - el.scrollTop + el.clientTop;\n current.top = yPos;\n }\n\n el = el.offsetParent;\n }\n\n return {\n x: xPos,\n y: yPos,\n };\n}", "scrollBehavior(to, from, savedPosition) {\n if (savedPosition) {\n return savedPosition\n } else {\n return {x: 0, y: 0}\n }\n }", "function getScrollXY() {\n var scrOfX = 0, scrOfY = 0;\n if(window.pageYOffset) {\n //Netscape compliant\n scrOfY = window.pageYOffset;\n scrOfX = window.pageXOffset;\n }else if(document.body && (document.body.scrollLeft || document.body.scrollTop)){\n //DOM compliant\n scrOfY = document.body.scrollTop;\n scrOfX = document.body.scrollLeft;\n }else if(document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop)){\n //IE6 standards compliant mode\n scrOfY = document.documentElement.scrollTop;\n scrOfX = document.documentElement.scrollLeft;\n }\n return new Point(scrOfX,scrOfY);\n}", "function get_scroll_xy() {\n var scroll_offset = {x:0, y:0};\n var body = document.body;\n var root = document.documentElement;\n if(typeof(window.pageYOffset) == 'number') {\n // Netscape compliant\n scroll_offset.y = window.pageYOffset;\n scroll_offset.x = window.pageXOffset;\n }\n else if(body && (body.scrollLeft || body.scrollTop)) {\n // DOM compliant\n scroll_offset.y = body.scrollTop;\n scroll_offset.x = body.scrollLeft;\n }\n else if(root && (root.scrollLeft || root.scrollTop)) {\n // IE6 standards compliant mode\n scroll_offset.y = root.scrollTop;\n scroll_offset.x = root.scrollLeft;\n }\n return scroll_offset;\n}", "scrollBehavior(to, from, savedPosition) {\n if (savedPosition) {\n return savedPosition\n } else {\n return { x: 0, y: 0 }\n }\n }", "function scrollIntoView(cm, rect) {\n var scrollPos = calculateScrollPos(cm, rect);\n if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); }\n if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }\n }", "function scrollIntoView(cm, rect) {\n var scrollPos = calculateScrollPos(cm, rect);\n if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); }\n if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }\n }", "function scrollIntoView(cm, rect) {\n var scrollPos = calculateScrollPos(cm, rect);\n if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); }\n if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }\n }", "function scrollIntoView(cm, rect) {\n var scrollPos = calculateScrollPos(cm, rect);\n if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); }\n if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }\n }", "function scrollIntoView(cm, rect) {\n var scrollPos = calculateScrollPos(cm, rect);\n if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); }\n if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }\n }", "function scrollIntoView(cm, rect) {\n var scrollPos = calculateScrollPos(cm, rect);\n if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); }\n if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }\n }", "function scrollIntoView(cm, rect) {\n var scrollPos = calculateScrollPos(cm, rect);\n if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); }\n if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }\n }", "function scrollIntoView(cm, rect) {\n var scrollPos = calculateScrollPos(cm, rect);\n if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); }\n if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }\n }", "function scrollIntoView(cm, rect) {\n var scrollPos = calculateScrollPos(cm, rect);\n if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); }\n if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }\n }", "function scrollIntoView(cm, rect) {\n var scrollPos = calculateScrollPos(cm, rect);\n if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); }\n if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }\n }", "function scrollIntoView(cm, rect) {\n var scrollPos = calculateScrollPos(cm, rect);\n if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); }\n if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }\n }" ]
[ "0.65926", "0.6490647", "0.6490647", "0.6490647", "0.6490647", "0.6490647", "0.6490647", "0.64872724", "0.6467502", "0.6460425", "0.6447043", "0.64178056", "0.64178056", "0.64178056", "0.64178056", "0.64178056", "0.64178056", "0.64178056", "0.64178056", "0.64178056", "0.64178056", "0.64178056", "0.63831216", "0.63445157", "0.63266957", "0.62822473", "0.6280911", "0.62561405", "0.6253357", "0.6232634", "0.62281877", "0.6215571", "0.6199207", "0.6199207", "0.618288", "0.61809856", "0.61809856", "0.61809856", "0.61809856", "0.61809856", "0.6154407", "0.6154407", "0.6154407", "0.6154407", "0.61293864", "0.6101642", "0.6099247", "0.6090867", "0.6090867", "0.6070766", "0.60529506", "0.60494655", "0.6027553", "0.601508", "0.601508", "0.601508", "0.601508", "0.59802127", "0.59763855", "0.59616303", "0.592584", "0.59135413", "0.589305", "0.5883272", "0.5877458", "0.5858856", "0.58570725", "0.5850944", "0.58505434", "0.58391637", "0.5838465", "0.5838465", "0.5835965", "0.5829813", "0.5795154", "0.5791912", "0.57907885", "0.57809085", "0.57757944", "0.5767333", "0.5767333", "0.5767333", "0.5767333", "0.5767333", "0.5767333", "0.5767333", "0.5767333", "0.5767333", "0.5767333", "0.5767333" ]
0.6590855
10
Store a relative adjustment to the scroll position in the current operation (to be applied when the operation finishes).
function addToScrollTop(cm, top) { if (top == null) { return } resolveScrollToPos(cm); cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "saveScrollPosition({ commit }, value) {\n commit('setScrollPosition', value)\n }", "function addToScrollPos(cm, left, top) {\n\t if (left != null || top != null) resolveScrollToPos(cm);\n\t if (left != null)\n\t cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left;\n\t if (top != null)\n\t cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;\n\t }", "function addToScrollPos(cm, left, top) {\n\t if (left != null || top != null) resolveScrollToPos(cm);\n\t if (left != null)\n\t cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left;\n\t if (top != null)\n\t cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;\n\t }", "function addToScrollPos(cm, left, top) {\n\t if (left != null || top != null) resolveScrollToPos(cm);\n\t if (left != null)\n\t cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left;\n\t if (top != null)\n\t cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;\n\t }", "function addToScrollPos(cm, left, top) {\n\t\t if (left != null || top != null) resolveScrollToPos(cm);\n\t\t if (left != null)\n\t\t cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left;\n\t\t if (top != null)\n\t\t cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;\n\t\t }", "function addToScrollPos(cm, left, top) {\n if (left != null || top != null) resolveScrollToPos(cm);\n if (left != null)\n cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left;\n if (top != null)\n cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;\n }", "function addToScrollPos(cm, left, top) {\n if (left != null || top != null) resolveScrollToPos(cm);\n if (left != null)\n cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left;\n if (top != null)\n cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;\n }", "function addToScrollPos(cm, left, top) {\n if (left != null || top != null) resolveScrollToPos(cm);\n if (left != null)\n cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left;\n if (top != null)\n cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;\n }", "function addToScrollPos(cm, left, top) {\n if (left != null || top != null) resolveScrollToPos(cm);\n if (left != null)\n cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left;\n if (top != null)\n cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;\n }", "function addToScrollPos(cm, left, top) {\n if (left != null || top != null) resolveScrollToPos(cm);\n if (left != null)\n cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left;\n if (top != null)\n cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;\n }", "function addToScrollPos(cm, left, top) {\n if (left != null || top != null) resolveScrollToPos(cm);\n if (left != null)\n cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left;\n if (top != null)\n cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;\n }", "function addToScrollPos(cm, left, top) {\n if (left != null || top != null) resolveScrollToPos(cm);\n if (left != null)\n cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left;\n if (top != null)\n cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;\n }", "updateScroll() {\n\t\t\tthis.scrollPosition = window.scrollY;\n\t\t}", "function addToScrollPos(cm, left, top) {\r\n if (left != null || top != null) resolveScrollToPos(cm);\r\n if (left != null)\r\n cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left;\r\n if (top != null)\r\n cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;\r\n }", "function ScrollPosition() {}", "function onScroll() {\n if (savePositionHandle !== null) {\n return;\n }\n\n // It's possible that this scroll operation was triggered by what will be\n // a `POP` transition. Instead of updating the saved location\n // immediately, we have to enqueue the update, then potentially cancel it\n // if we observe a location update.\n savePositionHandle = _domHelpersUtilRequestAnimationFrame2['default'](function () {\n savePositionHandle = null;\n\n var state = _historyLibDOMStateStorage.readState(currentKey);\n var scrollPosition = [_domHelpersQueryScrollLeft2['default'](window), _domHelpersQueryScrollTop2['default'](window)];\n\n // We have to directly update `DOMStateStorage`, because actually\n // updating the location could cause e.g. React Router to re-render the\n // entire page, which would lead to observably bad scroll performance.\n _historyLibDOMStateStorage.saveState(currentKey, _extends({}, state, { scrollPosition: scrollPosition }));\n });\n }", "function scroll_add(delta) {\n\tif (scroll_min != null) {\n\t\tscroll = Math.max(\n\t\t\tscroll_min/0.6 - innerHeight + 40,\n\t\t\tMath.min(scroll + delta, scroll_max/0.6 + scroll_offset - 35)\n\t\t);\n\t\tdiv.screen.style.top = scroll_offset - scroll;\n\t}\n}", "function recalculatePosition() {\n scope.position = appendToBody ? $position.offset(element) : $position.position(element);\n scope.position.top += element.prop('offsetHeight');\n }", "function recalculatePosition() {\n scope.position = appendToBody ? $position.offset(element) : $position.position(element);\n scope.position.top += element.prop('offsetHeight');\n }", "function recalculatePosition() {\n scope.position = appendToBody ? $position.offset(element) : $position.position(element);\n scope.position.top += element.prop('offsetHeight');\n }", "function recalculatePosition() {\n scope.position = appendToBody ? $position.offset(element) : $position.position(element);\n scope.position.top += element.prop('offsetHeight');\n }", "function recalculatePosition() {\n scope.position = appendToBody ? $position.offset(element) : $position.position(element);\n scope.position.top += element.prop('offsetHeight');\n }", "function recalculatePosition() {\n scope.position = appendToBody ? $position.offset(element) : $position.position(element);\n scope.position.top += element.prop('offsetHeight');\n }", "function recalculatePosition() {\n scope.position = appendToBody ? $position.offset(element) : $position.position(element);\n scope.position.top += element.prop('offsetHeight');\n }", "function recalculatePosition() {\n scope.position = appendToBody ? $position.offset(element) : $position.position(element);\n scope.position.top += element.prop('offsetHeight');\n }", "function recalculatePosition() {\n scope.position = appendToBody ? $position.offset(element) : $position.position(element);\n scope.position.top += element.prop('offsetHeight');\n }", "function recalculatePosition() {\n scope.position = appendToBody ? $position.offset(element) : $position.position(element);\n scope.position.top += element.prop('offsetHeight');\n }", "function recalculatePosition() {\n scope.position = appendToBody ? $position.offset(element) : $position.position(element);\n scope.position.top += element.prop('offsetHeight');\n }", "function recalculatePosition() {\n scope.position = appendToBody ? $position.offset(element) : $position.position(element);\n scope.position.top += element.prop('offsetHeight');\n }", "function recalculatePosition() {\n scope.position = appendToBody ? $position.offset(element) : $position.position(element);\n scope.position.top += element.prop('offsetHeight');\n }", "function recalculatePosition() {\n scope.position = appendToBody ? $position.offset(element) : $position.position(element);\n scope.position.top += element.prop('offsetHeight');\n }", "function recalculatePosition() {\n scope.position = appendToBody ? $position.offset(element) : $position.position(element);\n scope.position.top += element.prop('offsetHeight');\n }", "function recalculatePosition() {\n scope.position = appendToBody ? $position.offset(element) : $position.position(element);\n scope.position.top += element.prop('offsetHeight');\n }", "function recalculatePosition() {\n scope.position = appendToBody ? $position.offset(element) : $position.position(element);\n scope.position.top += element.prop('offsetHeight');\n }", "function recalculatePosition() {\n scope.position = appendToBody ? $position.offset(element) : $position.position(element);\n scope.position.top += element.prop('offsetHeight');\n }", "function recalculatePosition() {\n scope.position = appendToBody ? $position.offset(element) : $position.position(element);\n scope.position.top += element.prop('offsetHeight');\n }", "function recalculatePosition() {\n scope.position = appendToBody ? $position.offset(element) : $position.position(element);\n scope.position.top += element.prop('offsetHeight');\n }", "function addToScrollPos(cm, left, top) {\n if (left != null || top != null) { resolveScrollToPos(cm) }\n if (left != null)\n { cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left }\n if (top != null)\n { cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top }\n}", "function addToScrollPos(cm, left, top) {\n if (left != null || top != null) { resolveScrollToPos(cm) }\n if (left != null)\n { cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left }\n if (top != null)\n { cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top }\n}", "_adjustScrollingTop() {\n return this.el.scrollTop = this.g.zoomer.get(\"_alignmentScrollTop\");\n }", "function adjustOffset(e) {\n e.data._prvt.elemOffset = e.data.element.offsetLeft + e.data._prvt.sliderBarBack[0].offsetLeft;\n }", "scrollBehavior(_, _2, savedPosition) {\n if (savedPosition) {\n return savedPosition;\n }\n return { top: 0, left: 0 };\n }", "function createScrollActionPosition() {\n let header = document.getElementsByClassName(\"header\")[0];\n let headerHeight = header.offsetHeight;\n let pointofChange = headerHeight + 50;\n return pointofChange;\n}", "scrollBehavior(to, from, savedPosition) {\n if (savedPosition) return savedPosition;\n else return { left: 0, top: 0 };\n }", "update() {\n\t\tthis.scroll.update();\n\t}", "moveScroll( val )\r\n {\r\n let current = this.contentScroll.offsetLeft;\r\n let newPos = current + val;\r\n\r\n this.contentScroll.style.left = newPos+'px';\r\n\r\n this.handleButtons( newPos );\r\n }", "scrollBehavior (to, from, savedPosition) {\r\n if (savedPosition) {\r\n return savedPosition\r\n } else {\r\n return { x: 0, y: 0 }\r\n }\r\n }", "function _calcScrollOffset(normalize, refreshParticle) {\n\t\n\t // When moving using touch-gestures, make the offset stick to the\n\t // finger. When the bounds is exceeded, decrease the scroll distance\n\t // by two.\n\t if (refreshParticle || (this._scroll.particleValue === undefined)) {\n\t this._scroll.particleValue = this._scroll.particle.getPosition1D();\n\t this._scroll.particleValue = Math.round(this._scroll.particleValue * 1000) / 1000;\n\t }\n\t\n\t // do stuff\n\t var scrollOffset = this._scroll.particleValue;\n\t if (this._scroll.scrollDelta || this._scroll.normalizedScrollDelta) {\n\t scrollOffset += this._scroll.scrollDelta + this._scroll.normalizedScrollDelta;\n\t if (((this._scroll.boundsReached & Bounds.PREV) && (scrollOffset > this._scroll.springPosition)) ||\n\t ((this._scroll.boundsReached & Bounds.NEXT) && (scrollOffset < this._scroll.springPosition)) ||\n\t (this._scroll.boundsReached === Bounds.BOTH)) {\n\t scrollOffset = this._scroll.springPosition;\n\t }\n\t if (normalize) {\n\t if (!this._scroll.scrollDelta) {\n\t this._scroll.normalizedScrollDelta = 0;\n\t _setParticle.call(this, scrollOffset, undefined, '_calcScrollOffset');\n\t }\n\t this._scroll.normalizedScrollDelta += this._scroll.scrollDelta;\n\t this._scroll.scrollDelta = 0;\n\t }\n\t }\n\t\n\t if (this._scroll.scrollForceCount && this._scroll.scrollForce) {\n\t if (this._scroll.springPosition !== undefined) {\n\t scrollOffset = (scrollOffset + this._scroll.scrollForce + this._scroll.springPosition) / 2.0;\n\t }\n\t else {\n\t scrollOffset += this._scroll.scrollForce;\n\t }\n\t }\n\t\n\t // Prevent the scroll position from exceeding the bounds when overscroll is disabled\n\t if (!this.options.overscroll) {\n\t if ((this._scroll.boundsReached === Bounds.BOTH) ||\n\t ((this._scroll.boundsReached === Bounds.PREV) && (scrollOffset > this._scroll.springPosition)) ||\n\t ((this._scroll.boundsReached === Bounds.NEXT) && (scrollOffset < this._scroll.springPosition))) {\n\t scrollOffset = this._scroll.springPosition;\n\t }\n\t }\n\t\n\t //_log.call(this, 'scrollOffset: ', scrollOffset, ', particle:', this._scroll.particle.getPosition1D(), ', moveToPosition: ', this._scroll.moveToPosition, ', springPosition: ', this._scroll.springPosition);\n\t return scrollOffset;\n\t }", "updateScrollPosition(lastXDelta, lastYDelta) {\n // actually update the plane position only if last X delta or last Y delta is not equal to 0\n if(lastXDelta || lastYDelta) {\n // set new positions based on our delta without triggering reflow\n this._boundingRect.document.top += lastYDelta * this.renderer.pixelRatio;\n this._boundingRect.document.left += lastXDelta * this.renderer.pixelRatio;\n\n // apply them\n this._applyWorldPositions();\n }\n }", "scrollBehavior(to, from, savedPosition) {\n if (savedPosition) {\n return savedPosition\n } else {\n return {\n x: 0,\n y: 0,\n }\n }\n }", "scrollBehavior(to, from, savedPosition) {\n if (savedPosition) {\n return savedPosition\n } else {\n return { x: 0, y: 0 }\n }\n }", "function _calcScrollOffset(normalize, refreshParticle) {\n\n\t // When moving using touch-gestures, make the offset stick to the\n\t // finger. When the bounds is exceeded, decrease the scroll distance\n\t // by two.\n\t if (refreshParticle || (this._scroll.particleValue === undefined)) {\n\t this._scroll.particleValue = this._scroll.particle.getPosition1D();\n\t this._scroll.particleValue = Math.round(this._scroll.particleValue * 1000) / 1000;\n\t }\n\n\t // do stuff\n\t var scrollOffset = this._scroll.particleValue;\n\t if (this._scroll.scrollDelta || this._scroll.normalizedScrollDelta) {\n\t scrollOffset += this._scroll.scrollDelta + this._scroll.normalizedScrollDelta;\n\t if (((this._scroll.boundsReached & Bounds.PREV) && (scrollOffset > this._scroll.springPosition)) ||\n\t ((this._scroll.boundsReached & Bounds.NEXT) && (scrollOffset < this._scroll.springPosition)) ||\n\t (this._scroll.boundsReached === Bounds.BOTH)) {\n\t scrollOffset = this._scroll.springPosition;\n\t }\n\t if (normalize) {\n\t if (!this._scroll.scrollDelta) {\n\t this._scroll.normalizedScrollDelta = 0;\n\t _setParticle.call(this, scrollOffset, undefined, '_calcScrollOffset');\n\t }\n\t this._scroll.normalizedScrollDelta += this._scroll.scrollDelta;\n\t this._scroll.scrollDelta = 0;\n\t }\n\t }\n\n\t if (this._scroll.scrollForceCount && this._scroll.scrollForce) {\n\t if (this._scroll.springPosition !== undefined) {\n\t scrollOffset = (scrollOffset + this._scroll.scrollForce + this._scroll.springPosition) / 2.0;\n\t }\n\t else {\n\t scrollOffset += this._scroll.scrollForce;\n\t }\n\t }\n\n\t //_log.call(this, 'scrollOffset: ', scrollOffset, ', particle:', this._scroll.particle.getPosition1D(), ', moveToPosition: ', this._scroll.moveToPosition, ', springPosition: ', this._scroll.springPosition);\n\t return scrollOffset;\n\t }", "scrollBehavior(to, from, savedPosition) {\n if (savedPosition) {\n return savedPosition\n } else {\n return {\n x: 0,\n y: 0\n }\n }\n }", "scrollBehavior (to, from, savedPosition) {\n if (savedPosition) {\n console.log(\"后退\")\n return savedPosition\n } else {\n console.log(\"前进\")\n return {x: 0, y: 0}\n }\n }", "_updatePosition() {\n var width = this.$element.outerWidth();\n var outerWidth = $(window).width();\n var height = this.$element.outerHeight();\n var outerHeight = $(window).height();\n var left, top;\n if (this.options.hOffset === 'auto') {\n left = parseInt((outerWidth - width) / 2, 10);\n } else {\n left = parseInt(this.options.hOffset, 10);\n }\n if (this.options.vOffset === 'auto') {\n if (height > outerHeight) {\n top = parseInt(Math.min(100, outerHeight / 10), 10);\n } else {\n top = parseInt((outerHeight - height) / 4, 10);\n }\n } else {\n top = parseInt(this.options.vOffset, 10);\n }\n this.$element.css({top: top + 'px'});\n // only worry about left if we don't have an overlay or we havea horizontal offset,\n // otherwise we're perfectly in the middle\n if(!this.$overlay || (this.options.hOffset !== 'auto')) {\n this.$element.css({left: left + 'px'});\n this.$element.css({margin: '0px'});\n }\n\n }", "scrollBehavior (to, from, savedPosition) {\n return new Promise((resolve, reject) => {\n setTimeout(() => {\n if (savedPosition) {\n resolve(savedPosition);\n } else {\n resolve({ x: 0, y: 0 })\n }\n }, 500);\n })\n }", "function updateScroll(){\n var treshold = 5;\n ux.scroll.offsetPrevious = ux.scroll.offset;\n ux.scroll.offset = $(window).scrollTop();\n \n // We compare distance traveled with a defined treshold and report scroll direction\n if( ux.scroll.offset - ux.scroll.offsetPrevious > treshold ){\n ux.scroll.direction = 'down';\n } else if( ux.scroll.offsetPrevious - ux.scroll.offset > treshold ){\n ux.scroll.direction = 'up';\n }\n \n ux.viewport.visibleTop = ux.scroll.offset\n ux.viewport.visibleBottom = ux.viewport.height + ux.scroll.offset;\n}", "scrollBehavior(to, from, savedPosition) {\n if (savedPosition) {\n return savedPosition;\n } else {\n return { x: 0, y: 0 };\n }\n }", "scrollBehavior(to, from, savedPosition) {\n if (savedPosition) {\n return savedPosition\n } else {\n return {x: 0, y: 0}\n }\n }", "_scroll(scrollCoefficient) {\n const that = this;\n\n that.$.scrollViewer.scrollTop = that.$.scrollViewer.scrollTop + scrollCoefficient * 10;\n that._updateScrollButtonVisibility();\n that.focus();\n }", "setScrollPosition(position) {\n // Set the new scrollTop/scrollLeft to all scrollViews elements\n return this.pageScrollOptions.scrollViews.reduce((oneAlreadyWorked, scrollingView) => {\n const startScrollPropertyValue = this.getScrollPropertyValue(scrollingView);\n\n if (scrollingView && startScrollPropertyValue !== undefined && startScrollPropertyValue !== null) {\n const scrollDistance = Math.abs(startScrollPropertyValue - position); // The movement we need to perform is less than 2px\n // This we consider a small movement which some browser may not perform when\n // changing the scrollTop/scrollLeft property\n // Thus in this cases we do not stop the scroll animation, although setting the\n // scrollTop/scrollLeft value \"fails\"\n\n const isSmallMovement = scrollDistance < this.pageScrollOptions._minScrollDistance;\n\n if (!this.pageScrollOptions.verticalScrolling) {\n scrollingView.scrollLeft = position;\n } else {\n scrollingView.scrollTop = position;\n } // Return true if setting the new scrollTop/scrollLeft value worked\n // We consider that it worked if the new scrollTop/scrollLeft value is closer to the\n // desired scrollTop/scrollLeft than before (it might not be exactly the value we\n // set due to dpi or rounding irregularities)\n\n\n if (isSmallMovement || scrollDistance > Math.abs(this.getScrollPropertyValue(scrollingView) - position)) {\n return true;\n }\n }\n\n return oneAlreadyWorked;\n }, false);\n }", "scrollBehavior (to, from, savedPosition) {\n if (savedPosition) {\n return savedPosition\n } else {\n return { x: 0, y: 0 }\n }\n }", "scrollBehavior (to, from, savedPosition) {\n if (savedPosition) {\n return savedPosition\n } else {\n return { x: 0, y: 0 }\n }\n }", "getCurrentScrollPosition() {\n return this._state;\n }", "function updateScroll(event) {\n moveElements();\n}", "function calcScrollPosition() {\n const positionBracket = calcPositionBracket();\n const scrollY = window.scrollY;\n const r = ((scrollY - positionBracket.copy.prev) / (positionBracket.copy.next - positionBracket.copy.prev));\n\n const visualsScrollTarget = Math.round(positionBracket.visual.prev + ((positionBracket.visual.next - positionBracket.visual.prev) * r));\n\n return visualsScrollTarget;\n}", "function updateCalculations(win, rootElement, targetElement, setName, hasScrolled) {\n\t\tvar inView = isInViewport(win, targetElement);\n\t\tquery('.' + setName, rootElement)[0].value = inView ? 1 : 0;\n\t\tquery('.hasScrolled', rootElement)[0].value = hasScrolled ? 1 : 0;\n\t}", "beforeUpdate() {\n const {\n delta, remain, bench, changeProp, getZone,\n setScrollTop, offset, variable, getVarOffset, size,\n } = this;\n const calcstart = changeProp === 'start' ? this.start : delta.start;\n const zone = getZone(calcstart);\n delta.keeps = remain + (bench || remain);\n // if start, size or offset change, update scroll position.\n if (changeProp && ['start', 'size', 'offset'].includes(changeProp)) {\n let scrollTop = 0;\n if (changeProp === 'offset') {\n scrollTop = offset; // 更新了偏移,直接将偏移设置为滚动距离\n } else {\n const { isLast, start } = zone;\n const { total } = delta;\n if (variable) { // 可变高度,则通过函数来计算距离\n scrollTop = getVarOffset(isLast ? total : start);\n } else if (isLast && (total - calcstart <= remain)) { // 已经滚动到最底\n scrollTop = total * size;\n } else {\n scrollTop = calcstart * size;\n }\n }\n this.$nextTick(setScrollTop.bind(this, scrollTop));\n }\n\n // if points out difference, force update once again.\n if (changeProp || delta.end !== zone.end || calcstart !== zone.start) {\n this.changeProp = '';\n delta.end = zone.end;\n delta.start = zone.start;\n this.forceRender();\n }\n }", "function headerOffsetAdjust() {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif ($('body.compose-mode').length > 0) {\r\n\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t$headerScrollTop = nectarDOMInfo.scrollTop;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif (lastPosition == $headerScrollTop) {\r\n\t\t\t\t\t\t\trequestAnimationFrame(headerOffsetAdjust);\r\n\t\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tlastPosition = $headerScrollTop;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\theaderOffsetAdjustCalc();\r\n\t\t\t\t\t\trequestAnimationFrame(headerOffsetAdjust);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}", "setScrollPosition() {\n var step = this.state.step;\n var isVertical = this.props.vertical;\n var left = !isVertical ? step * this.state.width : 0;\n var top = isVertical ? step * this.state.height : 0;\n\n this.scroller.setPosition(left, top);\n this.scroller.scrollTo(left, top, false);\n }", "_setWrapperPosition() {\n this.wrapper.style.left = this.percentPosition.x + '%';\n this.wrapper.style.top = this.percentPosition.y + '%';\n }", "scrollToPosition(startPosition, endPosition, skipCursorUpdate) {\n if (this.skipScrollToPosition) {\n this.skipScrollToPosition = false;\n return;\n }\n if (this.owner.enableImageResizerMode && this.owner.imageResizerModule.isImageResizing\n || this.isMouseDownInFooterRegion || this.isRowOrCellResizing) {\n return;\n }\n let lineWidget = this.selection.getLineWidgetInternal(endPosition.currentWidget, endPosition.offset, true);\n if (isNullOrUndefined(lineWidget)) {\n return;\n }\n let top = this.selection.getTop(lineWidget);\n if (this.isMouseDown) {\n let prevLineWidget = this.selection.getLineWidgetInternal(endPosition.currentWidget, endPosition.offset, false);\n let prevTop = this.selection.getTop(prevLineWidget);\n if (prevLineWidget !== lineWidget && endPosition.location.y >= prevTop) {\n lineWidget = prevLineWidget;\n }\n }\n let height = lineWidget.height;\n //Gets current page.\n let endPage = this.selection.getPage(lineWidget.paragraph);\n this.currentPage = endPage;\n let x = 0;\n let y = 0;\n let viewer = this;\n let isPageLayout = viewer instanceof PageLayoutViewer;\n if (isPageLayout) {\n if (isNullOrUndefined(endPage)) {\n return;\n }\n let pageWidth = endPage.boundingRectangle.width;\n x = (this.visibleBounds.width - pageWidth * this.zoomFactor) / 2;\n if (x < 30) {\n x = 30;\n }\n // tslint:disable-next-line:max-line-length\n y = endPage.boundingRectangle.y * this.zoomFactor + (this.pages.indexOf(endPage) + 1) * viewer.pageGap * (1 - this.zoomFactor);\n }\n let scrollTop = this.containerTop;\n let scrollLeft = this.containerLeft;\n let pageHeight = this.visibleBounds.height;\n let caretInfo = this.selection.updateCaretSize(this.owner.selection.end, true);\n let topMargin = caretInfo.topMargin;\n let caretHeight = caretInfo.height;\n x += (endPosition.location.x) * this.zoomFactor;\n y += (endPosition.location.y + topMargin) * this.zoomFactor;\n //vertical scroll bar update\n if ((scrollTop + 20) > y) {\n this.viewerContainer.scrollTop = (y - 10);\n }\n else if (scrollTop + pageHeight < y + caretHeight) {\n this.viewerContainer.scrollTop = y + caretHeight - pageHeight + 10;\n }\n if (!skipCursorUpdate) {\n this.selection.updateCaretToPage(startPosition, endPage);\n }\n let scrollBarWidth = this.viewerContainer.offsetWidth - this.viewerContainer.clientWidth;\n if (scrollLeft > x) {\n this.viewerContainer.scrollLeft = x - (viewer.pageContainer.offsetWidth / 100) * 20;\n }\n else if (scrollLeft + this.visibleBounds.width < x + scrollBarWidth) {\n this.viewerContainer.scrollLeft = scrollLeft + (viewer.pageContainer.offsetWidth / 100) * 15 + scrollBarWidth;\n }\n }", "updateRelativePos_() {\n const {headerPosition_: header, footerPosition_: footer} = this;\n const {INSIDE, TOP, BOTTOM} = RelativePositions;\n\n devAssert(\n header || footer,\n 'next-page scroll triggered without a header or footer position'\n );\n\n if (header === INSIDE && footer === INSIDE) {\n // Both the header and footer are within the viewport bounds\n // meaning that the document is short enough to be\n // contained inside the viewport\n this.relativePos_ = PageRelativePos.INSIDE_VIEWPORT;\n } else if ((!header || header === TOP) && (!footer || footer === BOTTOM)) {\n // The head of the document is above the viewport and the\n // footer of the document is below it, meaning that the viewport\n // is looking at a section of the document\n this.relativePos_ = PageRelativePos.CONTAINS_VIEWPORT;\n } else if (\n ((!header || header === TOP) && footer === TOP) ||\n (header === BOTTOM && (!footer || footer === BOTTOM))\n ) {\n // Both the header and the footer of the document are either\n // above or below the document meaning that the viewport hasn't\n // reached the document yet or has passed it\n this.relativePos_ = PageRelativePos.OUTSIDE_VIEWPORT;\n } else {\n // The remaining case is the case where the document is halfway\n // through being scrolling into/out of the viewport in which case\n // we don't need to update the visibility\n this.relativePos_ = PageRelativePos.LEAVING_VIEWPORT;\n return;\n }\n\n this.manager_.updateVisibility();\n }", "updatePage(){\n let curPage = this.options.paging.offset,\n idxs = this.getFirstLastIndexes();\n\n if (this.options.internal.oldScrollPosition === undefined){\n this.options.internal.oldScrollPosition = 0;\n }\n\n let oldScrollPosition = this.options.internal.oldScrollPosition,\n newPage = idxs.first / this.options.paging.size;\n\n this.options.internal.oldScrollPosition = newPage;\n\n if (newPage < oldScrollPosition) {\n // scrolling up\n newPage = Math.floor(newPage);\n } else if (newPage > oldScrollPosition){\n // scrolling down\n newPage = Math.ceil(newPage);\n } else {\n // equal, just stay on the current page\n newPage = curPage;\n }\n\n if(!isNaN(newPage)){\n this.options.paging.offset = newPage;\n }\n }", "function Va(e){Qa(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}", "reapplyLastPosition() {\n if (!this._isDisposed && (!this._platform || this._platform.isBrowser)) {\n this._originRect = this._getOriginRect();\n this._overlayRect = this._pane.getBoundingClientRect();\n this._viewportRect = this._getNarrowedViewportRect();\n const lastPosition = this._lastPosition || this._preferredPositions[0];\n const originPoint = this._getOriginPoint(this._originRect, lastPosition);\n this._applyPosition(lastPosition, originPoint);\n }\n }", "getCurrentOffset() {\n return this.pageScrollOptions.scrollOffset;\n }", "function addToScrollTop(cm, top) {\n if (top == null) {\n return;\n }\n\n resolveScrollToPos(cm);\n cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;\n } // Make sure that at the end of the operation the current cursor is", "adjustPosition () {\n if (typeof window === 'undefined') return\n\n const spaceAbove = this.$el.getBoundingClientRect().top\n const spaceBelow = window.innerHeight - this.$el.getBoundingClientRect().bottom\n const hasEnoughSpaceBelow = spaceBelow > this.maxHeight\n\n if (hasEnoughSpaceBelow || spaceBelow > spaceAbove || this.openDirection === 'below' || this.openDirection === 'bottom') {\n this.prefferedOpenDirection = 'below'\n this.optimizedHeight = Math.min(spaceBelow - 40, this.maxHeight)\n } else {\n this.prefferedOpenDirection = 'above'\n this.optimizedHeight = Math.min(spaceAbove - 40, this.maxHeight)\n }\n }", "adjustPosition () {\n if (typeof window === 'undefined') return\n\n const spaceAbove = this.$el.getBoundingClientRect().top\n const spaceBelow = window.innerHeight - this.$el.getBoundingClientRect().bottom\n const hasEnoughSpaceBelow = spaceBelow > this.maxHeight\n\n if (hasEnoughSpaceBelow || spaceBelow > spaceAbove || this.openDirection === 'below' || this.openDirection === 'bottom') {\n this.prefferedOpenDirection = 'below'\n this.optimizedHeight = Math.min(spaceBelow - 40, this.maxHeight)\n } else {\n this.prefferedOpenDirection = 'above'\n this.optimizedHeight = Math.min(spaceAbove - 40, this.maxHeight)\n }\n }", "adjustPosition () {\n if (typeof window === 'undefined') return\n\n const spaceAbove = this.$el.getBoundingClientRect().top\n const spaceBelow = window.innerHeight - this.$el.getBoundingClientRect().bottom\n const hasEnoughSpaceBelow = spaceBelow > this.maxHeight\n\n if (hasEnoughSpaceBelow || spaceBelow > spaceAbove || this.openDirection === 'below' || this.openDirection === 'bottom') {\n this.prefferedOpenDirection = 'below'\n this.optimizedHeight = Math.min(spaceBelow - 40, this.maxHeight)\n } else {\n this.prefferedOpenDirection = 'above'\n this.optimizedHeight = Math.min(spaceAbove - 40, this.maxHeight)\n }\n }", "function reposition() {\n var amountOfIframeScroll = initialScroll - $editorDoc.scrollTop();\n var heightAboveToolbar = $toolbar.offset().top - $contentWrap.offset().top; // e.g. merge conflict resolution\n var heightOfPrecursor = $editorPrecursor.outerHeight();\n var heightOfToolbar = $toolbar.outerHeight();\n\n $editorPrecursor.css('top', (heightAboveToolbar + heightOfToolbar + amountOfIframeScroll + precursorTopPadding) + 'px');\n $editorBody.css('padding-top', (heightOfPrecursor + bodyTopPadding) + 'px');\n }", "function updateScroll () {\n if (!elements.li[0]) return;\n if (mode === MODE_STANDARD) {\n updateStandardScroll();\n } else {\n updateVirtualScroll();\n }\n }", "_updateTabScrollPosition() {\n if (this.disablePagination) {\n return;\n }\n const scrollDistance = this.scrollDistance;\n const translateX = this._getLayoutDirection() === 'ltr' ? -scrollDistance : scrollDistance;\n // Don't use `translate3d` here because we don't want to create a new layer. A new layer\n // seems to cause flickering and overflow in Internet Explorer. For example, the ink bar\n // and ripples will exceed the boundaries of the visible tab bar.\n // See: https://github.com/angular/components/issues/10276\n // We round the `transform` here, because transforms with sub-pixel precision cause some\n // browsers to blur the content of the element.\n this._tabList.nativeElement.style.transform = `translateX(${Math.round(translateX)}px)`;\n // Setting the `transform` on IE will change the scroll offset of the parent, causing the\n // position to be thrown off in some cases. We have to reset it ourselves to ensure that\n // it doesn't get thrown off. Note that we scope it only to IE and Edge, because messing\n // with the scroll position throws off Chrome 71+ in RTL mode (see #14689).\n if (this._platform.TRIDENT || this._platform.EDGE) {\n this._tabListContainer.nativeElement.scrollLeft = 0;\n }\n }", "scrollBehavior(to, from, savedPosition) {\n return { x: 0, y: 0 };\n }", "stepScrollAnimation_() {\n if (!this.scrollTarget) {\n return;\n }\n\n const currentScrollPos = -this.workspace_.scrollY;\n const diff = this.scrollTarget - currentScrollPos;\n if (Math.abs(diff) < 1) {\n this.workspace_.scrollbar.setY(this.scrollTarget);\n this.scrollTarget = null;\n return;\n }\n this.workspace_.scrollbar.setY(\n currentScrollPos + diff * this.scrollAnimationFraction);\n\n requestAnimationFrame(this.stepScrollAnimation_.bind(this));\n }", "scrollBehavior (to, from, savedPosition) {\n return { x: 0, y: 0 }\n }", "updatePosition() {\n console.log('update position');\n const xValue = this.IMAGE_WIDTH_ * this.currentIndex_;\n this.imageContainer_.style.left = -xValue;\n }", "scrollBehavior(to, from, savedPosition) {\n return {x: 0, y: 0};\n }", "function l(e){\n // Only if the scroll is not what it was last time we did this.\n e!=k&&(\n // Move the target element horizontally relative to its original\n // horizontal position.\n x.css(\"left\",S-e),\n // Hold the last horizontal position set.\n k=e)}", "updatePosition() {\n if (this._positionStrategy) {\n this._positionStrategy.apply();\n }\n }", "scrollBehavior(to, from, savedPosition) {\n if (savedPosition) {\n return savedPosition\n } if (to.hash) {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve({ selector: to.hash, behavior: 'smooth', offset: { y: 60 } })\n }, 0)\n })\n } else {\n return { x: 0, y: 0 }\n }\n }", "setOffsets() {\n const startPt = this.startPt.minusPt(this.head);\n const endPt = this.endPt.minusPt(this.head);\n const controlPt = this.controlPt.minusPt(this.head);\n this.stateOffset = { startPt, endPt, controlPt };\n }", "function refreshPosition(item) {\n // Find the top of an item by adding to the offsetHeight until we reach the\n // content element.\n var current = item.element[0];\n item.top = 0;\n item.left = 0;\n item.right = 0;\n while (current && current !== contentEl[0]) {\n item.top += current.offsetTop;\n item.left += current.offsetLeft;\n if (current.offsetParent) {\n // Compute offsetRight\n item.right += current.offsetParent.offsetWidth - current.offsetWidth - current.offsetLeft;\n }\n current = current.offsetParent;\n }\n item.height = item.element.prop('offsetHeight');\n\n var defaultVal = $mdUtil.floatingScrollbars() ? '0' : undefined;\n $mdUtil.bidi(item.clone, 'margin-left', item.left, defaultVal);\n $mdUtil.bidi(item.clone, 'margin-right', defaultVal, item.right);\n }", "_refreshScrollerPosition() {\n this.__carouselScrollerWidth = qx.bom.element.Dimension.getWidth(\n this.__carouselScroller.getContentElement()\n );\n\n this._scrollToPage(this.getCurrentIndex());\n }", "function ViewportScrollPosition() { }", "function ViewportScrollPosition() { }", "function defineOffset() {\n if(STATE.CURRENT_SLIDE > 1) {\n STATE.OFFSET = -STATE.RESIZE_OFFSET;\n } else {\n STATE.OFFSET = STATE.OFFSET;\n }\n }", "function refreshPosition(item) {\n // Find the top of an item by adding to the offsetHeight until we reach the \n // content element.\n var current = item.element[0];\n item.top = 0;\n item.left = 0;\n while (current && current !== contentEl[0]) {\n item.top += current.offsetTop;\n item.left += current.offsetLeft;\n current = current.offsetParent;\n }\n item.height = item.element.prop('offsetHeight');\n item.clone.css('margin-left', item.left + 'px');\n if ($mdUtil.floatingScrollbars()) {\n item.clone.css('margin-right', '0');\n }\n }", "update() {\n\t\tthis.slideWidth = this.slides[0].offsetWidth;\n\n\t\tthis.slideWidth = parseInt(this.slideWidth, 10);\n\t\tthis.startPos = 2 * (this.slideWidth + this.gap) + this.gap;\n\t\tthis.scrollRight = this.slider.scrollWidth - this.slider.offsetWidth;\n\t\tthis.endPos = this.scrollRight - this.startPos;\n\t\t\n\n\t}", "_updatePositions() {\n let direction = this.options.direction;\n let largestHeight = 0;\n if(this.lastIndex === -1)\n return;\n\n if(this.options.onPosition && typeof this.options.onPosition === 'function')\n this.options.onPosition.call();\n\n this.rows.forEach(row => {\n row.forEach(rowItem => {\n let itemBottom = rowItem.position.top + rowItem.item.offsetHeight;\n rowItem.item.style.top = rowItem.position.top + 'px';\n rowItem.item.style[direction] = rowItem.position[direction] + 'px';\n if(largestHeight < itemBottom)\n largestHeight = itemBottom;\n });\n });\n\n this.element.style.height = largestHeight + 'px';\n\n if(this.options.onPositioned && typeof this.options.onPositioned === 'function')\n this.options.onPositioned.call();\n }" ]
[ "0.6434745", "0.6315518", "0.6315518", "0.6315518", "0.6271345", "0.6246111", "0.6246111", "0.6246111", "0.6246111", "0.6246111", "0.6246111", "0.6246111", "0.6217396", "0.6204886", "0.6168477", "0.6106627", "0.60856074", "0.60713035", "0.60713035", "0.60713035", "0.606473", "0.606473", "0.606473", "0.606473", "0.606473", "0.606473", "0.606473", "0.606473", "0.606473", "0.606473", "0.606473", "0.606473", "0.606473", "0.606473", "0.606473", "0.606473", "0.606473", "0.6044812", "0.6044812", "0.6001052", "0.59726655", "0.5953607", "0.5948941", "0.5936029", "0.5933756", "0.58629566", "0.58465225", "0.58441055", "0.5835246", "0.5827363", "0.58267516", "0.5825506", "0.58216035", "0.5818723", "0.58152384", "0.5806479", "0.57687867", "0.5747708", "0.57387507", "0.57352996", "0.573092", "0.5730769", "0.57021475", "0.56996524", "0.5696599", "0.5690592", "0.56898904", "0.56869835", "0.5684887", "0.56840074", "0.5670502", "0.5668014", "0.5665054", "0.56545424", "0.5652035", "0.56424105", "0.564238", "0.5608002", "0.5607515", "0.5607515", "0.5607515", "0.5592587", "0.5579433", "0.5561678", "0.55530626", "0.5548197", "0.55447435", "0.55434173", "0.554138", "0.55348825", "0.55185866", "0.5507804", "0.55066645", "0.54978627", "0.54974806", "0.5494898", "0.5494898", "0.5489464", "0.5487754", "0.5478562", "0.5478348" ]
0.0
-1
Make sure that at the end of the operation the current cursor is shown.
function ensureCursorVisible(cm) { resolveScrollToPos(cm); var cur = cm.getCursor(); cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin}; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function EmptyCursor () {}", "_showCursor() {\n if (!this._coreService.isCursorInitialized) {\n this._coreService.isCursorInitialized = true;\n this.refresh(this.buffer.y, this.buffer.y);\n }\n }", "checkForCursorVisibility() {\n this.showCaret();\n }", "endDraw() {\n\t\tif (this.cursorEnabled) {\n\t\t\tthis.write(\"\\x1B[?25h\");\n\t\t\tthis.cursorVisible = true;\n\t\t}\n\t\tthis.write(\"\\x1B8\"); //load cursor pos\n\t}", "outputCR() {\n this.cursor.x = 0;\n }", "static SetCursor() {}", "function showCursor(cur)\n {\n if (cur != undefined) selectCursor(cur);\n container.style.cursor = currentCursor;\n\t}", "_resetCursors() {\n this._taskCursor = '';\n this._eventsCursor = '';\n }", "navigateLineEnd() {\n this.selection.moveCursorLineEnd();\n this.clearSelection();\n }", "function endOperation(cm) {\n var op = cm.curOp, doc = cm.doc, display = cm.display;\n cm.curOp = null;\n\n if (op.updateMaxLine) findMaxLine(cm);\n\n // If it looks like an update might be needed, call updateDisplay\n if (op.viewChanged || op.forceUpdate || op.scrollTop != null ||\n op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom ||\n op.scrollToPos.to.line >= display.viewTo) ||\n display.maxLineChanged && cm.options.lineWrapping) {\n var updated = updateDisplay(cm, {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate);\n if (cm.display.scroller.offsetHeight) cm.doc.scrollTop = cm.display.scroller.scrollTop;\n }\n // If no update was run, but the selection changed, redraw that.\n if (!updated && op.selectionChanged) updateSelection(cm);\n if (!updated && op.startHeight != cm.doc.height) updateScrollbars(cm);\n\n // Abort mouse wheel delta measurement, when scrolling explicitly\n if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos))\n display.wheelStartX = display.wheelStartY = null;\n\n // Propagate the scroll position to the actual DOM scroller\n if (op.scrollTop != null && display.scroller.scrollTop != op.scrollTop) {\n var top = Math.max(0, Math.min(display.scroller.scrollHeight - display.scroller.clientHeight, op.scrollTop));\n display.scroller.scrollTop = display.scrollbarV.scrollTop = doc.scrollTop = top;\n }\n if (op.scrollLeft != null && display.scroller.scrollLeft != op.scrollLeft) {\n var left = Math.max(0, Math.min(display.scroller.scrollWidth - display.scroller.clientWidth, op.scrollLeft));\n display.scroller.scrollLeft = display.scrollbarH.scrollLeft = doc.scrollLeft = left;\n alignHorizontally(cm);\n }\n // If we need to scroll a specific position into view, do so.\n if (op.scrollToPos) {\n var coords = scrollPosIntoView(cm, clipPos(cm.doc, op.scrollToPos.from),\n clipPos(cm.doc, op.scrollToPos.to), op.scrollToPos.margin);\n if (op.scrollToPos.isCursor && cm.state.focused) maybeScrollWindow(cm, coords);\n }\n\n if (op.selectionChanged) restartBlink(cm);\n\n if (cm.state.focused && op.updateInput)\n resetInput(cm, op.typing);\n\n // Fire events for markers that are hidden/unidden by editing or\n // undoing\n var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers;\n if (hidden) for (var i = 0; i < hidden.length; ++i)\n if (!hidden[i].lines.length) signal(hidden[i], \"hide\");\n if (unhidden) for (var i = 0; i < unhidden.length; ++i)\n if (unhidden[i].lines.length) signal(unhidden[i], \"unhide\");\n\n var delayed;\n if (!--delayedCallbackDepth) {\n delayed = delayedCallbacks;\n delayedCallbacks = null;\n }\n // Fire change events, and delayed event handlers\n if (op.changeObjs)\n signal(cm, \"changes\", cm, op.changeObjs);\n if (delayed) for (var i = 0; i < delayed.length; ++i) delayed[i]();\n if (op.cursorActivityHandlers)\n for (var i = 0; i < op.cursorActivityHandlers.length; i++)\n op.cursorActivityHandlers[i](cm);\n }", "updateCursorTotal () {\n\n }", "function setCursorToEnd(input){\n input.selectionStart = input.selectionEnd = 10000;\n}", "function cursorWait() {\n document.body.style.cursor = 'wait';\n }", "function updateCursor(cursor){\r\n\tif(typeof hatsForm.notRefreshSafe != \"undefined\"){\r\n\t\treturn;\r\n\t}\r\n\thatsForm.CURSORPOSITION.value = cursor;\r\n\tresetCursor();\r\n}", "function updateSelectionCursor(cm) {\n var display = cm.display, pos = cursorCoords(cm, cm.doc.sel.head, \"div\");\n display.cursor.style.left = pos.left + \"px\";\n display.cursor.style.top = pos.top + \"px\";\n display.cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n display.cursor.style.display = \"\";\n\n if (pos.other) {\n display.otherCursor.style.display = \"\";\n display.otherCursor.style.left = pos.other.left + \"px\";\n display.otherCursor.style.top = pos.other.top + \"px\";\n display.otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n } else { display.otherCursor.style.display = \"none\"; }\n }", "function updateSelectionCursor(cm) {\n var display = cm.display, pos = cursorCoords(cm, cm.doc.sel.head, \"div\");\n display.cursor.style.left = pos.left + \"px\";\n display.cursor.style.top = pos.top + \"px\";\n display.cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n display.cursor.style.display = \"\";\n\n if (pos.other) {\n display.otherCursor.style.display = \"\";\n display.otherCursor.style.left = pos.other.left + \"px\";\n display.otherCursor.style.top = pos.other.top + \"px\";\n display.otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n } else { display.otherCursor.style.display = \"none\"; }\n }", "function updateSelectionCursor(cm) {\n var display = cm.display, pos = cursorCoords(cm, cm.doc.sel.head, \"div\");\n display.cursor.style.left = pos.left + \"px\";\n display.cursor.style.top = pos.top + \"px\";\n display.cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n display.cursor.style.display = \"\";\n\n if (pos.other) {\n display.otherCursor.style.display = \"\";\n display.otherCursor.style.left = pos.other.left + \"px\";\n display.otherCursor.style.top = pos.other.top + \"px\";\n display.otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n } else { display.otherCursor.style.display = \"none\"; }\n }", "function updateSelectionCursor(cm) {\n var display = cm.display, pos = cursorCoords(cm, cm.doc.sel.head, \"div\");\n display.cursor.style.left = pos.left + \"px\";\n display.cursor.style.top = pos.top + \"px\";\n display.cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n display.cursor.style.display = \"\";\n\n if (pos.other) {\n display.otherCursor.style.display = \"\";\n display.otherCursor.style.left = pos.other.left + \"px\";\n display.otherCursor.style.top = pos.other.top + \"px\";\n display.otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n } else { display.otherCursor.style.display = \"none\"; }\n }", "function updateSelectionCursor(cm) {\n var display = cm.display, pos = cursorCoords(cm, cm.view.sel.head, \"div\");\n display.cursor.style.left = pos.left + \"px\";\n display.cursor.style.top = pos.top + \"px\";\n display.cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n display.cursor.style.display = \"\";\n\n if (pos.other) {\n display.otherCursor.style.display = \"\";\n display.otherCursor.style.left = pos.other.left + \"px\";\n display.otherCursor.style.top = pos.other.top + \"px\";\n display.otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n } else { display.otherCursor.style.display = \"none\"; }\n }", "function updateSelectionCursor(cm) {\n var display = cm.display, pos = cursorCoords(cm, cm.view.sel.head, \"div\");\n display.cursor.style.left = pos.left + \"px\";\n display.cursor.style.top = pos.top + \"px\";\n display.cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n display.cursor.style.display = \"\";\n\n if (pos.other) {\n display.otherCursor.style.display = \"\";\n display.otherCursor.style.left = pos.other.left + \"px\";\n display.otherCursor.style.top = pos.other.top + \"px\";\n display.otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n } else { display.otherCursor.style.display = \"none\"; }\n }", "function updateSelectionCursor(cm) {\n var display = cm.display, pos = cursorCoords(cm, cm.view.sel.head, \"div\");\n display.cursor.style.left = pos.left + \"px\";\n display.cursor.style.top = pos.top + \"px\";\n display.cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n display.cursor.style.display = \"\";\n\n if (pos.other) {\n display.otherCursor.style.display = \"\";\n display.otherCursor.style.left = pos.other.left + \"px\";\n display.otherCursor.style.top = pos.other.top + \"px\";\n display.otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n } else { display.otherCursor.style.display = \"none\"; }\n }", "function waitingCursor() {\n\t\t\t\tvar texts = ['/', '-', '\\\\', '|'],\n\t\t\t\t $c = me.$body.find('.cursor.waiting');\n\t\t\t\tif ($c.length > 0) {\n\t\t\t\t\t$c.each(function() {\n\t\t\t\t\t\tvar $this = $(this),\n\t\t\t\t\t\t text = $this.text(),\n\t\t\t\t\t\t index = texts.indexOf(text) + 1;\n\t\t\t\t\t\tif (index === texts.length) {\n\t\t\t\t\t\t\tindex = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$this.text(texts[index]);\n\t\t\t\t\t});\n\t\t\t\t\tview.waitingCursorTimeoutId = window.setTimeout(waitingCursor, 100);\n\t\t\t\t} else {\n\t\t\t\t\tdelete view.waitingCursorTimeoutId;\n\t\t\t\t}\n\t\t\t}", "getCursor() {\n return this.after;\n }", "function setCursorToEnd() {\n let p = document.getElementById(\"content\");\n let s = window.getSelection();\n let r = document.createRange();\n r.setStart(p.lastChild, 1);\n r.setEnd(p.lastChild, 1);\n s.removeAllRanges();\n s.addRange(r);\n}", "function updateCursorPosition() {\r\n var position = editor.getCursorPosition();\r\n // indicate cursor postion elements\r\n document.getElementById(\"cur-row\").innerText = position.row + 1;\r\n document.getElementById(\"cur-col\").innerText = position.column + 1;\r\n document.getElementById(\"all-lines\").innerText = editor.getSession().getLength();\r\n}", "outputLF() {\n this.cursor.y += 1;\n if (this.cursor.y == this.scrollMax + 1) {\n this.outputScrollUp(1);\n this.cursor.y = this.scrollMax;\n }\n else if (this.cursor.y >= this.termRows) {\n this.cursor.y = this.termRows - 1;\n }\n }", "navigateFileEnd() {\n this.selection.moveCursorFileEnd();\n this.clearSelection();\n }", "function ensureCursorVisible(cm) {\n\t\t resolveScrollToPos(cm);\n\t\t var cur = cm.getCursor();\n\t\t cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n\t\t }", "function handleClick(event)\n {\n if($(_consoleSelector)[0].selectionStart <= _eraseLimit || $(_consoleSelector)[0].selectionEnd <= _eraseLimit)\n {\n $(_consoleSelector)[0].selectionStart = _eraseLimit;\n $(_consoleSelector)[0].selectionEnd = _eraseLimit;\n }\t\n }", "writeAfterUpdate() {\n\t\tthis.setFocus();\n\t}", "writeAfterUpdate() {\n\t\tthis.setFocus();\n\t}", "function cursorClear() {\n document.body.style.cursor = 'default';\n }", "startDraw() {\n\t\tif (this.cursorVisible != false) {\n\t\t\tthis.write(\"\\x1B[?25l\");\n\t\t\tthis.cursorVisible = false;\n\t\t}\n\t\tthis.write(\"\\x1B7\"); //save cursor pos\n\t}", "outputRLF() {\n this.cursor.y -= 1;\n if (this.cursor.y == this.scrollMin - 1) {\n this.outputScrollDown(1);\n this.cursor.y = this.scrollMin;\n }\n else if (this.cursor.y < 0) {\n this.cursor.y = 0;\n }\n }", "function cursorInvisible() {\r\n\r\n\t\tcursorTime = cursorTime-1; //decrease time by 1\r\n\r\n\t\tif(cursorTime == 0) {\r\n\t\t\t$('body').css(\"cursor\", \"none\");\r\n\t\t\tclearInterval(cursor);\r\n\t\t}; //if time = 0, cursor disappears\r\n\r\n\t}", "handleControlEndKey() {\n let documentEnd = undefined;\n if (!isNullOrUndefined(this.owner.documentEnd)) {\n documentEnd = this.owner.documentEnd;\n }\n if (!isNullOrUndefined(documentEnd)) {\n this.owner.selection.selectContent(documentEnd, true);\n }\n this.checkForCursorVisibility();\n }", "function showCursorLoader(loading) {\n console.log('showCursorLoader running');\n if (loading) {\n $('body').css('cursor', 'progress');\n }\n else {\n $('body').css('cursor', 'default');\n }\n}", "_complete() {\n this._resetCurrent(true);\n\n super._complete();\n }", "function ensureCursorVisible(cm) {\r\n resolveScrollToPos(cm);\r\n var cur = cm.getCursor();\r\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\r\n}", "moveSourceCursorToTheNextPosition () {\n\n }", "function drawSelectionCursor(cm, head, output) {\n\t var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n\t var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n\t cursor.style.left = pos.left + \"px\";\n\t cursor.style.top = pos.top + \"px\";\n\t cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n\t if (pos.other) {\n\t // Secondary cursor, shown when on a 'jump' in bi-directional text\n\t var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n\t otherCursor.style.display = \"\";\n\t otherCursor.style.left = pos.other.left + \"px\";\n\t otherCursor.style.top = pos.other.top + \"px\";\n\t otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n\t }\n\t }", "function drawSelectionCursor(cm, head, output) {\n\t var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n\t var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n\t cursor.style.left = pos.left + \"px\";\n\t cursor.style.top = pos.top + \"px\";\n\t cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n\t if (pos.other) {\n\t // Secondary cursor, shown when on a 'jump' in bi-directional text\n\t var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n\t otherCursor.style.display = \"\";\n\t otherCursor.style.left = pos.other.left + \"px\";\n\t otherCursor.style.top = pos.other.top + \"px\";\n\t otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n\t }\n\t }", "function drawSelectionCursor(cm, head, output) {\n\t var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\t\n\t var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n\t cursor.style.left = pos.left + \"px\";\n\t cursor.style.top = pos.top + \"px\";\n\t cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\t\n\t if (pos.other) {\n\t // Secondary cursor, shown when on a 'jump' in bi-directional text\n\t var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n\t otherCursor.style.display = \"\";\n\t otherCursor.style.left = pos.other.left + \"px\";\n\t otherCursor.style.top = pos.other.top + \"px\";\n\t otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n\t }\n\t }", "showCursor() {\n this.canvas.style.cursor = CURRENT_CURSOR;\n }", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor(), from = cur, to = cur;\n if (!cm.options.lineWrapping) {\n from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;\n to = Pos(cur.line, cur.ch + 1);\n }\n cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true};\n }", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor(), from = cur, to = cur;\n if (!cm.options.lineWrapping) {\n from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;\n to = Pos(cur.line, cur.ch + 1);\n }\n cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true};\n }", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor(), from = cur, to = cur;\n if (!cm.options.lineWrapping) {\n from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;\n to = Pos(cur.line, cur.ch + 1);\n }\n cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true};\n }", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor(), from = cur, to = cur;\n if (!cm.options.lineWrapping) {\n from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;\n to = Pos(cur.line, cur.ch + 1);\n }\n cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true};\n }", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor(), from = cur, to = cur;\n if (!cm.options.lineWrapping) {\n from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;\n to = Pos(cur.line, cur.ch + 1);\n }\n cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true};\n }", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor(), from = cur, to = cur;\n if (!cm.options.lineWrapping) {\n from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;\n to = Pos(cur.line, cur.ch + 1);\n }\n cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true};\n }", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor(), from = cur, to = cur;\n if (!cm.options.lineWrapping) {\n from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;\n to = Pos(cur.line, cur.ch + 1);\n }\n cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true};\n }", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n}", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n}", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n}", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n}", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n}", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n}", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n}", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n}", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n}", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n}", "function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n}", "function CursorTrack() {}", "function finalizeSelection(){\n\n\tvar len = cliptext.value.length\n\tif(len > 5) cliptext.selectionStart = 3\n\telse cliptext.selectionStart = defaultStart\n\tcliptext.selectionEnd = len - 2\n}", "function resetCursor(){\r\n\ttry{ \r\n\t\tif (hatsForm.CURSORPOSITION.value){\r\n\t\t\tinitInputFieldFocus(hatsForm.CURSORPOSITION.value);\r\n\t\t}\r\n\t}catch(e){\r\n\t\treturn;\r\n\t}\r\n\tsetInputFieldFocus();\r\n\t//for mozilla and IE10 only\r\n\tsetInitValuesforHidden();\r\n}", "function waitCursorStart() {\n $(\"*\").css(\"cursor\", \"wait\");\n // $(\"html\").css(\"cursor\", \"wait\");\n }", "function drawSelectionCursor(cm, head, output) {\n\t\t var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\t\t\n\t\t var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n\t\t cursor.style.left = pos.left + \"px\";\n\t\t cursor.style.top = pos.top + \"px\";\n\t\t cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\t\t\n\t\t if (pos.other) {\n\t\t // Secondary cursor, shown when on a 'jump' in bi-directional text\n\t\t var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n\t\t otherCursor.style.display = \"\";\n\t\t otherCursor.style.left = pos.other.left + \"px\";\n\t\t otherCursor.style.top = pos.other.top + \"px\";\n\t\t otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n\t\t }\n\t\t }", "function noCursor() {\n _displaycontrol &= ~LCD_CURSORON;\n command(LCD_DISPLAYCONTROL | _displaycontrol);\n}", "function ensureCursorVisible(cm) {\n\t resolveScrollToPos(cm);\n\t var cur = cm.getCursor(), from = cur, to = cur;\n\t if (!cm.options.lineWrapping) {\n\t from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;\n\t to = Pos(cur.line, cur.ch + 1);\n\t }\n\t cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true};\n\t }", "function ensureCursorVisible(cm) {\n\t resolveScrollToPos(cm);\n\t var cur = cm.getCursor(), from = cur, to = cur;\n\t if (!cm.options.lineWrapping) {\n\t from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;\n\t to = Pos(cur.line, cur.ch + 1);\n\t }\n\t cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true};\n\t }", "function ensureCursorVisible(cm) {\n\t resolveScrollToPos(cm);\n\t var cur = cm.getCursor(), from = cur, to = cur;\n\t if (!cm.options.lineWrapping) {\n\t from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;\n\t to = Pos(cur.line, cur.ch + 1);\n\t }\n\t cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true};\n\t }", "function ensureCursorVisible(cm) {\n\t\t resolveScrollToPos(cm);\n\t\t var cur = cm.getCursor(), from = cur, to = cur;\n\t\t if (!cm.options.lineWrapping) {\n\t\t from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;\n\t\t to = Pos(cur.line, cur.ch + 1);\n\t\t }\n\t\t cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true};\n\t\t }", "afterOp() {\n if ( focusedNode && focusedNode.focusable ) {\n focusedNode.focus();\n }\n BrowserEvents.blockFocusCallbacks = false;\n }", "incrCursor() {\n const last = this.getLastHistory().groups;\n if (this.cursorIndex === null) {\n this.cursorIndex = 0;\n return;\n }\n if (this._overwrite) {\n if (this.cursorIndex < last.length) {\n // ?\n this.cursorIndex++;\n } else {\n return;\n }\n }\n if (!this._overwrite) {\n if (this.cursorIndex < last.length - 1) {\n // ?\n this.cursorIndex++;\n } else {\n }\n }\n }", "moveToDocumentEnd() {\n this.handleControlEndKey();\n }", "afterDrawEnd() {\n if (me.draw) {\n me.draw.setActive(false);\n }\n me.drawActive = false;\n HsQueryBaseService.activateQueries();\n }", "function advance_exec_cursor() {\n\t\t\t\twhile (exec_cursor < chain.length) {\n\t\t\t\t\tif (is_func(chain[exec_cursor])) {\n\t\t\t\t\t\t/*!START_DEBUG*/if (chain_opts[_Debug]) log_msg(\"$LAB.wait() executing: \"+chain[exec_cursor]);/*!END_DEBUG*/\n\t\t\t\t\t\ttry { chain[exec_cursor++](); } catch (err) {\n\t\t\t\t\t\t\t/*!START_DEBUG*/if (chain_opts[_Debug]) log_error(\"$LAB.wait() error caught: \",err);/*!END_DEBUG*/\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\telse if (!chain[exec_cursor].finished) {\n\t\t\t\t\t\tif (check_chain_group_scripts_ready(chain[exec_cursor])) continue;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\texec_cursor++;\n\t\t\t\t}\n\t\t\t\t// we've reached the end of the chain (so far)\n\t\t\t\tif (exec_cursor == chain.length) {\n\t\t\t\t\tscripts_currently_loading = false;\n\t\t\t\t\tgroup = false;\n\t\t\t\t}\n\t\t\t}", "function drawSelectionCursor(cm, head, output) {\n var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n }", "function drawSelectionCursor(cm, head, output) {\n var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n }", "function drawSelectionCursor(cm, head, output) {\n var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n }", "function drawSelectionCursor(cm, head, output) {\n var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n }", "function drawSelectionCursor(cm, head, output) {\n var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n }", "function drawSelectionCursor(cm, head, output) {\n var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n }", "function drawSelectionCursor(cm, head, output) {\n var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n }" ]
[ "0.71896726", "0.70795476", "0.70729387", "0.667339", "0.6522092", "0.6430521", "0.6329043", "0.62736994", "0.622839", "0.6224282", "0.6167339", "0.61538243", "0.61226624", "0.6042317", "0.6026656", "0.6026656", "0.6026656", "0.6026656", "0.60073024", "0.60073024", "0.60073024", "0.59939235", "0.59273213", "0.589298", "0.5887215", "0.5874777", "0.5874273", "0.5863685", "0.5847638", "0.58020186", "0.58020186", "0.5801903", "0.5799533", "0.5763028", "0.5749259", "0.573491", "0.57336116", "0.5718884", "0.5705823", "0.5701026", "0.56859577", "0.56859577", "0.5683615", "0.5673092", "0.5668682", "0.5668682", "0.5668682", "0.5668682", "0.5668682", "0.5668682", "0.5668682", "0.56579435", "0.56579435", "0.56579435", "0.56579435", "0.56579435", "0.56579435", "0.56579435", "0.56579435", "0.56579435", "0.56579435", "0.56579435", "0.56553936", "0.56457627", "0.5640363", "0.5638124", "0.5633837", "0.5632787", "0.56249344", "0.56249344", "0.56249344", "0.56207126", "0.5616729", "0.5614368", "0.5610282", "0.5601689", "0.5599656", "0.5598102", "0.5598102", "0.5598102", "0.5598102", "0.5598102", "0.5598102", "0.5598102" ]
0.58007646
46
When an operation has its scrollToPos property set, and another scroll action is applied before the end of the operation, this 'simulates' scrolling that position into view in a cheap way, so that the effect of intermediate scroll commands is not ignored.
function resolveScrollToPos(cm) { var range = cm.curOp.scrollToPos; if (range) { cm.curOp.scrollToPos = null; var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to); scrollToCoordsRange(cm, from, to, range.margin); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "scrollBehavior (to, from, savedPosition) {\n if (savedPosition) {\n console.log(\"后退\")\n return savedPosition\n } else {\n console.log(\"前进\")\n return {x: 0, y: 0}\n }\n }", "scrollBehavior (to, from, savedPosition) {\n return new Promise((resolve, reject) => {\n setTimeout(() => {\n if (savedPosition) {\n resolve(savedPosition);\n } else {\n resolve({ x: 0, y: 0 })\n }\n }, 500);\n })\n }", "function Qa(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;Xa(e,ua(e,t.from),ua(e,t.to),t.margin)}}", "setScrollPosition(position) {\n // Set the new scrollTop/scrollLeft to all scrollViews elements\n return this.pageScrollOptions.scrollViews.reduce((oneAlreadyWorked, scrollingView) => {\n const startScrollPropertyValue = this.getScrollPropertyValue(scrollingView);\n\n if (scrollingView && startScrollPropertyValue !== undefined && startScrollPropertyValue !== null) {\n const scrollDistance = Math.abs(startScrollPropertyValue - position); // The movement we need to perform is less than 2px\n // This we consider a small movement which some browser may not perform when\n // changing the scrollTop/scrollLeft property\n // Thus in this cases we do not stop the scroll animation, although setting the\n // scrollTop/scrollLeft value \"fails\"\n\n const isSmallMovement = scrollDistance < this.pageScrollOptions._minScrollDistance;\n\n if (!this.pageScrollOptions.verticalScrolling) {\n scrollingView.scrollLeft = position;\n } else {\n scrollingView.scrollTop = position;\n } // Return true if setting the new scrollTop/scrollLeft value worked\n // We consider that it worked if the new scrollTop/scrollLeft value is closer to the\n // desired scrollTop/scrollLeft than before (it might not be exactly the value we\n // set due to dpi or rounding irregularities)\n\n\n if (isSmallMovement || scrollDistance > Math.abs(this.getScrollPropertyValue(scrollingView) - position)) {\n return true;\n }\n }\n\n return oneAlreadyWorked;\n }, false);\n }", "scrollBehavior(to, from, savedPosition) {\n return {x: 0, y: 0};\n }", "scrollBehavior(to, from, savedPosition) {\n return { x: 0, y: 0 };\n }", "function resolveScrollToPos(cm) {\n\t\t var range = cm.curOp.scrollToPos;\n\t\t if (range) {\n\t\t cm.curOp.scrollToPos = null;\n\t\t var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to);\n\t\t scrollToCoordsRange(cm, from, to, range.margin);\n\t\t }\n\t\t }", "scrollBehavior (to, from, savedPosition) {\r\n if (savedPosition) {\r\n return savedPosition\r\n } else {\r\n return { x: 0, y: 0 }\r\n }\r\n }", "function ScrollPosition() {}", "scrollBehavior (to, from, savedPosition) {\n return { x: 0, y: 0 }\n }", "scrollBehavior(to, from, savedPosition) {\n if (savedPosition) {\n return savedPosition;\n } else {\n return { x: 0, y: 0 };\n }\n }", "scrollBehavior(to, from, savedPosition) {\n if (savedPosition) {\n return savedPosition\n } else {\n return { x: 0, y: 0 }\n }\n }", "scrollBehavior(to, from, savedPosition) {\n return { x: 0, y: 0 };\n }", "scrollBehavior(to, from, savedPosition) {\n if (savedPosition) return savedPosition;\n else return { left: 0, top: 0 };\n }", "scrollBehavior(to, from, savedPosition) {\n if (savedPosition) {\n return savedPosition\n } else {\n return {\n x: 0,\n y: 0\n }\n }\n }", "scrollBehavior(to, from, savedPosition) {\n if (savedPosition) {\n return savedPosition\n } else {\n return {\n x: 0,\n y: 0,\n }\n }\n }", "scrollToPosition(startPosition, endPosition, skipCursorUpdate) {\n if (this.skipScrollToPosition) {\n this.skipScrollToPosition = false;\n return;\n }\n if (this.owner.enableImageResizerMode && this.owner.imageResizerModule.isImageResizing\n || this.isMouseDownInFooterRegion || this.isRowOrCellResizing) {\n return;\n }\n let lineWidget = this.selection.getLineWidgetInternal(endPosition.currentWidget, endPosition.offset, true);\n if (isNullOrUndefined(lineWidget)) {\n return;\n }\n let top = this.selection.getTop(lineWidget);\n if (this.isMouseDown) {\n let prevLineWidget = this.selection.getLineWidgetInternal(endPosition.currentWidget, endPosition.offset, false);\n let prevTop = this.selection.getTop(prevLineWidget);\n if (prevLineWidget !== lineWidget && endPosition.location.y >= prevTop) {\n lineWidget = prevLineWidget;\n }\n }\n let height = lineWidget.height;\n //Gets current page.\n let endPage = this.selection.getPage(lineWidget.paragraph);\n this.currentPage = endPage;\n let x = 0;\n let y = 0;\n let viewer = this;\n let isPageLayout = viewer instanceof PageLayoutViewer;\n if (isPageLayout) {\n if (isNullOrUndefined(endPage)) {\n return;\n }\n let pageWidth = endPage.boundingRectangle.width;\n x = (this.visibleBounds.width - pageWidth * this.zoomFactor) / 2;\n if (x < 30) {\n x = 30;\n }\n // tslint:disable-next-line:max-line-length\n y = endPage.boundingRectangle.y * this.zoomFactor + (this.pages.indexOf(endPage) + 1) * viewer.pageGap * (1 - this.zoomFactor);\n }\n let scrollTop = this.containerTop;\n let scrollLeft = this.containerLeft;\n let pageHeight = this.visibleBounds.height;\n let caretInfo = this.selection.updateCaretSize(this.owner.selection.end, true);\n let topMargin = caretInfo.topMargin;\n let caretHeight = caretInfo.height;\n x += (endPosition.location.x) * this.zoomFactor;\n y += (endPosition.location.y + topMargin) * this.zoomFactor;\n //vertical scroll bar update\n if ((scrollTop + 20) > y) {\n this.viewerContainer.scrollTop = (y - 10);\n }\n else if (scrollTop + pageHeight < y + caretHeight) {\n this.viewerContainer.scrollTop = y + caretHeight - pageHeight + 10;\n }\n if (!skipCursorUpdate) {\n this.selection.updateCaretToPage(startPosition, endPage);\n }\n let scrollBarWidth = this.viewerContainer.offsetWidth - this.viewerContainer.clientWidth;\n if (scrollLeft > x) {\n this.viewerContainer.scrollLeft = x - (viewer.pageContainer.offsetWidth / 100) * 20;\n }\n else if (scrollLeft + this.visibleBounds.width < x + scrollBarWidth) {\n this.viewerContainer.scrollLeft = scrollLeft + (viewer.pageContainer.offsetWidth / 100) * 15 + scrollBarWidth;\n }\n }", "scrollBehavior (to, from, savedPosition) {\n if (savedPosition) {\n return savedPosition\n } else {\n return { x: 0, y: 0 }\n }\n }", "scrollBehavior(to, from, savedPosition) {\n if (savedPosition) {\n return savedPosition\n } else {\n return {x: 0, y: 0}\n }\n }", "function resolveScrollToPos(cm) {\n var range$$1 = cm.curOp.scrollToPos;\n if (range$$1) {\n cm.curOp.scrollToPos = null;\n var from = estimateCoords(cm, range$$1.from), to = estimateCoords(cm, range$$1.to);\n scrollToCoordsRange(cm, from, to, range$$1.margin);\n }\n }", "function resolveScrollToPos(cm) {\n var range$$1 = cm.curOp.scrollToPos;\n if (range$$1) {\n cm.curOp.scrollToPos = null;\n var from = estimateCoords(cm, range$$1.from), to = estimateCoords(cm, range$$1.to);\n scrollToCoordsRange(cm, from, to, range$$1.margin);\n }\n }", "function resolveScrollToPos(cm) {\n var range$$1 = cm.curOp.scrollToPos;\n if (range$$1) {\n cm.curOp.scrollToPos = null;\n var from = estimateCoords(cm, range$$1.from), to = estimateCoords(cm, range$$1.to);\n scrollToCoordsRange(cm, from, to, range$$1.margin);\n }\n }", "function resolveScrollToPos(cm) {\n var range$$1 = cm.curOp.scrollToPos;\n if (range$$1) {\n cm.curOp.scrollToPos = null;\n var from = estimateCoords(cm, range$$1.from), to = estimateCoords(cm, range$$1.to);\n scrollToCoordsRange(cm, from, to, range$$1.margin);\n }\n }", "function resolveScrollToPos(cm) {\n var range$$1 = cm.curOp.scrollToPos;\n if (range$$1) {\n cm.curOp.scrollToPos = null;\n var from = estimateCoords(cm, range$$1.from), to = estimateCoords(cm, range$$1.to);\n scrollToCoordsRange(cm, from, to, range$$1.margin);\n }\n }", "function resolveScrollToPos(cm) {\n var range$$1 = cm.curOp.scrollToPos;\n if (range$$1) {\n cm.curOp.scrollToPos = null;\n var from = estimateCoords(cm, range$$1.from), to = estimateCoords(cm, range$$1.to);\n scrollToCoordsRange(cm, from, to, range$$1.margin);\n }\n }", "function resolveScrollToPos(cm) {\n var range$$1 = cm.curOp.scrollToPos;\n if (range$$1) {\n cm.curOp.scrollToPos = null;\n var from = estimateCoords(cm, range$$1.from), to = estimateCoords(cm, range$$1.to);\n scrollToCoordsRange(cm, from, to, range$$1.margin);\n }\n }", "function resolveScrollToPos(cm) {\n var range$$1 = cm.curOp.scrollToPos;\n if (range$$1) {\n cm.curOp.scrollToPos = null;\n var from = estimateCoords(cm, range$$1.from), to = estimateCoords(cm, range$$1.to);\n scrollToCoordsRange(cm, from, to, range$$1.margin);\n }\n }", "function resolveScrollToPos(cm) {\n var range$$1 = cm.curOp.scrollToPos;\n if (range$$1) {\n cm.curOp.scrollToPos = null;\n var from = estimateCoords(cm, range$$1.from), to = estimateCoords(cm, range$$1.to);\n scrollToCoordsRange(cm, from, to, range$$1.margin);\n }\n }", "[scroll]() {\n if (!this.scrollableElement || !this.currentMousePosition) {\n return;\n }\n\n cancelAnimationFrame(this.scrollAnimationFrame);\n\n const { speed, sensitivity } = this.options;\n\n const rect = this.scrollableElement.getBoundingClientRect();\n const bottomCutOff = rect.bottom > window.innerHeight;\n const topCutOff = rect.top < 0;\n const cutOff = topCutOff || bottomCutOff;\n\n const documentScrollingElement = getDocumentScrollingElement();\n const scrollableElement = this.scrollableElement;\n const clientX = this.currentMousePosition.clientX;\n const clientY = this.currentMousePosition.clientY;\n\n if (scrollableElement !== document.body && scrollableElement !== document.documentElement && !cutOff) {\n const { offsetHeight, offsetWidth } = scrollableElement;\n\n if (rect.top + offsetHeight - clientY < sensitivity) {\n scrollableElement.scrollTop += speed;\n } else if (clientY - rect.top < sensitivity) {\n scrollableElement.scrollTop -= speed;\n }\n\n if (rect.left + offsetWidth - clientX < sensitivity) {\n scrollableElement.scrollLeft += speed;\n } else if (clientX - rect.left < sensitivity) {\n scrollableElement.scrollLeft -= speed;\n }\n } else {\n const { innerHeight, innerWidth } = window;\n\n if (clientY < sensitivity) {\n documentScrollingElement.scrollTop -= speed;\n } else if (innerHeight - clientY < sensitivity) {\n documentScrollingElement.scrollTop += speed;\n }\n\n if (clientX < sensitivity) {\n documentScrollingElement.scrollLeft -= speed;\n } else if (innerWidth - clientX < sensitivity) {\n documentScrollingElement.scrollLeft += speed;\n }\n }\n\n this.scrollAnimationFrame = requestAnimationFrame(this[scroll]);\n }", "function resolveScrollToPos(cm) {\n var range = cm.curOp.scrollToPos;\n\n if (range) {\n cm.curOp.scrollToPos = null;\n var from = estimateCoords(cm, range.from),\n to = estimateCoords(cm, range.to);\n scrollToCoordsRange(cm, from, to, range.margin);\n }\n }", "scrollBehavior(to, from, savedPosition) {\n if (savedPosition) {\n return savedPosition;\n }\n if (to.hash) {\n return { selector: to.hash };\n }\n return { x: 0, y: 0 };\n }", "stepScrollAnimation_() {\n if (!this.scrollTarget) {\n return;\n }\n\n const currentScrollPos = -this.workspace_.scrollY;\n const diff = this.scrollTarget - currentScrollPos;\n if (Math.abs(diff) < 1) {\n this.workspace_.scrollbar.setY(this.scrollTarget);\n this.scrollTarget = null;\n return;\n }\n this.workspace_.scrollbar.setY(\n currentScrollPos + diff * this.scrollAnimationFraction);\n\n requestAnimationFrame(this.stepScrollAnimation_.bind(this));\n }", "scrollBehavior (to, from, savedPosition) {\n if (savedPosition) {\n return savedPosition\n } else {\n return { x: 0, y: 0 }\n }\n }", "function _calcScrollToOffset(size, scrollOffset) {\n\t var scrollToRenderNode = this._scroll.scrollToRenderNode || this._scroll.ensureVisibleRenderNode;\n\t if (!scrollToRenderNode) {\n\t return;\n\t }\n\n\t // 1. When boundary is reached, stop scrolling in that direction\n\t if ((this._scroll.boundsReached === Bounds.BOTH) ||\n\t (!this._scroll.scrollToDirection && (this._scroll.boundsReached === Bounds.PREV)) ||\n\t (this._scroll.scrollToDirection && (this._scroll.boundsReached === Bounds.NEXT))) {\n\t return;\n\t }\n\n\t // 2. Find the node to scroll to\n\t var foundNode;\n\t var scrollToOffset = 0;\n\t var node = this._nodes.getStartEnumNode(true);\n\t var count = 0;\n\t while (node) {\n\t count++;\n\t if (!node._invalidated || (node.scrollLength === undefined)) {\n\t break;\n\t }\n\t if (this.options.alignment) {\n\t scrollToOffset -= node.scrollLength;\n\t }\n\t if (node.renderNode === scrollToRenderNode) {\n\t foundNode = node;\n\t break;\n\t }\n\t if (!this.options.alignment) {\n\t scrollToOffset -= node.scrollLength;\n\t }\n\t node = node._next;\n\t }\n\t if (!foundNode) {\n\t scrollToOffset = 0;\n\t node = this._nodes.getStartEnumNode(false);\n\t while (node) {\n\t if (!node._invalidated || (node.scrollLength === undefined)) {\n\t break;\n\t }\n\t if (!this.options.alignment) {\n\t scrollToOffset += node.scrollLength;\n\t }\n\t if (node.renderNode === scrollToRenderNode) {\n\t foundNode = node;\n\t break;\n\t }\n\t if (this.options.alignment) {\n\t scrollToOffset += node.scrollLength;\n\t }\n\t node = node._prev;\n\t }\n\t }\n\n\t // 3. Update springs\n\t if (foundNode) {\n\t if (this._scroll.ensureVisibleSequence) {\n\t if (this.options.alignment) {\n\t if ((scrollToOffset - foundNode.scrollLength) < 0) {\n\t this._scroll.springPosition = scrollToOffset;\n\t this._scroll.springSource = SpringSource.ENSUREVISIBLE;\n\t } else if (scrollToOffset > size[this._direction]) {\n\t this._scroll.springPosition = size[this._direction] - scrollToOffset;\n\t this._scroll.springSource = SpringSource.ENSUREVISIBLE;\n\t }\n\t else {\n\t this._scroll.ensureVisibleRenderNode = undefined;\n\t }\n\t }\n\t else {\n\t scrollToOffset = -scrollToOffset;\n\t if (scrollToOffset < 0) {\n\t this._scroll.springPosition = scrollToOffset;\n\t this._scroll.springSource = SpringSource.ENSUREVISIBLE;\n\t } else if ((scrollToOffset + foundNode.scrollLength) > size[this._direction]) {\n\t this._scroll.springPosition = size[this._direction] - (scrollToOffset + foundNode.scrollLength);\n\t this._scroll.springSource = SpringSource.ENSUREVISIBLE;\n\t }\n\t else {\n\t this._scroll.ensureVisibleRenderNode = undefined;\n\t }\n\t }\n\t }\n\t else { // scrollToSequence\n\t this._scroll.springPosition = scrollToOffset;\n\t this._scroll.springSource = SpringSource.GOTOSEQUENCE;\n\t }\n\t return;\n\t }\n\n\t // 4. When node not found, keep searching\n\t if (this._scroll.scrollToDirection) {\n\t this._scroll.springPosition = scrollOffset - size[this._direction];\n\t this._scroll.springSource = SpringSource.GOTOPREVDIRECTION;\n\t }\n\t else {\n\t this._scroll.springPosition = scrollOffset + size[this._direction];\n\t this._scroll.springSource = SpringSource.GOTONEXTDIRECTION;\n\t }\n\t }", "function Va(e){Qa(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}", "function _calcScrollToOffset(size, scrollOffset) {\n\t var scrollToRenderNode = this._scroll.scrollToRenderNode || this._scroll.ensureVisibleRenderNode;\n\t if (!scrollToRenderNode) {\n\t return;\n\t }\n\t\n\t // 1. When boundary is reached, stop scrolling in that direction\n\t if ((this._scroll.boundsReached === Bounds.BOTH) ||\n\t (!this._scroll.scrollToDirection && (this._scroll.boundsReached === Bounds.PREV)) ||\n\t (this._scroll.scrollToDirection && (this._scroll.boundsReached === Bounds.NEXT))) {\n\t return;\n\t }\n\t\n\t // 2. Find the node to scroll to\n\t var foundNode;\n\t var scrollToOffset = 0;\n\t var node = this._nodes.getStartEnumNode(true);\n\t var count = 0;\n\t while (node) {\n\t count++;\n\t if (!node._invalidated || (node.scrollLength === undefined)) {\n\t break;\n\t }\n\t if (this.options.alignment) {\n\t scrollToOffset -= node.scrollLength;\n\t }\n\t if (node.renderNode === scrollToRenderNode) {\n\t foundNode = node;\n\t break;\n\t }\n\t if (!this.options.alignment) {\n\t scrollToOffset -= node.scrollLength;\n\t }\n\t node = node._next;\n\t }\n\t if (!foundNode) {\n\t scrollToOffset = 0;\n\t node = this._nodes.getStartEnumNode(false);\n\t while (node) {\n\t if (!node._invalidated || (node.scrollLength === undefined)) {\n\t break;\n\t }\n\t if (!this.options.alignment) {\n\t scrollToOffset += node.scrollLength;\n\t }\n\t if (node.renderNode === scrollToRenderNode) {\n\t foundNode = node;\n\t break;\n\t }\n\t if (this.options.alignment) {\n\t scrollToOffset += node.scrollLength;\n\t }\n\t node = node._prev;\n\t }\n\t }\n\t\n\t // 3. Update springs\n\t if (foundNode) {\n\t if (this._scroll.ensureVisibleRenderNode) {\n\t if (this.options.alignment) {\n\t if ((scrollToOffset - foundNode.scrollLength) < 0) {\n\t this._scroll.springPosition = scrollToOffset;\n\t this._scroll.springSource = SpringSource.ENSUREVISIBLE;\n\t }\n\t else if (scrollToOffset > size[this._direction]) {\n\t this._scroll.springPosition = size[this._direction] - scrollToOffset;\n\t this._scroll.springSource = SpringSource.ENSUREVISIBLE;\n\t }\n\t else {\n\t if (!foundNode.trueSizeRequested) {\n\t this._scroll.ensureVisibleRenderNode = undefined;\n\t }\n\t }\n\t }\n\t else {\n\t scrollToOffset = -scrollToOffset;\n\t if (scrollToOffset < 0) {\n\t this._scroll.springPosition = scrollToOffset;\n\t this._scroll.springSource = SpringSource.ENSUREVISIBLE;\n\t }\n\t else if ((scrollToOffset + foundNode.scrollLength) > size[this._direction]) {\n\t this._scroll.springPosition = size[this._direction] - (scrollToOffset + foundNode.scrollLength);\n\t this._scroll.springSource = SpringSource.ENSUREVISIBLE;\n\t }\n\t else {\n\t if (!foundNode.trueSizeRequested) {\n\t this._scroll.ensureVisibleRenderNode = undefined;\n\t }\n\t }\n\t }\n\t }\n\t else { // scrollToSequence\n\t this._scroll.springPosition = scrollToOffset;\n\t this._scroll.springSource = SpringSource.GOTOSEQUENCE;\n\t }\n\t return;\n\t }\n\t\n\t // 4. When node not found, keep searching\n\t if (this._scroll.scrollToDirection) {\n\t this._scroll.springPosition = scrollOffset - size[this._direction];\n\t this._scroll.springSource = SpringSource.GOTONEXTDIRECTION;\n\t }\n\t else {\n\t this._scroll.springPosition = scrollOffset + size[this._direction];\n\t this._scroll.springSource = SpringSource.GOTOPREVDIRECTION;\n\t }\n\t\n\t // 5. In case of a VirtualViewSequnce, make sure all the view-sequence nodes are touched, so\n\t // that they are not cleaned up.\n\t if (this._viewSequence.cleanup) {\n\t var viewSequence = this._viewSequence;\n\t while (viewSequence.get() !== scrollToRenderNode) {\n\t viewSequence = this._scroll.scrollToDirection ? viewSequence.getNext(true) : viewSequence.getPrevious(true);\n\t if (!viewSequence) {\n\t break;\n\t }\n\t }\n\t }\n\t }", "function resolveScrollToPos(cm) {\n\t\t var range = cm.curOp.scrollToPos;\n\t\t if (range) {\n\t\t cm.curOp.scrollToPos = null;\n\t\t var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to);\n\t\t var sPos = calculateScrollPos(cm, Math.min(from.left, to.left),\n\t\t Math.min(from.top, to.top) - range.margin,\n\t\t Math.max(from.right, to.right),\n\t\t Math.max(from.bottom, to.bottom) + range.margin);\n\t\t cm.scrollTo(sPos.scrollLeft, sPos.scrollTop);\n\t\t }\n\t\t }", "_scroll(scrollButton) {\n const that = this,\n mainContainer = that.$.mainContainer,\n scrollCoefficient = scrollButton.classList.contains('jqx-scroll-button-near') ? -1 : 1,\n oldScrollTop = mainContainer.scrollTop;\n\n mainContainer.scrollTop = mainContainer.scrollTop + scrollCoefficient * 10;\n\n if (oldScrollTop !== mainContainer.scrollTop) {\n that._updateScrollButtonVisibility(mainContainer, false, [that.$.scrollButtonNear, that.$.scrollButtonFar]);\n that._fireScrollBottomReachedEvent(oldScrollTop);\n }\n }", "_scrollButtonNearClickHandler() {\n const that = this;\n\n if (that.$.scrollButtonNear.disabled) {\n return;\n }\n\n that._scroll(-1);\n }", "function resolveScrollToPos(cm) {\r\n var range$$1 = cm.curOp.scrollToPos;\r\n if (range$$1) {\r\n cm.curOp.scrollToPos = null;\r\n var from = estimateCoords(cm, range$$1.from), to = estimateCoords(cm, range$$1.to);\r\n scrollToCoordsRange(cm, from, to, range$$1.margin);\r\n }\r\n}", "function endOperation(cm) {\n var op = cm.curOp, doc = cm.doc, display = cm.display;\n cm.curOp = null;\n\n if (op.updateMaxLine) findMaxLine(cm);\n\n // If it looks like an update might be needed, call updateDisplay\n if (op.viewChanged || op.forceUpdate || op.scrollTop != null ||\n op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom ||\n op.scrollToPos.to.line >= display.viewTo) ||\n display.maxLineChanged && cm.options.lineWrapping) {\n var updated = updateDisplay(cm, {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate);\n if (cm.display.scroller.offsetHeight) cm.doc.scrollTop = cm.display.scroller.scrollTop;\n }\n // If no update was run, but the selection changed, redraw that.\n if (!updated && op.selectionChanged) updateSelection(cm);\n if (!updated && op.startHeight != cm.doc.height) updateScrollbars(cm);\n\n // Abort mouse wheel delta measurement, when scrolling explicitly\n if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos))\n display.wheelStartX = display.wheelStartY = null;\n\n // Propagate the scroll position to the actual DOM scroller\n if (op.scrollTop != null && display.scroller.scrollTop != op.scrollTop) {\n var top = Math.max(0, Math.min(display.scroller.scrollHeight - display.scroller.clientHeight, op.scrollTop));\n display.scroller.scrollTop = display.scrollbarV.scrollTop = doc.scrollTop = top;\n }\n if (op.scrollLeft != null && display.scroller.scrollLeft != op.scrollLeft) {\n var left = Math.max(0, Math.min(display.scroller.scrollWidth - display.scroller.clientWidth, op.scrollLeft));\n display.scroller.scrollLeft = display.scrollbarH.scrollLeft = doc.scrollLeft = left;\n alignHorizontally(cm);\n }\n // If we need to scroll a specific position into view, do so.\n if (op.scrollToPos) {\n var coords = scrollPosIntoView(cm, clipPos(cm.doc, op.scrollToPos.from),\n clipPos(cm.doc, op.scrollToPos.to), op.scrollToPos.margin);\n if (op.scrollToPos.isCursor && cm.state.focused) maybeScrollWindow(cm, coords);\n }\n\n if (op.selectionChanged) restartBlink(cm);\n\n if (cm.state.focused && op.updateInput)\n resetInput(cm, op.typing);\n\n // Fire events for markers that are hidden/unidden by editing or\n // undoing\n var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers;\n if (hidden) for (var i = 0; i < hidden.length; ++i)\n if (!hidden[i].lines.length) signal(hidden[i], \"hide\");\n if (unhidden) for (var i = 0; i < unhidden.length; ++i)\n if (unhidden[i].lines.length) signal(unhidden[i], \"unhide\");\n\n var delayed;\n if (!--delayedCallbackDepth) {\n delayed = delayedCallbacks;\n delayedCallbacks = null;\n }\n // Fire change events, and delayed event handlers\n if (op.changeObjs)\n signal(cm, \"changes\", cm, op.changeObjs);\n if (delayed) for (var i = 0; i < delayed.length; ++i) delayed[i]();\n if (op.cursorActivityHandlers)\n for (var i = 0; i < op.cursorActivityHandlers.length; i++)\n op.cursorActivityHandlers[i](cm);\n }", "function resolveScrollToPos(cm) {\n var range = cm.curOp.scrollToPos;\n if (range) {\n cm.curOp.scrollToPos = null;\n var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to);\n var sPos = calculateScrollPos(cm, Math.min(from.left, to.left),\n Math.min(from.top, to.top) - range.margin,\n Math.max(from.right, to.right),\n Math.max(from.bottom, to.bottom) + range.margin);\n cm.scrollTo(sPos.scrollLeft, sPos.scrollTop);\n }\n }", "function resolveScrollToPos(cm) {\n var range = cm.curOp.scrollToPos;\n if (range) {\n cm.curOp.scrollToPos = null;\n var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to);\n var sPos = calculateScrollPos(cm, Math.min(from.left, to.left),\n Math.min(from.top, to.top) - range.margin,\n Math.max(from.right, to.right),\n Math.max(from.bottom, to.bottom) + range.margin);\n cm.scrollTo(sPos.scrollLeft, sPos.scrollTop);\n }\n }", "function resolveScrollToPos(cm) {\n var range = cm.curOp.scrollToPos;\n if (range) {\n cm.curOp.scrollToPos = null;\n var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to);\n var sPos = calculateScrollPos(cm, Math.min(from.left, to.left),\n Math.min(from.top, to.top) - range.margin,\n Math.max(from.right, to.right),\n Math.max(from.bottom, to.bottom) + range.margin);\n cm.scrollTo(sPos.scrollLeft, sPos.scrollTop);\n }\n }", "function resolveScrollToPos(cm) {\n var range = cm.curOp.scrollToPos;\n if (range) {\n cm.curOp.scrollToPos = null;\n var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to);\n var sPos = calculateScrollPos(cm, Math.min(from.left, to.left),\n Math.min(from.top, to.top) - range.margin,\n Math.max(from.right, to.right),\n Math.max(from.bottom, to.bottom) + range.margin);\n cm.scrollTo(sPos.scrollLeft, sPos.scrollTop);\n }\n }", "function resolveScrollToPos(cm) {\n var range = cm.curOp.scrollToPos;\n if (range) {\n cm.curOp.scrollToPos = null;\n var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to);\n var sPos = calculateScrollPos(cm, Math.min(from.left, to.left),\n Math.min(from.top, to.top) - range.margin,\n Math.max(from.right, to.right),\n Math.max(from.bottom, to.bottom) + range.margin);\n cm.scrollTo(sPos.scrollLeft, sPos.scrollTop);\n }\n }", "function resolveScrollToPos(cm) {\n var range = cm.curOp.scrollToPos;\n if (range) {\n cm.curOp.scrollToPos = null;\n var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to);\n var sPos = calculateScrollPos(cm, Math.min(from.left, to.left),\n Math.min(from.top, to.top) - range.margin,\n Math.max(from.right, to.right),\n Math.max(from.bottom, to.bottom) + range.margin);\n cm.scrollTo(sPos.scrollLeft, sPos.scrollTop);\n }\n }", "function resolveScrollToPos(cm) {\n var range = cm.curOp.scrollToPos;\n if (range) {\n cm.curOp.scrollToPos = null;\n var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to);\n var sPos = calculateScrollPos(cm, Math.min(from.left, to.left),\n Math.min(from.top, to.top) - range.margin,\n Math.max(from.right, to.right),\n Math.max(from.bottom, to.bottom) + range.margin);\n cm.scrollTo(sPos.scrollLeft, sPos.scrollTop);\n }\n }", "function resolveScrollToPos(cm) {\n\t var range = cm.curOp.scrollToPos;\n\t if (range) {\n\t cm.curOp.scrollToPos = null;\n\t var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to);\n\t var sPos = calculateScrollPos(cm, Math.min(from.left, to.left),\n\t Math.min(from.top, to.top) - range.margin,\n\t Math.max(from.right, to.right),\n\t Math.max(from.bottom, to.bottom) + range.margin);\n\t cm.scrollTo(sPos.scrollLeft, sPos.scrollTop);\n\t }\n\t }", "function resolveScrollToPos(cm) {\n\t var range = cm.curOp.scrollToPos;\n\t if (range) {\n\t cm.curOp.scrollToPos = null;\n\t var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to);\n\t var sPos = calculateScrollPos(cm, Math.min(from.left, to.left),\n\t Math.min(from.top, to.top) - range.margin,\n\t Math.max(from.right, to.right),\n\t Math.max(from.bottom, to.bottom) + range.margin);\n\t cm.scrollTo(sPos.scrollLeft, sPos.scrollTop);\n\t }\n\t }", "function resolveScrollToPos(cm) {\n\t var range = cm.curOp.scrollToPos;\n\t if (range) {\n\t cm.curOp.scrollToPos = null;\n\t var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to);\n\t var sPos = calculateScrollPos(cm, Math.min(from.left, to.left),\n\t Math.min(from.top, to.top) - range.margin,\n\t Math.max(from.right, to.right),\n\t Math.max(from.bottom, to.bottom) + range.margin);\n\t cm.scrollTo(sPos.scrollLeft, sPos.scrollTop);\n\t }\n\t }", "function resolveScrollToPos(cm) {\r\n var range = cm.curOp.scrollToPos;\r\n if (range) {\r\n cm.curOp.scrollToPos = null;\r\n var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to);\r\n var sPos = calculateScrollPos(cm, Math.min(from.left, to.left),\r\n Math.min(from.top, to.top) - range.margin,\r\n Math.max(from.right, to.right),\r\n Math.max(from.bottom, to.bottom) + range.margin);\r\n cm.scrollTo(sPos.scrollLeft, sPos.scrollTop);\r\n }\r\n }", "scrollBehavior(to, from, savedPosition) {\n if (savedPosition) {\n return savedPosition\n } if (to.hash) {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve({ selector: to.hash, behavior: 'smooth', offset: { y: 60 } })\n }, 0)\n })\n } else {\n return { x: 0, y: 0 }\n }\n }", "function resolveScrollToPos(cm) {\n var range$$1 = cm.curOp.scrollToPos;\n if (range$$1) {\n cm.curOp.scrollToPos = null;\n var from = estimateCoords(cm, range$$1.from), to = estimateCoords(cm, range$$1.to);\n scrollToCoordsRange(cm, from, to, range$$1.margin);\n }\n}", "function resolveScrollToPos(cm) {\n var range$$1 = cm.curOp.scrollToPos;\n if (range$$1) {\n cm.curOp.scrollToPos = null;\n var from = estimateCoords(cm, range$$1.from), to = estimateCoords(cm, range$$1.to);\n scrollToCoordsRange(cm, from, to, range$$1.margin);\n }\n}", "function resolveScrollToPos(cm) {\n var range$$1 = cm.curOp.scrollToPos;\n if (range$$1) {\n cm.curOp.scrollToPos = null;\n var from = estimateCoords(cm, range$$1.from), to = estimateCoords(cm, range$$1.to);\n scrollToCoordsRange(cm, from, to, range$$1.margin);\n }\n}", "function resolveScrollToPos(cm) {\n var range$$1 = cm.curOp.scrollToPos;\n if (range$$1) {\n cm.curOp.scrollToPos = null;\n var from = estimateCoords(cm, range$$1.from), to = estimateCoords(cm, range$$1.to);\n scrollToCoordsRange(cm, from, to, range$$1.margin);\n }\n}", "function resolveScrollToPos(cm) {\n var range$$1 = cm.curOp.scrollToPos;\n if (range$$1) {\n cm.curOp.scrollToPos = null;\n var from = estimateCoords(cm, range$$1.from), to = estimateCoords(cm, range$$1.to);\n scrollToCoordsRange(cm, from, to, range$$1.margin);\n }\n}", "function resolveScrollToPos(cm) {\n var range$$1 = cm.curOp.scrollToPos;\n if (range$$1) {\n cm.curOp.scrollToPos = null;\n var from = estimateCoords(cm, range$$1.from), to = estimateCoords(cm, range$$1.to);\n scrollToCoordsRange(cm, from, to, range$$1.margin);\n }\n}", "function resolveScrollToPos(cm) {\n var range$$1 = cm.curOp.scrollToPos;\n if (range$$1) {\n cm.curOp.scrollToPos = null;\n var from = estimateCoords(cm, range$$1.from), to = estimateCoords(cm, range$$1.to);\n scrollToCoordsRange(cm, from, to, range$$1.margin);\n }\n}", "function resolveScrollToPos(cm) {\n var range$$1 = cm.curOp.scrollToPos;\n if (range$$1) {\n cm.curOp.scrollToPos = null;\n var from = estimateCoords(cm, range$$1.from), to = estimateCoords(cm, range$$1.to);\n scrollToCoordsRange(cm, from, to, range$$1.margin);\n }\n}", "function resolveScrollToPos(cm) {\n var range$$1 = cm.curOp.scrollToPos;\n if (range$$1) {\n cm.curOp.scrollToPos = null;\n var from = estimateCoords(cm, range$$1.from), to = estimateCoords(cm, range$$1.to);\n scrollToCoordsRange(cm, from, to, range$$1.margin);\n }\n}", "function resolveScrollToPos(cm) {\n var range$$1 = cm.curOp.scrollToPos;\n if (range$$1) {\n cm.curOp.scrollToPos = null;\n var from = estimateCoords(cm, range$$1.from), to = estimateCoords(cm, range$$1.to);\n scrollToCoordsRange(cm, from, to, range$$1.margin);\n }\n}", "function resolveScrollToPos(cm) {\n var range$$1 = cm.curOp.scrollToPos;\n if (range$$1) {\n cm.curOp.scrollToPos = null;\n var from = estimateCoords(cm, range$$1.from), to = estimateCoords(cm, range$$1.to);\n scrollToCoordsRange(cm, from, to, range$$1.margin);\n }\n}", "scrollBehavior (to, from, savedPosition) {\n\t\treturn { x: 0, y: 0 }\n\t}", "function updateScroll () {\n if (!elements.li[0]) return;\n if (mode === MODE_STANDARD) {\n updateStandardScroll();\n } else {\n updateVirtualScroll();\n }\n }", "get scrolledIntoView() {\n return (this.updated & UPDATED_SCROLL) > 0;\n }", "updateScroll() {\n\t\t\tthis.scrollPosition = window.scrollY;\n\t\t}", "function resolveScrollToPos(cm) {\n var range = cm.curOp.scrollToPos\n if (range) {\n cm.curOp.scrollToPos = null\n var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to)\n var sPos = calculateScrollPos(cm, Math.min(from.left, to.left),\n Math.min(from.top, to.top) - range.margin,\n Math.max(from.right, to.right),\n Math.max(from.bottom, to.bottom) + range.margin)\n cm.scrollTo(sPos.scrollLeft, sPos.scrollTop)\n }\n}", "scrollBehavior(to, from, savedPosition) {\n if (to.hash) {\n return { selector: to.hash };\n } else if (savedPosition) {\n return savedPosition;\n } else {\n return { x: 0, y: 0 };\n }\n }", "setRenderedContentOffset(offset, to = 'to-start') {\n // For a horizontal viewport in a right-to-left language we need to translate along the x-axis\n // in the negative direction.\n const isRtl = this.dir && this.dir.value == 'rtl';\n const isHorizontal = this.orientation == 'horizontal';\n const axis = isHorizontal ? 'X' : 'Y';\n const axisDirection = isHorizontal && isRtl ? -1 : 1;\n let transform = `translate${axis}(${Number(axisDirection * offset)}px)`; // in appendOnly, we always start from the top\n\n offset = this.appendOnly && to === 'to-start' ? 0 : offset;\n this._renderedContentOffset = offset;\n\n if (to === 'to-end') {\n transform += ` translate${axis}(-100%)`; // The viewport should rewrite this as a `to-start` offset on the next render cycle. Otherwise\n // elements will appear to expand in the wrong direction (e.g. `mat-expansion-panel` would\n // expand upward).\n\n this._renderedContentOffsetNeedsRewrite = true;\n }\n\n if (this._renderedContentTransform != transform) {\n // We know this value is safe because we parse `offset` with `Number()` before passing it\n // into the string.\n this._renderedContentTransform = transform;\n\n this._markChangeDetectionNeeded(() => {\n if (this._renderedContentOffsetNeedsRewrite) {\n this._renderedContentOffset -= this.measureRenderedContentSize();\n this._renderedContentOffsetNeedsRewrite = false;\n this.setRenderedContentOffset(this._renderedContentOffset);\n } else {\n this._scrollStrategy.onRenderedOffsetChanged();\n }\n });\n }\n }", "function addToScrollPos(cm, left, top) {\n\t if (left != null || top != null) resolveScrollToPos(cm);\n\t if (left != null)\n\t cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left;\n\t if (top != null)\n\t cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;\n\t }", "function addToScrollPos(cm, left, top) {\n\t if (left != null || top != null) resolveScrollToPos(cm);\n\t if (left != null)\n\t cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left;\n\t if (top != null)\n\t cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;\n\t }", "function addToScrollPos(cm, left, top) {\n\t if (left != null || top != null) resolveScrollToPos(cm);\n\t if (left != null)\n\t cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left;\n\t if (top != null)\n\t cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;\n\t }", "function addToScrollPos(cm, left, top) {\n\t\t if (left != null || top != null) resolveScrollToPos(cm);\n\t\t if (left != null)\n\t\t cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left;\n\t\t if (top != null)\n\t\t cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;\n\t\t }", "function Wa(e,t){null!=t&&(Qa(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}", "scrollToPos(scrollTop) {\n if (this.scrollTimeout) {\n clearTimeout(this.scrollTimeout);\n this.scrollTimeout = null;\n }\n if (scrollTop < 0) {\n return;\n }\n const delay = 10;\n const helper = (duration = 0) => {\n this.scrollTimeout = setTimeout(() => {\n if (duration <= 0) {\n this.previewScrollDelay = Date.now() + 500;\n this.previewElement.scrollTop = scrollTop;\n return;\n }\n const difference = scrollTop - this.previewElement.scrollTop;\n const perTick = (difference / duration) * delay;\n // disable preview onscroll\n this.previewScrollDelay = Date.now() + 500;\n this.previewElement.scrollTop += perTick;\n if (this.previewElement.scrollTop === scrollTop) {\n return;\n }\n helper(duration - delay);\n }, delay);\n };\n const scrollDuration = 120;\n helper(scrollDuration);\n }", "function resolveScrollToPos(cm) {\n var range = cm.curOp.scrollToPos\n if (range) {\n cm.curOp.scrollToPos = null\n var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to)\n var sPos = calculateScrollPos(cm, {\n left: Math.min(from.left, to.left),\n top: Math.min(from.top, to.top) - range.margin,\n right: Math.max(from.right, to.right),\n bottom: Math.max(from.bottom, to.bottom) + range.margin\n })\n cm.scrollTo(sPos.scrollLeft, sPos.scrollTop)\n }\n}", "function scrollStart() {\n // Hide context menu if showing\n component.hideContextMenu();\n // Bind clickout scroll\n //component.layers[\"clickout\"].on(\"scroll\", onChangeLayout);\n }", "function CameraCommand_Scroll_ProcessScrollables()\n{\n\t//assume done\n\tthis.State = __CAMERA_CMD_STATE_FINISHED;\n\t//reset scrollables\n\tthis.ScrollTarget = this.TargetHTML;\n\tthis.ScrollArea = new Position_Rect(this.TargetArea.left, this.TargetArea.top, this.TargetArea.width, this.TargetArea.height);\n\tthis.ScrollDirection = __CAMERA_CMD_SCROLL_NOSCROLL;\n\tthis.ScrollValue = 0;\n\t//setup new scrollcommand\n\tvar listOfScrollCmds = [];\n\t//loop through scrollables\n\tfor (var i = 0, c = this.Scrollables.length; i < c; i++)\n\t{\n\t\t//transform the area to scrollable\n\t\tvar newArea = this.TransformToParent(this.Scrollables[i]);\n\t\t//check if we need to scroll\n\t\tthis.NeedsToScrollParent(this.Scrollables[i], newArea, listOfScrollCmds);\n\t}\n\t//has scroll direction?\n\tif (this.ScrollDirection != __CAMERA_CMD_SCROLL_NOSCROLL)\n\t{\n\t\t///\n\t\t//we might be stuck on an infinite loop\n\t\t///\n\t\t//check scroll attemps\n\t\tif (this.ScrollAttempts++ > __CAMERA_CMD_SCROLL_MAX_ATTEMPTS)\n\t\t{\n\t\t\t//we have failed, we cannot scroll properly. report\n\t\t\tCommon_Log(\"Camera Cmd Scroll: Failed to scroll, max attempts reached\");\n\t\t\ttry\n\t\t\t{\n\t\t\t\t//attempt to scroll into view\n\t\t\t\tthis.TargetHTML.scrollIntoView();\n\t\t\t}\n\t\t\tcatch (error)\n\t\t\t{\n\t\t\t\t//ignore this\n\t\t\t}\n\t\t\t//now we are finished\n\t\t\tthis.State = __CAMERA_CMD_STATE_FINISHED;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t//check last command? do we have at least 2 commands?\n\t\t\tif (this.LastScrollCmd.length > 1)\n\t\t\t{\n\t\t\t\t//get the last command\n\t\t\t\tvar lastCommand = this.LastScrollCmd.pop();\n\t\t\t\t//compare the current command with the last command\n\t\t\t\tif (lastCommand.ScrollTargetId == this.ScrollTarget.id)\n\t\t\t\t{\n\t\t\t\t\t//we are scrolling the same object? are we reversing the scroll?\n\t\t\t\t\tswitch (lastCommand.ScrollDirection + this.ScrollDirection)\n\t\t\t\t\t{\n\t\t\t\t\t\tcase 3: //UP == 1 + DOWN == 2 -> 3\n\t\t\t\t\t\tcase 7: //LEFT == 3 + RIGHT == 4 -> 7\n\t\t\t\t\t\t\t///\n\t\t\t\t\t\t\t//command is being reversed, cancel it\n\t\t\t\t\t\t\t///\n\t\t\t\t\t\t\t//retrieve the one before this one\n\t\t\t\t\t\t\tvar newCmd = this.LastScrollCmd[this.LastScrollCmd.length - 1];\n\t\t\t\t\t\t\t//reset data\n\t\t\t\t\t\t\tthis.ScrollTarget = newCmd.ScrollTarget;\n\t\t\t\t\t\t\tthis.ScrollValue = newCmd.ScrollValue;\n\t\t\t\t\t\t\tthis.ScrollDirection = newCmd.ScrollDirection;\n\t\t\t\t\t\t\tthis.ScrollArea = newCmd.ScrollArea;\n\t\t\t\t\t\t\t//now correct the scroll target area\n\t\t\t\t\t\t\tthis.CorrectScrollTargetArea(this.ScrollDirection, newCmd.Parent);\n\t\t\t\t\t\t\t//update list of scroll cmds\n\t\t\t\t\t\t\tlistOfScrollCmds = this.LastScrollCmd;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t//update the last command\n\t\t\tthis.LastScrollCmd = listOfScrollCmds;\n\t\t\t//has camera?\n\t\t\tif (this.Camera)\n\t\t\t{\n\t\t\t\t//show the camera\n\t\t\t\tthis.Camera.CameraUI.Show(true);\n\t\t\t}\n\t\t\t//move to target\n\t\t\tthis.State = __CAMERA_CMD_STATE_MOVING;\n\t\t}\n\t}\n}", "scrollIntoView() {\n this.updated |= UPDATED_SCROLL;\n return this;\n }", "scrollBehavior(_, _2, savedPosition) {\n if (savedPosition) {\n return savedPosition;\n }\n return { top: 0, left: 0 };\n }", "enable() {\n if (this._scrollSubscription) {\n return;\n }\n const stream = this._scrollDispatcher.scrolled(0);\n if (this._config && this._config.threshold && this._config.threshold > 1) {\n this._initialScrollPosition = this._viewportRuler.getViewportScrollPosition().top;\n this._scrollSubscription = stream.subscribe(() => {\n const scrollPosition = this._viewportRuler.getViewportScrollPosition().top;\n if (Math.abs(scrollPosition - this._initialScrollPosition) > this._config.threshold) {\n this._detach();\n }\n else {\n this._overlayRef.updatePosition();\n }\n });\n }\n else {\n this._scrollSubscription = stream.subscribe(this._detach);\n }\n }", "_scroll(scrollCoefficient) {\n const that = this;\n\n that.$.scrollViewer.scrollTop = that.$.scrollViewer.scrollTop + scrollCoefficient * 10;\n that._updateScrollButtonVisibility();\n that.focus();\n }", "function updateScroll(event) {\n moveElements();\n}", "function step () {\n // Check for scroll interference before continuing animation\n if (lastX === container.scrollLeft && lastY === container.scrollTop) {\n const elapsed = Date.now() - startTime\n lastX = container.scrollLeft = position(startX, targetX, elapsed, duration)\n lastY = container.scrollTop = position(startY, targetY, elapsed, duration)\n if (elapsed > duration && typeof options.onArrive === 'function') options.onArrive()\n else window.requestAnimationFrame(step)\n } else {\n typeof options.onInterrupt === 'function' && options.onInterrupt()\n }\n }", "function _calcScrollOffset(normalize, refreshParticle) {\n\t\n\t // When moving using touch-gestures, make the offset stick to the\n\t // finger. When the bounds is exceeded, decrease the scroll distance\n\t // by two.\n\t if (refreshParticle || (this._scroll.particleValue === undefined)) {\n\t this._scroll.particleValue = this._scroll.particle.getPosition1D();\n\t this._scroll.particleValue = Math.round(this._scroll.particleValue * 1000) / 1000;\n\t }\n\t\n\t // do stuff\n\t var scrollOffset = this._scroll.particleValue;\n\t if (this._scroll.scrollDelta || this._scroll.normalizedScrollDelta) {\n\t scrollOffset += this._scroll.scrollDelta + this._scroll.normalizedScrollDelta;\n\t if (((this._scroll.boundsReached & Bounds.PREV) && (scrollOffset > this._scroll.springPosition)) ||\n\t ((this._scroll.boundsReached & Bounds.NEXT) && (scrollOffset < this._scroll.springPosition)) ||\n\t (this._scroll.boundsReached === Bounds.BOTH)) {\n\t scrollOffset = this._scroll.springPosition;\n\t }\n\t if (normalize) {\n\t if (!this._scroll.scrollDelta) {\n\t this._scroll.normalizedScrollDelta = 0;\n\t _setParticle.call(this, scrollOffset, undefined, '_calcScrollOffset');\n\t }\n\t this._scroll.normalizedScrollDelta += this._scroll.scrollDelta;\n\t this._scroll.scrollDelta = 0;\n\t }\n\t }\n\t\n\t if (this._scroll.scrollForceCount && this._scroll.scrollForce) {\n\t if (this._scroll.springPosition !== undefined) {\n\t scrollOffset = (scrollOffset + this._scroll.scrollForce + this._scroll.springPosition) / 2.0;\n\t }\n\t else {\n\t scrollOffset += this._scroll.scrollForce;\n\t }\n\t }\n\t\n\t // Prevent the scroll position from exceeding the bounds when overscroll is disabled\n\t if (!this.options.overscroll) {\n\t if ((this._scroll.boundsReached === Bounds.BOTH) ||\n\t ((this._scroll.boundsReached === Bounds.PREV) && (scrollOffset > this._scroll.springPosition)) ||\n\t ((this._scroll.boundsReached === Bounds.NEXT) && (scrollOffset < this._scroll.springPosition))) {\n\t scrollOffset = this._scroll.springPosition;\n\t }\n\t }\n\t\n\t //_log.call(this, 'scrollOffset: ', scrollOffset, ', particle:', this._scroll.particle.getPosition1D(), ', moveToPosition: ', this._scroll.moveToPosition, ', springPosition: ', this._scroll.springPosition);\n\t return scrollOffset;\n\t }", "_scrollSpy() {\n const currentScrollPosition = scrollPosition();\n if (currentScrollPosition.top > this.props.scrollStart) {\n if (!this.state.isVisible) {\n this.setState({ isVisible: true });\n }\n } else {\n if (this.state.isVisible) {\n this.setState({ isVisible: false });\n }\n }\n }", "function addToScrollPos(cm, left, top) {\n if (left != null || top != null) resolveScrollToPos(cm);\n if (left != null)\n cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left;\n if (top != null)\n cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;\n }", "function addToScrollPos(cm, left, top) {\n if (left != null || top != null) resolveScrollToPos(cm);\n if (left != null)\n cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left;\n if (top != null)\n cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;\n }", "function addToScrollPos(cm, left, top) {\n if (left != null || top != null) resolveScrollToPos(cm);\n if (left != null)\n cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left;\n if (top != null)\n cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;\n }", "function addToScrollPos(cm, left, top) {\n if (left != null || top != null) resolveScrollToPos(cm);\n if (left != null)\n cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left;\n if (top != null)\n cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;\n }", "function addToScrollPos(cm, left, top) {\n if (left != null || top != null) resolveScrollToPos(cm);\n if (left != null)\n cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left;\n if (top != null)\n cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;\n }" ]
[ "0.6445942", "0.64281124", "0.6380104", "0.6374943", "0.63135195", "0.63110936", "0.6300032", "0.6285562", "0.62773645", "0.62624735", "0.6240491", "0.6235333", "0.6234318", "0.6229291", "0.6197611", "0.61976075", "0.6192568", "0.6169131", "0.6149815", "0.61469245", "0.61469245", "0.61469245", "0.61469245", "0.61469245", "0.61469245", "0.61469245", "0.61469245", "0.61469245", "0.614586", "0.61250126", "0.6123582", "0.6119269", "0.61023027", "0.61022145", "0.60975826", "0.6088769", "0.607365", "0.6032978", "0.60316324", "0.6030559", "0.6028313", "0.60266405", "0.60266405", "0.60266405", "0.60266405", "0.60266405", "0.60266405", "0.60266405", "0.60236", "0.60236", "0.60236", "0.6014024", "0.6008626", "0.59956735", "0.59956735", "0.59956735", "0.59956735", "0.59956735", "0.59956735", "0.59956735", "0.59956735", "0.59956735", "0.59956735", "0.59956735", "0.5988781", "0.5978341", "0.596701", "0.5946013", "0.5927943", "0.5909703", "0.5906044", "0.5900569", "0.5900569", "0.5900569", "0.58909094", "0.58769524", "0.5875175", "0.58619004", "0.58473706", "0.5846885", "0.58432686", "0.58254206", "0.5820517", "0.58185494", "0.5800937", "0.58006227", "0.5798415", "0.57980245", "0.579713", "0.579713", "0.579713", "0.579713", "0.579713" ]
0.61753
23
Sync the scrollable area and scrollbars, ensure the viewport covers the visible area.
function updateScrollTop(cm, val) { if (Math.abs(cm.doc.scrollTop - val) < 2) { return } if (!gecko) { updateDisplaySimple(cm, {top: val}); } setScrollTop(cm, val, true); if (gecko) { updateDisplaySimple(cm); } startWorker(cm, 100); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_setScrollBars() {\r\n const that = this;\r\n\r\n if (!that._scrollView) {\r\n that._scrollView = new LW.Utilities.Scroll(that.$.timeline, that.$.horizontalScrollBar, that.$.verticalScrollBar);\r\n }\r\n\r\n const vScrollBar = that._scrollView.vScrollBar,\r\n hScrollBar = that._scrollView.hScrollBar;\r\n\r\n hScrollBar.$.addClass('lw-hidden');\r\n vScrollBar.$.addClass('lw-hidden');\r\n\r\n //Cancel Style/Resize observers of the ScrollBars\r\n vScrollBar.hasStyleObserver = false;\r\n hScrollBar.hasStyleObserver = false;\r\n vScrollBar.hasResizeObserver = false;\r\n hScrollBar.hasResizeObserver = false;\r\n\r\n hScrollBar.wait = false;\r\n vScrollBar.wait = false;\r\n\r\n //Refreshes the ScrollBars\r\n that._refresh();\r\n }", "_ensureVisible(scrollTarget) {\n const that = this;\n\n if (that._minimized) {\n return;\n }\n\n const mode = that.mode;\n let parent, scrollButtons;\n\n if (mode !== 'tree' && scrollTarget.parentElement !== that.$.mainContainer) {\n if (scrollTarget.dropDownHeight === null) {\n return;\n }\n\n parent = scrollTarget.parentElement;\n scrollButtons = [parent.container.children[0], parent.container.children[2]];\n }\n else {\n parent = that.$.mainContainer;\n scrollButtons = [that.$.scrollButtonNear, that.$.scrollButtonFar];\n }\n\n if (parent === that.$.mainContainer &&\n (that.dropDownAppendTo === null && that.mode !== 'tree' && !that.$mainContainer.hasClass('simple') ||\n !parent.$.hasClass('scroll-buttons-shown') && that.overflow !== 'hidden')) {\n return;\n }\n\n const parentBoundingRect = parent.getBoundingClientRect(),\n scrollTargetBoundingRect = scrollTarget.getBoundingClientRect();\n\n if (mode === 'tree') {\n that._ensureVisibleTreeMode(scrollTarget, scrollTargetBoundingRect, parent, parentBoundingRect, 0);\n return;\n }\n\n function setTargetScrollValue(scrollValue, scrollDimension, dimension) {\n let targetScrollValue = scrollTarget.firstElementChild[dimension] + scrollValue - parent[dimension];\n\n if (targetScrollValue < 0) {\n targetScrollValue = scrollValue;\n }\n\n parent['scroll' + scrollDimension] = targetScrollValue;\n }\n\n function scrollTo(scrollDimension, dimension) {\n let scrollValue = scrollTarget['offset' + scrollDimension],\n oldParentDimension = parent[dimension];\n\n if (scrollDimension === 'Top' && parent !== that.$.mainContainer && !scrollButtons[0].$.hasClass('jqx-hidden')) {\n scrollValue -= scrollButtons[0][dimension];\n }\n\n setTargetScrollValue(scrollValue, scrollDimension, dimension);\n that._updateScrollButtonVisibility(parent, scrollDimension === 'Left', scrollButtons);\n\n if (oldParentDimension !== parent[dimension]) {\n setTargetScrollValue(scrollValue, scrollDimension, dimension);\n }\n }\n\n if ((parent === that.$.mainContainer && mode === 'horizontal') &&\n (parentBoundingRect.left > scrollTargetBoundingRect.left || parentBoundingRect.right < scrollTargetBoundingRect.right)) {\n scrollTo('Left', 'offsetWidth');\n }\n else if (parentBoundingRect.top > scrollTargetBoundingRect.top || parentBoundingRect.bottom < scrollTargetBoundingRect.bottom) {\n scrollTo('Top', 'offsetHeight');\n }\n }", "updateScrollableContents() {\n if (this.intervalId_ !== null) {\n return;\n } // notifyResize is already in progress.\n\n this.requestUpdateScroll();\n\n const nodeList = this.shadowRoot.querySelectorAll('[scrollable] iron-list');\n if (!nodeList.length) {\n return;\n }\n\n let nodesToResize = Array.from(nodeList).map(node => ({\n node: node,\n lastScrollHeight: 0,\n }));\n // Use setInterval to avoid initial render / sizing issues.\n this.intervalId_ = window.setInterval(() => {\n const checkAgain = [];\n nodesToResize.forEach(({node, lastScrollHeight}) => {\n const scrollHeight = node.parentNode.scrollHeight;\n // A hidden scroll-container has a height of 0. When not hidden, it has\n // a min-height of 1px and the iron-list needs a resize to show the\n // initial items and update the |scrollHeight|. The initial item count\n // is determined by the |scrollHeight|. A scrollHeight of 1px will\n // result in the minimum default item count (currently 3). After the\n // |scrollHeight| is updated to be greater than 1px, another resize is\n // needed to correctly calculate the number of physical iron-list items\n // to render.\n if (scrollHeight !== lastScrollHeight) {\n const ironList = /** @type {!IronListElement} */ (node);\n ironList.notifyResize();\n }\n\n // TODO(crbug.com/1121679): Add UI Test for this behavior.\n if (scrollHeight <= 1 &&\n window.getComputedStyle(node.parentNode).display !== 'none') {\n checkAgain.push({\n node: node,\n lastScrollHeight: scrollHeight,\n });\n }\n });\n if (checkAgain.length === 0) {\n window.clearInterval(this.intervalId_);\n this.intervalId_ = null;\n } else {\n nodesToResize = checkAgain;\n }\n }, 10);\n }", "_handleScrollbarsDisplay(event) {\n const that = this,\n textBox = that.$.input;\n\n setTimeout(function () {\n switch (that.horizontalScrollBarVisibility) {\n case 'disabled':\n that.$container.addClass('hscroll');\n that.$.horizontalScrollBar.disabled = true;\n break;\n case 'hidden':\n that.$container.removeClass('hscroll');\n break;\n case 'visible':\n that.$container.addClass('hscroll');\n that._scrollView.scrollWidth = textBox.scrollWidth - textBox.clientWidth;\n that._scrollView.scrollTo(that.$.input.scrollLeft, true);\n that.$.horizontalScrollBar.disabled = false;\n break;\n default:\n if (textBox.scrollWidth > textBox.clientWidth) {\n that.$container.addClass('hscroll');\n\n that._scrollView.scrollWidth = textBox.scrollWidth - textBox.clientWidth;\n\n if (event && event.type === 'resize') {\n that.$.input.scrollLeft = that._scrollView.scrollLeft;\n }\n else {\n that._scrollView.scrollTo(that.$.input.scrollLeft, true);\n }\n }\n else {\n that.$container.removeClass('hscroll');\n }\n that.$.horizontalScrollBar.disabled = false;\n }\n\n switch (that.verticalScrollBarVisibility) {\n case 'disabled':\n that.$container.addClass('vscroll');\n that.$.verticalScrollBar.disabled = true;\n break;\n case 'hidden':\n that.$container.removeClass('vscroll');\n break;\n case 'visible':\n that.$container.addClass('vscroll');\n that._scrollView.scrollHeight = textBox.scrollHeight - textBox.clientHeight;\n that._scrollView.scrollTo(that.$.input.scrollTop);\n that.$.verticalScrollBar.disabled = false;\n break;\n default:\n if (textBox.scrollHeight > textBox.clientHeight) {\n that.$container.addClass('vscroll');\n\n that._scrollView.scrollHeight = textBox.scrollHeight - textBox.clientHeight;\n\n if (event && event.type === 'resize') {\n that.$.input.scrollTop = that._scrollView.scrollTop;\n }\n else {\n that._scrollView.scrollTo(that.$.input.scrollTop);\n }\n }\n else {\n that.$container.removeClass('vscroll');\n }\n that.$.verticalScrollBar.disabled = false;\n }\n }, 0);\n\n }", "_refreshVerticalScrollBarVisibility(scrollHeight) {\n const that = this;\n\n if (that._autoHeight) {\n that.scrollTop = 0;\n that.scrollHeight = 0;\n return;\n }\n\n if (that.computedHorizontalScrollBarVisibility) {\n scrollHeight += that.$.horizontalScrollBar.offsetHeight;\n }\n\n that.scrollHeight = scrollHeight;\n\n if (that.paging.enabled && that.paging.spinner.visible) {\n that.$.verticalScrollBarVisibility.classList.remove('smart-hidden');\n }\n\n if (!that.computedVerticalScrollBarVisibility) {\n that.scrollTop = 0;\n }\n }", "_syncScrollbar(dimension, value) {\n const that = this;\n let max, scrollbar;\n\n if (dimension === 0 && that._oneDimensionSpecialCase === false) {\n if (!that.showHorizontalScrollbar) {\n return;\n }\n\n max = that._getMaxValuesOfScrollBars('horizontal');\n scrollbar = that.$.horizontalScrollbar;\n }\n else {\n if (!that.showVerticalScrollbar) {\n return;\n }\n\n max = that._getMaxValuesOfScrollBars('vertical');\n scrollbar = that.$.verticalScrollbar;\n }\n\n if (value > max) {\n max = value;\n }\n\n const currentMax = scrollbar.max;\n\n if (currentMax !== max) {\n if (currentMax > max) {\n that._suppressScrollbarEvent = true;\n }\n\n scrollbar.max = max;\n }\n\n if (scrollbar.value !== value) {\n that._suppressScrollbarEvent = true;\n scrollbar.value = value;\n }\n }", "function syncVisualPanelScroll() {\n const visualPanelEl = document.querySelector('.visual-panel');\n const currentScroll = visualPanelEl.scrollTop;\n const targetScroll = calcScrollPosition();\n const difference = targetScroll - visualPanelEl.scrollTop;\n const step = difference * 0.67;\n\n const t = currentScroll + step;\n visualPanelEl.scrollTo({\n top: t\n });\n window.requestAnimationFrame(syncVisualPanelScroll);\n}", "function updateScrollbars(d /* display */, docHeight) {\n var totalHeight = docHeight + 2 * paddingTop(d);\n d.sizer.style.minHeight = d.heightForcer.style.top = totalHeight + \"px\";\n var scrollHeight = Math.max(totalHeight, d.scroller.scrollHeight);\n var needsH = d.scroller.scrollWidth > d.scroller.clientWidth;\n var needsV = scrollHeight > d.scroller.clientHeight;\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarV.firstChild.style.height = \n (scrollHeight - d.scroller.clientHeight + d.scrollbarV.clientHeight) + \"px\";\n } else d.scrollbarV.style.display = \"\";\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (d.scroller.scrollWidth - d.scroller.clientWidth + d.scrollbarH.clientWidth) + \"px\";\n } else d.scrollbarH.style.display = \"\";\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = scrollbarWidth(d.measure) + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n\n if (mac_geLion && scrollbarWidth(d.measure) === 0)\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = mac_geMountainLion ? \"18px\" : \"12px\";\n }", "function updateScrollbars(d /* display */, docHeight) {\n var totalHeight = docHeight + 2 * paddingTop(d);\n d.sizer.style.minHeight = d.heightForcer.style.top = totalHeight + \"px\";\n var scrollHeight = Math.max(totalHeight, d.scroller.scrollHeight);\n var needsH = d.scroller.scrollWidth > d.scroller.clientWidth;\n var needsV = scrollHeight > d.scroller.clientHeight;\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarV.firstChild.style.height = \n (scrollHeight - d.scroller.clientHeight + d.scrollbarV.clientHeight) + \"px\";\n } else d.scrollbarV.style.display = \"\";\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (d.scroller.scrollWidth - d.scroller.clientWidth + d.scrollbarH.clientWidth) + \"px\";\n } else d.scrollbarH.style.display = \"\";\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = scrollbarWidth(d.measure) + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n\n if (mac_geLion && scrollbarWidth(d.measure) === 0)\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = mac_geMountainLion ? \"18px\" : \"12px\";\n }", "function updateScrollbars(d /* display */, docHeight) {\n var totalHeight = docHeight + 2 * paddingTop(d);\n d.sizer.style.minHeight = d.heightForcer.style.top = totalHeight + \"px\";\n var scrollHeight = Math.max(totalHeight, d.scroller.scrollHeight);\n var needsH = d.scroller.scrollWidth > d.scroller.clientWidth;\n var needsV = scrollHeight > d.scroller.clientHeight;\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarV.firstChild.style.height = \n (scrollHeight - d.scroller.clientHeight + d.scrollbarV.clientHeight) + \"px\";\n } else d.scrollbarV.style.display = \"\";\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (d.scroller.scrollWidth - d.scroller.clientWidth + d.scrollbarH.clientWidth) + \"px\";\n } else d.scrollbarH.style.display = \"\";\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = scrollbarWidth(d.measure) + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n\n if (mac_geLion && scrollbarWidth(d.measure) === 0)\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = mac_geMountainLion ? \"18px\" : \"12px\";\n }", "function ensureVisible()\r\n{\r\n var selectedTop = selected.position().top;\r\n var selectedBottom = selectedTop + selected.outerHeight();\r\n\r\n var $wnd = $(wnd);\r\n var wndTop = $wnd.scrollTop();\r\n var wndBottom = wndTop + $wnd.height();\r\n\r\n if(selectedBottom > wndBottom)\r\n {\r\n $wnd.scrollTop(wndTop + (selectedBottom-wndBottom));\r\n }\r\n else if(selectedTop < wndTop)\r\n {\r\n $wnd.scrollTop(selectedTop);\r\n }\r\n}", "updateScroll(){\n \t\tif (this.$.content.scrollHeight > this.$.content.offsetHeight){\n \t\t\tthis.$.content.scrollTop = this.$.content.scrollHeight - this.$.content.offsetHeight;\n \t\t}\n \t}", "_refreshVerticalScrollBarVisibility(scrollHeight) {\n const that = this;\n\n if (that._autoHeight) {\n that.scrollTop = 0;\n that.scrollHeight = 0;\n return;\n }\n\n if (that.computedHorizontalScrollBarVisibility) {\n scrollHeight += that.$.horizontalScrollBar.offsetHeight;\n }\n\n that.scrollHeight = scrollHeight;\n\n if (that.paging.enabled && that.paging.spinner.visible) {\n that.$.verticalScrollBarVisibility.classList.remove('jqx-hidden');\n }\n\n if (!that.computedVerticalScrollBarVisibility) {\n that.scrollTop = 0;\n }\n }", "syncScrollArea(immediate = false) {\n // If buffer height changed\n if (this._lastRecordedBufferLength !== this._bufferService.buffer.lines.length) {\n this._lastRecordedBufferLength = this._bufferService.buffer.lines.length;\n this._refresh(immediate);\n return;\n }\n // If viewport height changed\n if (this._lastRecordedViewportHeight !== this._renderService.dimensions.canvasHeight) {\n this._refresh(immediate);\n return;\n }\n // If the buffer position doesn't match last scroll top\n const newScrollTop = this._bufferService.buffer.ydisp * this._currentRowHeight;\n if (this._lastScrollTop !== newScrollTop) {\n this._refresh(immediate);\n return;\n }\n // If element's scroll top changed, this can happen when hiding the element\n if (this._lastScrollTop !== this._viewportElement.scrollTop) {\n this._refresh(immediate);\n return;\n }\n // If row height changed\n if (this._renderService.dimensions.scaledCellHeight / window.devicePixelRatio !== this._currentRowHeight) {\n this._refresh(immediate);\n return;\n }\n }", "_refreshLayout() {\n const that = this;\n const source = that._items;\n\n that.__scrollHeight = null;\n that.__scrollWidth = null;\n that._height = null;\n\n if (!that._scrollView) {\n that._scrollView = new JQX.Utilities.Scroll(that, that.$.horizontalScrollBar, that.$.verticalScrollBar);\n }\n\n that.$itemsContainer.removeClass('hscroll');\n that.$itemsContainer.removeClass('vscroll');\n\n if (!source || source === null || source.length === 0) {\n that.scrollWidth = 0;\n that.scrollHeight = 0;\n that.$filterInputContainer.removeClass('vscroll');\n that.$placeholder.removeClass('jqx-hidden');\n\n if (that.isVirtualized) {\n that._recycle();\n }\n\n return;\n }\n\n that.$placeholder.addClass('jqx-hidden');\n\n const horizontalOffset = 2 * (parseInt(getComputedStyle(that.$.itemsInnerContainer).getPropertyValue('--jqx-list-item-horizontal-offset')) || 0);\n\n let hScrollWidth = that._scrollWidth - that.$.itemsContainer.offsetWidth - horizontalOffset;\n let vScrollHeight = that._scrollHeight;\n\n that._refreshHorizontalScrollBarVisibility(hScrollWidth);\n that._refreshVerticalScrollBarVisibility(vScrollHeight);\n\n\n if (that.horizontalScrollBarVisibility === 'hidden') {\n that.$.itemsInnerContainer.style.width = that.$.itemsContainer.offsetWidth - horizontalOffset;\n }\n else {\n that.$.itemsInnerContainer.style.width = Math.max(that.$.itemsContainer.offsetWidth - horizontalOffset, -horizontalOffset + that.__scrollWidth) + 'px';\n }\n\n if (that.computedVerticalScrollBarVisibility) {\n hScrollWidth = that._scrollWidth - that.$.itemsContainer.offsetWidth - that._scrollView.vScrollBar.offsetWidth;\n that._refreshHorizontalScrollBarVisibility(hScrollWidth);\n\n if (that.horizontalScrollBarVisibility !== 'hidden') {\n that.$.itemsInnerContainer.style.width = Math.max(that.$.itemsContainer.offsetWidth - horizontalOffset, -horizontalOffset + that.__scrollWidth - that._scrollView.vScrollBar.offsetWidth) + 'px';\n }\n\n if (that.computedHorizontalScrollBarVisibility) {\n if (!(that.horizontalScrollBarVisibility === 'visible' && that.scrollWidth === 0)) {\n that.__scrollHeight += that._scrollView.hScrollBar.offsetHeight;\n }\n else if (that.horizontalScrollBarVisibility === 'visible') {\n that.__scrollHeight += that._scrollView.hScrollBar.offsetHeight;\n }\n\n that.scrollHeight = that.__scrollHeight;\n }\n\n if (that.isVirtualized) {\n that._recycle();\n }\n\n return;\n }\n\n hScrollWidth = that._scrollWidth - that.$.itemsContainer.offsetWidth - horizontalOffset;\n that._refreshHorizontalScrollBarVisibility(hScrollWidth);\n\n if (that.computedHorizontalScrollBarVisibility) {\n that.scrollHeight = that._scrollHeight;\n that._refreshVerticalScrollBarVisibility(that.scrollHeight);\n\n //Resize event not thrown after 'bottom-corner' is applied\n if (that._scrollView.vScrollBar.$.hasClass('bottom-corner')) {\n that._scrollView.vScrollBar.refresh();\n }\n }\n\n if (that.isVirtualized) {\n that._recycle();\n }\n\n const isIE = /Trident|Edge/.test(navigator.userAgent);\n if (!that.isRefreshing && isIE) {\n setTimeout(function () {\n that.isRefreshing = true;\n that._refreshLayout();\n that.isRefreshing = false;\n }, 50);\n }\n }", "_updateRenderedRange() {\n if (!this._viewport) {\n return;\n }\n const renderedRange = this._viewport.getRenderedRange();\n const newRange = { start: renderedRange.start, end: renderedRange.end };\n const viewportSize = this._viewport.getViewportSize();\n const dataLength = this._viewport.getDataLength();\n let scrollOffset = this._viewport.measureScrollOffset();\n // Prevent NaN as result when dividing by zero.\n let firstVisibleIndex = (this._itemSize > 0) ? scrollOffset / this._itemSize : 0;\n // If user scrolls to the bottom of the list and data changes to a smaller list\n if (newRange.end > dataLength) {\n // We have to recalculate the first visible index based on new data length and viewport size.\n const maxVisibleItems = Math.ceil(viewportSize / this._itemSize);\n const newVisibleIndex = Math.max(0, Math.min(firstVisibleIndex, dataLength - maxVisibleItems));\n // If first visible index changed we must update scroll offset to handle start/end buffers\n // Current range must also be adjusted to cover the new position (bottom of new list).\n if (firstVisibleIndex != newVisibleIndex) {\n firstVisibleIndex = newVisibleIndex;\n scrollOffset = newVisibleIndex * this._itemSize;\n newRange.start = Math.floor(firstVisibleIndex);\n }\n newRange.end = Math.max(0, Math.min(dataLength, newRange.start + maxVisibleItems));\n }\n const startBuffer = scrollOffset - newRange.start * this._itemSize;\n if (startBuffer < this._minBufferPx && newRange.start != 0) {\n const expandStart = Math.ceil((this._maxBufferPx - startBuffer) / this._itemSize);\n newRange.start = Math.max(0, newRange.start - expandStart);\n newRange.end = Math.min(dataLength, Math.ceil(firstVisibleIndex + (viewportSize + this._minBufferPx) / this._itemSize));\n }\n else {\n const endBuffer = newRange.end * this._itemSize - (scrollOffset + viewportSize);\n if (endBuffer < this._minBufferPx && newRange.end != dataLength) {\n const expandEnd = Math.ceil((this._maxBufferPx - endBuffer) / this._itemSize);\n if (expandEnd > 0) {\n newRange.end = Math.min(dataLength, newRange.end + expandEnd);\n newRange.start = Math.max(0, Math.floor(firstVisibleIndex - this._minBufferPx / this._itemSize));\n }\n }\n }\n this._viewport.setRenderedRange(newRange);\n this._viewport.setRenderedContentOffset(this._itemSize * newRange.start);\n this._scrolledIndexChange.next(Math.floor(firstVisibleIndex));\n }", "function containScroll() {\n\n var targetX = startX + deltaX;\n var targetY = startY + deltaY;\n\n if (targetY < 0)\n deltaY += -targetY;\n else {\n var containerVisibleHeight = focus ? focus.clientHeight : root.innerHeight;\n var containerRealHeight = focus ? focus.scrollHeight : document.body.scrollHeight;\n if (targetY + containerVisibleHeight > containerRealHeight)\n deltaY -= targetY + containerVisibleHeight - containerRealHeight;\n }\n\n if (targetX < 0)\n deltaX += -targetX;\n else {\n var containerVisibleWidth = focus ? focus.clientWidth : root.innerWidth;\n var containerRealWidth = focus ? focus.scrollWidth : document.body.scrollWidth;\n if (targetX + containerVisibleWidth > containerRealWidth)\n deltaX -= targetX + containerVisibleWidth - containerRealWidth;\n }\n\n }", "function overlapScrollbars() {\n var tmpSb = document.createElement('div'),\n tmpSbInner = document.createElement('div');\n tmpSb.className = \"CodeMirror-scrollbar\";\n tmpSb.style.cssText = \"position: absolute; left: -9999px; height: 100px;\";\n tmpSbInner.className = \"CodeMirror-scrollbar-inner\";\n tmpSbInner.style.height = \"200px\";\n tmpSb.appendChild(tmpSbInner);\n\n document.body.appendChild(tmpSb);\n var result = (tmpSb.offsetWidth <= 1);\n document.body.removeChild(tmpSb);\n return result;\n }", "updateScroll() {\n // _mustAlwaysScroll works by stopping _mustScroll from being automatically updated, so it stays `true`.\n if (!this._mustAlwaysScroll && this._modalElement) {\n // Semantic UI modal margin and dimmer padding are 1rem, which is relative to the global font size, so for compatibility:\n const fontSize = parseFloat(window.getComputedStyle(document.documentElement).getPropertyValue(\"font-size\"));\n const margin = fontSize * 2;\n const element = this._modalElement.nativeElement;\n // The modal must scroll if the window height is smaller than the modal height + both margins.\n this._mustScroll = window.innerHeight < element.clientHeight + margin * 2;\n }\n }", "_checkScrollPosition() {\n\n var isVisible = this._isVisible;\n var isAtBottom = this._isAtBottom;\n var scrollTop = typeof window.scrollY !== 'undefined' ? window.scrollY : window.pageYOffset;\n var bottomThreshold = scrollTop + this._windowHeight;\n\n this._isVisible = scrollTop + this._windowHeight >= this._visibleThreshold ? true : false;\n this._isAtBottom = this._containerBottom <= bottomThreshold ? true : false;\n\n if (this._isAtBottom !== isAtBottom || this._isVisible !== isVisible) {\n this._updateBindings();\n }\n }", "_updateRenderedRange() {\n if (!this._viewport) {\n return;\n }\n const renderedRange = this._viewport.getRenderedRange();\n const newRange = { start: renderedRange.start, end: renderedRange.end };\n const viewportSize = this._viewport.getViewportSize();\n const dataLength = this._viewport.getDataLength();\n let scrollOffset = this._viewport.measureScrollOffset();\n let firstVisibleIndex = scrollOffset / this._itemSize;\n // If user scrolls to the bottom of the list and data changes to a smaller list\n if (newRange.end > dataLength) {\n // We have to recalculate the first visible index based on new data length and viewport size.\n const maxVisibleItems = Math.ceil(viewportSize / this._itemSize);\n const newVisibleIndex = Math.max(0, Math.min(firstVisibleIndex, dataLength - maxVisibleItems));\n // If first visible index changed we must update scroll offset to handle start/end buffers\n // Current range must also be adjusted to cover the new position (bottom of new list).\n if (firstVisibleIndex != newVisibleIndex) {\n firstVisibleIndex = newVisibleIndex;\n scrollOffset = newVisibleIndex * this._itemSize;\n newRange.start = Math.floor(firstVisibleIndex);\n }\n newRange.end = Math.max(0, Math.min(dataLength, newRange.start + maxVisibleItems));\n }\n const startBuffer = scrollOffset - newRange.start * this._itemSize;\n if (startBuffer < this._minBufferPx && newRange.start != 0) {\n const expandStart = Math.ceil((this._maxBufferPx - startBuffer) / this._itemSize);\n newRange.start = Math.max(0, newRange.start - expandStart);\n newRange.end = Math.min(dataLength, Math.ceil(firstVisibleIndex + (viewportSize + this._minBufferPx) / this._itemSize));\n }\n else {\n const endBuffer = newRange.end * this._itemSize - (scrollOffset + viewportSize);\n if (endBuffer < this._minBufferPx && newRange.end != dataLength) {\n const expandEnd = Math.ceil((this._maxBufferPx - endBuffer) / this._itemSize);\n if (expandEnd > 0) {\n newRange.end = Math.min(dataLength, newRange.end + expandEnd);\n newRange.start = Math.max(0, Math.floor(firstVisibleIndex - this._minBufferPx / this._itemSize));\n }\n }\n }\n this._viewport.setRenderedRange(newRange);\n this._viewport.setRenderedContentOffset(this._itemSize * newRange.start);\n this._scrolledIndexChange.next(Math.floor(firstVisibleIndex));\n }", "function updateScrollbars(cm) {\n var d = cm.display, docHeight = cm.doc.height;\n var totalHeight = docHeight + paddingVert(d);\n d.sizer.style.minHeight = d.heightForcer.style.top = totalHeight + \"px\";\n d.gutters.style.height = Math.max(totalHeight, d.scroller.clientHeight - scrollerCutOff) + \"px\";\n var scrollHeight = Math.max(totalHeight, d.scroller.scrollHeight);\n var needsH = d.scroller.scrollWidth > (d.scroller.clientWidth + 1);\n var needsV = scrollHeight > (d.scroller.clientHeight + 1);\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarV.firstChild.style.height =\n (scrollHeight - d.scroller.clientHeight + d.scrollbarV.clientHeight) + \"px\";\n } else {\n d.scrollbarV.style.display = \"\";\n d.scrollbarV.firstChild.style.height = \"0\";\n }\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (d.scroller.scrollWidth - d.scroller.clientWidth + d.scrollbarH.clientWidth) + \"px\";\n } else {\n d.scrollbarH.style.display = \"\";\n d.scrollbarH.firstChild.style.width = \"0\";\n }\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = scrollbarWidth(d.measure) + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = scrollbarWidth(d.measure) + \"px\";\n d.gutterFiller.style.width = d.gutters.offsetWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n\n if (mac_geLion && scrollbarWidth(d.measure) === 0) {\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = mac_geMountainLion ? \"18px\" : \"12px\";\n d.scrollbarV.style.pointerEvents = d.scrollbarH.style.pointerEvents = \"none\";\n }\n }", "function updateScrollbars(cm) {\n var d = cm.display, docHeight = cm.doc.height;\n var totalHeight = docHeight + paddingVert(d);\n d.sizer.style.minHeight = d.heightForcer.style.top = totalHeight + \"px\";\n d.gutters.style.height = Math.max(totalHeight, d.scroller.clientHeight - scrollerCutOff) + \"px\";\n var scrollHeight = Math.max(totalHeight, d.scroller.scrollHeight);\n var needsH = d.scroller.scrollWidth > (d.scroller.clientWidth + 1);\n var needsV = scrollHeight > (d.scroller.clientHeight + 1);\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarV.firstChild.style.height =\n (scrollHeight - d.scroller.clientHeight + d.scrollbarV.clientHeight) + \"px\";\n } else {\n d.scrollbarV.style.display = \"\";\n d.scrollbarV.firstChild.style.height = \"0\";\n }\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (d.scroller.scrollWidth - d.scroller.clientWidth + d.scrollbarH.clientWidth) + \"px\";\n } else {\n d.scrollbarH.style.display = \"\";\n d.scrollbarH.firstChild.style.width = \"0\";\n }\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = scrollbarWidth(d.measure) + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = scrollbarWidth(d.measure) + \"px\";\n d.gutterFiller.style.width = d.gutters.offsetWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n\n if (mac_geLion && scrollbarWidth(d.measure) === 0) {\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = mac_geMountainLion ? \"18px\" : \"12px\";\n d.scrollbarV.style.pointerEvents = d.scrollbarH.style.pointerEvents = \"none\";\n }\n }", "function updateScrollbars(cm) {\n var d = cm.display, docHeight = cm.doc.height;\n var totalHeight = docHeight + paddingVert(d);\n d.sizer.style.minHeight = d.heightForcer.style.top = totalHeight + \"px\";\n d.gutters.style.height = Math.max(totalHeight, d.scroller.clientHeight - scrollerCutOff) + \"px\";\n var scrollHeight = Math.max(totalHeight, d.scroller.scrollHeight);\n var needsH = d.scroller.scrollWidth > (d.scroller.clientWidth + 1);\n var needsV = scrollHeight > (d.scroller.clientHeight + 1);\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarV.firstChild.style.height =\n (scrollHeight - d.scroller.clientHeight + d.scrollbarV.clientHeight) + \"px\";\n } else {\n d.scrollbarV.style.display = \"\";\n d.scrollbarV.firstChild.style.height = \"0\";\n }\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (d.scroller.scrollWidth - d.scroller.clientWidth + d.scrollbarH.clientWidth) + \"px\";\n } else {\n d.scrollbarH.style.display = \"\";\n d.scrollbarH.firstChild.style.width = \"0\";\n }\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = scrollbarWidth(d.measure) + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = scrollbarWidth(d.measure) + \"px\";\n d.gutterFiller.style.width = d.gutters.offsetWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n\n if (mac_geLion && scrollbarWidth(d.measure) === 0) {\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = mac_geMountainLion ? \"18px\" : \"12px\";\n d.scrollbarV.style.pointerEvents = d.scrollbarH.style.pointerEvents = \"none\";\n }\n }", "_updateRenderedRange() {\n if (!this._viewport) {\n return;\n }\n\n const renderedRange = this._viewport.getRenderedRange();\n\n const newRange = {\n start: renderedRange.start,\n end: renderedRange.end\n };\n\n const viewportSize = this._viewport.getViewportSize();\n\n const dataLength = this._viewport.getDataLength();\n\n let scrollOffset = this._viewport.measureScrollOffset(); // Prevent NaN as result when dividing by zero.\n\n\n let firstVisibleIndex = this._itemSize > 0 ? scrollOffset / this._itemSize : 0; // If user scrolls to the bottom of the list and data changes to a smaller list\n\n if (newRange.end > dataLength) {\n // We have to recalculate the first visible index based on new data length and viewport size.\n const maxVisibleItems = Math.ceil(viewportSize / this._itemSize);\n const newVisibleIndex = Math.max(0, Math.min(firstVisibleIndex, dataLength - maxVisibleItems)); // If first visible index changed we must update scroll offset to handle start/end buffers\n // Current range must also be adjusted to cover the new position (bottom of new list).\n\n if (firstVisibleIndex != newVisibleIndex) {\n firstVisibleIndex = newVisibleIndex;\n scrollOffset = newVisibleIndex * this._itemSize;\n newRange.start = Math.floor(firstVisibleIndex);\n }\n\n newRange.end = Math.max(0, Math.min(dataLength, newRange.start + maxVisibleItems));\n }\n\n const startBuffer = scrollOffset - newRange.start * this._itemSize;\n\n if (startBuffer < this._minBufferPx && newRange.start != 0) {\n const expandStart = Math.ceil((this._maxBufferPx - startBuffer) / this._itemSize);\n newRange.start = Math.max(0, newRange.start - expandStart);\n newRange.end = Math.min(dataLength, Math.ceil(firstVisibleIndex + (viewportSize + this._minBufferPx) / this._itemSize));\n } else {\n const endBuffer = newRange.end * this._itemSize - (scrollOffset + viewportSize);\n\n if (endBuffer < this._minBufferPx && newRange.end != dataLength) {\n const expandEnd = Math.ceil((this._maxBufferPx - endBuffer) / this._itemSize);\n\n if (expandEnd > 0) {\n newRange.end = Math.min(dataLength, newRange.end + expandEnd);\n newRange.start = Math.max(0, Math.floor(firstVisibleIndex - this._minBufferPx / this._itemSize));\n }\n }\n }\n\n this._viewport.setRenderedRange(newRange);\n\n this._viewport.setRenderedContentOffset(this._itemSize * newRange.start);\n\n this._scrolledIndexChange.next(Math.floor(firstVisibleIndex));\n }", "function updateScrollbars(cm) {\n var d = cm.display, docHeight = cm.doc.height;\n var totalHeight = docHeight + paddingVert(d);\n d.sizer.style.minHeight = d.heightForcer.style.top = totalHeight + \"px\";\n d.gutters.style.height = Math.max(totalHeight, d.scroller.clientHeight - scrollerCutOff) + \"px\";\n var scrollHeight = Math.max(totalHeight, d.scroller.scrollHeight);\n var needsH = d.scroller.scrollWidth > (d.scroller.clientWidth + 1);\n var needsV = scrollHeight > (d.scroller.clientHeight + 1);\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarV.firstChild.style.height =\n (scrollHeight - d.scroller.clientHeight + d.scrollbarV.clientHeight) + \"px\";\n } else d.scrollbarV.style.display = \"\";\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (d.scroller.scrollWidth - d.scroller.clientWidth + d.scrollbarH.clientWidth) + \"px\";\n } else d.scrollbarH.style.display = \"\";\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = scrollbarWidth(d.measure) + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = scrollbarWidth(d.measure) + \"px\";\n d.gutterFiller.style.width = d.gutters.offsetWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n\n if (mac_geLion && scrollbarWidth(d.measure) === 0)\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = mac_geMountainLion ? \"18px\" : \"12px\";\n }", "checkViewportSize() {\n // TODO: Cleanup later when add logic for handling content resize\n this._measureViewportSize();\n\n this._scrollStrategy.onDataLengthChanged();\n }", "function determineScrollbars() {\n var docStyle = inlineStyle(docElem);\n mainBodyRect = bodyGeo.getCurrentBodyInfo();\n\n // -- Clear the scrollbars --\n if (shouldComputeMainBodyScrollbars) {\n defaultOverflowX = defaultOverflowY = 'hidden';\n }\n else {\n defaultOverflowX = docStyle.overflowX;\n defaultOverflowY = docStyle.overflowY;\n }\n\n // -- Set the scrollbars after a delay --\n // If the right side of the visible content is beyond the window width,\n // or the visible content is wider than the window width, show the scrollbars.\n // Doing this after a timeout fixes SC-3722 for some reason -- the toolbar was moving up and down by the height\n // of the horizontal scrollbar. It's as if doing it on a delay gives IE/Edge a chance to\n // deal with zoom first, and then scrollbars separately\n // The delay also allows us to collect several concurrent requests and handle them once.\n clearTimeout(finalizeScrollbarsTimer);\n\n var\n doUseHorizScrollbar = doForceHorizScrollbar || isBodyTooWide(),\n doUseVertScrollbar = doForceVertScrollbar || isBodyTooTall(),\n newOverflowX = doUseHorizScrollbar ? 'scroll' : defaultOverflowX,\n newOverflowY = doUseVertScrollbar ? 'scroll' : defaultOverflowY;\n\n if (newOverflowX !== docStyle.overflowX || newOverflowY !== docStyle.overflowY) {\n if (shouldComputeMainBodyScrollbars) {\n // MS browsers need to reset first, otherwise causes SC-3722\n setOverflow('hidden', 'hidden');\n }\n finalizeScrollbarsTimer = nativeGlobal.setTimeout(function() {\n setOverflow(newOverflowX, newOverflowY);\n }, 0);\n }\n }", "_ensureVisible(scrollTarget) {\n const that = this,\n parent = that.$.mainContainer;\n\n if (!parent.$.hasClass('scroll-buttons-shown') && that.overflow !== 'hidden') {\n return;\n }\n\n const parentBoundingRect = parent.getBoundingClientRect(),\n scrollTargetBoundingRect = scrollTarget.getBoundingClientRect(),\n scrollButtons = [that.$.scrollButtonNear, that.$.scrollButtonFar],\n oldScrollTop = parent.scrollTop;\n\n if (parentBoundingRect.top > scrollTargetBoundingRect.top || parentBoundingRect.bottom < scrollTargetBoundingRect.bottom) {\n parent.scrollTop = scrollTarget.offsetTop;\n that._updateScrollButtonVisibility(parent, false, scrollButtons);\n }\n\n that._fireScrollBottomReachedEvent(oldScrollTop);\n }", "_checkOverflow() {\n const that = this,\n scrollViewer = that.$.scrollViewer,\n overflow = that.overflow;\n\n if (that.scrollMode === 'scrollbar' || overflow === 'hidden') {\n scrollViewer.refresh();\n return;\n }\n\n const oldScrollTop = scrollViewer.scrollTop;\n\n if (overflow === 'auto') {\n scrollViewer.$.removeClass('scroll-buttons-shown');\n scrollViewer.$.removeClass('one-button-shown');\n that.$scrollButtonNear.addClass('jqx-hidden');\n that.$scrollButtonFar.addClass('jqx-hidden');\n }\n\n const overflowing = Math.round(scrollViewer.$.scrollViewerContentContainer.offsetHeight) >\n Math.round(scrollViewer.$.scrollViewerContainer.offsetHeight),\n showNear = Math.round(scrollViewer.scrollTop) > 0,\n showFar = Math.round(scrollViewer.$.scrollViewerContainer.offsetHeight + scrollViewer.scrollTop) <\n Math.round(scrollViewer.$.scrollViewerContentContainer.offsetHeight);\n\n if (overflowing) {\n if (overflow === 'auto') {\n scrollViewer.$.addClass('scroll-buttons-shown');\n\n if (showNear) {\n that.$scrollButtonNear.removeClass('jqx-hidden');\n }\n\n if (showFar) {\n that.$scrollButtonFar.removeClass('jqx-hidden');\n }\n\n if ((showNear && showFar) === false) {\n scrollViewer.$.addClass('one-button-shown');\n }\n\n if (!that.disabled) {\n that.$.scrollButtonNear.disabled = false;\n that.$.scrollButtonFar.disabled = false;\n }\n\n scrollViewer.scrollTop = oldScrollTop;\n }\n else {\n that.$scrollButtonNear.removeClass('jqx-hidden');\n that.$scrollButtonFar.removeClass('jqx-hidden');\n\n if (that.disabled) {\n that.$.scrollButtonNear.disabled = true;\n that.$.scrollButtonFar.disabled = true;\n }\n else {\n that.$.scrollButtonNear.disabled = !showNear;\n that.$.scrollButtonFar.disabled = !showFar;\n }\n }\n }\n else if (overflow === 'scroll') {\n that.$.scrollButtonNear.disabled = true;\n that.$.scrollButtonFar.disabled = true;\n }\n\n scrollViewer.refresh();\n }", "enable() {\n if (this._scrollSubscription) {\n return;\n }\n const stream = this._scrollDispatcher.scrolled(0);\n if (this._config && this._config.threshold && this._config.threshold > 1) {\n this._initialScrollPosition = this._viewportRuler.getViewportScrollPosition().top;\n this._scrollSubscription = stream.subscribe(() => {\n const scrollPosition = this._viewportRuler.getViewportScrollPosition().top;\n if (Math.abs(scrollPosition - this._initialScrollPosition) > this._config.threshold) {\n this._detach();\n }\n else {\n this._overlayRef.updatePosition();\n }\n });\n }\n else {\n this._scrollSubscription = stream.subscribe(this._detach);\n }\n }", "_updateViewport () {\n const $scrollElement = this.$(this._scrollClass)\n this.set('_viewport.scrollLeft', $scrollElement[0].scrollLeft)\n this.set('_viewport.width', $scrollElement.width())\n }", "_refreshVerticalScrollBarVisibility(scrollHeight) {\n const that = this;\n\n that.scrollHeight = scrollHeight;\n\n if (that.computedVerticalScrollBarVisibility) {\n that.$itemsContainer.addClass('vscroll');\n that.$filterInputContainer.addClass('vscroll');\n\n }\n else {\n that.$itemsContainer.removeClass('vscroll');\n that.$filterInputContainer.removeClass('vscroll');\n }\n }", "checkViewportSize() {\n // TODO: Cleanup later when add logic for handling content resize\n this._measureViewportSize();\n this._scrollStrategy.onDataLengthChanged();\n }", "checkViewportSize() {\n // TODO: Cleanup later when add logic for handling content resize\n this._measureViewportSize();\n this._scrollStrategy.onDataLengthChanged();\n }", "function updateScroll() {\n\n var _tmStart = BrowserUtils.now();\n var requestedScrollPos = scroll.scrollTop();\n var availableRowCount = $controller.availableRowCount();\n\n\n // adjust the scroll height if necessary\n var newScrollHeight = availableRowCount *\n (layoutMetrics.cellOuterSize + paddingMetrics.spaceY) +\n paddingMetrics.spaceY;\n if (newScrollHeight && scrollSpacer.height() !== newScrollHeight) {\n scrollSpacer.css('height', newScrollHeight + 'px');\n }\n\n\n // fix up the scroll position if trackNewData is enabled\n var trackNewData = $controller.trackNewData();\n var rootHeight = root.height();\n var rows = $controller.rows();\n\n var neededTopIdx = Math.floor(requestedScrollPos / \n (layoutMetrics.cellOuterSize + paddingMetrics.spaceY)) - 1;\n var actualTopIdx = rows.length ? rows[0].id : 0;\n\n var tblTopPx;\n\n if (trackNewData && rows.length > layoutMetrics.rowsPerScreen) {\n requestedScrollPos = newScrollHeight - rootHeight;\n scroll.scrollTop(requestedScrollPos); \n // for tracking, the table always stays at the bottom\n tblTopPx = newScrollHeight - tbl.height();\n } else {\n\n // figure out what rows should now be visible, and request\n // them if they're not visible.\n\n if (neededTopIdx != actualTopIdx) {\n\n $controller.windowPosition(\n neededTopIdx + layoutMetrics.maxRowCount - 1);\n rows = $scope.automatonViewer.rows;\n actualTopIdx = rows.length ? rows[0].id : 0;\n }\n\n // now, put the table where it should be within the scroll\n tblTopPx = actualTopIdx * \n (layoutMetrics.cellOuterSize + paddingMetrics.spaceY) + \n (scroll.scrollTop() - requestedScrollPos);\n } \n\n if (tbl.css('top') !== tblTopPx) {\n tbl.css('top', tblTopPx + 'px');\n }\n\n return;\n }", "_addScrollBar() {\n const canvas = this.getCanvas();\n\n canvas.add(this._horizontalScroll);\n canvas.add(this._verticalScroll);\n\n if (this.scrollBarTid) {\n clearTimeout(this.scrollBarTid);\n }\n\n this.scrollBarTid = setTimeout(() => {\n canvas.remove(this._horizontalScroll);\n canvas.remove(this._verticalScroll);\n }, 3000);\n }", "setupScrollSync() {\n let scrollBar = this.element.querySelector('.et-horizontal-scroll-wrapper');\n\n let bodyScrollContainer = this.element.querySelector('tbody');\n let headerScrollContainer = this.element.querySelector('thead');\n let footerScrollContainer = this.element.querySelector('tfoot');\n\n let scrollElements = [\n bodyScrollContainer,\n headerScrollContainer,\n footerScrollContainer\n ].filter((item) => {\n return item;\n });\n\n let prevClientX, prevClientY;\n\n this._wheelHandler = (event) => {\n if (Math.abs(event.deltaX) < Math.abs(event.deltaY)) {\n return;\n }\n\n event.preventDefault();\n\n scrollBar.scrollLeft += event.deltaX;\n\n for (let scrollElement of scrollElements) {\n scrollElement.scrollLeft = scrollBar.scrollLeft;\n }\n };\n\n this._scrollHandler = () => {\n for (let scrollElement of scrollElements) {\n scrollElement.scrollLeft = scrollBar.scrollLeft;\n }\n };\n\n this._touchstartHandler = (event) => {\n let [{ clientX, clientY }] = event.touches;\n\n prevClientX = clientX;\n prevClientY = clientY;\n };\n\n this._touchmoveHandler = (event) => {\n let [{ clientX, clientY }] = event.touches;\n\n let deltaX = clientX - prevClientX;\n let deltaY = clientY - prevClientY;\n\n if (Math.abs(deltaX) < Math.abs(deltaY)) {\n return;\n }\n\n event.preventDefault();\n\n scrollBar.scrollLeft -= deltaX;\n\n for (let scrollElement of scrollElements) {\n scrollElement.scrollLeft = scrollBar.scrollLeft;\n }\n\n prevClientX = clientX;\n prevClientY = clientY;\n };\n\n this.element.addEventListener('wheel', this._wheelHandler);\n scrollBar.addEventListener('scroll', this._scrollHandler);\n\n bodyScrollContainer.addEventListener('touchstart', this._touchstartHandler);\n bodyScrollContainer.addEventListener('touchmove', this._touchmoveHandler);\n }", "onScroll_() {\n const scrollTop = this.scrollTop;\n if (scrollTop > 0 && this.instances_.length !== this.items.length) {\n if (this.fillViewHeight_(scrollTop + this.maxHeight)) {\n this.updateHeight_();\n }\n }\n }", "updateMenuScrollArea(){\n \n //$('#sidebar-scroller').perfectScrollbar('update');\n \n }", "refreshVirtualScrollbars() {\n // NOTE: This was at some point changed to only run on platforms with width-occupying scrollbars, but it needs\n // to run with overlayed scrollbars also to make them show/hide as they should.\n const me = this,\n {\n headerContainer,\n footerContainer,\n virtualScrollers,\n hasVerticalOverflow\n } = me,\n // We need to ask each subGrid if it has horizontal overflow.\n // If any do, we show the virtual scroller, otherwise we hide it.\n hasHorizontalOverflow = Object.values(me.subGrids).some(subGrid => subGrid.overflowingHorizontally),\n method = hasVerticalOverflow ? 'add' : 'remove';\n\n if (hasHorizontalOverflow) {\n virtualScrollers.classList.remove('b-hide-display');\n } else {\n virtualScrollers.classList.add('b-hide-display');\n } // Auto-widthed padding element at end hides or shows to create matching margin.\n\n if (DomHelper.scrollBarWidth) {\n headerContainer.classList[method]('b-show-yscroll-padding');\n footerContainer.classList[method]('b-show-yscroll-padding');\n virtualScrollers.classList[method]('b-show-yscroll-padding');\n } // Change of scrollbar status means height change\n\n me.onHeightChange();\n }", "update() {\n\t\tthis.scroll.update();\n\t}", "_updateIfNeeded()\n\t{\n\t\tif (!this._needUpdate)\n\t\t{\n\t\t\treturn;\n\t\t}\n\t\tthis._needUpdate = false;\n\n\t\t// calculate the edges of the form and various other sizes, in various units:\n\t\tthis._leftEdge = this._pos[0] - this._size[0] / 2.0;\n\t\tthis._rightEdge = this._pos[0] + this._size[0] / 2.0;\n\t\tthis._topEdge = this._pos[1] + this._size[1] / 2.0;\n\t\tthis._bottomEdge = this._pos[1] - this._size[1] / 2.0;\n\n\t\t[this._leftEdge_px, this._topEdge_px] = util.to_px(\n\t\t\t[this._leftEdge, this._topEdge],\n\t\t\tthis.units,\n\t\t\tthis.win,\n\t\t\ttrue,\n\t\t);\n\t\t[this._rightEdge_px, this._bottomEdge_px] = util.to_px(\n\t\t\t[this._rightEdge, this._bottomEdge],\n\t\t\tthis.units,\n\t\t\tthis.win,\n\t\t\ttrue,\n\t\t);\n\t\tthis._itemPadding_px = this._getLengthPix(this._itemPadding);\n\t\tthis._scrollbarWidth_px = this._getLengthPix(this._scrollbarWidth, true);\n\t\tthis._size_px = util.to_px(this._size, this.units, this.win, true);\n\n\t\t// update the stimuli clip mask\n\t\t// note: the clip mask is in screen coordinates\n\t\tthis._stimuliClipMask.clear();\n\t\tthis._stimuliClipMask.beginFill(0xFFFFFF);\n\t\tthis._stimuliClipMask.drawRect(\n\t\t\tthis._win._stimsContainer.position.x + this._leftEdge_px + 2,\n\t\t\tthis._win._stimsContainer.position.y + this._bottomEdge_px + 2,\n\t\t\tthis._size_px[0] - 4,\n\t\t\tthis._size_px[1] - 6,\n\t\t);\n\t\tthis._stimuliClipMask.endFill();\n\n\t\t// position the scrollbar and get the scrollbar offset, in form units:\n\t\tthis._scrollbar.setPos([this._rightEdge - this._scrollbarWidth / 2, this._pos[1]], false);\n\t\tthis._scrollbar.setOpacity(0.5);\n\t\tthis._scrollbarOffset = this._prevScrollbarMarkerPos * (this._visual.stimuliTotalHeight + this._size[1]) / (-this._visual.stimuliTotalHeight / this._size[1]);\n\n\t\t// update decorations and stimuli:\n\t\tthis._updateVisibleStimuli();\n\t\tthis._updateDecorations();\n\t}", "function updateScroll(){\n var treshold = 5;\n ux.scroll.offsetPrevious = ux.scroll.offset;\n ux.scroll.offset = $(window).scrollTop();\n \n // We compare distance traveled with a defined treshold and report scroll direction\n if( ux.scroll.offset - ux.scroll.offsetPrevious > treshold ){\n ux.scroll.direction = 'down';\n } else if( ux.scroll.offsetPrevious - ux.scroll.offset > treshold ){\n ux.scroll.direction = 'up';\n }\n \n ux.viewport.visibleTop = ux.scroll.offset\n ux.viewport.visibleBottom = ux.viewport.height + ux.scroll.offset;\n}", "_updateScrollButtonVisibility() {\n const that = this,\n overflow = that.overflow;\n\n if (that.scrollMode === 'scrollbar' || overflow === 'hidden') {\n return;\n }\n\n let showNear = true,\n showFar = true;\n\n if (Math.round(that.$.scrollViewer.scrollTop) === 0) {\n showNear = false;\n }\n\n if (Math.round(that.$.scrollViewer.$.scrollViewerContainer.offsetHeight + that.$.scrollViewer.scrollTop) >=\n Math.round(that.$.scrollViewer.$.scrollViewerContentContainer.offsetHeight)) {\n showFar = false;\n }\n\n if (overflow === 'auto') {\n if (showNear && showFar) {\n that.$scrollButtonNear.removeClass('jqx-hidden');\n that.$scrollButtonFar.removeClass('jqx-hidden');\n that.$scrollViewer.removeClass('one-button-shown');\n that.$.scrollViewer.refresh();\n return;\n }\n\n if (showNear) {\n that.$scrollButtonNear.removeClass('jqx-hidden');\n }\n else {\n that.$scrollButtonNear.addClass('jqx-hidden');\n }\n\n if (showFar) {\n that.$scrollButtonFar.removeClass('jqx-hidden');\n }\n else {\n that.$scrollButtonFar.addClass('jqx-hidden');\n }\n\n that.$scrollViewer.addClass('one-button-shown');\n that.$.scrollViewer.refresh();\n }\n else if (overflow === 'scroll' && !that.disabled) {\n that.$.scrollButtonNear.disabled = !showNear;\n that.$.scrollButtonFar.disabled = !showFar;\n }\n }", "function monitorScroll() {\n //reset vars for new view\n $rootScope.showScrollRight = true;\n $rootScope.showScrollLeft = false;\n //get dom elements\n var view = angular.element($document[0].getElementById(\"navTabsScroller\"))\n var maxScrollLeft = $document[0].getElementById(\"navTabsScroller\").scrollWidth - $document[0].getElementById(\"navTabsScroller\").clientWidth;\n //bind to scroll\n view.bind('scroll', function() {\n // console.log(view.scrollLeft());\n\n if(view.scrollLeft() == 0) {\n $rootScope.$apply(function() {\n $rootScope.showScrollLeft = false\n });\n } else {\n $rootScope.$apply(function() {\n $rootScope.showScrollLeft = true\n });\n }\n\n if(view.scrollLeft() == maxScrollLeft) {\n $rootScope.$apply(function() {\n $rootScope.showScrollRight = false\n });\n } else {\n $rootScope.$apply(function() {\n $rootScope.showScrollRight = true\n });\n }\n\n });\n\n }", "pollBoundingRect() {\n if (this.isAutoAlignment() && this.popoverVisible) {\n // eslint-disable-next-line @lwc/lwc/no-async-operation\n setTimeout(() => {\n if (this.isConnected) {\n observePosition(this, 300, this._boundingRect, () => {\n this.close();\n });\n\n this.pollBoundingRect();\n }\n }, 250);\n }\n }", "onVerticalScroll() {\n // ResizeMonitor triggers scroll during render, make sure render is done\n if (this.isDrawn) {\n // Do not invalidate on scroll, if height changes it will be invalidated anyway\n this.scheduleDraw(false);\n }\n }", "onVerticalScroll() {\n // ResizeMonitor triggers scroll during render, make sure render is done\n if (this.isDrawn) {\n // Do not invalidate on scroll, if height changes it will be invalidated anyway\n this.scheduleDraw(false);\n }\n }", "function monitorScroll() {\n SidebarActions.monitorScroll()\n}", "updateScrolling(coords) {\n const {\n left: x,\n top: y,\n width: w,\n height: h,\n } = this.container.getBoundingClientRect();\n const box = { x, y, w, h };\n\n // calculate strength\n this.scaleX = this.props.horizontalStrength(box, coords);\n this.scaleY = this.props.verticalStrength(box, coords);\n\n // start scrolling if we need to\n if (!this.frame && (this.scaleX || this.scaleY)) {\n this.startScrolling();\n }\n }", "function setViewportByController() {\r\n setViewportBounds(webController.getLastViewport());\r\n}", "onViewportResize() {// TODO: Could do something cheaper\n // Refresh without discarding any available layouts\n // this.scheduler.refresh(); // Seems not needed? Will be updated by horizontal scroll anyway\n }", "onScroll_() {\n if (this.$.container.scrollTop > 0 &&\n this.domRepeat_.items.length !== this.items.length) {\n const aboveScrollTopItemCount =\n Math.round(this.$.container.scrollTop / this.domItemAverageHeight_());\n\n // Ensure we have sufficient items to fill the current scroll position and\n // a full view following our current position.\n if (aboveScrollTopItemCount + this.chunkItemThreshold >\n this.domRepeat_.items.length) {\n this.ensureDomItemsAvailableStartingAt_(aboveScrollTopItemCount);\n }\n }\n }", "function shouldLockDocumentScroll(options) {\n\n //if (supportsOverscrollBehavior) {\n // return false;\n //}\n\n return true;\n }", "function updateScreenshotScroll() {\r\n if (!isMobile) { \r\n $('#screenshots').slimScroll(slimOptionsContent); \r\n }\r\n}", "_dragScroll() {\n if (!this._model.selectionEnd || !this._model.selectionStart) {\n return;\n }\n if (this._dragScrollAmount) {\n this._onRequestScrollLines.fire({ amount: this._dragScrollAmount, suppressScrollEvent: false });\n // Re-evaluate selection\n // If the cursor was above or below the viewport, make sure it's at the\n // start or end of the viewport respectively. This should only happen when\n // NOT in column select mode.\n const buffer = this._bufferService.buffer;\n if (this._dragScrollAmount > 0) {\n if (this._activeSelectionMode !== 3 /* COLUMN */) {\n this._model.selectionEnd[0] = this._bufferService.cols;\n }\n this._model.selectionEnd[1] = Math.min(buffer.ydisp + this._bufferService.rows, buffer.lines.length - 1);\n }\n else {\n if (this._activeSelectionMode !== 3 /* COLUMN */) {\n this._model.selectionEnd[0] = 0;\n }\n this._model.selectionEnd[1] = buffer.ydisp;\n }\n this.refresh();\n }\n }", "[scroll]() {\n if (!this.scrollableElement || !this.currentMousePosition) {\n return;\n }\n\n cancelAnimationFrame(this.scrollAnimationFrame);\n\n const { speed, sensitivity } = this.options;\n\n const rect = this.scrollableElement.getBoundingClientRect();\n const bottomCutOff = rect.bottom > window.innerHeight;\n const topCutOff = rect.top < 0;\n const cutOff = topCutOff || bottomCutOff;\n\n const documentScrollingElement = getDocumentScrollingElement();\n const scrollableElement = this.scrollableElement;\n const clientX = this.currentMousePosition.clientX;\n const clientY = this.currentMousePosition.clientY;\n\n if (scrollableElement !== document.body && scrollableElement !== document.documentElement && !cutOff) {\n const { offsetHeight, offsetWidth } = scrollableElement;\n\n if (rect.top + offsetHeight - clientY < sensitivity) {\n scrollableElement.scrollTop += speed;\n } else if (clientY - rect.top < sensitivity) {\n scrollableElement.scrollTop -= speed;\n }\n\n if (rect.left + offsetWidth - clientX < sensitivity) {\n scrollableElement.scrollLeft += speed;\n } else if (clientX - rect.left < sensitivity) {\n scrollableElement.scrollLeft -= speed;\n }\n } else {\n const { innerHeight, innerWidth } = window;\n\n if (clientY < sensitivity) {\n documentScrollingElement.scrollTop -= speed;\n } else if (innerHeight - clientY < sensitivity) {\n documentScrollingElement.scrollTop += speed;\n }\n\n if (clientX < sensitivity) {\n documentScrollingElement.scrollLeft -= speed;\n } else if (innerWidth - clientX < sensitivity) {\n documentScrollingElement.scrollLeft += speed;\n }\n }\n\n this.scrollAnimationFrame = requestAnimationFrame(this[scroll]);\n }", "function ListView_UpdateScrollBars(theObject)\n{\n\t//content exits?\n\tif (theObject.Content && theObject.Content.Item_Panel)\n\t{\n\t\t//set scrollbars\n\t\ttheObject.Content.Item_Panel.style.overflowX = Get_Bool(theObject.Properties[__NEMESIS_PROPERTY_HORIZONTAL_SCROLL_BAR], true) ? \"auto\" : \"hidden\";\n\t\ttheObject.Content.Item_Panel.style.overflowY = Get_Bool(theObject.Properties[__NEMESIS_PROPERTY_VERTICAL_SCROLL_BAR], true) ? \"auto\" : \"hidden\";\n\t\t//has vertical scroll position?\n\t\tvar vertical = Get_String(theObject.Properties[__NEMESIS_PROPERTY_VERTICAL_SCROLL_POS], null);\n\t\t//and horizontal\n\t\tvar horizontal = Get_String(theObject.Properties[__NEMESIS_PROPERTY_HORIZONTAL_SCROLL_POS], null);\n\t\t//at least one is valid?\n\t\tif (vertical != null || horizontal != null)\n\t\t{\n\t\t\t//vertical?\n\t\t\tif (vertical != null)\n\t\t\t{\n\t\t\t\t//set vertical\n\t\t\t\ttheObject.Content.Item_Panel.scrollTop = vertical * theObject.Content.Item_Height;\n\t\t\t}\n\t\t\t//has horizontal\n\t\t\tif (horizontal != null)\n\t\t\t{\n\t\t\t\t//set horizontal\n\t\t\t\ttheObject.Content.Item_Panel.scrollLeft = horizontal;\n\t\t\t\t//has header panel?\n\t\t\t\tif (theObject.Content.Header_Panel)\n\t\t\t\t{\n\t\t\t\t\t//match scroll pos\n\t\t\t\t\ttheObject.Content.Header_Panel.scrollLeft = theObject.Content.Item_Panel.scrollLeft;\n\t\t\t\t}\n\t\t\t}\n\t\t\t//trigger a repaint\n\t\t\tListView_Paint(theObject);\n\t\t}\n\t}\n}", "function handleWindowScroll() {\n centerElement();\n }", "attached() {\n const that = this;\n\n super.attached();\n\n if (!that._scrollView) {\n that._scrollView = new JQX.Utilities.Scroll(that.$.input, that.$.horizontalScrollBar, that.$.verticalScrollBar);\n }\n }", "function updateScrollbars(cm, measure) {\n if (!measure) measure = measureForScrollbars(cm);\n var d = cm.display, sWidth = scrollbarWidth(d.measure);\n var scrollHeight = measure.docHeight + scrollerCutOff;\n var needsH = measure.scrollWidth > measure.clientWidth;\n if (needsH && measure.scrollWidth <= measure.clientWidth + 1 &&\n sWidth > 0 && !measure.hScrollbarTakesSpace)\n needsH = false; // (Issue #2562)\n var needsV = scrollHeight > measure.clientHeight;\n\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? sWidth + \"px\" : \"0\";\n // A bug in IE8 can cause this value to be negative, so guard it.\n d.scrollbarV.firstChild.style.height =\n Math.max(0, scrollHeight - measure.clientHeight + (measure.barHeight || d.scrollbarV.clientHeight)) + \"px\";\n } else {\n d.scrollbarV.style.display = \"\";\n d.scrollbarV.firstChild.style.height = \"0\";\n }\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? sWidth + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (measure.scrollWidth - measure.clientWidth + (measure.barWidth || d.scrollbarH.clientWidth)) + \"px\";\n } else {\n d.scrollbarH.style.display = \"\";\n d.scrollbarH.firstChild.style.width = \"0\";\n }\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = sWidth + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sWidth + \"px\";\n d.gutterFiller.style.width = d.gutters.offsetWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n\n if (!cm.state.checkedOverlayScrollbar && measure.clientHeight > 0) {\n if (sWidth === 0) {\n var w = mac && !mac_geMountainLion ? \"12px\" : \"18px\";\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = w;\n var barMouseDown = function(e) {\n if (e_target(e) != d.scrollbarV && e_target(e) != d.scrollbarH)\n operation(cm, onMouseDown)(e);\n };\n on(d.scrollbarV, \"mousedown\", barMouseDown);\n on(d.scrollbarH, \"mousedown\", barMouseDown);\n }\n cm.state.checkedOverlayScrollbar = true;\n }\n }", "function updateScrollbars(cm, measure) {\n if (!measure) measure = measureForScrollbars(cm);\n var d = cm.display, sWidth = scrollbarWidth(d.measure);\n var scrollHeight = measure.docHeight + scrollerCutOff;\n var needsH = measure.scrollWidth > measure.clientWidth;\n if (needsH && measure.scrollWidth <= measure.clientWidth + 1 &&\n sWidth > 0 && !measure.hScrollbarTakesSpace)\n needsH = false; // (Issue #2562)\n var needsV = scrollHeight > measure.clientHeight;\n\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? sWidth + \"px\" : \"0\";\n // A bug in IE8 can cause this value to be negative, so guard it.\n d.scrollbarV.firstChild.style.height =\n Math.max(0, scrollHeight - measure.clientHeight + (measure.barHeight || d.scrollbarV.clientHeight)) + \"px\";\n } else {\n d.scrollbarV.style.display = \"\";\n d.scrollbarV.firstChild.style.height = \"0\";\n }\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? sWidth + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (measure.scrollWidth - measure.clientWidth + (measure.barWidth || d.scrollbarH.clientWidth)) + \"px\";\n } else {\n d.scrollbarH.style.display = \"\";\n d.scrollbarH.firstChild.style.width = \"0\";\n }\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = sWidth + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sWidth + \"px\";\n d.gutterFiller.style.width = d.gutters.offsetWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n\n if (!cm.state.checkedOverlayScrollbar && measure.clientHeight > 0) {\n if (sWidth === 0) {\n var w = mac && !mac_geMountainLion ? \"12px\" : \"18px\";\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = w;\n var barMouseDown = function(e) {\n if (e_target(e) != d.scrollbarV && e_target(e) != d.scrollbarH)\n operation(cm, onMouseDown)(e);\n };\n on(d.scrollbarV, \"mousedown\", barMouseDown);\n on(d.scrollbarH, \"mousedown\", barMouseDown);\n }\n cm.state.checkedOverlayScrollbar = true;\n }\n }", "function updateScrollbars(cm, measure) {\n if (!measure) measure = measureForScrollbars(cm);\n var d = cm.display, sWidth = scrollbarWidth(d.measure);\n var scrollHeight = measure.docHeight + scrollerCutOff;\n var needsH = measure.scrollWidth > measure.clientWidth;\n if (needsH && measure.scrollWidth <= measure.clientWidth + 1 &&\n sWidth > 0 && !measure.hScrollbarTakesSpace)\n needsH = false; // (Issue #2562)\n var needsV = scrollHeight > measure.clientHeight;\n\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? sWidth + \"px\" : \"0\";\n // A bug in IE8 can cause this value to be negative, so guard it.\n d.scrollbarV.firstChild.style.height =\n Math.max(0, scrollHeight - measure.clientHeight + (measure.barHeight || d.scrollbarV.clientHeight)) + \"px\";\n } else {\n d.scrollbarV.style.display = \"\";\n d.scrollbarV.firstChild.style.height = \"0\";\n }\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? sWidth + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (measure.scrollWidth - measure.clientWidth + (measure.barWidth || d.scrollbarH.clientWidth)) + \"px\";\n } else {\n d.scrollbarH.style.display = \"\";\n d.scrollbarH.firstChild.style.width = \"0\";\n }\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = sWidth + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sWidth + \"px\";\n d.gutterFiller.style.width = d.gutters.offsetWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n\n if (!cm.state.checkedOverlayScrollbar && measure.clientHeight > 0) {\n if (sWidth === 0) {\n var w = mac && !mac_geMountainLion ? \"12px\" : \"18px\";\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = w;\n var barMouseDown = function(e) {\n if (e_target(e) != d.scrollbarV && e_target(e) != d.scrollbarH)\n operation(cm, onMouseDown)(e);\n };\n on(d.scrollbarV, \"mousedown\", barMouseDown);\n on(d.scrollbarH, \"mousedown\", barMouseDown);\n }\n cm.state.checkedOverlayScrollbar = true;\n }\n }", "function updateScrollbars(cm, measure) {\n if (!measure) measure = measureForScrollbars(cm);\n var d = cm.display, sWidth = scrollbarWidth(d.measure);\n var scrollHeight = measure.docHeight + scrollerCutOff;\n var needsH = measure.scrollWidth > measure.clientWidth;\n if (needsH && measure.scrollWidth <= measure.clientWidth + 1 &&\n sWidth > 0 && !measure.hScrollbarTakesSpace)\n needsH = false; // (Issue #2562)\n var needsV = scrollHeight > measure.clientHeight;\n\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? sWidth + \"px\" : \"0\";\n // A bug in IE8 can cause this value to be negative, so guard it.\n d.scrollbarV.firstChild.style.height =\n Math.max(0, scrollHeight - measure.clientHeight + (measure.barHeight || d.scrollbarV.clientHeight)) + \"px\";\n } else {\n d.scrollbarV.style.display = \"\";\n d.scrollbarV.firstChild.style.height = \"0\";\n }\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? sWidth + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (measure.scrollWidth - measure.clientWidth + (measure.barWidth || d.scrollbarH.clientWidth)) + \"px\";\n } else {\n d.scrollbarH.style.display = \"\";\n d.scrollbarH.firstChild.style.width = \"0\";\n }\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = sWidth + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sWidth + \"px\";\n d.gutterFiller.style.width = d.gutters.offsetWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n\n if (!cm.state.checkedOverlayScrollbar && measure.clientHeight > 0) {\n if (sWidth === 0) {\n var w = mac && !mac_geMountainLion ? \"12px\" : \"18px\";\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = w;\n var barMouseDown = function(e) {\n if (e_target(e) != d.scrollbarV && e_target(e) != d.scrollbarH)\n operation(cm, onMouseDown)(e);\n };\n on(d.scrollbarV, \"mousedown\", barMouseDown);\n on(d.scrollbarH, \"mousedown\", barMouseDown);\n }\n cm.state.checkedOverlayScrollbar = true;\n }\n }", "function _checkInView() {\n var viewport = {\n top: 0,\n bottom: getViewportHeight()\n };\n var callbacks = [];\n\n watchingItems.forEach(function (item) {\n var bounds = getBoundingClientRect(item.element[0]);\n\n if (bounds.top < viewport.bottom && bounds.bottom >= viewport.top) {\n callbacks.push(item.callback);\n }\n });\n\n callbacks.forEach(function (callback) {\n callback();\n });\n }", "function onWindowScroll() {\n checkFlipped();\n }", "function setCustomScrollBars() {\n /* * * M a l i h u j Q u e r y C u s t o m C o n t e n t S c r o l l e r : BEGIN * * */\n /*http://manos.malihu.gr/jquery-custom-content-scroller/*/\n //$(\".consoleLogOutput\").append('<div class=\"consoleLog_helm\">$(window).load() event starting.</div>');\n if (Compass.Global.isInternetExplorer === false) {\n $(\"#LoanDatesPanelContent_helm\").mCustomScrollbar({\n theme: \"dark\",\n alwaysShowScrollbar: 0, //Disable scrolll bar when there’s nothing to scroll.\n //scrollbarPosition: \"outside\",\n snapAmount: 26,\n snapOffset: 3,\n mouseWheel: {\n deltaFactor: 28,\n normalizeDelta: false\n },\n callbacks: {\n onScrollStart: function () {\n Compass.Helm.hideHelpPopOvers();\n }\n },\n scrollInertia: 500\n\n });\n $(\"#LoanContactsListContainer_helm\").mCustomScrollbar({\n theme: \"dark\",\n alwaysShowScrollbar: 0, //Disable scrolll bar when there’s nothing to scroll.\n //scrollbarPosition: \"outside\",\n snapAmount: 26,\n snapOffset: 3,\n mouseWheel: {\n deltaFactor: 28,\n normalizeDelta: false\n },\n scrollInertia: 500\n\n });\n }\n /* * * M a l i h u j Q u e r y C u s t o m C o n t e n t S c r o l l e r : END * * */\n }", "updateScroll() {\n\t\t\tthis.scrollPosition = window.scrollY;\n\t\t}", "function update() {\n\n let bounds = element.bounds(container)\n offsetTop = bounds.top\n offsetBot = bounds.top + bounds.height + $(window).height()\n\n offsetTop = offsetTop - $(window).height()\n offsetBot = offsetBot - $(window).height()\n\n if (offsetTop < 0) {\n offsetTop = 0\n }\n }", "function updateScrollbars(cm, measure) {\r\n if (!measure) measure = measureForScrollbars(cm);\r\n var d = cm.display, sWidth = scrollbarWidth(d.measure);\r\n var scrollHeight = measure.docHeight + scrollerCutOff;\r\n var needsH = measure.scrollWidth > measure.clientWidth;\r\n if (needsH && measure.scrollWidth <= measure.clientWidth + 1 &&\r\n sWidth > 0 && !measure.hScrollbarTakesSpace)\r\n needsH = false; // (Issue #2562)\r\n var needsV = scrollHeight > measure.clientHeight;\r\n\r\n if (needsV) {\r\n d.scrollbarV.style.display = \"block\";\r\n d.scrollbarV.style.bottom = needsH ? sWidth + \"px\" : \"0\";\r\n // A bug in IE8 can cause this value to be negative, so guard it.\r\n d.scrollbarV.firstChild.style.height =\r\n Math.max(0, scrollHeight - measure.clientHeight + (measure.barHeight || d.scrollbarV.clientHeight)) + \"px\";\r\n } else {\r\n d.scrollbarV.style.display = \"\";\r\n d.scrollbarV.firstChild.style.height = \"0\";\r\n }\r\n if (needsH) {\r\n d.scrollbarH.style.display = \"block\";\r\n d.scrollbarH.style.right = needsV ? sWidth + \"px\" : \"0\";\r\n d.scrollbarH.firstChild.style.width =\r\n (measure.scrollWidth - measure.clientWidth + (measure.barWidth || d.scrollbarH.clientWidth)) + \"px\";\r\n } else {\r\n d.scrollbarH.style.display = \"\";\r\n d.scrollbarH.firstChild.style.width = \"0\";\r\n }\r\n if (needsH && needsV) {\r\n d.scrollbarFiller.style.display = \"block\";\r\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = sWidth + \"px\";\r\n } else d.scrollbarFiller.style.display = \"\";\r\n if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\r\n d.gutterFiller.style.display = \"block\";\r\n d.gutterFiller.style.height = sWidth + \"px\";\r\n d.gutterFiller.style.width = d.gutters.offsetWidth + \"px\";\r\n } else d.gutterFiller.style.display = \"\";\r\n\r\n if (!cm.state.checkedOverlayScrollbar && measure.clientHeight > 0) {\r\n if (sWidth === 0) {\r\n var w = mac && !mac_geMountainLion ? \"12px\" : \"18px\";\r\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = w;\r\n var barMouseDown = function(e) {\r\n if (e_target(e) != d.scrollbarV && e_target(e) != d.scrollbarH)\r\n operation(cm, onMouseDown)(e);\r\n };\r\n on(d.scrollbarV, \"mousedown\", barMouseDown);\r\n on(d.scrollbarH, \"mousedown\", barMouseDown);\r\n }\r\n cm.state.checkedOverlayScrollbar = true;\r\n }\r\n }", "function syncSelectionIndicator() {\n _.forEach(_views, function (view) {\n view.$openFilesContainer.triggerHandler(\"scroll\");\n });\n }", "_refreshLayout() {\n const that = this;\n const source = that.rows;\n\n if (that._layoutSuspended) {\n return;\n }\n\n that._visibleRows = null;\n that.__viewRows = null;\n that.__clientSize = null;\n that.__scrollHeight = null;\n that.__scrollWidth = null;\n that.__parentCells = null;\n\n that.$.columnFarContainer.classList.remove('vscroll');\n that.$.columnNearContainer.classList.remove('vscroll');\n\n that.$.scrollView.classList.remove('hscroll');\n that.$.scrollView.classList.remove('vscroll');\n\n that._refreshElementsVisibility();\n that._refreshColumnHeights();\n that._refreshContentHeight();\n\n if (!(source && source.url)) {\n if (!source || source === null || source.length === 0 || that.columns.length === 0) {\n that.$.placeholder.classList.remove('smart-hidden');\n\n that.scrollWidth = 0;\n that.scrollHeight = 0;\n\n return;\n }\n }\n\n if (!that.__columnHeaderHeight) {\n that.__columnHeaderHeight = that.$.columnHeader.offsetHeight;\n }\n\n if (!that.__filterFooterOffsetHeight) {\n that.__filterFooterOffsetHeight = that.$.filterFooter.classList.contains('smart-hidden') ? 0 : that.$.filterFooter.offsetHeight;\n }\n\n const scrollViewOffsetHeight = that._contentHeight - that.__filterFooterOffsetHeight - that.__columnHeaderHeight;\n\n that.$.scrollView.style.height = scrollViewOffsetHeight + 'px';\n that.htmlColumnLastChild.style.height = that.__columnHeaderHeight + 'px';\n\n\n if (that.paging.spinner.enabled && that.paging.enabled) {\n if (!that.pageScroll) {\n const pageScroll = document.createElement('smart-scroll-bar');\n\n pageScroll.orientation = 'vertical';\n pageScroll.style.height = '100%';\n pageScroll.style.width = '100%';\n pageScroll.max = Math.ceil(that.dataSource.length / that.paging.pageSize);\n pageScroll.step = that.paging.spinner.step;\n pageScroll.largeStep = that.paging.spinner.step;\n pageScroll.setAttribute('spinner', '');\n pageScroll.setAttribute('smart-id', 'spinner');\n pageScroll.ownerElement = that;\n\n that.addPropertyBinding('[[paging_spinner_step]]', 'step', pageScroll, that.$.columnHeader);\n\n pageScroll.addEventListener('change', function (event) {\n that.paging.pageIndex = event.detail.value;\n });\n\n that.pageScroll = pageScroll;\n }\n\n that.htmlColumnLastChild.appendChild(that.pageScroll);\n }\n else {\n that.htmlColumnLastChild.innerHTML = '';\n }\n\n that._refreshScrollBars();\n\n }", "function _isInViewport() {\n if (isOpen){\n $items.css('top', ($outerWrapper.offset().top + $outerWrapper.outerHeight() + itemsHeight > $win.scrollTop() + $win.height()) ? -itemsHeight : '');\n setTimeout(_isInViewport, 100);\n }\n }", "_verticalScrollbarHandler(event) {\n const that = this;\n const value = event.detail.value;\n event.stopPropagation();\n\n if (that.isVirtualized) {\n that._recycle();\n }\n else {\n that.$.itemsContainer.scrollTop = value;\n }\n\n that._updateTopVisibleIndex();\n\n if (event.context.max === event.context.value) {\n that.$.fireEvent('scrollBottomReached');\n return;\n }\n\n if (event.context.min === event.context.value) {\n that.$.fireEvent('scrollTopReached');\n }\n }", "setScroll() {\n this.canScroll = true\n }", "function mkdOnWindowScroll() {\n \n }", "function manageScroll () {\n\t\tvar scroller = $('#scroller'),\n\t\t\telementScrolled,\n\t\t\tcurrentScrollTop;\n\n\t\tscroller.scroll(function () {\n\t\t\tcurrentScrollTop = $(this).scrollTop();\n\t\t\tif (currentScrollTop > prevScrollTop) {\n\t\t\t\telementScrolled = Math.floor((currentScrollTop - prevScrollTop) / minContentHeight);\n\t\t\t\t// If a complete block is scrolled up only then call the updateGrid function\n\t\t\t\tif (elementScrolled) {\n\t\t\t\t\tupdateGrid(lastDrawIndex, lastDrawIndex + 3);\n\t\t\t\t\tprevScrollTop = currentScrollTop;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}", "function simpleLock() {\n // save scrolled Y position when locking\n scrolledClientY = document.body.getBoundingClientRect().top;\n // force the Y scrollbar to always appear to prevent jumping issues\n document.body.style.overflow = 'hidden scroll';\n // add scrolled Y position to body top before changing the position property\n document.body.style.top = `${scrolledClientY}px`;\n // limit the vertical height by fixing the position\n document.body.style.position = 'fixed';\n // force body to expand to its whole width\n document.body.style.width = '100%';\n}", "initScroll() {\n const me = this;\n // This method may be called early, before render calls it, so ensure that it's\n // only executed once.\n if (!me.scrollInitialized) {\n let scrollTop,\n onScroll = me.createOnFrame(() => {\n me._scrollTop = scrollTop = me.scrollable.y;\n\n if (!me.scrolling) {\n me.scrolling = true;\n me.eachSubGrid((s) => (s.suspendResizeMonitor = true));\n }\n\n me.rowManager.updateRenderedRows(scrollTop);\n\n /**\n * Grid has scrolled vertically\n * @event scroll\n * @param {Grid.view.Grid} grid\n * @param {Number} scrollTop\n */\n me.trigger('scroll', { scrollTop });\n });\n\n me.scrollInitialized = true;\n\n me.scrollable.on({\n scroll: onScroll,\n scrollend() {\n me.scrolling = false;\n me.eachSubGrid((s) => (s.suspendResizeMonitor = false));\n }\n });\n\n me.callEachSubGrid('initScroll');\n }\n }", "function updateScrollbarsInner(cm, measure) {\n\t\t var d = cm.display;\n\t\t var sizes = d.scrollbars.update(measure);\n\n\t\t d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n\t\t d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n\t\t d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n\t\t if (sizes.right && sizes.bottom) {\n\t\t d.scrollbarFiller.style.display = \"block\";\n\t\t d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n\t\t d.scrollbarFiller.style.width = sizes.right + \"px\";\n\t\t } else { d.scrollbarFiller.style.display = \"\"; }\n\t\t if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n\t\t d.gutterFiller.style.display = \"block\";\n\t\t d.gutterFiller.style.height = sizes.bottom + \"px\";\n\t\t d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n\t\t } else { d.gutterFiller.style.display = \"\"; }\n\t\t }", "function updateScrollbarsInner(cm, measure) {\n\t var d = cm.display;\n\t var sizes = d.scrollbars.update(measure);\n\n\t d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n\t d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n\t d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\"\n\n\t if (sizes.right && sizes.bottom) {\n\t d.scrollbarFiller.style.display = \"block\";\n\t d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n\t d.scrollbarFiller.style.width = sizes.right + \"px\";\n\t } else d.scrollbarFiller.style.display = \"\";\n\t if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n\t d.gutterFiller.style.display = \"block\";\n\t d.gutterFiller.style.height = sizes.bottom + \"px\";\n\t d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n\t } else d.gutterFiller.style.display = \"\";\n\t }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\"\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n\t\t var d = cm.display;\n\t\t var sizes = d.scrollbars.update(measure);\n\t\t\n\t\t d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n\t\t d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n\t\t d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\"\n\t\t\n\t\t if (sizes.right && sizes.bottom) {\n\t\t d.scrollbarFiller.style.display = \"block\";\n\t\t d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n\t\t d.scrollbarFiller.style.width = sizes.right + \"px\";\n\t\t } else d.scrollbarFiller.style.display = \"\";\n\t\t if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n\t\t d.gutterFiller.style.display = \"block\";\n\t\t d.gutterFiller.style.height = sizes.bottom + \"px\";\n\t\t d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n\t\t } else d.gutterFiller.style.display = \"\";\n\t\t }" ]
[ "0.63104016", "0.6014229", "0.597583", "0.59733564", "0.59518754", "0.5943817", "0.59371865", "0.59174764", "0.59174764", "0.59174764", "0.58966506", "0.5860512", "0.58578753", "0.58413035", "0.5810574", "0.57836545", "0.57833326", "0.5774653", "0.57643884", "0.5733071", "0.5726734", "0.5721265", "0.5721265", "0.5721265", "0.5709189", "0.57021976", "0.57020646", "0.568683", "0.5681366", "0.56542313", "0.56452626", "0.56292516", "0.56242484", "0.56056964", "0.56056964", "0.5595465", "0.5587639", "0.5583839", "0.55829364", "0.55829036", "0.55563766", "0.5538077", "0.5534446", "0.55282825", "0.5525091", "0.54866487", "0.54842615", "0.548222", "0.548222", "0.54763484", "0.5474811", "0.547405", "0.54516524", "0.54491526", "0.54464275", "0.54232264", "0.5421176", "0.53916967", "0.53914595", "0.538449", "0.5383856", "0.53815293", "0.53815293", "0.53815293", "0.53815293", "0.53775096", "0.53774196", "0.53774107", "0.53565437", "0.5356002", "0.5350169", "0.5344188", "0.53373224", "0.5335114", "0.53235644", "0.5322245", "0.5315177", "0.53118604", "0.5305926", "0.5279465", "0.52778494", "0.5274698", "0.52739215", "0.52695286", "0.52695286", "0.52695286", "0.52695286", "0.52695286", "0.52695286", "0.52695286", "0.52695286", "0.52695286", "0.52695286", "0.52695286", "0.52695286", "0.52695286", "0.52695286", "0.52695286", "0.52695286", "0.52695286", "0.52688867" ]
0.0
-1
Sync scroller and scrollbar, ensure the gutter elements are aligned.
function setScrollLeft(cm, val, isScroller, forceScroll) { val = Math.max(0, Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth)); if ((isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) && !forceScroll) { return } cm.doc.scrollLeft = val; alignHorizontally(cm); if (cm.display.scroller.scrollLeft != val) { cm.display.scroller.scrollLeft = val; } cm.display.scrollbars.setScrollLeft(val); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateScrollbars(cm) {\n var d = cm.display, docHeight = cm.doc.height;\n var totalHeight = docHeight + paddingVert(d);\n d.sizer.style.minHeight = d.heightForcer.style.top = totalHeight + \"px\";\n d.gutters.style.height = Math.max(totalHeight, d.scroller.clientHeight - scrollerCutOff) + \"px\";\n var scrollHeight = Math.max(totalHeight, d.scroller.scrollHeight);\n var needsH = d.scroller.scrollWidth > (d.scroller.clientWidth + 1);\n var needsV = scrollHeight > (d.scroller.clientHeight + 1);\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarV.firstChild.style.height =\n (scrollHeight - d.scroller.clientHeight + d.scrollbarV.clientHeight) + \"px\";\n } else d.scrollbarV.style.display = \"\";\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (d.scroller.scrollWidth - d.scroller.clientWidth + d.scrollbarH.clientWidth) + \"px\";\n } else d.scrollbarH.style.display = \"\";\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = scrollbarWidth(d.measure) + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = scrollbarWidth(d.measure) + \"px\";\n d.gutterFiller.style.width = d.gutters.offsetWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n\n if (mac_geLion && scrollbarWidth(d.measure) === 0)\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = mac_geMountainLion ? \"18px\" : \"12px\";\n }", "function updateScrollbars(cm) {\n var d = cm.display, docHeight = cm.doc.height;\n var totalHeight = docHeight + paddingVert(d);\n d.sizer.style.minHeight = d.heightForcer.style.top = totalHeight + \"px\";\n d.gutters.style.height = Math.max(totalHeight, d.scroller.clientHeight - scrollerCutOff) + \"px\";\n var scrollHeight = Math.max(totalHeight, d.scroller.scrollHeight);\n var needsH = d.scroller.scrollWidth > (d.scroller.clientWidth + 1);\n var needsV = scrollHeight > (d.scroller.clientHeight + 1);\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarV.firstChild.style.height =\n (scrollHeight - d.scroller.clientHeight + d.scrollbarV.clientHeight) + \"px\";\n } else {\n d.scrollbarV.style.display = \"\";\n d.scrollbarV.firstChild.style.height = \"0\";\n }\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (d.scroller.scrollWidth - d.scroller.clientWidth + d.scrollbarH.clientWidth) + \"px\";\n } else {\n d.scrollbarH.style.display = \"\";\n d.scrollbarH.firstChild.style.width = \"0\";\n }\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = scrollbarWidth(d.measure) + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = scrollbarWidth(d.measure) + \"px\";\n d.gutterFiller.style.width = d.gutters.offsetWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n\n if (mac_geLion && scrollbarWidth(d.measure) === 0) {\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = mac_geMountainLion ? \"18px\" : \"12px\";\n d.scrollbarV.style.pointerEvents = d.scrollbarH.style.pointerEvents = \"none\";\n }\n }", "function updateScrollbars(cm) {\n var d = cm.display, docHeight = cm.doc.height;\n var totalHeight = docHeight + paddingVert(d);\n d.sizer.style.minHeight = d.heightForcer.style.top = totalHeight + \"px\";\n d.gutters.style.height = Math.max(totalHeight, d.scroller.clientHeight - scrollerCutOff) + \"px\";\n var scrollHeight = Math.max(totalHeight, d.scroller.scrollHeight);\n var needsH = d.scroller.scrollWidth > (d.scroller.clientWidth + 1);\n var needsV = scrollHeight > (d.scroller.clientHeight + 1);\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarV.firstChild.style.height =\n (scrollHeight - d.scroller.clientHeight + d.scrollbarV.clientHeight) + \"px\";\n } else {\n d.scrollbarV.style.display = \"\";\n d.scrollbarV.firstChild.style.height = \"0\";\n }\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (d.scroller.scrollWidth - d.scroller.clientWidth + d.scrollbarH.clientWidth) + \"px\";\n } else {\n d.scrollbarH.style.display = \"\";\n d.scrollbarH.firstChild.style.width = \"0\";\n }\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = scrollbarWidth(d.measure) + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = scrollbarWidth(d.measure) + \"px\";\n d.gutterFiller.style.width = d.gutters.offsetWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n\n if (mac_geLion && scrollbarWidth(d.measure) === 0) {\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = mac_geMountainLion ? \"18px\" : \"12px\";\n d.scrollbarV.style.pointerEvents = d.scrollbarH.style.pointerEvents = \"none\";\n }\n }", "function updateScrollbars(cm) {\n var d = cm.display, docHeight = cm.doc.height;\n var totalHeight = docHeight + paddingVert(d);\n d.sizer.style.minHeight = d.heightForcer.style.top = totalHeight + \"px\";\n d.gutters.style.height = Math.max(totalHeight, d.scroller.clientHeight - scrollerCutOff) + \"px\";\n var scrollHeight = Math.max(totalHeight, d.scroller.scrollHeight);\n var needsH = d.scroller.scrollWidth > (d.scroller.clientWidth + 1);\n var needsV = scrollHeight > (d.scroller.clientHeight + 1);\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarV.firstChild.style.height =\n (scrollHeight - d.scroller.clientHeight + d.scrollbarV.clientHeight) + \"px\";\n } else {\n d.scrollbarV.style.display = \"\";\n d.scrollbarV.firstChild.style.height = \"0\";\n }\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (d.scroller.scrollWidth - d.scroller.clientWidth + d.scrollbarH.clientWidth) + \"px\";\n } else {\n d.scrollbarH.style.display = \"\";\n d.scrollbarH.firstChild.style.width = \"0\";\n }\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = scrollbarWidth(d.measure) + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = scrollbarWidth(d.measure) + \"px\";\n d.gutterFiller.style.width = d.gutters.offsetWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n\n if (mac_geLion && scrollbarWidth(d.measure) === 0) {\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = mac_geMountainLion ? \"18px\" : \"12px\";\n d.scrollbarV.style.pointerEvents = d.scrollbarH.style.pointerEvents = \"none\";\n }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n }", "function updateScrollbarsInner(cm, measure) {\n\t var d = cm.display;\n\t var sizes = d.scrollbars.update(measure);\n\n\t d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n\t d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n\n\t if (sizes.right && sizes.bottom) {\n\t d.scrollbarFiller.style.display = \"block\";\n\t d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n\t d.scrollbarFiller.style.width = sizes.right + \"px\";\n\t } else d.scrollbarFiller.style.display = \"\";\n\t if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n\t d.gutterFiller.style.display = \"block\";\n\t d.gutterFiller.style.height = sizes.bottom + \"px\";\n\t d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n\t } else d.gutterFiller.style.display = \"\";\n\t }", "function updateScrollbars(cm, measure) {\n if (!measure) measure = measureForScrollbars(cm);\n var d = cm.display, sWidth = scrollbarWidth(d.measure);\n var scrollHeight = measure.docHeight + scrollerCutOff;\n var needsH = measure.scrollWidth > measure.clientWidth;\n if (needsH && measure.scrollWidth <= measure.clientWidth + 1 &&\n sWidth > 0 && !measure.hScrollbarTakesSpace)\n needsH = false; // (Issue #2562)\n var needsV = scrollHeight > measure.clientHeight;\n\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? sWidth + \"px\" : \"0\";\n // A bug in IE8 can cause this value to be negative, so guard it.\n d.scrollbarV.firstChild.style.height =\n Math.max(0, scrollHeight - measure.clientHeight + (measure.barHeight || d.scrollbarV.clientHeight)) + \"px\";\n } else {\n d.scrollbarV.style.display = \"\";\n d.scrollbarV.firstChild.style.height = \"0\";\n }\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? sWidth + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (measure.scrollWidth - measure.clientWidth + (measure.barWidth || d.scrollbarH.clientWidth)) + \"px\";\n } else {\n d.scrollbarH.style.display = \"\";\n d.scrollbarH.firstChild.style.width = \"0\";\n }\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = sWidth + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sWidth + \"px\";\n d.gutterFiller.style.width = d.gutters.offsetWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n\n if (!cm.state.checkedOverlayScrollbar && measure.clientHeight > 0) {\n if (sWidth === 0) {\n var w = mac && !mac_geMountainLion ? \"12px\" : \"18px\";\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = w;\n var barMouseDown = function(e) {\n if (e_target(e) != d.scrollbarV && e_target(e) != d.scrollbarH)\n operation(cm, onMouseDown)(e);\n };\n on(d.scrollbarV, \"mousedown\", barMouseDown);\n on(d.scrollbarH, \"mousedown\", barMouseDown);\n }\n cm.state.checkedOverlayScrollbar = true;\n }\n }", "function updateScrollbars(cm, measure) {\n if (!measure) measure = measureForScrollbars(cm);\n var d = cm.display, sWidth = scrollbarWidth(d.measure);\n var scrollHeight = measure.docHeight + scrollerCutOff;\n var needsH = measure.scrollWidth > measure.clientWidth;\n if (needsH && measure.scrollWidth <= measure.clientWidth + 1 &&\n sWidth > 0 && !measure.hScrollbarTakesSpace)\n needsH = false; // (Issue #2562)\n var needsV = scrollHeight > measure.clientHeight;\n\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? sWidth + \"px\" : \"0\";\n // A bug in IE8 can cause this value to be negative, so guard it.\n d.scrollbarV.firstChild.style.height =\n Math.max(0, scrollHeight - measure.clientHeight + (measure.barHeight || d.scrollbarV.clientHeight)) + \"px\";\n } else {\n d.scrollbarV.style.display = \"\";\n d.scrollbarV.firstChild.style.height = \"0\";\n }\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? sWidth + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (measure.scrollWidth - measure.clientWidth + (measure.barWidth || d.scrollbarH.clientWidth)) + \"px\";\n } else {\n d.scrollbarH.style.display = \"\";\n d.scrollbarH.firstChild.style.width = \"0\";\n }\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = sWidth + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sWidth + \"px\";\n d.gutterFiller.style.width = d.gutters.offsetWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n\n if (!cm.state.checkedOverlayScrollbar && measure.clientHeight > 0) {\n if (sWidth === 0) {\n var w = mac && !mac_geMountainLion ? \"12px\" : \"18px\";\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = w;\n var barMouseDown = function(e) {\n if (e_target(e) != d.scrollbarV && e_target(e) != d.scrollbarH)\n operation(cm, onMouseDown)(e);\n };\n on(d.scrollbarV, \"mousedown\", barMouseDown);\n on(d.scrollbarH, \"mousedown\", barMouseDown);\n }\n cm.state.checkedOverlayScrollbar = true;\n }\n }", "function updateScrollbars(cm, measure) {\n if (!measure) measure = measureForScrollbars(cm);\n var d = cm.display, sWidth = scrollbarWidth(d.measure);\n var scrollHeight = measure.docHeight + scrollerCutOff;\n var needsH = measure.scrollWidth > measure.clientWidth;\n if (needsH && measure.scrollWidth <= measure.clientWidth + 1 &&\n sWidth > 0 && !measure.hScrollbarTakesSpace)\n needsH = false; // (Issue #2562)\n var needsV = scrollHeight > measure.clientHeight;\n\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? sWidth + \"px\" : \"0\";\n // A bug in IE8 can cause this value to be negative, so guard it.\n d.scrollbarV.firstChild.style.height =\n Math.max(0, scrollHeight - measure.clientHeight + (measure.barHeight || d.scrollbarV.clientHeight)) + \"px\";\n } else {\n d.scrollbarV.style.display = \"\";\n d.scrollbarV.firstChild.style.height = \"0\";\n }\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? sWidth + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (measure.scrollWidth - measure.clientWidth + (measure.barWidth || d.scrollbarH.clientWidth)) + \"px\";\n } else {\n d.scrollbarH.style.display = \"\";\n d.scrollbarH.firstChild.style.width = \"0\";\n }\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = sWidth + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sWidth + \"px\";\n d.gutterFiller.style.width = d.gutters.offsetWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n\n if (!cm.state.checkedOverlayScrollbar && measure.clientHeight > 0) {\n if (sWidth === 0) {\n var w = mac && !mac_geMountainLion ? \"12px\" : \"18px\";\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = w;\n var barMouseDown = function(e) {\n if (e_target(e) != d.scrollbarV && e_target(e) != d.scrollbarH)\n operation(cm, onMouseDown)(e);\n };\n on(d.scrollbarV, \"mousedown\", barMouseDown);\n on(d.scrollbarH, \"mousedown\", barMouseDown);\n }\n cm.state.checkedOverlayScrollbar = true;\n }\n }", "function updateScrollbars(cm, measure) {\n if (!measure) measure = measureForScrollbars(cm);\n var d = cm.display, sWidth = scrollbarWidth(d.measure);\n var scrollHeight = measure.docHeight + scrollerCutOff;\n var needsH = measure.scrollWidth > measure.clientWidth;\n if (needsH && measure.scrollWidth <= measure.clientWidth + 1 &&\n sWidth > 0 && !measure.hScrollbarTakesSpace)\n needsH = false; // (Issue #2562)\n var needsV = scrollHeight > measure.clientHeight;\n\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? sWidth + \"px\" : \"0\";\n // A bug in IE8 can cause this value to be negative, so guard it.\n d.scrollbarV.firstChild.style.height =\n Math.max(0, scrollHeight - measure.clientHeight + (measure.barHeight || d.scrollbarV.clientHeight)) + \"px\";\n } else {\n d.scrollbarV.style.display = \"\";\n d.scrollbarV.firstChild.style.height = \"0\";\n }\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? sWidth + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (measure.scrollWidth - measure.clientWidth + (measure.barWidth || d.scrollbarH.clientWidth)) + \"px\";\n } else {\n d.scrollbarH.style.display = \"\";\n d.scrollbarH.firstChild.style.width = \"0\";\n }\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = sWidth + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sWidth + \"px\";\n d.gutterFiller.style.width = d.gutters.offsetWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n\n if (!cm.state.checkedOverlayScrollbar && measure.clientHeight > 0) {\n if (sWidth === 0) {\n var w = mac && !mac_geMountainLion ? \"12px\" : \"18px\";\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = w;\n var barMouseDown = function(e) {\n if (e_target(e) != d.scrollbarV && e_target(e) != d.scrollbarH)\n operation(cm, onMouseDown)(e);\n };\n on(d.scrollbarV, \"mousedown\", barMouseDown);\n on(d.scrollbarH, \"mousedown\", barMouseDown);\n }\n cm.state.checkedOverlayScrollbar = true;\n }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\"\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n }", "function updateScrollbars(cm, measure) {\r\n if (!measure) measure = measureForScrollbars(cm);\r\n var d = cm.display, sWidth = scrollbarWidth(d.measure);\r\n var scrollHeight = measure.docHeight + scrollerCutOff;\r\n var needsH = measure.scrollWidth > measure.clientWidth;\r\n if (needsH && measure.scrollWidth <= measure.clientWidth + 1 &&\r\n sWidth > 0 && !measure.hScrollbarTakesSpace)\r\n needsH = false; // (Issue #2562)\r\n var needsV = scrollHeight > measure.clientHeight;\r\n\r\n if (needsV) {\r\n d.scrollbarV.style.display = \"block\";\r\n d.scrollbarV.style.bottom = needsH ? sWidth + \"px\" : \"0\";\r\n // A bug in IE8 can cause this value to be negative, so guard it.\r\n d.scrollbarV.firstChild.style.height =\r\n Math.max(0, scrollHeight - measure.clientHeight + (measure.barHeight || d.scrollbarV.clientHeight)) + \"px\";\r\n } else {\r\n d.scrollbarV.style.display = \"\";\r\n d.scrollbarV.firstChild.style.height = \"0\";\r\n }\r\n if (needsH) {\r\n d.scrollbarH.style.display = \"block\";\r\n d.scrollbarH.style.right = needsV ? sWidth + \"px\" : \"0\";\r\n d.scrollbarH.firstChild.style.width =\r\n (measure.scrollWidth - measure.clientWidth + (measure.barWidth || d.scrollbarH.clientWidth)) + \"px\";\r\n } else {\r\n d.scrollbarH.style.display = \"\";\r\n d.scrollbarH.firstChild.style.width = \"0\";\r\n }\r\n if (needsH && needsV) {\r\n d.scrollbarFiller.style.display = \"block\";\r\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = sWidth + \"px\";\r\n } else d.scrollbarFiller.style.display = \"\";\r\n if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\r\n d.gutterFiller.style.display = \"block\";\r\n d.gutterFiller.style.height = sWidth + \"px\";\r\n d.gutterFiller.style.width = d.gutters.offsetWidth + \"px\";\r\n } else d.gutterFiller.style.display = \"\";\r\n\r\n if (!cm.state.checkedOverlayScrollbar && measure.clientHeight > 0) {\r\n if (sWidth === 0) {\r\n var w = mac && !mac_geMountainLion ? \"12px\" : \"18px\";\r\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = w;\r\n var barMouseDown = function(e) {\r\n if (e_target(e) != d.scrollbarV && e_target(e) != d.scrollbarH)\r\n operation(cm, onMouseDown)(e);\r\n };\r\n on(d.scrollbarV, \"mousedown\", barMouseDown);\r\n on(d.scrollbarH, \"mousedown\", barMouseDown);\r\n }\r\n cm.state.checkedOverlayScrollbar = true;\r\n }\r\n }", "function updateScrollbarsInner(cm, measure) {\n\t var d = cm.display;\n\t var sizes = d.scrollbars.update(measure);\n\n\t d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n\t d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n\t d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\"\n\n\t if (sizes.right && sizes.bottom) {\n\t d.scrollbarFiller.style.display = \"block\";\n\t d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n\t d.scrollbarFiller.style.width = sizes.right + \"px\";\n\t } else d.scrollbarFiller.style.display = \"\";\n\t if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n\t d.gutterFiller.style.display = \"block\";\n\t d.gutterFiller.style.height = sizes.bottom + \"px\";\n\t d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n\t } else d.gutterFiller.style.display = \"\";\n\t }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n\t\t var d = cm.display;\n\t\t var sizes = d.scrollbars.update(measure);\n\n\t\t d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n\t\t d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n\t\t d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n\t\t if (sizes.right && sizes.bottom) {\n\t\t d.scrollbarFiller.style.display = \"block\";\n\t\t d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n\t\t d.scrollbarFiller.style.width = sizes.right + \"px\";\n\t\t } else { d.scrollbarFiller.style.display = \"\"; }\n\t\t if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n\t\t d.gutterFiller.style.display = \"block\";\n\t\t d.gutterFiller.style.height = sizes.bottom + \"px\";\n\t\t d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n\t\t } else { d.gutterFiller.style.display = \"\"; }\n\t\t }", "function updateScrollbars(d /* display */, docHeight) {\n var totalHeight = docHeight + 2 * paddingTop(d);\n d.sizer.style.minHeight = d.heightForcer.style.top = totalHeight + \"px\";\n var scrollHeight = Math.max(totalHeight, d.scroller.scrollHeight);\n var needsH = d.scroller.scrollWidth > d.scroller.clientWidth;\n var needsV = scrollHeight > d.scroller.clientHeight;\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarV.firstChild.style.height = \n (scrollHeight - d.scroller.clientHeight + d.scrollbarV.clientHeight) + \"px\";\n } else d.scrollbarV.style.display = \"\";\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (d.scroller.scrollWidth - d.scroller.clientWidth + d.scrollbarH.clientWidth) + \"px\";\n } else d.scrollbarH.style.display = \"\";\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = scrollbarWidth(d.measure) + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n\n if (mac_geLion && scrollbarWidth(d.measure) === 0)\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = mac_geMountainLion ? \"18px\" : \"12px\";\n }", "function updateScrollbars(d /* display */, docHeight) {\n var totalHeight = docHeight + 2 * paddingTop(d);\n d.sizer.style.minHeight = d.heightForcer.style.top = totalHeight + \"px\";\n var scrollHeight = Math.max(totalHeight, d.scroller.scrollHeight);\n var needsH = d.scroller.scrollWidth > d.scroller.clientWidth;\n var needsV = scrollHeight > d.scroller.clientHeight;\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarV.firstChild.style.height = \n (scrollHeight - d.scroller.clientHeight + d.scrollbarV.clientHeight) + \"px\";\n } else d.scrollbarV.style.display = \"\";\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (d.scroller.scrollWidth - d.scroller.clientWidth + d.scrollbarH.clientWidth) + \"px\";\n } else d.scrollbarH.style.display = \"\";\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = scrollbarWidth(d.measure) + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n\n if (mac_geLion && scrollbarWidth(d.measure) === 0)\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = mac_geMountainLion ? \"18px\" : \"12px\";\n }", "function updateScrollbars(d /* display */, docHeight) {\n var totalHeight = docHeight + 2 * paddingTop(d);\n d.sizer.style.minHeight = d.heightForcer.style.top = totalHeight + \"px\";\n var scrollHeight = Math.max(totalHeight, d.scroller.scrollHeight);\n var needsH = d.scroller.scrollWidth > d.scroller.clientWidth;\n var needsV = scrollHeight > d.scroller.clientHeight;\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarV.firstChild.style.height = \n (scrollHeight - d.scroller.clientHeight + d.scrollbarV.clientHeight) + \"px\";\n } else d.scrollbarV.style.display = \"\";\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (d.scroller.scrollWidth - d.scroller.clientWidth + d.scrollbarH.clientWidth) + \"px\";\n } else d.scrollbarH.style.display = \"\";\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = scrollbarWidth(d.measure) + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n\n if (mac_geLion && scrollbarWidth(d.measure) === 0)\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = mac_geMountainLion ? \"18px\" : \"12px\";\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display\n var sizes = d.scrollbars.update(measure)\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\"\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\"\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\"\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\"\n d.scrollbarFiller.style.height = sizes.bottom + \"px\"\n d.scrollbarFiller.style.width = sizes.right + \"px\"\n } else { d.scrollbarFiller.style.display = \"\" }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\"\n d.gutterFiller.style.height = sizes.bottom + \"px\"\n d.gutterFiller.style.width = measure.gutterWidth + \"px\"\n } else { d.gutterFiller.style.display = \"\" }\n}", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display\n var sizes = d.scrollbars.update(measure)\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\"\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\"\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\"\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\"\n d.scrollbarFiller.style.height = sizes.bottom + \"px\"\n d.scrollbarFiller.style.width = sizes.right + \"px\"\n } else { d.scrollbarFiller.style.display = \"\" }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\"\n d.gutterFiller.style.height = sizes.bottom + \"px\"\n d.gutterFiller.style.width = measure.gutterWidth + \"px\"\n } else { d.gutterFiller.style.display = \"\" }\n}", "function updateScrollbarsInner(cm, measure) {\n\t\t var d = cm.display;\n\t\t var sizes = d.scrollbars.update(measure);\n\t\t\n\t\t d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n\t\t d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n\t\t d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\"\n\t\t\n\t\t if (sizes.right && sizes.bottom) {\n\t\t d.scrollbarFiller.style.display = \"block\";\n\t\t d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n\t\t d.scrollbarFiller.style.width = sizes.right + \"px\";\n\t\t } else d.scrollbarFiller.style.display = \"\";\n\t\t if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n\t\t d.gutterFiller.style.display = \"block\";\n\t\t d.gutterFiller.style.height = sizes.bottom + \"px\";\n\t\t d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n\t\t } else d.gutterFiller.style.display = \"\";\n\t\t }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n}", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n}", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n}", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n}", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n}", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n}", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n}", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n}", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n}", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n}", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n}", "function alignHorizontally(cm) {\r\n var display = cm.display, view = display.view;\r\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\r\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\r\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\r\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\r\n if (cm.options.fixedGutter) {\r\n if (view[i].gutter)\r\n { view[i].gutter.style.left = left; }\r\n if (view[i].gutterBackground)\r\n { view[i].gutterBackground.style.left = left; }\r\n }\r\n var align = view[i].alignable;\r\n if (align) { for (var j = 0; j < align.length; j++)\r\n { align[j].style.left = left; } }\r\n } }\r\n if (cm.options.fixedGutter)\r\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\r\n}", "function updateScrollbarsInner(cm, measure) {\n\t var d = cm.display;\n\t var sizes = d.scrollbars.update(measure);\n\t\n\t d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n\t d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n\t d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\"\n\t\n\t if (sizes.right && sizes.bottom) {\n\t d.scrollbarFiller.style.display = \"block\";\n\t d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n\t d.scrollbarFiller.style.width = sizes.right + \"px\";\n\t } else d.scrollbarFiller.style.display = \"\";\n\t if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n\t d.gutterFiller.style.display = \"block\";\n\t d.gutterFiller.style.height = sizes.bottom + \"px\";\n\t d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n\t } else d.gutterFiller.style.display = \"\";\n\t }", "function updateScrollbarsInner(cm, measure) {\r\n var d = cm.display;\r\n var sizes = d.scrollbars.update(measure);\r\n\r\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\r\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\r\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\r\n\r\n if (sizes.right && sizes.bottom) {\r\n d.scrollbarFiller.style.display = \"block\";\r\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\r\n d.scrollbarFiller.style.width = sizes.right + \"px\";\r\n } else { d.scrollbarFiller.style.display = \"\"; }\r\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\r\n d.gutterFiller.style.display = \"block\";\r\n d.gutterFiller.style.height = sizes.bottom + \"px\";\r\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\r\n } else { d.gutterFiller.style.display = \"\"; }\r\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\"\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left }\n }\n var align = view[i].alignable\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\" }\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\"\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left }\n }\n var align = view[i].alignable\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\" }\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n view[i].gutter.style.left = left;\n if (view[i].gutterBackground)\n view[i].gutterBackground.style.left = left;\n }\n var align = view[i].alignable;\n if (align) for (var j = 0; j < align.length; j++)\n align[j].style.left = left;\n }\n if (cm.options.fixedGutter)\n display.gutters.style.left = (comp + gutterW) + \"px\";\n }", "function alignHorizontally(cm) {\n\t\t var display = cm.display, view = display.view;\n\t\t if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n\t\t var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n\t\t var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n\t\t for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n\t\t if (cm.options.fixedGutter) {\n\t\t if (view[i].gutter)\n\t\t { view[i].gutter.style.left = left; }\n\t\t if (view[i].gutterBackground)\n\t\t { view[i].gutterBackground.style.left = left; }\n\t\t }\n\t\t var align = view[i].alignable;\n\t\t if (align) { for (var j = 0; j < align.length; j++)\n\t\t { align[j].style.left = left; } }\n\t\t } }\n\t\t if (cm.options.fixedGutter)\n\t\t { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n\t\t }", "function measureForScrollbars(cm) {\n\t\t var d = cm.display, gutterW = d.gutters.offsetWidth;\n\t\t var docH = Math.round(cm.doc.height + paddingVert(cm.display));\n\t\t return {\n\t\t clientHeight: d.scroller.clientHeight,\n\t\t viewHeight: d.wrapper.clientHeight,\n\t\t scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,\n\t\t viewWidth: d.wrapper.clientWidth,\n\t\t barLeft: cm.options.fixedGutter ? gutterW : 0,\n\t\t docHeight: docH,\n\t\t scrollHeight: docH + scrollGap(cm) + d.barHeight,\n\t\t nativeBarWidth: d.nativeBarWidth,\n\t\t gutterWidth: gutterW\n\t\t };\n\t\t }", "function measureForScrollbars(cm) {\n\t\t var d = cm.display, gutterW = d.gutters.offsetWidth;\n\t\t var docH = Math.round(cm.doc.height + paddingVert(cm.display));\n\t\t return {\n\t\t clientHeight: d.scroller.clientHeight,\n\t\t viewHeight: d.wrapper.clientHeight,\n\t\t scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,\n\t\t viewWidth: d.wrapper.clientWidth,\n\t\t barLeft: cm.options.fixedGutter ? gutterW : 0,\n\t\t docHeight: docH,\n\t\t scrollHeight: docH + scrollGap(cm) + d.barHeight,\n\t\t nativeBarWidth: d.nativeBarWidth,\n\t\t gutterWidth: gutterW\n\t\t }\n\t\t }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\n if (cm.options.fixedGutter && view[i].gutter)\n view[i].gutter.style.left = left;\n var align = view[i].alignable;\n if (align) for (var j = 0; j < align.length; j++)\n align[j].style.left = left;\n }\n if (cm.options.fixedGutter)\n display.gutters.style.left = (comp + gutterW) + \"px\";\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\n if (cm.options.fixedGutter && view[i].gutter)\n view[i].gutter.style.left = left;\n var align = view[i].alignable;\n if (align) for (var j = 0; j < align.length; j++)\n align[j].style.left = left;\n }\n if (cm.options.fixedGutter)\n display.gutters.style.left = (comp + gutterW) + \"px\";\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\n if (cm.options.fixedGutter && view[i].gutter)\n view[i].gutter.style.left = left;\n var align = view[i].alignable;\n if (align) for (var j = 0; j < align.length; j++)\n align[j].style.left = left;\n }\n if (cm.options.fixedGutter)\n display.gutters.style.left = (comp + gutterW) + \"px\";\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\n if (cm.options.fixedGutter && view[i].gutter)\n view[i].gutter.style.left = left;\n var align = view[i].alignable;\n if (align) for (var j = 0; j < align.length; j++)\n align[j].style.left = left;\n }\n if (cm.options.fixedGutter)\n display.gutters.style.left = (comp + gutterW) + \"px\";\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\n if (cm.options.fixedGutter && view[i].gutter)\n view[i].gutter.style.left = left;\n var align = view[i].alignable;\n if (align) for (var j = 0; j < align.length; j++)\n align[j].style.left = left;\n }\n if (cm.options.fixedGutter)\n display.gutters.style.left = (comp + gutterW) + \"px\";\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\n if (cm.options.fixedGutter && view[i].gutter)\n view[i].gutter.style.left = left;\n var align = view[i].alignable;\n if (align) for (var j = 0; j < align.length; j++)\n align[j].style.left = left;\n }\n if (cm.options.fixedGutter)\n display.gutters.style.left = (comp + gutterW) + \"px\";\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\n if (cm.options.fixedGutter && view[i].gutter)\n view[i].gutter.style.left = left;\n var align = view[i].alignable;\n if (align) for (var j = 0; j < align.length; j++)\n align[j].style.left = left;\n }\n if (cm.options.fixedGutter)\n display.gutters.style.left = (comp + gutterW) + \"px\";\n }", "function alignHorizontally(cm) {\r\n var display = cm.display, view = display.view;\r\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\r\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\r\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\r\n for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\r\n if (cm.options.fixedGutter && view[i].gutter)\r\n view[i].gutter.style.left = left;\r\n var align = view[i].alignable;\r\n if (align) for (var j = 0; j < align.length; j++)\r\n align[j].style.left = left;\r\n }\r\n if (cm.options.fixedGutter)\r\n display.gutters.style.left = (comp + gutterW) + \"px\";\r\n }", "function alignHorizontally(cm) {\n\t\t var display = cm.display, view = display.view;\n\t\t if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\n\t\t var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n\t\t var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n\t\t for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\n\t\t if (cm.options.fixedGutter) {\n\t\t if (view[i].gutter)\n\t\t view[i].gutter.style.left = left;\n\t\t if (view[i].gutterBackground)\n\t\t view[i].gutterBackground.style.left = left;\n\t\t }\n\t\t var align = view[i].alignable;\n\t\t if (align) for (var j = 0; j < align.length; j++)\n\t\t align[j].style.left = left;\n\t\t }\n\t\t if (cm.options.fixedGutter)\n\t\t display.gutters.style.left = (comp + gutterW) + \"px\";\n\t\t }", "function wa(e){for(var t=e.display,a={},n={},r=t.gutters.clientLeft,f=t.gutters.firstChild,o=0;f;f=f.nextSibling,++o)a[e.options.gutters[o]]=f.offsetLeft+f.clientLeft+r,n[e.options.gutters[o]]=f.clientWidth;return{fixedPos:xa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:a,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}", "function alignHorizontally(cm) {\n\t var display = cm.display, view = display.view;\n\t if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\n\t var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n\t var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n\t for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\n\t if (cm.options.fixedGutter) {\n\t if (view[i].gutter)\n\t view[i].gutter.style.left = left;\n\t if (view[i].gutterBackground)\n\t view[i].gutterBackground.style.left = left;\n\t }\n\t var align = view[i].alignable;\n\t if (align) for (var j = 0; j < align.length; j++)\n\t align[j].style.left = left;\n\t }\n\t if (cm.options.fixedGutter)\n\t display.gutters.style.left = (comp + gutterW) + \"px\";\n\t }", "function Ga(e){var t=e.display,a=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=xa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,r=t.gutters.offsetWidth,f=n+\"px\",o=0;o<a.length;o++)if(!a[o].hidden){e.options.fixedGutter&&(a[o].gutter&&(a[o].gutter.style.left=f),a[o].gutterBackground&&(a[o].gutterBackground.style.left=f));var i=a[o].alignable;if(i)for(var s=0;s<i.length;s++)i[s].style.left=f}e.options.fixedGutter&&(t.gutters.style.left=n+r+\"px\")}}", "function measureForScrollbars(cm) {\n var d = cm.display, gutterW = d.gutters.offsetWidth;\n var docH = Math.round(cm.doc.height + paddingVert(cm.display));\n return {\n clientHeight: d.scroller.clientHeight,\n viewHeight: d.wrapper.clientHeight,\n scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,\n viewWidth: d.wrapper.clientWidth,\n barLeft: cm.options.fixedGutter ? gutterW : 0,\n docHeight: docH,\n scrollHeight: docH + scrollGap(cm) + d.barHeight,\n nativeBarWidth: d.nativeBarWidth,\n gutterWidth: gutterW\n };\n }", "function measureForScrollbars(cm) {\n var d = cm.display, gutterW = d.gutters.offsetWidth;\n var docH = Math.round(cm.doc.height + paddingVert(cm.display));\n return {\n clientHeight: d.scroller.clientHeight,\n viewHeight: d.wrapper.clientHeight,\n scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,\n viewWidth: d.wrapper.clientWidth,\n barLeft: cm.options.fixedGutter ? gutterW : 0,\n docHeight: docH,\n scrollHeight: docH + scrollGap(cm) + d.barHeight,\n nativeBarWidth: d.nativeBarWidth,\n gutterWidth: gutterW\n };\n }" ]
[ "0.7326363", "0.7248495", "0.7248495", "0.7248495", "0.6466243", "0.6466243", "0.6466243", "0.6408239", "0.6333963", "0.6333963", "0.6333963", "0.6333963", "0.63296926", "0.63296926", "0.63296926", "0.63296926", "0.63296926", "0.63296926", "0.63296926", "0.63296926", "0.63296926", "0.63296926", "0.63296926", "0.63296926", "0.63296926", "0.63296926", "0.63296926", "0.63296926", "0.63296926", "0.6324029", "0.6294794", "0.628248", "0.6279778", "0.6279778", "0.6279778", "0.6279778", "0.6279778", "0.6279778", "0.6279778", "0.6279778", "0.6279778", "0.6279778", "0.6279778", "0.6279778", "0.6279778", "0.6279778", "0.6279778", "0.6279778", "0.6279778", "0.62716603", "0.62712586", "0.62712586", "0.62712586", "0.62544215", "0.62544215", "0.625376", "0.62448996", "0.62448996", "0.62448996", "0.62448996", "0.62448996", "0.62448996", "0.62448996", "0.62448996", "0.62448996", "0.62448996", "0.62448996", "0.6243314", "0.6229712", "0.6227861", "0.62126076", "0.62126076", "0.6210351", "0.6210351", "0.6210351", "0.6210351", "0.6210351", "0.6210351", "0.6210351", "0.6210351", "0.6210351", "0.6210351", "0.6210351", "0.6195666", "0.6194987", "0.6161866", "0.61471444", "0.61313343", "0.61313343", "0.61313343", "0.61313343", "0.61313343", "0.61313343", "0.61313343", "0.61307997", "0.61029714", "0.6102724", "0.6081404", "0.6049881", "0.60450023", "0.60450023" ]
0.0
-1
SCROLLBARS Prepare DOM reads needed to update the scrollbars. Done in one shot to minimize update/measure roundtrips.
function measureForScrollbars(cm) { var d = cm.display, gutterW = d.gutters.offsetWidth; var docH = Math.round(cm.doc.height + paddingVert(cm.display)); return { clientHeight: d.scroller.clientHeight, viewHeight: d.wrapper.clientHeight, scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth, viewWidth: d.wrapper.clientWidth, barLeft: cm.options.fixedGutter ? gutterW : 0, docHeight: docH, scrollHeight: docH + scrollGap(cm) + d.barHeight, nativeBarWidth: d.nativeBarWidth, gutterWidth: gutterW } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createScrollBarForAll(){\n if($('body').hasClass(RESPONSIVE)){\n removeResponsiveScrollOverflows();\n }\n else{\n forEachSectionAndSlide(createScrollBar);\n }\n }", "function createScrollBarForAll() {\n if ($('body').hasClass(RESPONSIVE)) {\n removeResponsiveScrollOverflows();\n } else {\n forEachSectionAndSlide(createScrollBar);\n }\n }", "_setScrollBars() {\r\n const that = this;\r\n\r\n if (!that._scrollView) {\r\n that._scrollView = new LW.Utilities.Scroll(that.$.timeline, that.$.horizontalScrollBar, that.$.verticalScrollBar);\r\n }\r\n\r\n const vScrollBar = that._scrollView.vScrollBar,\r\n hScrollBar = that._scrollView.hScrollBar;\r\n\r\n hScrollBar.$.addClass('lw-hidden');\r\n vScrollBar.$.addClass('lw-hidden');\r\n\r\n //Cancel Style/Resize observers of the ScrollBars\r\n vScrollBar.hasStyleObserver = false;\r\n hScrollBar.hasStyleObserver = false;\r\n vScrollBar.hasResizeObserver = false;\r\n hScrollBar.hasResizeObserver = false;\r\n\r\n hScrollBar.wait = false;\r\n vScrollBar.wait = false;\r\n\r\n //Refreshes the ScrollBars\r\n that._refresh();\r\n }", "function setCustomScrollBars() {\n /* * * M a l i h u j Q u e r y C u s t o m C o n t e n t S c r o l l e r : BEGIN * * */\n /*http://manos.malihu.gr/jquery-custom-content-scroller/*/\n //$(\".consoleLogOutput\").append('<div class=\"consoleLog_helm\">$(window).load() event starting.</div>');\n if (Compass.Global.isInternetExplorer === false) {\n $(\"#LoanDatesPanelContent_helm\").mCustomScrollbar({\n theme: \"dark\",\n alwaysShowScrollbar: 0, //Disable scrolll bar when there’s nothing to scroll.\n //scrollbarPosition: \"outside\",\n snapAmount: 26,\n snapOffset: 3,\n mouseWheel: {\n deltaFactor: 28,\n normalizeDelta: false\n },\n callbacks: {\n onScrollStart: function () {\n Compass.Helm.hideHelpPopOvers();\n }\n },\n scrollInertia: 500\n\n });\n $(\"#LoanContactsListContainer_helm\").mCustomScrollbar({\n theme: \"dark\",\n alwaysShowScrollbar: 0, //Disable scrolll bar when there’s nothing to scroll.\n //scrollbarPosition: \"outside\",\n snapAmount: 26,\n snapOffset: 3,\n mouseWheel: {\n deltaFactor: 28,\n normalizeDelta: false\n },\n scrollInertia: 500\n\n });\n }\n /* * * M a l i h u j Q u e r y C u s t o m C o n t e n t S c r o l l e r : END * * */\n }", "function updateScrollbars(d /* display */, docHeight) {\n var totalHeight = docHeight + 2 * paddingTop(d);\n d.sizer.style.minHeight = d.heightForcer.style.top = totalHeight + \"px\";\n var scrollHeight = Math.max(totalHeight, d.scroller.scrollHeight);\n var needsH = d.scroller.scrollWidth > d.scroller.clientWidth;\n var needsV = scrollHeight > d.scroller.clientHeight;\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarV.firstChild.style.height = \n (scrollHeight - d.scroller.clientHeight + d.scrollbarV.clientHeight) + \"px\";\n } else d.scrollbarV.style.display = \"\";\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (d.scroller.scrollWidth - d.scroller.clientWidth + d.scrollbarH.clientWidth) + \"px\";\n } else d.scrollbarH.style.display = \"\";\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = scrollbarWidth(d.measure) + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n\n if (mac_geLion && scrollbarWidth(d.measure) === 0)\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = mac_geMountainLion ? \"18px\" : \"12px\";\n }", "function updateScrollbars(d /* display */, docHeight) {\n var totalHeight = docHeight + 2 * paddingTop(d);\n d.sizer.style.minHeight = d.heightForcer.style.top = totalHeight + \"px\";\n var scrollHeight = Math.max(totalHeight, d.scroller.scrollHeight);\n var needsH = d.scroller.scrollWidth > d.scroller.clientWidth;\n var needsV = scrollHeight > d.scroller.clientHeight;\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarV.firstChild.style.height = \n (scrollHeight - d.scroller.clientHeight + d.scrollbarV.clientHeight) + \"px\";\n } else d.scrollbarV.style.display = \"\";\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (d.scroller.scrollWidth - d.scroller.clientWidth + d.scrollbarH.clientWidth) + \"px\";\n } else d.scrollbarH.style.display = \"\";\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = scrollbarWidth(d.measure) + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n\n if (mac_geLion && scrollbarWidth(d.measure) === 0)\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = mac_geMountainLion ? \"18px\" : \"12px\";\n }", "function updateScrollbars(d /* display */, docHeight) {\n var totalHeight = docHeight + 2 * paddingTop(d);\n d.sizer.style.minHeight = d.heightForcer.style.top = totalHeight + \"px\";\n var scrollHeight = Math.max(totalHeight, d.scroller.scrollHeight);\n var needsH = d.scroller.scrollWidth > d.scroller.clientWidth;\n var needsV = scrollHeight > d.scroller.clientHeight;\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarV.firstChild.style.height = \n (scrollHeight - d.scroller.clientHeight + d.scrollbarV.clientHeight) + \"px\";\n } else d.scrollbarV.style.display = \"\";\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (d.scroller.scrollWidth - d.scroller.clientWidth + d.scrollbarH.clientWidth) + \"px\";\n } else d.scrollbarH.style.display = \"\";\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = scrollbarWidth(d.measure) + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n\n if (mac_geLion && scrollbarWidth(d.measure) === 0)\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = mac_geMountainLion ? \"18px\" : \"12px\";\n }", "function determineScrollbars() {\n var docStyle = inlineStyle(docElem);\n mainBodyRect = bodyGeo.getCurrentBodyInfo();\n\n // -- Clear the scrollbars --\n if (shouldComputeMainBodyScrollbars) {\n defaultOverflowX = defaultOverflowY = 'hidden';\n }\n else {\n defaultOverflowX = docStyle.overflowX;\n defaultOverflowY = docStyle.overflowY;\n }\n\n // -- Set the scrollbars after a delay --\n // If the right side of the visible content is beyond the window width,\n // or the visible content is wider than the window width, show the scrollbars.\n // Doing this after a timeout fixes SC-3722 for some reason -- the toolbar was moving up and down by the height\n // of the horizontal scrollbar. It's as if doing it on a delay gives IE/Edge a chance to\n // deal with zoom first, and then scrollbars separately\n // The delay also allows us to collect several concurrent requests and handle them once.\n clearTimeout(finalizeScrollbarsTimer);\n\n var\n doUseHorizScrollbar = doForceHorizScrollbar || isBodyTooWide(),\n doUseVertScrollbar = doForceVertScrollbar || isBodyTooTall(),\n newOverflowX = doUseHorizScrollbar ? 'scroll' : defaultOverflowX,\n newOverflowY = doUseVertScrollbar ? 'scroll' : defaultOverflowY;\n\n if (newOverflowX !== docStyle.overflowX || newOverflowY !== docStyle.overflowY) {\n if (shouldComputeMainBodyScrollbars) {\n // MS browsers need to reset first, otherwise causes SC-3722\n setOverflow('hidden', 'hidden');\n }\n finalizeScrollbarsTimer = nativeGlobal.setTimeout(function() {\n setOverflow(newOverflowX, newOverflowY);\n }, 0);\n }\n }", "function updateScrollbars(cm) {\n var d = cm.display, docHeight = cm.doc.height;\n var totalHeight = docHeight + paddingVert(d);\n d.sizer.style.minHeight = d.heightForcer.style.top = totalHeight + \"px\";\n d.gutters.style.height = Math.max(totalHeight, d.scroller.clientHeight - scrollerCutOff) + \"px\";\n var scrollHeight = Math.max(totalHeight, d.scroller.scrollHeight);\n var needsH = d.scroller.scrollWidth > (d.scroller.clientWidth + 1);\n var needsV = scrollHeight > (d.scroller.clientHeight + 1);\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarV.firstChild.style.height =\n (scrollHeight - d.scroller.clientHeight + d.scrollbarV.clientHeight) + \"px\";\n } else {\n d.scrollbarV.style.display = \"\";\n d.scrollbarV.firstChild.style.height = \"0\";\n }\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (d.scroller.scrollWidth - d.scroller.clientWidth + d.scrollbarH.clientWidth) + \"px\";\n } else {\n d.scrollbarH.style.display = \"\";\n d.scrollbarH.firstChild.style.width = \"0\";\n }\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = scrollbarWidth(d.measure) + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = scrollbarWidth(d.measure) + \"px\";\n d.gutterFiller.style.width = d.gutters.offsetWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n\n if (mac_geLion && scrollbarWidth(d.measure) === 0) {\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = mac_geMountainLion ? \"18px\" : \"12px\";\n d.scrollbarV.style.pointerEvents = d.scrollbarH.style.pointerEvents = \"none\";\n }\n }", "function updateScrollbars(cm) {\n var d = cm.display, docHeight = cm.doc.height;\n var totalHeight = docHeight + paddingVert(d);\n d.sizer.style.minHeight = d.heightForcer.style.top = totalHeight + \"px\";\n d.gutters.style.height = Math.max(totalHeight, d.scroller.clientHeight - scrollerCutOff) + \"px\";\n var scrollHeight = Math.max(totalHeight, d.scroller.scrollHeight);\n var needsH = d.scroller.scrollWidth > (d.scroller.clientWidth + 1);\n var needsV = scrollHeight > (d.scroller.clientHeight + 1);\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarV.firstChild.style.height =\n (scrollHeight - d.scroller.clientHeight + d.scrollbarV.clientHeight) + \"px\";\n } else {\n d.scrollbarV.style.display = \"\";\n d.scrollbarV.firstChild.style.height = \"0\";\n }\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (d.scroller.scrollWidth - d.scroller.clientWidth + d.scrollbarH.clientWidth) + \"px\";\n } else {\n d.scrollbarH.style.display = \"\";\n d.scrollbarH.firstChild.style.width = \"0\";\n }\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = scrollbarWidth(d.measure) + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = scrollbarWidth(d.measure) + \"px\";\n d.gutterFiller.style.width = d.gutters.offsetWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n\n if (mac_geLion && scrollbarWidth(d.measure) === 0) {\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = mac_geMountainLion ? \"18px\" : \"12px\";\n d.scrollbarV.style.pointerEvents = d.scrollbarH.style.pointerEvents = \"none\";\n }\n }", "function updateScrollbars(cm) {\n var d = cm.display, docHeight = cm.doc.height;\n var totalHeight = docHeight + paddingVert(d);\n d.sizer.style.minHeight = d.heightForcer.style.top = totalHeight + \"px\";\n d.gutters.style.height = Math.max(totalHeight, d.scroller.clientHeight - scrollerCutOff) + \"px\";\n var scrollHeight = Math.max(totalHeight, d.scroller.scrollHeight);\n var needsH = d.scroller.scrollWidth > (d.scroller.clientWidth + 1);\n var needsV = scrollHeight > (d.scroller.clientHeight + 1);\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarV.firstChild.style.height =\n (scrollHeight - d.scroller.clientHeight + d.scrollbarV.clientHeight) + \"px\";\n } else {\n d.scrollbarV.style.display = \"\";\n d.scrollbarV.firstChild.style.height = \"0\";\n }\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (d.scroller.scrollWidth - d.scroller.clientWidth + d.scrollbarH.clientWidth) + \"px\";\n } else {\n d.scrollbarH.style.display = \"\";\n d.scrollbarH.firstChild.style.width = \"0\";\n }\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = scrollbarWidth(d.measure) + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = scrollbarWidth(d.measure) + \"px\";\n d.gutterFiller.style.width = d.gutters.offsetWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n\n if (mac_geLion && scrollbarWidth(d.measure) === 0) {\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = mac_geMountainLion ? \"18px\" : \"12px\";\n d.scrollbarV.style.pointerEvents = d.scrollbarH.style.pointerEvents = \"none\";\n }\n }", "refreshVirtualScrollbars() {\n // NOTE: This was at some point changed to only run on platforms with width-occupying scrollbars, but it needs\n // to run with overlayed scrollbars also to make them show/hide as they should.\n const me = this,\n {\n headerContainer,\n footerContainer,\n virtualScrollers,\n hasVerticalOverflow\n } = me,\n // We need to ask each subGrid if it has horizontal overflow.\n // If any do, we show the virtual scroller, otherwise we hide it.\n hasHorizontalOverflow = Object.values(me.subGrids).some(subGrid => subGrid.overflowingHorizontally),\n method = hasVerticalOverflow ? 'add' : 'remove';\n\n if (hasHorizontalOverflow) {\n virtualScrollers.classList.remove('b-hide-display');\n } else {\n virtualScrollers.classList.add('b-hide-display');\n } // Auto-widthed padding element at end hides or shows to create matching margin.\n\n if (DomHelper.scrollBarWidth) {\n headerContainer.classList[method]('b-show-yscroll-padding');\n footerContainer.classList[method]('b-show-yscroll-padding');\n virtualScrollers.classList[method]('b-show-yscroll-padding');\n } // Change of scrollbar status means height change\n\n me.onHeightChange();\n }", "function updateScrollbars(cm) {\n var d = cm.display, docHeight = cm.doc.height;\n var totalHeight = docHeight + paddingVert(d);\n d.sizer.style.minHeight = d.heightForcer.style.top = totalHeight + \"px\";\n d.gutters.style.height = Math.max(totalHeight, d.scroller.clientHeight - scrollerCutOff) + \"px\";\n var scrollHeight = Math.max(totalHeight, d.scroller.scrollHeight);\n var needsH = d.scroller.scrollWidth > (d.scroller.clientWidth + 1);\n var needsV = scrollHeight > (d.scroller.clientHeight + 1);\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarV.firstChild.style.height =\n (scrollHeight - d.scroller.clientHeight + d.scrollbarV.clientHeight) + \"px\";\n } else d.scrollbarV.style.display = \"\";\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (d.scroller.scrollWidth - d.scroller.clientWidth + d.scrollbarH.clientWidth) + \"px\";\n } else d.scrollbarH.style.display = \"\";\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = scrollbarWidth(d.measure) + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = scrollbarWidth(d.measure) + \"px\";\n d.gutterFiller.style.width = d.gutters.offsetWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n\n if (mac_geLion && scrollbarWidth(d.measure) === 0)\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = mac_geMountainLion ? \"18px\" : \"12px\";\n }", "_addScrollBar() {\n const canvas = this.getCanvas();\n\n canvas.add(this._horizontalScroll);\n canvas.add(this._verticalScroll);\n\n if (this.scrollBarTid) {\n clearTimeout(this.scrollBarTid);\n }\n\n this.scrollBarTid = setTimeout(() => {\n canvas.remove(this._horizontalScroll);\n canvas.remove(this._verticalScroll);\n }, 3000);\n }", "function updateScrollbarsInner(cm, measure) {\n\t\t var d = cm.display;\n\t\t var sizes = d.scrollbars.update(measure);\n\t\t\n\t\t d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n\t\t d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n\t\t d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\"\n\t\t\n\t\t if (sizes.right && sizes.bottom) {\n\t\t d.scrollbarFiller.style.display = \"block\";\n\t\t d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n\t\t d.scrollbarFiller.style.width = sizes.right + \"px\";\n\t\t } else d.scrollbarFiller.style.display = \"\";\n\t\t if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n\t\t d.gutterFiller.style.display = \"block\";\n\t\t d.gutterFiller.style.height = sizes.bottom + \"px\";\n\t\t d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n\t\t } else d.gutterFiller.style.display = \"\";\n\t\t }", "function updateAllTransientScrollbars() {\n for (var i = 0; i < transientScrollbarEls.length; i++) {\n var el = transientScrollbarEls[i];\n updateTransientScrollbars(el);\n }\n}", "function updateScrollbarsInner(cm, measure) {\n\t\t var d = cm.display;\n\t\t var sizes = d.scrollbars.update(measure);\n\n\t\t d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n\t\t d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n\t\t d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n\t\t if (sizes.right && sizes.bottom) {\n\t\t d.scrollbarFiller.style.display = \"block\";\n\t\t d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n\t\t d.scrollbarFiller.style.width = sizes.right + \"px\";\n\t\t } else { d.scrollbarFiller.style.display = \"\"; }\n\t\t if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n\t\t d.gutterFiller.style.display = \"block\";\n\t\t d.gutterFiller.style.height = sizes.bottom + \"px\";\n\t\t d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n\t\t } else { d.gutterFiller.style.display = \"\"; }\n\t\t }", "function updateScrollbarsInner(cm, measure) {\n\t var d = cm.display;\n\t var sizes = d.scrollbars.update(measure);\n\n\t d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n\t d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n\t d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\"\n\n\t if (sizes.right && sizes.bottom) {\n\t d.scrollbarFiller.style.display = \"block\";\n\t d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n\t d.scrollbarFiller.style.width = sizes.right + \"px\";\n\t } else d.scrollbarFiller.style.display = \"\";\n\t if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n\t d.gutterFiller.style.display = \"block\";\n\t d.gutterFiller.style.height = sizes.bottom + \"px\";\n\t d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n\t } else d.gutterFiller.style.display = \"\";\n\t }", "function updateScrollbarsInner(cm, measure) {\n\t var d = cm.display;\n\t var sizes = d.scrollbars.update(measure);\n\n\t d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n\t d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n\n\t if (sizes.right && sizes.bottom) {\n\t d.scrollbarFiller.style.display = \"block\";\n\t d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n\t d.scrollbarFiller.style.width = sizes.right + \"px\";\n\t } else d.scrollbarFiller.style.display = \"\";\n\t if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n\t d.gutterFiller.style.display = \"block\";\n\t d.gutterFiller.style.height = sizes.bottom + \"px\";\n\t d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n\t } else d.gutterFiller.style.display = \"\";\n\t }", "initScrollbar(){\n\t\tconst { fade = true } = this.options.scrollbar;\n\t\tthis.indicators = [];\n\t\tlet indicator;\n\n\t\tif (this.options.scrollX) {\n\t\t\tindicator = {\n\t\t\t\tel: createScrollbar('horizontal'),\n\t\t\t\tdirection: 'horizontal',\n\t\t\t\tfade\n\t\t\t};\n\t\t\tthis.insertScrollBar(indicator.el);\n\n\t\t\tthis.indicators.push(new Indicator(this, indicator));\n\t\t}\n\n\t\tif (this.options.scrollY) {\n\t\t\tindicator = {\n\t\t\t\tel: createScrollbar('vertical'),\n\t\t\t\tdirection: 'vertical',\n\t\t\t\tfade\n\t\t\t};\n\t\t\tthis.insertScrollBar(indicator.el);\n\t\t\tthis.indicators.push(new Indicator(this, indicator));\n\t\t}\n\n\t\tthis.on('refresh', () => {\n\t\t\tfor (let i = 0; i < this.indicators.length; i++) {\n\t\t\t\tthis.indicators[i].refresh();\n\t\t\t}\n\t\t});\n\n\t\tif (fade) {\n\t\t\tthis.on('scrollEnd', () => {\n\t\t\t\tfor (let i = 0; i < this.indicators.length; i++) {\n\t\t\t\t\tthis.indicators[i].fade();\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tthis.on('scrollCancel', () => {\n\t\t\t\tfor (let i = 0; i < this.indicators.length; i++) {\n\t\t\t\t\tthis.indicators[i].fade();\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tthis.on('scrollStart', () => {\n\t\t\t\tfor (let i = 0; i < this.indicators.length; i++) {\n\t\t\t\t\tthis.indicators[i].fade(true);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tthis.on('beforeScrollStart', () => {\n\t\t\t\tfor (let i = 0; i < this.indicators.length; i++) {\n\t\t\t\t\tthis.indicators[i].fade(true, true);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}", "function updateScrollbarsInner(cm, measure) {\n\t var d = cm.display;\n\t var sizes = d.scrollbars.update(measure);\n\t\n\t d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n\t d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n\t d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\"\n\t\n\t if (sizes.right && sizes.bottom) {\n\t d.scrollbarFiller.style.display = \"block\";\n\t d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n\t d.scrollbarFiller.style.width = sizes.right + \"px\";\n\t } else d.scrollbarFiller.style.display = \"\";\n\t if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n\t d.gutterFiller.style.display = \"block\";\n\t d.gutterFiller.style.height = sizes.bottom + \"px\";\n\t d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n\t } else d.gutterFiller.style.display = \"\";\n\t }", "function initScroll() {\n this.leftButton.onmousedown = handleScrollClick;\n this.leftButton.onmouseup = handleScrollStop;\n\n this.rightButton.onmousedown = handleScrollClick;\n this.rightButton.onmouseup = handleScrollStop;\n disableNavigation(0,0);\n disableNavigation(0,1);\n var isIEMac = (navigator.appName.indexOf(\"Explorer\") != -1 && navigator.userAgent.indexOf(\"Mac\") != -1);\n if (!isIEMac) {\n document.getElementById(\"theInnerContainer\").style.overflow = \"hidden\";\n }\n}", "_refreshLayout() {\n const that = this;\n const source = that.rows;\n\n if (that._layoutSuspended) {\n return;\n }\n\n that._visibleRows = null;\n that.__viewRows = null;\n that.__clientSize = null;\n that.__scrollHeight = null;\n that.__scrollWidth = null;\n that.__parentCells = null;\n\n that.$.columnFarContainer.classList.remove('vscroll');\n that.$.scrollView.classList.remove('hscroll');\n that.$.scrollView.classList.remove('vscroll');\n\n that._refreshElementsVisibility();\n that._refreshColumnHeights();\n that._refreshContentHeight();\n\n if (!(source && source.url)) {\n if (!source || source === null || source.length === 0 || that.columns.length === 0) {\n that.$.placeholder.classList.remove('jqx-hidden');\n\n that.scrollWidth = 0;\n that.scrollHeight = 0;\n\n return;\n }\n }\n\n if (!that.__columnHeaderHeight) {\n that.__columnHeaderHeight = that.$.columnHeader.offsetHeight;\n }\n\n if (!that.__filterFooterOffsetHeight) {\n that.__filterFooterOffsetHeight = that.$.filterFooter.classList.contains('jqx-hidden') ? 0 : that.$.filterFooter.offsetHeight;\n }\n\n const scrollViewOffsetHeight = that._contentHeight - that.__filterFooterOffsetHeight - that.__columnHeaderHeight;\n\n that.$.scrollView.style.height = scrollViewOffsetHeight + 'px';\n that.htmlColumnLastChild.style.height = that.__columnHeaderHeight + 'px';\n\n\n if (that.paging.spinner.enabled && that.paging.enabled) {\n if (!that.pageScroll) {\n const pageScroll = document.createElement('jqx-scroll-bar');\n\n pageScroll.orientation = 'vertical';\n pageScroll.style.height = '100%';\n pageScroll.style.width = '100%';\n pageScroll.max = Math.ceil(that.dataSource.length / that.paging.pageSize);\n pageScroll.step = that.paging.spinner.step;\n pageScroll.largeStep = that.paging.spinner.step;\n pageScroll.setAttribute('spinner', '');\n pageScroll.setAttribute('jqx-id', 'spinner');\n pageScroll.ownerElement = that;\n\n that.addPropertyBinding('[[paging_spinner_step]]', 'step', pageScroll, that.$.columnHeader);\n\n pageScroll.addEventListener('change', function (event) {\n that.paging.pageIndex = event.detail.value;\n });\n\n that.pageScroll = pageScroll;\n }\n\n that.htmlColumnLastChild.appendChild(that.pageScroll);\n }\n else {\n that.htmlColumnLastChild.innerHTML = '';\n }\n\n that._refreshScrollBars();\n\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\"\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }", "_refreshLayout() {\n const that = this;\n const source = that._items;\n\n that.__scrollHeight = null;\n that.__scrollWidth = null;\n that._height = null;\n\n if (!that._scrollView) {\n that._scrollView = new JQX.Utilities.Scroll(that, that.$.horizontalScrollBar, that.$.verticalScrollBar);\n }\n\n that.$itemsContainer.removeClass('hscroll');\n that.$itemsContainer.removeClass('vscroll');\n\n if (!source || source === null || source.length === 0) {\n that.scrollWidth = 0;\n that.scrollHeight = 0;\n that.$filterInputContainer.removeClass('vscroll');\n that.$placeholder.removeClass('jqx-hidden');\n\n if (that.isVirtualized) {\n that._recycle();\n }\n\n return;\n }\n\n that.$placeholder.addClass('jqx-hidden');\n\n const horizontalOffset = 2 * (parseInt(getComputedStyle(that.$.itemsInnerContainer).getPropertyValue('--jqx-list-item-horizontal-offset')) || 0);\n\n let hScrollWidth = that._scrollWidth - that.$.itemsContainer.offsetWidth - horizontalOffset;\n let vScrollHeight = that._scrollHeight;\n\n that._refreshHorizontalScrollBarVisibility(hScrollWidth);\n that._refreshVerticalScrollBarVisibility(vScrollHeight);\n\n\n if (that.horizontalScrollBarVisibility === 'hidden') {\n that.$.itemsInnerContainer.style.width = that.$.itemsContainer.offsetWidth - horizontalOffset;\n }\n else {\n that.$.itemsInnerContainer.style.width = Math.max(that.$.itemsContainer.offsetWidth - horizontalOffset, -horizontalOffset + that.__scrollWidth) + 'px';\n }\n\n if (that.computedVerticalScrollBarVisibility) {\n hScrollWidth = that._scrollWidth - that.$.itemsContainer.offsetWidth - that._scrollView.vScrollBar.offsetWidth;\n that._refreshHorizontalScrollBarVisibility(hScrollWidth);\n\n if (that.horizontalScrollBarVisibility !== 'hidden') {\n that.$.itemsInnerContainer.style.width = Math.max(that.$.itemsContainer.offsetWidth - horizontalOffset, -horizontalOffset + that.__scrollWidth - that._scrollView.vScrollBar.offsetWidth) + 'px';\n }\n\n if (that.computedHorizontalScrollBarVisibility) {\n if (!(that.horizontalScrollBarVisibility === 'visible' && that.scrollWidth === 0)) {\n that.__scrollHeight += that._scrollView.hScrollBar.offsetHeight;\n }\n else if (that.horizontalScrollBarVisibility === 'visible') {\n that.__scrollHeight += that._scrollView.hScrollBar.offsetHeight;\n }\n\n that.scrollHeight = that.__scrollHeight;\n }\n\n if (that.isVirtualized) {\n that._recycle();\n }\n\n return;\n }\n\n hScrollWidth = that._scrollWidth - that.$.itemsContainer.offsetWidth - horizontalOffset;\n that._refreshHorizontalScrollBarVisibility(hScrollWidth);\n\n if (that.computedHorizontalScrollBarVisibility) {\n that.scrollHeight = that._scrollHeight;\n that._refreshVerticalScrollBarVisibility(that.scrollHeight);\n\n //Resize event not thrown after 'bottom-corner' is applied\n if (that._scrollView.vScrollBar.$.hasClass('bottom-corner')) {\n that._scrollView.vScrollBar.refresh();\n }\n }\n\n if (that.isVirtualized) {\n that._recycle();\n }\n\n const isIE = /Trident|Edge/.test(navigator.userAgent);\n if (!that.isRefreshing && isIE) {\n setTimeout(function () {\n that.isRefreshing = true;\n that._refreshLayout();\n that.isRefreshing = false;\n }, 50);\n }\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display\n var sizes = d.scrollbars.update(measure)\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\"\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\"\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\"\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\"\n d.scrollbarFiller.style.height = sizes.bottom + \"px\"\n d.scrollbarFiller.style.width = sizes.right + \"px\"\n } else { d.scrollbarFiller.style.display = \"\" }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\"\n d.gutterFiller.style.height = sizes.bottom + \"px\"\n d.gutterFiller.style.width = measure.gutterWidth + \"px\"\n } else { d.gutterFiller.style.display = \"\" }\n}", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display\n var sizes = d.scrollbars.update(measure)\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\"\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\"\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\"\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\"\n d.scrollbarFiller.style.height = sizes.bottom + \"px\"\n d.scrollbarFiller.style.width = sizes.right + \"px\"\n } else { d.scrollbarFiller.style.display = \"\" }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\"\n d.gutterFiller.style.height = sizes.bottom + \"px\"\n d.gutterFiller.style.width = measure.gutterWidth + \"px\"\n } else { d.gutterFiller.style.display = \"\" }\n}", "function updateScrollbarsInner(cm, measure) {\r\n var d = cm.display;\r\n var sizes = d.scrollbars.update(measure);\r\n\r\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\r\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\r\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\r\n\r\n if (sizes.right && sizes.bottom) {\r\n d.scrollbarFiller.style.display = \"block\";\r\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\r\n d.scrollbarFiller.style.width = sizes.right + \"px\";\r\n } else { d.scrollbarFiller.style.display = \"\"; }\r\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\r\n d.gutterFiller.style.display = \"block\";\r\n d.gutterFiller.style.height = sizes.bottom + \"px\";\r\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\r\n } else { d.gutterFiller.style.display = \"\"; }\r\n}", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n}", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n}", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n}", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n}", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n}", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n}", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n}", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n}", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n}", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n}", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n}", "function createScrollBar() {\n\tvar $d = $('#skill_content');\n\tvar $j = $d.data('jsp');\n\n\tif ( $j ) {\n\t\t$j.reinitialise();\n\t} else {\n\t\t$d.jScrollPane({verticalGutter: 10});\n\t\tvar $e = $d.data('jsp').getContentPane();\n\t\t\n\t\tif ( $e.next().hasClass('jspVerticalBar') ) {\n\t\t\t$e.addClass('filler');\n\t\t} else {\n\t\t\t$d.css({'background-color': 'rgba(0,0,0,0.5)'});\n\t\t}\n\t}\n}", "function createNodeScrollBar() {\r\n\tfor (let i = 0; i < nodesPayload.length; i++) {\r\n\t\tcreateNodeElement(nodesPayload[i]);\r\n\t}\r\n}", "function createScrollBarHandler(){\n $(SECTION_SEL).each(function(){\n var slides = $(this).find(SLIDE_SEL);\n\n if(slides.length){\n slides.each(function(){\n createScrollBar($(this));\n });\n }else{\n createScrollBar($(this));\n }\n\n });\n afterRenderActions();\n }", "function createScrollBarHandler(){\n $(SECTION_SEL).each(function(){\n var slides = $(this).find(SLIDE_SEL);\n\n if(slides.length){\n slides.each(function(){\n createScrollBar($(this));\n });\n }else{\n createScrollBar($(this));\n }\n\n });\n afterRenderActions();\n }", "_refreshVerticalScrollBarVisibility(scrollHeight) {\n const that = this;\n\n if (that._autoHeight) {\n that.scrollTop = 0;\n that.scrollHeight = 0;\n return;\n }\n\n if (that.computedHorizontalScrollBarVisibility) {\n scrollHeight += that.$.horizontalScrollBar.offsetHeight;\n }\n\n that.scrollHeight = scrollHeight;\n\n if (that.paging.enabled && that.paging.spinner.visible) {\n that.$.verticalScrollBarVisibility.classList.remove('jqx-hidden');\n }\n\n if (!that.computedVerticalScrollBarVisibility) {\n that.scrollTop = 0;\n }\n }", "function createScrollBarHandler(){\r\n $(SECTION_SEL).each(function(){\r\n var slides = $(this).find(SLIDE_SEL);\r\n\r\n if(slides.length){\r\n slides.each(function(){\r\n createScrollBar($(this));\r\n });\r\n }else{\r\n createScrollBar($(this));\r\n }\r\n\r\n });\r\n afterRenderActions();\r\n }", "function createScrollBarHandler(){\r\n $(SECTION_SEL).each(function(){\r\n var slides = $(this).find(SLIDE_SEL);\r\n\r\n if(slides.length){\r\n slides.each(function(){\r\n createScrollBar($(this));\r\n });\r\n }else{\r\n createScrollBar($(this));\r\n }\r\n\r\n });\r\n afterRenderActions();\r\n }", "function updateScrollbars(cm, measure) {\r\n if (!measure) measure = measureForScrollbars(cm);\r\n var d = cm.display, sWidth = scrollbarWidth(d.measure);\r\n var scrollHeight = measure.docHeight + scrollerCutOff;\r\n var needsH = measure.scrollWidth > measure.clientWidth;\r\n if (needsH && measure.scrollWidth <= measure.clientWidth + 1 &&\r\n sWidth > 0 && !measure.hScrollbarTakesSpace)\r\n needsH = false; // (Issue #2562)\r\n var needsV = scrollHeight > measure.clientHeight;\r\n\r\n if (needsV) {\r\n d.scrollbarV.style.display = \"block\";\r\n d.scrollbarV.style.bottom = needsH ? sWidth + \"px\" : \"0\";\r\n // A bug in IE8 can cause this value to be negative, so guard it.\r\n d.scrollbarV.firstChild.style.height =\r\n Math.max(0, scrollHeight - measure.clientHeight + (measure.barHeight || d.scrollbarV.clientHeight)) + \"px\";\r\n } else {\r\n d.scrollbarV.style.display = \"\";\r\n d.scrollbarV.firstChild.style.height = \"0\";\r\n }\r\n if (needsH) {\r\n d.scrollbarH.style.display = \"block\";\r\n d.scrollbarH.style.right = needsV ? sWidth + \"px\" : \"0\";\r\n d.scrollbarH.firstChild.style.width =\r\n (measure.scrollWidth - measure.clientWidth + (measure.barWidth || d.scrollbarH.clientWidth)) + \"px\";\r\n } else {\r\n d.scrollbarH.style.display = \"\";\r\n d.scrollbarH.firstChild.style.width = \"0\";\r\n }\r\n if (needsH && needsV) {\r\n d.scrollbarFiller.style.display = \"block\";\r\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = sWidth + \"px\";\r\n } else d.scrollbarFiller.style.display = \"\";\r\n if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\r\n d.gutterFiller.style.display = \"block\";\r\n d.gutterFiller.style.height = sWidth + \"px\";\r\n d.gutterFiller.style.width = d.gutters.offsetWidth + \"px\";\r\n } else d.gutterFiller.style.display = \"\";\r\n\r\n if (!cm.state.checkedOverlayScrollbar && measure.clientHeight > 0) {\r\n if (sWidth === 0) {\r\n var w = mac && !mac_geMountainLion ? \"12px\" : \"18px\";\r\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = w;\r\n var barMouseDown = function(e) {\r\n if (e_target(e) != d.scrollbarV && e_target(e) != d.scrollbarH)\r\n operation(cm, onMouseDown)(e);\r\n };\r\n on(d.scrollbarV, \"mousedown\", barMouseDown);\r\n on(d.scrollbarH, \"mousedown\", barMouseDown);\r\n }\r\n cm.state.checkedOverlayScrollbar = true;\r\n }\r\n }", "function updateScrollbars(cm, measure) {\n if (!measure) measure = measureForScrollbars(cm);\n var d = cm.display, sWidth = scrollbarWidth(d.measure);\n var scrollHeight = measure.docHeight + scrollerCutOff;\n var needsH = measure.scrollWidth > measure.clientWidth;\n if (needsH && measure.scrollWidth <= measure.clientWidth + 1 &&\n sWidth > 0 && !measure.hScrollbarTakesSpace)\n needsH = false; // (Issue #2562)\n var needsV = scrollHeight > measure.clientHeight;\n\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? sWidth + \"px\" : \"0\";\n // A bug in IE8 can cause this value to be negative, so guard it.\n d.scrollbarV.firstChild.style.height =\n Math.max(0, scrollHeight - measure.clientHeight + (measure.barHeight || d.scrollbarV.clientHeight)) + \"px\";\n } else {\n d.scrollbarV.style.display = \"\";\n d.scrollbarV.firstChild.style.height = \"0\";\n }\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? sWidth + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (measure.scrollWidth - measure.clientWidth + (measure.barWidth || d.scrollbarH.clientWidth)) + \"px\";\n } else {\n d.scrollbarH.style.display = \"\";\n d.scrollbarH.firstChild.style.width = \"0\";\n }\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = sWidth + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sWidth + \"px\";\n d.gutterFiller.style.width = d.gutters.offsetWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n\n if (!cm.state.checkedOverlayScrollbar && measure.clientHeight > 0) {\n if (sWidth === 0) {\n var w = mac && !mac_geMountainLion ? \"12px\" : \"18px\";\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = w;\n var barMouseDown = function(e) {\n if (e_target(e) != d.scrollbarV && e_target(e) != d.scrollbarH)\n operation(cm, onMouseDown)(e);\n };\n on(d.scrollbarV, \"mousedown\", barMouseDown);\n on(d.scrollbarH, \"mousedown\", barMouseDown);\n }\n cm.state.checkedOverlayScrollbar = true;\n }\n }", "function updateScrollbars(cm, measure) {\n if (!measure) measure = measureForScrollbars(cm);\n var d = cm.display, sWidth = scrollbarWidth(d.measure);\n var scrollHeight = measure.docHeight + scrollerCutOff;\n var needsH = measure.scrollWidth > measure.clientWidth;\n if (needsH && measure.scrollWidth <= measure.clientWidth + 1 &&\n sWidth > 0 && !measure.hScrollbarTakesSpace)\n needsH = false; // (Issue #2562)\n var needsV = scrollHeight > measure.clientHeight;\n\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? sWidth + \"px\" : \"0\";\n // A bug in IE8 can cause this value to be negative, so guard it.\n d.scrollbarV.firstChild.style.height =\n Math.max(0, scrollHeight - measure.clientHeight + (measure.barHeight || d.scrollbarV.clientHeight)) + \"px\";\n } else {\n d.scrollbarV.style.display = \"\";\n d.scrollbarV.firstChild.style.height = \"0\";\n }\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? sWidth + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (measure.scrollWidth - measure.clientWidth + (measure.barWidth || d.scrollbarH.clientWidth)) + \"px\";\n } else {\n d.scrollbarH.style.display = \"\";\n d.scrollbarH.firstChild.style.width = \"0\";\n }\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = sWidth + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sWidth + \"px\";\n d.gutterFiller.style.width = d.gutters.offsetWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n\n if (!cm.state.checkedOverlayScrollbar && measure.clientHeight > 0) {\n if (sWidth === 0) {\n var w = mac && !mac_geMountainLion ? \"12px\" : \"18px\";\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = w;\n var barMouseDown = function(e) {\n if (e_target(e) != d.scrollbarV && e_target(e) != d.scrollbarH)\n operation(cm, onMouseDown)(e);\n };\n on(d.scrollbarV, \"mousedown\", barMouseDown);\n on(d.scrollbarH, \"mousedown\", barMouseDown);\n }\n cm.state.checkedOverlayScrollbar = true;\n }\n }", "function updateScrollbars(cm, measure) {\n if (!measure) measure = measureForScrollbars(cm);\n var d = cm.display, sWidth = scrollbarWidth(d.measure);\n var scrollHeight = measure.docHeight + scrollerCutOff;\n var needsH = measure.scrollWidth > measure.clientWidth;\n if (needsH && measure.scrollWidth <= measure.clientWidth + 1 &&\n sWidth > 0 && !measure.hScrollbarTakesSpace)\n needsH = false; // (Issue #2562)\n var needsV = scrollHeight > measure.clientHeight;\n\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? sWidth + \"px\" : \"0\";\n // A bug in IE8 can cause this value to be negative, so guard it.\n d.scrollbarV.firstChild.style.height =\n Math.max(0, scrollHeight - measure.clientHeight + (measure.barHeight || d.scrollbarV.clientHeight)) + \"px\";\n } else {\n d.scrollbarV.style.display = \"\";\n d.scrollbarV.firstChild.style.height = \"0\";\n }\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? sWidth + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (measure.scrollWidth - measure.clientWidth + (measure.barWidth || d.scrollbarH.clientWidth)) + \"px\";\n } else {\n d.scrollbarH.style.display = \"\";\n d.scrollbarH.firstChild.style.width = \"0\";\n }\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = sWidth + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sWidth + \"px\";\n d.gutterFiller.style.width = d.gutters.offsetWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n\n if (!cm.state.checkedOverlayScrollbar && measure.clientHeight > 0) {\n if (sWidth === 0) {\n var w = mac && !mac_geMountainLion ? \"12px\" : \"18px\";\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = w;\n var barMouseDown = function(e) {\n if (e_target(e) != d.scrollbarV && e_target(e) != d.scrollbarH)\n operation(cm, onMouseDown)(e);\n };\n on(d.scrollbarV, \"mousedown\", barMouseDown);\n on(d.scrollbarH, \"mousedown\", barMouseDown);\n }\n cm.state.checkedOverlayScrollbar = true;\n }\n }", "function updateScrollbars(cm, measure) {\n if (!measure) measure = measureForScrollbars(cm);\n var d = cm.display, sWidth = scrollbarWidth(d.measure);\n var scrollHeight = measure.docHeight + scrollerCutOff;\n var needsH = measure.scrollWidth > measure.clientWidth;\n if (needsH && measure.scrollWidth <= measure.clientWidth + 1 &&\n sWidth > 0 && !measure.hScrollbarTakesSpace)\n needsH = false; // (Issue #2562)\n var needsV = scrollHeight > measure.clientHeight;\n\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? sWidth + \"px\" : \"0\";\n // A bug in IE8 can cause this value to be negative, so guard it.\n d.scrollbarV.firstChild.style.height =\n Math.max(0, scrollHeight - measure.clientHeight + (measure.barHeight || d.scrollbarV.clientHeight)) + \"px\";\n } else {\n d.scrollbarV.style.display = \"\";\n d.scrollbarV.firstChild.style.height = \"0\";\n }\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? sWidth + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (measure.scrollWidth - measure.clientWidth + (measure.barWidth || d.scrollbarH.clientWidth)) + \"px\";\n } else {\n d.scrollbarH.style.display = \"\";\n d.scrollbarH.firstChild.style.width = \"0\";\n }\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = sWidth + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sWidth + \"px\";\n d.gutterFiller.style.width = d.gutters.offsetWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n\n if (!cm.state.checkedOverlayScrollbar && measure.clientHeight > 0) {\n if (sWidth === 0) {\n var w = mac && !mac_geMountainLion ? \"12px\" : \"18px\";\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = w;\n var barMouseDown = function(e) {\n if (e_target(e) != d.scrollbarV && e_target(e) != d.scrollbarH)\n operation(cm, onMouseDown)(e);\n };\n on(d.scrollbarV, \"mousedown\", barMouseDown);\n on(d.scrollbarH, \"mousedown\", barMouseDown);\n }\n cm.state.checkedOverlayScrollbar = true;\n }\n }", "function initializeScrollbar() { \n $(\".mcustomScroll\").mCustomScrollbar({ \n theme:\"dark-3\",\n axis:\"yx\",\n advanced:{\n updateOnContentResize: true\n }\n });\n\n $(\".mcustomScroll.mcustomScrollVerticalOnly\").mCustomScrollbar({ \n theme:\"dark-3\",\n axis:\"y\",\n advanced:{\n updateOnContentResize: true\n }\n });\n }", "_refreshLayout() {\n const that = this;\n const source = that.rows;\n\n if (that._layoutSuspended) {\n return;\n }\n\n that._visibleRows = null;\n that.__viewRows = null;\n that.__clientSize = null;\n that.__scrollHeight = null;\n that.__scrollWidth = null;\n that.__parentCells = null;\n\n that.$.columnFarContainer.classList.remove('vscroll');\n that.$.columnNearContainer.classList.remove('vscroll');\n\n that.$.scrollView.classList.remove('hscroll');\n that.$.scrollView.classList.remove('vscroll');\n\n that._refreshElementsVisibility();\n that._refreshColumnHeights();\n that._refreshContentHeight();\n\n if (!(source && source.url)) {\n if (!source || source === null || source.length === 0 || that.columns.length === 0) {\n that.$.placeholder.classList.remove('smart-hidden');\n\n that.scrollWidth = 0;\n that.scrollHeight = 0;\n\n return;\n }\n }\n\n if (!that.__columnHeaderHeight) {\n that.__columnHeaderHeight = that.$.columnHeader.offsetHeight;\n }\n\n if (!that.__filterFooterOffsetHeight) {\n that.__filterFooterOffsetHeight = that.$.filterFooter.classList.contains('smart-hidden') ? 0 : that.$.filterFooter.offsetHeight;\n }\n\n const scrollViewOffsetHeight = that._contentHeight - that.__filterFooterOffsetHeight - that.__columnHeaderHeight;\n\n that.$.scrollView.style.height = scrollViewOffsetHeight + 'px';\n that.htmlColumnLastChild.style.height = that.__columnHeaderHeight + 'px';\n\n\n if (that.paging.spinner.enabled && that.paging.enabled) {\n if (!that.pageScroll) {\n const pageScroll = document.createElement('smart-scroll-bar');\n\n pageScroll.orientation = 'vertical';\n pageScroll.style.height = '100%';\n pageScroll.style.width = '100%';\n pageScroll.max = Math.ceil(that.dataSource.length / that.paging.pageSize);\n pageScroll.step = that.paging.spinner.step;\n pageScroll.largeStep = that.paging.spinner.step;\n pageScroll.setAttribute('spinner', '');\n pageScroll.setAttribute('smart-id', 'spinner');\n pageScroll.ownerElement = that;\n\n that.addPropertyBinding('[[paging_spinner_step]]', 'step', pageScroll, that.$.columnHeader);\n\n pageScroll.addEventListener('change', function (event) {\n that.paging.pageIndex = event.detail.value;\n });\n\n that.pageScroll = pageScroll;\n }\n\n that.htmlColumnLastChild.appendChild(that.pageScroll);\n }\n else {\n that.htmlColumnLastChild.innerHTML = '';\n }\n\n that._refreshScrollBars();\n\n }", "refreshVirtualScrollbars() {\n const { scrollBarWidth } = DomHelper;\n\n if (scrollBarWidth) {\n const me = this,\n { headerContainer, footerContainer, virtualScrollers } = me,\n hasVerticalOverflow = me.virtualScrollHeight > me.bodyHeight, //bodyContainer.scrollHeight > bodyContainer.clientHeight,\n // We need to ask each subGrid if it has horizontal overflow.\n // If any do, we show the virtual scroller, otherwise we hide it.\n hasHorizontalOverflow = Object.values(me.subGrids).some((subGrid) => subGrid.overflowingHorizontally);\n\n if (hasHorizontalOverflow) {\n virtualScrollers.classList.remove('b-hide-display');\n } else {\n virtualScrollers.classList.add('b-hide-display');\n }\n\n if (hasVerticalOverflow) {\n if (!headerContainer.classList.contains('b-grid-vertical-overflow')) {\n headerContainer.classList.add('b-grid-vertical-overflow');\n }\n } else {\n headerContainer.classList.remove('b-grid-vertical-overflow');\n }\n\n // can get called before headers are rendered. headers might also be hidden (such as in docs)\n const lastHeaderScroller = headerContainer.querySelector('.b-grid-header-scroller:last-child');\n if (lastHeaderScroller && hasVerticalOverflow) {\n const headerBorderWidth = parseInt(DomHelper.getStyleValue(lastHeaderScroller, 'border-right-width'));\n // Add a style to pad the header-container to clear the grid's vertical scrollbar\n // TODO: regions part of calculation is to compensate for 1px off with third region, but it should be solvable using CSS. Not finding how though...\n headerContainer.style.paddingRight =\n scrollBarWidth - headerBorderWidth + (me.regions.length > 2 ? 1 : 0) + 'px';\n footerContainer.style.paddingRight = `${scrollBarWidth}px`;\n } else {\n headerContainer.style.paddingRight = '0';\n footerContainer.style.paddingRight = '0';\n }\n }\n }", "_refreshVerticalScrollBarVisibility(scrollHeight) {\n const that = this;\n\n if (that._autoHeight) {\n that.scrollTop = 0;\n that.scrollHeight = 0;\n return;\n }\n\n if (that.computedHorizontalScrollBarVisibility) {\n scrollHeight += that.$.horizontalScrollBar.offsetHeight;\n }\n\n that.scrollHeight = scrollHeight;\n\n if (that.paging.enabled && that.paging.spinner.visible) {\n that.$.verticalScrollBarVisibility.classList.remove('smart-hidden');\n }\n\n if (!that.computedVerticalScrollBarVisibility) {\n that.scrollTop = 0;\n }\n }", "function ListView_UpdateScrollBars(theObject)\n{\n\t//content exits?\n\tif (theObject.Content && theObject.Content.Item_Panel)\n\t{\n\t\t//set scrollbars\n\t\ttheObject.Content.Item_Panel.style.overflowX = Get_Bool(theObject.Properties[__NEMESIS_PROPERTY_HORIZONTAL_SCROLL_BAR], true) ? \"auto\" : \"hidden\";\n\t\ttheObject.Content.Item_Panel.style.overflowY = Get_Bool(theObject.Properties[__NEMESIS_PROPERTY_VERTICAL_SCROLL_BAR], true) ? \"auto\" : \"hidden\";\n\t\t//has vertical scroll position?\n\t\tvar vertical = Get_String(theObject.Properties[__NEMESIS_PROPERTY_VERTICAL_SCROLL_POS], null);\n\t\t//and horizontal\n\t\tvar horizontal = Get_String(theObject.Properties[__NEMESIS_PROPERTY_HORIZONTAL_SCROLL_POS], null);\n\t\t//at least one is valid?\n\t\tif (vertical != null || horizontal != null)\n\t\t{\n\t\t\t//vertical?\n\t\t\tif (vertical != null)\n\t\t\t{\n\t\t\t\t//set vertical\n\t\t\t\ttheObject.Content.Item_Panel.scrollTop = vertical * theObject.Content.Item_Height;\n\t\t\t}\n\t\t\t//has horizontal\n\t\t\tif (horizontal != null)\n\t\t\t{\n\t\t\t\t//set horizontal\n\t\t\t\ttheObject.Content.Item_Panel.scrollLeft = horizontal;\n\t\t\t\t//has header panel?\n\t\t\t\tif (theObject.Content.Header_Panel)\n\t\t\t\t{\n\t\t\t\t\t//match scroll pos\n\t\t\t\t\ttheObject.Content.Header_Panel.scrollLeft = theObject.Content.Item_Panel.scrollLeft;\n\t\t\t\t}\n\t\t\t}\n\t\t\t//trigger a repaint\n\t\t\tListView_Paint(theObject);\n\t\t}\n\t}\n}", "static resetScrollBarWidth() {\n scrollBarWidth = null;\n }", "static resetScrollBarWidth() {\n scrollBarWidth = null;\n }", "function measureForScrollbars(cm) {\n\t\t var d = cm.display, gutterW = d.gutters.offsetWidth;\n\t\t var docH = Math.round(cm.doc.height + paddingVert(cm.display));\n\t\t return {\n\t\t clientHeight: d.scroller.clientHeight,\n\t\t viewHeight: d.wrapper.clientHeight,\n\t\t scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,\n\t\t viewWidth: d.wrapper.clientWidth,\n\t\t barLeft: cm.options.fixedGutter ? gutterW : 0,\n\t\t docHeight: docH,\n\t\t scrollHeight: docH + scrollGap(cm) + d.barHeight,\n\t\t nativeBarWidth: d.nativeBarWidth,\n\t\t gutterWidth: gutterW\n\t\t };\n\t\t }", "function measureForScrollbars(cm) {\n\t\t var d = cm.display, gutterW = d.gutters.offsetWidth;\n\t\t var docH = Math.round(cm.doc.height + paddingVert(cm.display));\n\t\t return {\n\t\t clientHeight: d.scroller.clientHeight,\n\t\t viewHeight: d.wrapper.clientHeight,\n\t\t scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,\n\t\t viewWidth: d.wrapper.clientWidth,\n\t\t barLeft: cm.options.fixedGutter ? gutterW : 0,\n\t\t docHeight: docH,\n\t\t scrollHeight: docH + scrollGap(cm) + d.barHeight,\n\t\t nativeBarWidth: d.nativeBarWidth,\n\t\t gutterWidth: gutterW\n\t\t }\n\t\t }", "function adjustPagesForScrollBar() {\n var scrollBarWidth = 0;\n $.each($(\".page\"), function () {\n var $page = $(this);\n if ($page.css(\"display\") != \"none\") {\n var $pageRowScrollContainer = $page.children(\".pageRowScrollContainer\");\n if ($pageRowScrollContainer.outerWidth(true) > $pageRowScrollContainer.children(\".pageRow\").outerWidth(true)) {\n scrollBarWidth = $pageRowScrollContainer.outerWidth(true) - $pageRowScrollContainer.children(\".pageRow\").outerWidth(true);\n $page.children(\".pageTitles\").css(\"padding-right\", scrollBarWidth + \"px\");\n } else {\n $page.children(\".pageTitles\").css(\"padding-right\", \"\");\n }\n }\n });\n\n var $comparePage = $(\".comparePage\");\n if ($comparePage.css(\"display\") != \"none\") {\n var $compareRowsContainer = $comparePage.children(\".compareRows\");\n if ($compareRowsContainer.outerWidth(true) > $compareRowsContainer.children(\".pageRow\").outerWidth(true)) {\n scrollBarWidth = $compareRowsContainer.outerWidth(true) - $compareRowsContainer.children(\".pageRow\").outerWidth(true);\n $comparePage.children(\".comparePageTitles\").css(\"padding-right\", scrollBarWidth + \"px\");\n } else {\n $comparePage.children(\".comparePageTitles\").css(\"padding-right\", \"\");\n }\n }\n }", "initSnap(){\n\t\tthis.currentPage = {};\n\t\tconst snap = this.options.snap;\n\n\t\tif (snap.loop) {\n\t\t\tlet children = this.scroller.children;\n\t\t\tif (children.length > 0) {\n\t\t\t\tprepend(children[children.length - 1].cloneNode(true), this.scroller);\n\t\t\t\tthis.scroller.appendChild(children[1].cloneNode(true));\n\t\t\t}\n\t\t}\n\n\t\tlet el = snap.el;\n\t\tif (typeof el === 'string') {\n\t\t\tel = this.scroller.querySelectorAll(el);\n\t\t}\n\n\t\tthis.on('refresh', () => {\n\t\t\tthis.pages = [];\n\n\t\t\tif (!this.wrapperWidth || !this.wrapperHeight || !this.scrollerWidth || !this.scrollerHeight) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet stepX = snap.stepX || this.wrapperWidth;\n\t\t\tlet stepY = snap.stepY || this.wrapperHeight;\n\n\t\t\tlet x = 0;\n\t\t\tlet y;\n\t\t\tlet cx;\n\t\t\tlet cy;\n\t\t\tlet i = 0;\n\t\t\tlet l;\n\t\t\tlet m = 0;\n\t\t\tlet n;\n\t\t\tlet rect;\n\t\t\tif (!el) {\n\t\t\t\tcx = Math.round(stepX / 2);\n\t\t\t\tcy = Math.round(stepY / 2);\n\n\t\t\t\twhile (x > -this.scrollerWidth) {\n\t\t\t\t\tthis.pages[i] = [];\n\t\t\t\t\tl = 0;\n\t\t\t\t\ty = 0;\n\n\t\t\t\t\twhile (y > -this.scrollerHeight) {\n\t\t\t\t\t\tthis.pages[i][l] = {\n\t\t\t\t\t\t\tx: Math.max(x, this.maxScrollX),\n\t\t\t\t\t\t\ty: Math.max(y, this.maxScrollY),\n\t\t\t\t\t\t\twidth: stepX,\n\t\t\t\t\t\t\theight: stepY,\n\t\t\t\t\t\t\tcx: x - cx,\n\t\t\t\t\t\t\tcy: y - cy\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\ty -= stepY;\n\t\t\t\t\t\tl++;\n\t\t\t\t\t}\n\n\t\t\t\t\tx -= stepX;\n\t\t\t\t\ti++;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tl = el.length;\n\t\t\t\tn = -1;\n\n\t\t\t\tfor (; i < l; i++) {\n\t\t\t\t\trect = getRect(el[i]);\n\t\t\t\t\tif (i === 0 || rect.left <= getRect(el[i - 1]).left) {\n\t\t\t\t\t\tm = 0;\n\t\t\t\t\t\tn++;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!this.pages[m]) {\n\t\t\t\t\t\tthis.pages[m] = [];\n\t\t\t\t\t}\n\n\t\t\t\t\tx = Math.max(-rect.left, this.maxScrollX);\n\t\t\t\t\ty = Math.max(-rect.top, this.maxScrollY);\n\t\t\t\t\tcx = x - Math.round(rect.width / 2);\n\t\t\t\t\tcy = y - Math.round(rect.height / 2);\n\n\t\t\t\t\tthis.pages[m][n] = {\n\t\t\t\t\t\tx: x,\n\t\t\t\t\t\ty: y,\n\t\t\t\t\t\twidth: rect.width,\n\t\t\t\t\t\theight: rect.height,\n\t\t\t\t\t\tcx: cx,\n\t\t\t\t\t\tcy: cy\n\t\t\t\t\t};\n\n\t\t\t\t\tif (x > this.maxScrollX) {\n\t\t\t\t\t\tm++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet initPage = snap.loop ? 1 : 0;\n\t\t\tthis.goToPage(this.currentPage.pageX || initPage, this.currentPage.pageY || 0, 0);\n\n\t\t\tconst snapThreshold = snap.threshold;\n\t\t\tif (snapThreshold % 1 === 0) {\n\t\t\t\tthis.snapThresholdX = snapThreshold;\n\t\t\t\tthis.snapThresholdY = snapThreshold;\n\t\t\t} else {\n\t\t\t\tthis.snapThresholdX = Math.round(this.pages[this.currentPage.pageX][this.currentPage.pageY].width * snapThreshold);\n\t\t\t\tthis.snapThresholdY = Math.round(this.pages[this.currentPage.pageX][this.currentPage.pageY].height * snapThreshold);\n\t\t\t}\n\t\t});\n\n\t\tthis.on('scrollEnd', () => {\n\t\t\tif (snap.loop) {\n\t\t\t\tif (this.currentPage.pageX === 0) {\n\t\t\t\t\tthis.goToPage(this.pages.length - 2, this.currentPage.pageY, 0);\n\t\t\t\t}\n\t\t\t\tif (this.currentPage.pageX === this.pages.length - 1) {\n\t\t\t\t\tthis.goToPage(1, this.currentPage.pageY, 0);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tif (snap.listenFlick !== false) {\n\t\t\tthis.on('flick', () => {\n\t\t\t\tlet time = snap.speed || Math.max(\n\t\t\t\t\tMath.max(\n\t\t\t\t\t\tMath.min(Math.abs(this.x - this.startX), 1000),\n\t\t\t\t\t\tMath.min(Math.abs(this.y - this.startY), 1000)\n\t\t\t\t\t), 300);\n\n\t\t\t\tthis.goToPage(\n\t\t\t\t\tthis.currentPage.pageX + this.directionX,\n\t\t\t\t\tthis.currentPage.pageY + this.directionY,\n\t\t\t\t\ttime\n\t\t\t\t);\n\t\t\t});\n\t\t}\n\t}", "_handleScrollbarsDisplay(event) {\n const that = this,\n textBox = that.$.input;\n\n setTimeout(function () {\n switch (that.horizontalScrollBarVisibility) {\n case 'disabled':\n that.$container.addClass('hscroll');\n that.$.horizontalScrollBar.disabled = true;\n break;\n case 'hidden':\n that.$container.removeClass('hscroll');\n break;\n case 'visible':\n that.$container.addClass('hscroll');\n that._scrollView.scrollWidth = textBox.scrollWidth - textBox.clientWidth;\n that._scrollView.scrollTo(that.$.input.scrollLeft, true);\n that.$.horizontalScrollBar.disabled = false;\n break;\n default:\n if (textBox.scrollWidth > textBox.clientWidth) {\n that.$container.addClass('hscroll');\n\n that._scrollView.scrollWidth = textBox.scrollWidth - textBox.clientWidth;\n\n if (event && event.type === 'resize') {\n that.$.input.scrollLeft = that._scrollView.scrollLeft;\n }\n else {\n that._scrollView.scrollTo(that.$.input.scrollLeft, true);\n }\n }\n else {\n that.$container.removeClass('hscroll');\n }\n that.$.horizontalScrollBar.disabled = false;\n }\n\n switch (that.verticalScrollBarVisibility) {\n case 'disabled':\n that.$container.addClass('vscroll');\n that.$.verticalScrollBar.disabled = true;\n break;\n case 'hidden':\n that.$container.removeClass('vscroll');\n break;\n case 'visible':\n that.$container.addClass('vscroll');\n that._scrollView.scrollHeight = textBox.scrollHeight - textBox.clientHeight;\n that._scrollView.scrollTo(that.$.input.scrollTop);\n that.$.verticalScrollBar.disabled = false;\n break;\n default:\n if (textBox.scrollHeight > textBox.clientHeight) {\n that.$container.addClass('vscroll');\n\n that._scrollView.scrollHeight = textBox.scrollHeight - textBox.clientHeight;\n\n if (event && event.type === 'resize') {\n that.$.input.scrollTop = that._scrollView.scrollTop;\n }\n else {\n that._scrollView.scrollTo(that.$.input.scrollTop);\n }\n }\n else {\n that.$container.removeClass('vscroll');\n }\n that.$.verticalScrollBar.disabled = false;\n }\n }, 0);\n\n }", "function measureForScrollbars(cm) {\n\t var d = cm.display, gutterW = d.gutters.offsetWidth;\n\t var docH = Math.round(cm.doc.height + paddingVert(cm.display));\n\t return {\n\t clientHeight: d.scroller.clientHeight,\n\t viewHeight: d.wrapper.clientHeight,\n\t scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,\n\t viewWidth: d.wrapper.clientWidth,\n\t barLeft: cm.options.fixedGutter ? gutterW : 0,\n\t docHeight: docH,\n\t scrollHeight: docH + scrollGap(cm) + d.barHeight,\n\t nativeBarWidth: d.nativeBarWidth,\n\t gutterWidth: gutterW\n\t };\n\t }", "function measureForScrollbars(cm) {\n\t var d = cm.display, gutterW = d.gutters.offsetWidth;\n\t var docH = Math.round(cm.doc.height + paddingVert(cm.display));\n\t return {\n\t clientHeight: d.scroller.clientHeight,\n\t viewHeight: d.wrapper.clientHeight,\n\t scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,\n\t viewWidth: d.wrapper.clientWidth,\n\t barLeft: cm.options.fixedGutter ? gutterW : 0,\n\t docHeight: docH,\n\t scrollHeight: docH + scrollGap(cm) + d.barHeight,\n\t nativeBarWidth: d.nativeBarWidth,\n\t gutterWidth: gutterW\n\t };\n\t }", "function measureForScrollbars(cm) {\n\t var d = cm.display, gutterW = d.gutters.offsetWidth;\n\t var docH = Math.round(cm.doc.height + paddingVert(cm.display));\n\t return {\n\t clientHeight: d.scroller.clientHeight,\n\t viewHeight: d.wrapper.clientHeight,\n\t scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,\n\t viewWidth: d.wrapper.clientWidth,\n\t barLeft: cm.options.fixedGutter ? gutterW : 0,\n\t docHeight: docH,\n\t scrollHeight: docH + scrollGap(cm) + d.barHeight,\n\t nativeBarWidth: d.nativeBarWidth,\n\t gutterWidth: gutterW\n\t };\n\t }", "function initProgressBars(){\n\t\"use strict\";\n\n\tif($j('.q_progress_bar').length){\n\t\t$j('.q_progress_bar').each(function() {\n\t\t\tif($j(this).parents('.vertical_split_slider').length){\n\t\t\t\tinitToCounterHorizontalProgressBar($j(this));\n\t\t\t\tvar percentage = $j(this).find('.progress_content').data('percentage');\n\t\t\t\t$j(this).find('.progress_content').css('width', '0%');\n\t\t\t\t$j(this).find('.progress_content').animate({'width': percentage+'%'}, 1500);\n\t\t\t\t$j(this).find('.progress_number_wrapper').css('width', '0%');\n\t\t\t\t$j(this).find('.progress_number_wrapper').animate({'width': percentage+'%'}, 1500);\n\t\t\t}\n else {\n\t\t\t\t$j(this).appear(function() {\n\t\t\t\t\tinitToCounterHorizontalProgressBar($j(this));\n\t\t\t\t\tvar percentage = $j(this).find('.progress_content').data('percentage');\n\t\t\t\t\t$j(this).find('.progress_content').css('width', '0%');\n\t\t\t\t\t$j(this).find('.progress_content').animate({'width': percentage+'%'}, 1500);\n\t\t\t\t\t$j(this).find('.progress_number_wrapper').css('width', '0%');\n\t $j(this).find('.progress_number_wrapper').animate({'width': percentage+'%'}, 1500);\n\t \n\t\t\t\t\t\n\t\t\t\t},{accX: 0, accY: -200});\n\t\t\t}\n\t\t});\n\t}\n}", "function measureForScrollbars(cm) {\n var d = cm.display, gutterW = d.gutters.offsetWidth;\n var docH = Math.round(cm.doc.height + paddingVert(cm.display));\n return {\n clientHeight: d.scroller.clientHeight,\n viewHeight: d.wrapper.clientHeight,\n scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,\n viewWidth: d.wrapper.clientWidth,\n barLeft: cm.options.fixedGutter ? gutterW : 0,\n docHeight: docH,\n scrollHeight: docH + scrollGap(cm) + d.barHeight,\n nativeBarWidth: d.nativeBarWidth,\n gutterWidth: gutterW\n };\n }", "function measureForScrollbars(cm) {\n var d = cm.display, gutterW = d.gutters.offsetWidth;\n var docH = Math.round(cm.doc.height + paddingVert(cm.display));\n return {\n clientHeight: d.scroller.clientHeight,\n viewHeight: d.wrapper.clientHeight,\n scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,\n viewWidth: d.wrapper.clientWidth,\n barLeft: cm.options.fixedGutter ? gutterW : 0,\n docHeight: docH,\n scrollHeight: docH + scrollGap(cm) + d.barHeight,\n nativeBarWidth: d.nativeBarWidth,\n gutterWidth: gutterW\n };\n }", "function measureForScrollbars(cm) {\n var d = cm.display, gutterW = d.gutters.offsetWidth;\n var docH = Math.round(cm.doc.height + paddingVert(cm.display));\n return {\n clientHeight: d.scroller.clientHeight,\n viewHeight: d.wrapper.clientHeight,\n scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,\n viewWidth: d.wrapper.clientWidth,\n barLeft: cm.options.fixedGutter ? gutterW : 0,\n docHeight: docH,\n scrollHeight: docH + scrollGap(cm) + d.barHeight,\n nativeBarWidth: d.nativeBarWidth,\n gutterWidth: gutterW\n };\n }", "function measureForScrollbars(cm) {\n var d = cm.display, gutterW = d.gutters.offsetWidth;\n var docH = Math.round(cm.doc.height + paddingVert(cm.display));\n return {\n clientHeight: d.scroller.clientHeight,\n viewHeight: d.wrapper.clientHeight,\n scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,\n viewWidth: d.wrapper.clientWidth,\n barLeft: cm.options.fixedGutter ? gutterW : 0,\n docHeight: docH,\n scrollHeight: docH + scrollGap(cm) + d.barHeight,\n nativeBarWidth: d.nativeBarWidth,\n gutterWidth: gutterW\n };\n }" ]
[ "0.69221926", "0.6867306", "0.68645257", "0.681939", "0.6619201", "0.6619201", "0.6619201", "0.66106427", "0.6462986", "0.6462986", "0.6462986", "0.6459632", "0.64464295", "0.639866", "0.6393667", "0.6378429", "0.6358009", "0.63557327", "0.63541985", "0.63348293", "0.63275594", "0.6313843", "0.6305723", "0.63052005", "0.6288074", "0.6288074", "0.6288074", "0.6284552", "0.6284552", "0.6284552", "0.6284552", "0.6284552", "0.6284552", "0.6284552", "0.6284552", "0.6284552", "0.6284552", "0.6284552", "0.6284552", "0.6284552", "0.6284552", "0.6284552", "0.6284552", "0.6284552", "0.62732255", "0.6210748", "0.6210748", "0.62072736", "0.6177655", "0.6177655", "0.6177655", "0.6177655", "0.6177655", "0.6177655", "0.6177655", "0.6177655", "0.6177655", "0.6177655", "0.6177655", "0.61689055", "0.61392856", "0.60953075", "0.60953075", "0.60775936", "0.6062216", "0.6062216", "0.60602", "0.60299873", "0.60299873", "0.60299873", "0.60299873", "0.59418213", "0.5937835", "0.5933595", "0.5915984", "0.5910091", "0.59090006", "0.59090006", "0.58471626", "0.58450997", "0.5810602", "0.5773404", "0.57450044", "0.5737375", "0.5737375", "0.5737375", "0.573179", "0.5676639", "0.5676639", "0.5676639", "0.5676639" ]
0.0
-1
Resynchronize the fake scrollbars with the actual size of the content.
function updateScrollbarsInner(cm, measure) { var d = cm.display; var sizes = d.scrollbars.update(measure); d.sizer.style.paddingRight = (d.barWidth = sizes.right) + "px"; d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + "px"; d.heightForcer.style.borderBottom = sizes.bottom + "px solid transparent"; if (sizes.right && sizes.bottom) { d.scrollbarFiller.style.display = "block"; d.scrollbarFiller.style.height = sizes.bottom + "px"; d.scrollbarFiller.style.width = sizes.right + "px"; } else { d.scrollbarFiller.style.display = ""; } if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) { d.gutterFiller.style.display = "block"; d.gutterFiller.style.height = sizes.bottom + "px"; d.gutterFiller.style.width = measure.gutterWidth + "px"; } else { d.gutterFiller.style.display = ""; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updateScrollableContents() {\n if (this.intervalId_ !== null) {\n return;\n } // notifyResize is already in progress.\n\n this.requestUpdateScroll();\n\n const nodeList = this.shadowRoot.querySelectorAll('[scrollable] iron-list');\n if (!nodeList.length) {\n return;\n }\n\n let nodesToResize = Array.from(nodeList).map(node => ({\n node: node,\n lastScrollHeight: 0,\n }));\n // Use setInterval to avoid initial render / sizing issues.\n this.intervalId_ = window.setInterval(() => {\n const checkAgain = [];\n nodesToResize.forEach(({node, lastScrollHeight}) => {\n const scrollHeight = node.parentNode.scrollHeight;\n // A hidden scroll-container has a height of 0. When not hidden, it has\n // a min-height of 1px and the iron-list needs a resize to show the\n // initial items and update the |scrollHeight|. The initial item count\n // is determined by the |scrollHeight|. A scrollHeight of 1px will\n // result in the minimum default item count (currently 3). After the\n // |scrollHeight| is updated to be greater than 1px, another resize is\n // needed to correctly calculate the number of physical iron-list items\n // to render.\n if (scrollHeight !== lastScrollHeight) {\n const ironList = /** @type {!IronListElement} */ (node);\n ironList.notifyResize();\n }\n\n // TODO(crbug.com/1121679): Add UI Test for this behavior.\n if (scrollHeight <= 1 &&\n window.getComputedStyle(node.parentNode).display !== 'none') {\n checkAgain.push({\n node: node,\n lastScrollHeight: scrollHeight,\n });\n }\n });\n if (checkAgain.length === 0) {\n window.clearInterval(this.intervalId_);\n this.intervalId_ = null;\n } else {\n nodesToResize = checkAgain;\n }\n }, 10);\n }", "function updateScrollbarsInner(cm, measure) {\n\t var d = cm.display;\n\t var sizes = d.scrollbars.update(measure);\n\n\t d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n\t d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n\n\t if (sizes.right && sizes.bottom) {\n\t d.scrollbarFiller.style.display = \"block\";\n\t d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n\t d.scrollbarFiller.style.width = sizes.right + \"px\";\n\t } else d.scrollbarFiller.style.display = \"\";\n\t if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n\t d.gutterFiller.style.display = \"block\";\n\t d.gutterFiller.style.height = sizes.bottom + \"px\";\n\t d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n\t } else d.gutterFiller.style.display = \"\";\n\t }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\"\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n }", "function updateScrollbarsInner(cm, measure) {\n\t var d = cm.display;\n\t var sizes = d.scrollbars.update(measure);\n\n\t d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n\t d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n\t d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\"\n\n\t if (sizes.right && sizes.bottom) {\n\t d.scrollbarFiller.style.display = \"block\";\n\t d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n\t d.scrollbarFiller.style.width = sizes.right + \"px\";\n\t } else d.scrollbarFiller.style.display = \"\";\n\t if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n\t d.gutterFiller.style.display = \"block\";\n\t d.gutterFiller.style.height = sizes.bottom + \"px\";\n\t d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n\t } else d.gutterFiller.style.display = \"\";\n\t }", "function updateScrollbarsInner(cm, measure) {\n\t\t var d = cm.display;\n\t\t var sizes = d.scrollbars.update(measure);\n\t\t\n\t\t d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n\t\t d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n\t\t d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\"\n\t\t\n\t\t if (sizes.right && sizes.bottom) {\n\t\t d.scrollbarFiller.style.display = \"block\";\n\t\t d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n\t\t d.scrollbarFiller.style.width = sizes.right + \"px\";\n\t\t } else d.scrollbarFiller.style.display = \"\";\n\t\t if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n\t\t d.gutterFiller.style.display = \"block\";\n\t\t d.gutterFiller.style.height = sizes.bottom + \"px\";\n\t\t d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n\t\t } else d.gutterFiller.style.display = \"\";\n\t\t }", "function updateScrollbarsInner(cm, measure) {\n\t var d = cm.display;\n\t var sizes = d.scrollbars.update(measure);\n\t\n\t d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n\t d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n\t d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\"\n\t\n\t if (sizes.right && sizes.bottom) {\n\t d.scrollbarFiller.style.display = \"block\";\n\t d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n\t d.scrollbarFiller.style.width = sizes.right + \"px\";\n\t } else d.scrollbarFiller.style.display = \"\";\n\t if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n\t d.gutterFiller.style.display = \"block\";\n\t d.gutterFiller.style.height = sizes.bottom + \"px\";\n\t d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n\t } else d.gutterFiller.style.display = \"\";\n\t }", "function updateScrollbarsInner(cm, measure) {\n\t\t var d = cm.display;\n\t\t var sizes = d.scrollbars.update(measure);\n\n\t\t d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n\t\t d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n\t\t d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n\t\t if (sizes.right && sizes.bottom) {\n\t\t d.scrollbarFiller.style.display = \"block\";\n\t\t d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n\t\t d.scrollbarFiller.style.width = sizes.right + \"px\";\n\t\t } else { d.scrollbarFiller.style.display = \"\"; }\n\t\t if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n\t\t d.gutterFiller.style.display = \"block\";\n\t\t d.gutterFiller.style.height = sizes.bottom + \"px\";\n\t\t d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n\t\t } else { d.gutterFiller.style.display = \"\"; }\n\t\t }", "updateScrollerSize_() {\n if (this.$.selector.items.length !== 0) {\n const estScrollHeight = this.items.length * this.domItemAverageHeight_();\n this.$.items.style.height = estScrollHeight + 'px';\n }\n }", "_resizeHandler() {\n const that = this;\n\n that.$.scrollableContainer.refresh();\n }", "_refreshLayout() {\n const that = this;\n const source = that._items;\n\n that.__scrollHeight = null;\n that.__scrollWidth = null;\n that._height = null;\n\n if (!that._scrollView) {\n that._scrollView = new JQX.Utilities.Scroll(that, that.$.horizontalScrollBar, that.$.verticalScrollBar);\n }\n\n that.$itemsContainer.removeClass('hscroll');\n that.$itemsContainer.removeClass('vscroll');\n\n if (!source || source === null || source.length === 0) {\n that.scrollWidth = 0;\n that.scrollHeight = 0;\n that.$filterInputContainer.removeClass('vscroll');\n that.$placeholder.removeClass('jqx-hidden');\n\n if (that.isVirtualized) {\n that._recycle();\n }\n\n return;\n }\n\n that.$placeholder.addClass('jqx-hidden');\n\n const horizontalOffset = 2 * (parseInt(getComputedStyle(that.$.itemsInnerContainer).getPropertyValue('--jqx-list-item-horizontal-offset')) || 0);\n\n let hScrollWidth = that._scrollWidth - that.$.itemsContainer.offsetWidth - horizontalOffset;\n let vScrollHeight = that._scrollHeight;\n\n that._refreshHorizontalScrollBarVisibility(hScrollWidth);\n that._refreshVerticalScrollBarVisibility(vScrollHeight);\n\n\n if (that.horizontalScrollBarVisibility === 'hidden') {\n that.$.itemsInnerContainer.style.width = that.$.itemsContainer.offsetWidth - horizontalOffset;\n }\n else {\n that.$.itemsInnerContainer.style.width = Math.max(that.$.itemsContainer.offsetWidth - horizontalOffset, -horizontalOffset + that.__scrollWidth) + 'px';\n }\n\n if (that.computedVerticalScrollBarVisibility) {\n hScrollWidth = that._scrollWidth - that.$.itemsContainer.offsetWidth - that._scrollView.vScrollBar.offsetWidth;\n that._refreshHorizontalScrollBarVisibility(hScrollWidth);\n\n if (that.horizontalScrollBarVisibility !== 'hidden') {\n that.$.itemsInnerContainer.style.width = Math.max(that.$.itemsContainer.offsetWidth - horizontalOffset, -horizontalOffset + that.__scrollWidth - that._scrollView.vScrollBar.offsetWidth) + 'px';\n }\n\n if (that.computedHorizontalScrollBarVisibility) {\n if (!(that.horizontalScrollBarVisibility === 'visible' && that.scrollWidth === 0)) {\n that.__scrollHeight += that._scrollView.hScrollBar.offsetHeight;\n }\n else if (that.horizontalScrollBarVisibility === 'visible') {\n that.__scrollHeight += that._scrollView.hScrollBar.offsetHeight;\n }\n\n that.scrollHeight = that.__scrollHeight;\n }\n\n if (that.isVirtualized) {\n that._recycle();\n }\n\n return;\n }\n\n hScrollWidth = that._scrollWidth - that.$.itemsContainer.offsetWidth - horizontalOffset;\n that._refreshHorizontalScrollBarVisibility(hScrollWidth);\n\n if (that.computedHorizontalScrollBarVisibility) {\n that.scrollHeight = that._scrollHeight;\n that._refreshVerticalScrollBarVisibility(that.scrollHeight);\n\n //Resize event not thrown after 'bottom-corner' is applied\n if (that._scrollView.vScrollBar.$.hasClass('bottom-corner')) {\n that._scrollView.vScrollBar.refresh();\n }\n }\n\n if (that.isVirtualized) {\n that._recycle();\n }\n\n const isIE = /Trident|Edge/.test(navigator.userAgent);\n if (!that.isRefreshing && isIE) {\n setTimeout(function () {\n that.isRefreshing = true;\n that._refreshLayout();\n that.isRefreshing = false;\n }, 50);\n }\n }", "function updateScrollbarsInner(cm, measure) {\r\n var d = cm.display;\r\n var sizes = d.scrollbars.update(measure);\r\n\r\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\r\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\r\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\r\n\r\n if (sizes.right && sizes.bottom) {\r\n d.scrollbarFiller.style.display = \"block\";\r\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\r\n d.scrollbarFiller.style.width = sizes.right + \"px\";\r\n } else { d.scrollbarFiller.style.display = \"\"; }\r\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\r\n d.gutterFiller.style.display = \"block\";\r\n d.gutterFiller.style.height = sizes.bottom + \"px\";\r\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\r\n } else { d.gutterFiller.style.display = \"\"; }\r\n}", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display\n var sizes = d.scrollbars.update(measure)\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\"\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\"\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\"\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\"\n d.scrollbarFiller.style.height = sizes.bottom + \"px\"\n d.scrollbarFiller.style.width = sizes.right + \"px\"\n } else { d.scrollbarFiller.style.display = \"\" }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\"\n d.gutterFiller.style.height = sizes.bottom + \"px\"\n d.gutterFiller.style.width = measure.gutterWidth + \"px\"\n } else { d.gutterFiller.style.display = \"\" }\n}", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display\n var sizes = d.scrollbars.update(measure)\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\"\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\"\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\"\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\"\n d.scrollbarFiller.style.height = sizes.bottom + \"px\"\n d.scrollbarFiller.style.width = sizes.right + \"px\"\n } else { d.scrollbarFiller.style.display = \"\" }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\"\n d.gutterFiller.style.height = sizes.bottom + \"px\"\n d.gutterFiller.style.width = measure.gutterWidth + \"px\"\n } else { d.gutterFiller.style.display = \"\" }\n}", "refreshVirtualScrollbars() {\n // NOTE: This was at some point changed to only run on platforms with width-occupying scrollbars, but it needs\n // to run with overlayed scrollbars also to make them show/hide as they should.\n const me = this,\n {\n headerContainer,\n footerContainer,\n virtualScrollers,\n hasVerticalOverflow\n } = me,\n // We need to ask each subGrid if it has horizontal overflow.\n // If any do, we show the virtual scroller, otherwise we hide it.\n hasHorizontalOverflow = Object.values(me.subGrids).some(subGrid => subGrid.overflowingHorizontally),\n method = hasVerticalOverflow ? 'add' : 'remove';\n\n if (hasHorizontalOverflow) {\n virtualScrollers.classList.remove('b-hide-display');\n } else {\n virtualScrollers.classList.add('b-hide-display');\n } // Auto-widthed padding element at end hides or shows to create matching margin.\n\n if (DomHelper.scrollBarWidth) {\n headerContainer.classList[method]('b-show-yscroll-padding');\n footerContainer.classList[method]('b-show-yscroll-padding');\n virtualScrollers.classList[method]('b-show-yscroll-padding');\n } // Change of scrollbar status means height change\n\n me.onHeightChange();\n }", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n}", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n}", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n}", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n}", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n}", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n}", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n}", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n}", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n}", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n}", "function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n}", "function sizeScrollbar() {\n var remainder = $scrollContent.width() - $scrollPane.width();\n var proportion = remainder / $scrollContent.width();\n var handleSize = $scrollPane.width() - (proportion * $scrollPane.width());\n $scrollbar.find(\".ui-slider-handle\").css({\n width: handleSize,\n \"margin-left\": -handleSize / 2\n });\n handleHelper.width(\"\").width($scrollbar.width() - handleSize);\n }", "function sizeScrollbar(){\n\t\tvar remainder = scrollContent.width() - scrollPane.width();\n\t\tvar proportion = remainder / scrollContent.width();\n\t\tvar handleSize = scrollPane.width() - (proportion * scrollPane.width());\n\t\tscrollbar.find('.ui-slider-handle').css({\n\t\t\twidth: handleSize,\n\t\t\t'margin-left': -handleSize/2\n\t\t});\n\t\thandleHelper.width('').width( scrollbar.width() - handleSize);\n\t}", "function sizeScrollbar() {\n\t\t\t}", "function updateScrollbars(d /* display */, docHeight) {\n var totalHeight = docHeight + 2 * paddingTop(d);\n d.sizer.style.minHeight = d.heightForcer.style.top = totalHeight + \"px\";\n var scrollHeight = Math.max(totalHeight, d.scroller.scrollHeight);\n var needsH = d.scroller.scrollWidth > d.scroller.clientWidth;\n var needsV = scrollHeight > d.scroller.clientHeight;\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarV.firstChild.style.height = \n (scrollHeight - d.scroller.clientHeight + d.scrollbarV.clientHeight) + \"px\";\n } else d.scrollbarV.style.display = \"\";\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (d.scroller.scrollWidth - d.scroller.clientWidth + d.scrollbarH.clientWidth) + \"px\";\n } else d.scrollbarH.style.display = \"\";\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = scrollbarWidth(d.measure) + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n\n if (mac_geLion && scrollbarWidth(d.measure) === 0)\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = mac_geMountainLion ? \"18px\" : \"12px\";\n }", "function updateScrollbars(d /* display */, docHeight) {\n var totalHeight = docHeight + 2 * paddingTop(d);\n d.sizer.style.minHeight = d.heightForcer.style.top = totalHeight + \"px\";\n var scrollHeight = Math.max(totalHeight, d.scroller.scrollHeight);\n var needsH = d.scroller.scrollWidth > d.scroller.clientWidth;\n var needsV = scrollHeight > d.scroller.clientHeight;\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarV.firstChild.style.height = \n (scrollHeight - d.scroller.clientHeight + d.scrollbarV.clientHeight) + \"px\";\n } else d.scrollbarV.style.display = \"\";\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (d.scroller.scrollWidth - d.scroller.clientWidth + d.scrollbarH.clientWidth) + \"px\";\n } else d.scrollbarH.style.display = \"\";\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = scrollbarWidth(d.measure) + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n\n if (mac_geLion && scrollbarWidth(d.measure) === 0)\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = mac_geMountainLion ? \"18px\" : \"12px\";\n }", "function updateScrollbars(d /* display */, docHeight) {\n var totalHeight = docHeight + 2 * paddingTop(d);\n d.sizer.style.minHeight = d.heightForcer.style.top = totalHeight + \"px\";\n var scrollHeight = Math.max(totalHeight, d.scroller.scrollHeight);\n var needsH = d.scroller.scrollWidth > d.scroller.clientWidth;\n var needsV = scrollHeight > d.scroller.clientHeight;\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarV.firstChild.style.height = \n (scrollHeight - d.scroller.clientHeight + d.scrollbarV.clientHeight) + \"px\";\n } else d.scrollbarV.style.display = \"\";\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (d.scroller.scrollWidth - d.scroller.clientWidth + d.scrollbarH.clientWidth) + \"px\";\n } else d.scrollbarH.style.display = \"\";\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = scrollbarWidth(d.measure) + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n\n if (mac_geLion && scrollbarWidth(d.measure) === 0)\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = mac_geMountainLion ? \"18px\" : \"12px\";\n }", "function sizeScrollbar() {\r\n\t\t\tvar remainder = scrollContent.width() - scrollPane.width();\r\n\t\t\tvar proportion = remainder / scrollContent.width();\r\n\t\t\tvar handleSize = scrollPane.width() - ( proportion * scrollPane.width() );\r\n\t\t\tscrollbar.find( \".ui-slider-handle\" ).css({\r\n\t\t\t\twidth: handleSize,\r\n\t\t\t\t\"margin-left\": -handleSize / 2\r\n\t\t\t});\r\n\t\t\thandleHelper.width( \"\" ).width( scrollbar.width() - handleSize );\r\n\t\t}", "updateScroll(){\n \t\tif (this.$.content.scrollHeight > this.$.content.offsetHeight){\n \t\t\tthis.$.content.scrollTop = this.$.content.scrollHeight - this.$.content.offsetHeight;\n \t\t}\n \t}", "_setScrollBars() {\r\n const that = this;\r\n\r\n if (!that._scrollView) {\r\n that._scrollView = new LW.Utilities.Scroll(that.$.timeline, that.$.horizontalScrollBar, that.$.verticalScrollBar);\r\n }\r\n\r\n const vScrollBar = that._scrollView.vScrollBar,\r\n hScrollBar = that._scrollView.hScrollBar;\r\n\r\n hScrollBar.$.addClass('lw-hidden');\r\n vScrollBar.$.addClass('lw-hidden');\r\n\r\n //Cancel Style/Resize observers of the ScrollBars\r\n vScrollBar.hasStyleObserver = false;\r\n hScrollBar.hasStyleObserver = false;\r\n vScrollBar.hasResizeObserver = false;\r\n hScrollBar.hasResizeObserver = false;\r\n\r\n hScrollBar.wait = false;\r\n vScrollBar.wait = false;\r\n\r\n //Refreshes the ScrollBars\r\n that._refresh();\r\n }", "_resizeContent(e) {\n // fake a resize event to make contents happy\n async.microTask.run(() => {\n window.dispatchEvent(new Event(\"resize\"));\n });\n }", "updateHeight_() {\n const estScrollHeight = this.items.length > 0 ?\n this.items.length * this.domItemAverageHeight_() :\n 0;\n this.$.container.style.height = estScrollHeight + 'px';\n }", "refreshFakeScroll() {\n const me = this,\n {\n element,\n virtualScrollerElement,\n virtualScrollerWidth,\n totalFixedWidth,\n store\n } = me,\n scroller = me.scrollable; // Use a fixed scroll width if grid is empty, to make it scrollable without rows\n // https://app.assembla.com/spaces/bryntum/tickets/7184\n\n scroller.scrollWidth = store && store.count ? null : totalFixedWidth; // Scroller lays out in the same way as subgrid.\n // If we are flexed, the scroller is flexed etc.\n\n virtualScrollerElement.style.width = element.style.width;\n virtualScrollerElement.style.flex = element.style.flex;\n\n if (!me.collapsed) {\n if (me.overflowingHorizontally) {\n virtualScrollerWidth.style.width = `${scroller.scrollWidth}px`;\n me.header.element.classList.add('b-overflowing');\n me.footer && me.footer.element.classList.add('b-overflowing'); // If *any* SubGrids have horizontal overflow, the main grid\n // has to show its virtual horizontal scollbar.\n\n me.grid.virtualScrollers.classList.remove('b-hide-display');\n } else {\n virtualScrollerWidth.style.width = 0;\n me.header.element.classList.remove('b-overflowing');\n me.footer && me.footer.element.classList.remove('b-overflowing');\n }\n }\n }", "function determineScrollbars() {\n var docStyle = inlineStyle(docElem);\n mainBodyRect = bodyGeo.getCurrentBodyInfo();\n\n // -- Clear the scrollbars --\n if (shouldComputeMainBodyScrollbars) {\n defaultOverflowX = defaultOverflowY = 'hidden';\n }\n else {\n defaultOverflowX = docStyle.overflowX;\n defaultOverflowY = docStyle.overflowY;\n }\n\n // -- Set the scrollbars after a delay --\n // If the right side of the visible content is beyond the window width,\n // or the visible content is wider than the window width, show the scrollbars.\n // Doing this after a timeout fixes SC-3722 for some reason -- the toolbar was moving up and down by the height\n // of the horizontal scrollbar. It's as if doing it on a delay gives IE/Edge a chance to\n // deal with zoom first, and then scrollbars separately\n // The delay also allows us to collect several concurrent requests and handle them once.\n clearTimeout(finalizeScrollbarsTimer);\n\n var\n doUseHorizScrollbar = doForceHorizScrollbar || isBodyTooWide(),\n doUseVertScrollbar = doForceVertScrollbar || isBodyTooTall(),\n newOverflowX = doUseHorizScrollbar ? 'scroll' : defaultOverflowX,\n newOverflowY = doUseVertScrollbar ? 'scroll' : defaultOverflowY;\n\n if (newOverflowX !== docStyle.overflowX || newOverflowY !== docStyle.overflowY) {\n if (shouldComputeMainBodyScrollbars) {\n // MS browsers need to reset first, otherwise causes SC-3722\n setOverflow('hidden', 'hidden');\n }\n finalizeScrollbarsTimer = nativeGlobal.setTimeout(function() {\n setOverflow(newOverflowX, newOverflowY);\n }, 0);\n }\n }", "function updateScrollbars(cm) {\n var d = cm.display, docHeight = cm.doc.height;\n var totalHeight = docHeight + paddingVert(d);\n d.sizer.style.minHeight = d.heightForcer.style.top = totalHeight + \"px\";\n d.gutters.style.height = Math.max(totalHeight, d.scroller.clientHeight - scrollerCutOff) + \"px\";\n var scrollHeight = Math.max(totalHeight, d.scroller.scrollHeight);\n var needsH = d.scroller.scrollWidth > (d.scroller.clientWidth + 1);\n var needsV = scrollHeight > (d.scroller.clientHeight + 1);\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarV.firstChild.style.height =\n (scrollHeight - d.scroller.clientHeight + d.scrollbarV.clientHeight) + \"px\";\n } else {\n d.scrollbarV.style.display = \"\";\n d.scrollbarV.firstChild.style.height = \"0\";\n }\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (d.scroller.scrollWidth - d.scroller.clientWidth + d.scrollbarH.clientWidth) + \"px\";\n } else {\n d.scrollbarH.style.display = \"\";\n d.scrollbarH.firstChild.style.width = \"0\";\n }\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = scrollbarWidth(d.measure) + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = scrollbarWidth(d.measure) + \"px\";\n d.gutterFiller.style.width = d.gutters.offsetWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n\n if (mac_geLion && scrollbarWidth(d.measure) === 0) {\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = mac_geMountainLion ? \"18px\" : \"12px\";\n d.scrollbarV.style.pointerEvents = d.scrollbarH.style.pointerEvents = \"none\";\n }\n }", "function updateScrollbars(cm) {\n var d = cm.display, docHeight = cm.doc.height;\n var totalHeight = docHeight + paddingVert(d);\n d.sizer.style.minHeight = d.heightForcer.style.top = totalHeight + \"px\";\n d.gutters.style.height = Math.max(totalHeight, d.scroller.clientHeight - scrollerCutOff) + \"px\";\n var scrollHeight = Math.max(totalHeight, d.scroller.scrollHeight);\n var needsH = d.scroller.scrollWidth > (d.scroller.clientWidth + 1);\n var needsV = scrollHeight > (d.scroller.clientHeight + 1);\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarV.firstChild.style.height =\n (scrollHeight - d.scroller.clientHeight + d.scrollbarV.clientHeight) + \"px\";\n } else {\n d.scrollbarV.style.display = \"\";\n d.scrollbarV.firstChild.style.height = \"0\";\n }\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (d.scroller.scrollWidth - d.scroller.clientWidth + d.scrollbarH.clientWidth) + \"px\";\n } else {\n d.scrollbarH.style.display = \"\";\n d.scrollbarH.firstChild.style.width = \"0\";\n }\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = scrollbarWidth(d.measure) + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = scrollbarWidth(d.measure) + \"px\";\n d.gutterFiller.style.width = d.gutters.offsetWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n\n if (mac_geLion && scrollbarWidth(d.measure) === 0) {\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = mac_geMountainLion ? \"18px\" : \"12px\";\n d.scrollbarV.style.pointerEvents = d.scrollbarH.style.pointerEvents = \"none\";\n }\n }", "function updateScrollbars(cm) {\n var d = cm.display, docHeight = cm.doc.height;\n var totalHeight = docHeight + paddingVert(d);\n d.sizer.style.minHeight = d.heightForcer.style.top = totalHeight + \"px\";\n d.gutters.style.height = Math.max(totalHeight, d.scroller.clientHeight - scrollerCutOff) + \"px\";\n var scrollHeight = Math.max(totalHeight, d.scroller.scrollHeight);\n var needsH = d.scroller.scrollWidth > (d.scroller.clientWidth + 1);\n var needsV = scrollHeight > (d.scroller.clientHeight + 1);\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarV.firstChild.style.height =\n (scrollHeight - d.scroller.clientHeight + d.scrollbarV.clientHeight) + \"px\";\n } else {\n d.scrollbarV.style.display = \"\";\n d.scrollbarV.firstChild.style.height = \"0\";\n }\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (d.scroller.scrollWidth - d.scroller.clientWidth + d.scrollbarH.clientWidth) + \"px\";\n } else {\n d.scrollbarH.style.display = \"\";\n d.scrollbarH.firstChild.style.width = \"0\";\n }\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = scrollbarWidth(d.measure) + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = scrollbarWidth(d.measure) + \"px\";\n d.gutterFiller.style.width = d.gutters.offsetWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n\n if (mac_geLion && scrollbarWidth(d.measure) === 0) {\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = mac_geMountainLion ? \"18px\" : \"12px\";\n d.scrollbarV.style.pointerEvents = d.scrollbarH.style.pointerEvents = \"none\";\n }\n }", "function setCustomScrollBars() {\n /* * * M a l i h u j Q u e r y C u s t o m C o n t e n t S c r o l l e r : BEGIN * * */\n /*http://manos.malihu.gr/jquery-custom-content-scroller/*/\n //$(\".consoleLogOutput\").append('<div class=\"consoleLog_helm\">$(window).load() event starting.</div>');\n if (Compass.Global.isInternetExplorer === false) {\n $(\"#LoanDatesPanelContent_helm\").mCustomScrollbar({\n theme: \"dark\",\n alwaysShowScrollbar: 0, //Disable scrolll bar when there’s nothing to scroll.\n //scrollbarPosition: \"outside\",\n snapAmount: 26,\n snapOffset: 3,\n mouseWheel: {\n deltaFactor: 28,\n normalizeDelta: false\n },\n callbacks: {\n onScrollStart: function () {\n Compass.Helm.hideHelpPopOvers();\n }\n },\n scrollInertia: 500\n\n });\n $(\"#LoanContactsListContainer_helm\").mCustomScrollbar({\n theme: \"dark\",\n alwaysShowScrollbar: 0, //Disable scrolll bar when there’s nothing to scroll.\n //scrollbarPosition: \"outside\",\n snapAmount: 26,\n snapOffset: 3,\n mouseWheel: {\n deltaFactor: 28,\n normalizeDelta: false\n },\n scrollInertia: 500\n\n });\n }\n /* * * M a l i h u j Q u e r y C u s t o m C o n t e n t S c r o l l e r : END * * */\n }", "_handleScrollbarsDisplay(event) {\n const that = this,\n textBox = that.$.input;\n\n setTimeout(function () {\n switch (that.horizontalScrollBarVisibility) {\n case 'disabled':\n that.$container.addClass('hscroll');\n that.$.horizontalScrollBar.disabled = true;\n break;\n case 'hidden':\n that.$container.removeClass('hscroll');\n break;\n case 'visible':\n that.$container.addClass('hscroll');\n that._scrollView.scrollWidth = textBox.scrollWidth - textBox.clientWidth;\n that._scrollView.scrollTo(that.$.input.scrollLeft, true);\n that.$.horizontalScrollBar.disabled = false;\n break;\n default:\n if (textBox.scrollWidth > textBox.clientWidth) {\n that.$container.addClass('hscroll');\n\n that._scrollView.scrollWidth = textBox.scrollWidth - textBox.clientWidth;\n\n if (event && event.type === 'resize') {\n that.$.input.scrollLeft = that._scrollView.scrollLeft;\n }\n else {\n that._scrollView.scrollTo(that.$.input.scrollLeft, true);\n }\n }\n else {\n that.$container.removeClass('hscroll');\n }\n that.$.horizontalScrollBar.disabled = false;\n }\n\n switch (that.verticalScrollBarVisibility) {\n case 'disabled':\n that.$container.addClass('vscroll');\n that.$.verticalScrollBar.disabled = true;\n break;\n case 'hidden':\n that.$container.removeClass('vscroll');\n break;\n case 'visible':\n that.$container.addClass('vscroll');\n that._scrollView.scrollHeight = textBox.scrollHeight - textBox.clientHeight;\n that._scrollView.scrollTo(that.$.input.scrollTop);\n that.$.verticalScrollBar.disabled = false;\n break;\n default:\n if (textBox.scrollHeight > textBox.clientHeight) {\n that.$container.addClass('vscroll');\n\n that._scrollView.scrollHeight = textBox.scrollHeight - textBox.clientHeight;\n\n if (event && event.type === 'resize') {\n that.$.input.scrollTop = that._scrollView.scrollTop;\n }\n else {\n that._scrollView.scrollTo(that.$.input.scrollTop);\n }\n }\n else {\n that.$container.removeClass('vscroll');\n }\n that.$.verticalScrollBar.disabled = false;\n }\n }, 0);\n\n }", "function updateScrollbars(cm) {\n var d = cm.display, docHeight = cm.doc.height;\n var totalHeight = docHeight + paddingVert(d);\n d.sizer.style.minHeight = d.heightForcer.style.top = totalHeight + \"px\";\n d.gutters.style.height = Math.max(totalHeight, d.scroller.clientHeight - scrollerCutOff) + \"px\";\n var scrollHeight = Math.max(totalHeight, d.scroller.scrollHeight);\n var needsH = d.scroller.scrollWidth > (d.scroller.clientWidth + 1);\n var needsV = scrollHeight > (d.scroller.clientHeight + 1);\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarV.firstChild.style.height =\n (scrollHeight - d.scroller.clientHeight + d.scrollbarV.clientHeight) + \"px\";\n } else d.scrollbarV.style.display = \"\";\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? scrollbarWidth(d.measure) + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (d.scroller.scrollWidth - d.scroller.clientWidth + d.scrollbarH.clientWidth) + \"px\";\n } else d.scrollbarH.style.display = \"\";\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = scrollbarWidth(d.measure) + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = scrollbarWidth(d.measure) + \"px\";\n d.gutterFiller.style.width = d.gutters.offsetWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n\n if (mac_geLion && scrollbarWidth(d.measure) === 0)\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = mac_geMountainLion ? \"18px\" : \"12px\";\n }", "function sizeScrollbar() {\n\tvar remainder = scrollContent.width() - scrollPane.width();\n\tif(remainder < 1){\n\t\t//remainder = scrollContent.width();\n\t\tscrollbar.find( \".ui-slider-handle\" ).hide();\n\t}else{\n\t\tscrollbar.find( \".ui-slider-handle\" ).show();\n\t}\n\tvar proportion = remainder / scrollContent.width();\n\tvar handleSize = scrollPane.width() - ( proportion * scrollPane.width() );\n\tscrollbar.find( \".ui-slider-handle\" ).css({\n\t\twidth: handleSize,\n\t\t\"margin-left\": -handleSize / 2\n\t});\n\thandleHelper.width( \"\" ).width( scrollbar.width() - handleSize );\n}", "function sizeScrollbar() {\nvar remainder = scrollContent.width() - scrollPane.width();\nvar proportion = remainder / scrollContent.width();\nvar handleSize = scrollPane.width() - ( proportion * scrollPane.width() );\nscrollbar.find( \".ui-slider-handle\" ).css({\nwidth: handleSize,\n\"margin-left\": -handleSize / 2\n});\nhandleHelper.width( \"\" ).width( scrollbar.width() - handleSize );\n}", "_updateSizeRowsCols() {\n const that = this;\n\n that.$.container.removeAttribute('style');\n\n setTimeout(function () {\n if ((that.horizontalScrollBarVisibility === 'disabled' || that.horizontalScrollBarVisibility === 'hidden') && (that.verticalScrollBarVisibility === 'disabled' || that.verticalScrollBarVisibility === 'hidden')) {\n return;\n }\n\n const rectObject = that.getBoundingClientRect();\n\n that.$.container.style.width = rectObject.width + 'px';\n that.$.container.style.height = rectObject.height + 'px';\n }, 0);\n }", "handleResize() {\n if (this.scrollHeight !== this.contentNode.scrollHeight || this.clientHeight !== this.contentNode.clientHeight) {\n this.adjustHeight();\n }\n this.forceUpdate();\n }", "function updateScrollbars(cm, measure) {\n if (!measure) measure = measureForScrollbars(cm);\n var d = cm.display, sWidth = scrollbarWidth(d.measure);\n var scrollHeight = measure.docHeight + scrollerCutOff;\n var needsH = measure.scrollWidth > measure.clientWidth;\n if (needsH && measure.scrollWidth <= measure.clientWidth + 1 &&\n sWidth > 0 && !measure.hScrollbarTakesSpace)\n needsH = false; // (Issue #2562)\n var needsV = scrollHeight > measure.clientHeight;\n\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? sWidth + \"px\" : \"0\";\n // A bug in IE8 can cause this value to be negative, so guard it.\n d.scrollbarV.firstChild.style.height =\n Math.max(0, scrollHeight - measure.clientHeight + (measure.barHeight || d.scrollbarV.clientHeight)) + \"px\";\n } else {\n d.scrollbarV.style.display = \"\";\n d.scrollbarV.firstChild.style.height = \"0\";\n }\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? sWidth + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (measure.scrollWidth - measure.clientWidth + (measure.barWidth || d.scrollbarH.clientWidth)) + \"px\";\n } else {\n d.scrollbarH.style.display = \"\";\n d.scrollbarH.firstChild.style.width = \"0\";\n }\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = sWidth + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sWidth + \"px\";\n d.gutterFiller.style.width = d.gutters.offsetWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n\n if (!cm.state.checkedOverlayScrollbar && measure.clientHeight > 0) {\n if (sWidth === 0) {\n var w = mac && !mac_geMountainLion ? \"12px\" : \"18px\";\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = w;\n var barMouseDown = function(e) {\n if (e_target(e) != d.scrollbarV && e_target(e) != d.scrollbarH)\n operation(cm, onMouseDown)(e);\n };\n on(d.scrollbarV, \"mousedown\", barMouseDown);\n on(d.scrollbarH, \"mousedown\", barMouseDown);\n }\n cm.state.checkedOverlayScrollbar = true;\n }\n }", "function updateScrollbars(cm, measure) {\n if (!measure) measure = measureForScrollbars(cm);\n var d = cm.display, sWidth = scrollbarWidth(d.measure);\n var scrollHeight = measure.docHeight + scrollerCutOff;\n var needsH = measure.scrollWidth > measure.clientWidth;\n if (needsH && measure.scrollWidth <= measure.clientWidth + 1 &&\n sWidth > 0 && !measure.hScrollbarTakesSpace)\n needsH = false; // (Issue #2562)\n var needsV = scrollHeight > measure.clientHeight;\n\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? sWidth + \"px\" : \"0\";\n // A bug in IE8 can cause this value to be negative, so guard it.\n d.scrollbarV.firstChild.style.height =\n Math.max(0, scrollHeight - measure.clientHeight + (measure.barHeight || d.scrollbarV.clientHeight)) + \"px\";\n } else {\n d.scrollbarV.style.display = \"\";\n d.scrollbarV.firstChild.style.height = \"0\";\n }\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? sWidth + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (measure.scrollWidth - measure.clientWidth + (measure.barWidth || d.scrollbarH.clientWidth)) + \"px\";\n } else {\n d.scrollbarH.style.display = \"\";\n d.scrollbarH.firstChild.style.width = \"0\";\n }\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = sWidth + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sWidth + \"px\";\n d.gutterFiller.style.width = d.gutters.offsetWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n\n if (!cm.state.checkedOverlayScrollbar && measure.clientHeight > 0) {\n if (sWidth === 0) {\n var w = mac && !mac_geMountainLion ? \"12px\" : \"18px\";\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = w;\n var barMouseDown = function(e) {\n if (e_target(e) != d.scrollbarV && e_target(e) != d.scrollbarH)\n operation(cm, onMouseDown)(e);\n };\n on(d.scrollbarV, \"mousedown\", barMouseDown);\n on(d.scrollbarH, \"mousedown\", barMouseDown);\n }\n cm.state.checkedOverlayScrollbar = true;\n }\n }", "function updateScrollbars(cm, measure) {\n if (!measure) measure = measureForScrollbars(cm);\n var d = cm.display, sWidth = scrollbarWidth(d.measure);\n var scrollHeight = measure.docHeight + scrollerCutOff;\n var needsH = measure.scrollWidth > measure.clientWidth;\n if (needsH && measure.scrollWidth <= measure.clientWidth + 1 &&\n sWidth > 0 && !measure.hScrollbarTakesSpace)\n needsH = false; // (Issue #2562)\n var needsV = scrollHeight > measure.clientHeight;\n\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? sWidth + \"px\" : \"0\";\n // A bug in IE8 can cause this value to be negative, so guard it.\n d.scrollbarV.firstChild.style.height =\n Math.max(0, scrollHeight - measure.clientHeight + (measure.barHeight || d.scrollbarV.clientHeight)) + \"px\";\n } else {\n d.scrollbarV.style.display = \"\";\n d.scrollbarV.firstChild.style.height = \"0\";\n }\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? sWidth + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (measure.scrollWidth - measure.clientWidth + (measure.barWidth || d.scrollbarH.clientWidth)) + \"px\";\n } else {\n d.scrollbarH.style.display = \"\";\n d.scrollbarH.firstChild.style.width = \"0\";\n }\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = sWidth + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sWidth + \"px\";\n d.gutterFiller.style.width = d.gutters.offsetWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n\n if (!cm.state.checkedOverlayScrollbar && measure.clientHeight > 0) {\n if (sWidth === 0) {\n var w = mac && !mac_geMountainLion ? \"12px\" : \"18px\";\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = w;\n var barMouseDown = function(e) {\n if (e_target(e) != d.scrollbarV && e_target(e) != d.scrollbarH)\n operation(cm, onMouseDown)(e);\n };\n on(d.scrollbarV, \"mousedown\", barMouseDown);\n on(d.scrollbarH, \"mousedown\", barMouseDown);\n }\n cm.state.checkedOverlayScrollbar = true;\n }\n }", "function updateScrollbars(cm, measure) {\n if (!measure) measure = measureForScrollbars(cm);\n var d = cm.display, sWidth = scrollbarWidth(d.measure);\n var scrollHeight = measure.docHeight + scrollerCutOff;\n var needsH = measure.scrollWidth > measure.clientWidth;\n if (needsH && measure.scrollWidth <= measure.clientWidth + 1 &&\n sWidth > 0 && !measure.hScrollbarTakesSpace)\n needsH = false; // (Issue #2562)\n var needsV = scrollHeight > measure.clientHeight;\n\n if (needsV) {\n d.scrollbarV.style.display = \"block\";\n d.scrollbarV.style.bottom = needsH ? sWidth + \"px\" : \"0\";\n // A bug in IE8 can cause this value to be negative, so guard it.\n d.scrollbarV.firstChild.style.height =\n Math.max(0, scrollHeight - measure.clientHeight + (measure.barHeight || d.scrollbarV.clientHeight)) + \"px\";\n } else {\n d.scrollbarV.style.display = \"\";\n d.scrollbarV.firstChild.style.height = \"0\";\n }\n if (needsH) {\n d.scrollbarH.style.display = \"block\";\n d.scrollbarH.style.right = needsV ? sWidth + \"px\" : \"0\";\n d.scrollbarH.firstChild.style.width =\n (measure.scrollWidth - measure.clientWidth + (measure.barWidth || d.scrollbarH.clientWidth)) + \"px\";\n } else {\n d.scrollbarH.style.display = \"\";\n d.scrollbarH.firstChild.style.width = \"0\";\n }\n if (needsH && needsV) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = sWidth + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sWidth + \"px\";\n d.gutterFiller.style.width = d.gutters.offsetWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n\n if (!cm.state.checkedOverlayScrollbar && measure.clientHeight > 0) {\n if (sWidth === 0) {\n var w = mac && !mac_geMountainLion ? \"12px\" : \"18px\";\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = w;\n var barMouseDown = function(e) {\n if (e_target(e) != d.scrollbarV && e_target(e) != d.scrollbarH)\n operation(cm, onMouseDown)(e);\n };\n on(d.scrollbarV, \"mousedown\", barMouseDown);\n on(d.scrollbarH, \"mousedown\", barMouseDown);\n }\n cm.state.checkedOverlayScrollbar = true;\n }\n }", "function updateScrollbars(cm, measure) {\r\n if (!measure) measure = measureForScrollbars(cm);\r\n var d = cm.display, sWidth = scrollbarWidth(d.measure);\r\n var scrollHeight = measure.docHeight + scrollerCutOff;\r\n var needsH = measure.scrollWidth > measure.clientWidth;\r\n if (needsH && measure.scrollWidth <= measure.clientWidth + 1 &&\r\n sWidth > 0 && !measure.hScrollbarTakesSpace)\r\n needsH = false; // (Issue #2562)\r\n var needsV = scrollHeight > measure.clientHeight;\r\n\r\n if (needsV) {\r\n d.scrollbarV.style.display = \"block\";\r\n d.scrollbarV.style.bottom = needsH ? sWidth + \"px\" : \"0\";\r\n // A bug in IE8 can cause this value to be negative, so guard it.\r\n d.scrollbarV.firstChild.style.height =\r\n Math.max(0, scrollHeight - measure.clientHeight + (measure.barHeight || d.scrollbarV.clientHeight)) + \"px\";\r\n } else {\r\n d.scrollbarV.style.display = \"\";\r\n d.scrollbarV.firstChild.style.height = \"0\";\r\n }\r\n if (needsH) {\r\n d.scrollbarH.style.display = \"block\";\r\n d.scrollbarH.style.right = needsV ? sWidth + \"px\" : \"0\";\r\n d.scrollbarH.firstChild.style.width =\r\n (measure.scrollWidth - measure.clientWidth + (measure.barWidth || d.scrollbarH.clientWidth)) + \"px\";\r\n } else {\r\n d.scrollbarH.style.display = \"\";\r\n d.scrollbarH.firstChild.style.width = \"0\";\r\n }\r\n if (needsH && needsV) {\r\n d.scrollbarFiller.style.display = \"block\";\r\n d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = sWidth + \"px\";\r\n } else d.scrollbarFiller.style.display = \"\";\r\n if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\r\n d.gutterFiller.style.display = \"block\";\r\n d.gutterFiller.style.height = sWidth + \"px\";\r\n d.gutterFiller.style.width = d.gutters.offsetWidth + \"px\";\r\n } else d.gutterFiller.style.display = \"\";\r\n\r\n if (!cm.state.checkedOverlayScrollbar && measure.clientHeight > 0) {\r\n if (sWidth === 0) {\r\n var w = mac && !mac_geMountainLion ? \"12px\" : \"18px\";\r\n d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = w;\r\n var barMouseDown = function(e) {\r\n if (e_target(e) != d.scrollbarV && e_target(e) != d.scrollbarH)\r\n operation(cm, onMouseDown)(e);\r\n };\r\n on(d.scrollbarV, \"mousedown\", barMouseDown);\r\n on(d.scrollbarH, \"mousedown\", barMouseDown);\r\n }\r\n cm.state.checkedOverlayScrollbar = true;\r\n }\r\n }", "_addScrollBar() {\n const canvas = this.getCanvas();\n\n canvas.add(this._horizontalScroll);\n canvas.add(this._verticalScroll);\n\n if (this.scrollBarTid) {\n clearTimeout(this.scrollBarTid);\n }\n\n this.scrollBarTid = setTimeout(() => {\n canvas.remove(this._horizontalScroll);\n canvas.remove(this._verticalScroll);\n }, 3000);\n }", "refreshFakeScroll() {\n const me = this,\n { element, virtualScrollerElement, virtualScrollerWidth } = me,\n scroller = me.scrollable;\n\n // Use a fixed scroll width if grid is empty, to make it scrollable without rows\n // https://app.assembla.com/spaces/bryntum/tickets/7184\n scroller.scrollWidth = me.store.count ? null : me.totalFixedWidth;\n\n virtualScrollerElement.style.width = `${element.offsetWidth}px`;\n\n //if (BrowserHelper.isEdge) {\n // Needed for Edge, it does not size correctly\n if (me.totalFixedWidth > scroller.clientWidth) {\n element.classList.add('b-overflowing-horizontally');\n } else {\n element.classList.remove('b-overflowing-horizontally');\n }\n //}\n\n // This is if *this* subGrid has horizontal overflow\n // +1 is for Edge, it messes up otherwise\n if (scroller.scrollWidth > scroller.clientWidth + (BrowserHelper.isEdge ? 1 : 0)) {\n virtualScrollerWidth.style.width = `${scroller.scrollWidth}px`;\n me.header.element.classList.add('b-overflowing');\n me.footer && me.footer.element.classList.add('b-overflowing');\n me.overflowingHorizontally = true;\n // If *any* SubGrids have horizontal overflow, the main grid\n // has to show its virtual horizontal scollbar.\n me.grid.virtualScrollers.classList.remove('b-hide-display');\n } else {\n virtualScrollerWidth.style.width = 0;\n me.header.element.classList.remove('b-overflowing');\n me.footer && me.footer.element.classList.remove('b-overflowing');\n me.overflowingHorizontally = false;\n }\n }", "_resizeHandler(event) {\n const that = this;\n\n if (event.target === that && !that._isUpdatingScrollBars) {\n that._isUpdatingScrollBars = true;\n that._initializeRecyclingItems();\n that._refreshLayout();\n that._isUpdatingScrollBars = false;\n }\n }", "refresh() {\n this._resizeEventHandler();\n }", "function createScrollBarForAll(){\n if($('body').hasClass(RESPONSIVE)){\n removeResponsiveScrollOverflows();\n }\n else{\n forEachSectionAndSlide(createScrollBar);\n }\n }", "_updateSize() {\n if (qx.ui.mobile.core.Blocker.ROOT == this.getLayoutParent()) {\n this.getContainerElement().style.top =\n qx.bom.Viewport.getScrollTop() + \"px\";\n this.getContainerElement().style.left =\n qx.bom.Viewport.getScrollLeft() + \"px\";\n this.getContainerElement().style.width =\n qx.bom.Viewport.getWidth() + \"px\";\n this.getContainerElement().style.height =\n qx.bom.Viewport.getHeight() + \"px\";\n } else if (this.getLayoutParent() != null) {\n var dimension = qx.bom.element.Dimension.getSize(\n this.getLayoutParent().getContainerElement()\n );\n\n this.getContainerElement().style.width = dimension.width + \"px\";\n this.getContainerElement().style.height = dimension.height + \"px\";\n }\n }", "function createScrollBarForAll() {\n if ($('body').hasClass(RESPONSIVE)) {\n removeResponsiveScrollOverflows();\n } else {\n forEachSectionAndSlide(createScrollBar);\n }\n }", "function ListView_UpdateScrollBars(theObject)\n{\n\t//content exits?\n\tif (theObject.Content && theObject.Content.Item_Panel)\n\t{\n\t\t//set scrollbars\n\t\ttheObject.Content.Item_Panel.style.overflowX = Get_Bool(theObject.Properties[__NEMESIS_PROPERTY_HORIZONTAL_SCROLL_BAR], true) ? \"auto\" : \"hidden\";\n\t\ttheObject.Content.Item_Panel.style.overflowY = Get_Bool(theObject.Properties[__NEMESIS_PROPERTY_VERTICAL_SCROLL_BAR], true) ? \"auto\" : \"hidden\";\n\t\t//has vertical scroll position?\n\t\tvar vertical = Get_String(theObject.Properties[__NEMESIS_PROPERTY_VERTICAL_SCROLL_POS], null);\n\t\t//and horizontal\n\t\tvar horizontal = Get_String(theObject.Properties[__NEMESIS_PROPERTY_HORIZONTAL_SCROLL_POS], null);\n\t\t//at least one is valid?\n\t\tif (vertical != null || horizontal != null)\n\t\t{\n\t\t\t//vertical?\n\t\t\tif (vertical != null)\n\t\t\t{\n\t\t\t\t//set vertical\n\t\t\t\ttheObject.Content.Item_Panel.scrollTop = vertical * theObject.Content.Item_Height;\n\t\t\t}\n\t\t\t//has horizontal\n\t\t\tif (horizontal != null)\n\t\t\t{\n\t\t\t\t//set horizontal\n\t\t\t\ttheObject.Content.Item_Panel.scrollLeft = horizontal;\n\t\t\t\t//has header panel?\n\t\t\t\tif (theObject.Content.Header_Panel)\n\t\t\t\t{\n\t\t\t\t\t//match scroll pos\n\t\t\t\t\ttheObject.Content.Header_Panel.scrollLeft = theObject.Content.Item_Panel.scrollLeft;\n\t\t\t\t}\n\t\t\t}\n\t\t\t//trigger a repaint\n\t\t\tListView_Paint(theObject);\n\t\t}\n\t}\n}", "function OnClientResize_DocView(sender, eventArgs)\r\n{ \r\n var rcp = $find('ResizableControlBehavior1');\r\n\r\n if (isLoaded)\r\n {\r\n var width = rcp.get_Size().width;\r\n var height = rcp.get_Size().height;\r\n PageMethods.SetDocDimensions(width, height);\r\n }\r\n}", "componentDidUpdate () {\n this.setHeight();\n this.scrollList();\n }", "_refreshScrollerPosition() {\n this.__carouselScrollerWidth = qx.bom.element.Dimension.getWidth(\n this.__carouselScroller.getContentElement()\n );\n\n this._scrollToPage(this.getCurrentIndex());\n }", "_refreshVerticalScrollBarVisibility(scrollHeight) {\n const that = this;\n\n if (that._autoHeight) {\n that.scrollTop = 0;\n that.scrollHeight = 0;\n return;\n }\n\n if (that.computedHorizontalScrollBarVisibility) {\n scrollHeight += that.$.horizontalScrollBar.offsetHeight;\n }\n\n that.scrollHeight = scrollHeight;\n\n if (that.paging.enabled && that.paging.spinner.visible) {\n that.$.verticalScrollBarVisibility.classList.remove('jqx-hidden');\n }\n\n if (!that.computedVerticalScrollBarVisibility) {\n that.scrollTop = 0;\n }\n }", "renderAndAdjust() {\n this.hot.render();\n\n // Dirty workaround to prevent scroll height not adjusting to the table height. Needs refactoring in the future.\n this.hot.view.adjustElementsSize();\n }", "handleResize() {\n this.refresh();\n }", "_refreshVerticalScrollBarVisibility(scrollHeight) {\n const that = this;\n\n if (that._autoHeight) {\n that.scrollTop = 0;\n that.scrollHeight = 0;\n return;\n }\n\n if (that.computedHorizontalScrollBarVisibility) {\n scrollHeight += that.$.horizontalScrollBar.offsetHeight;\n }\n\n that.scrollHeight = scrollHeight;\n\n if (that.paging.enabled && that.paging.spinner.visible) {\n that.$.verticalScrollBarVisibility.classList.remove('smart-hidden');\n }\n\n if (!that.computedVerticalScrollBarVisibility) {\n that.scrollTop = 0;\n }\n }", "bindResize() {\n const self = this;\n const el = $(suiController.scrollable)[0];\n // unit test programs don't have resize html\n if (!el) {\n return;\n }\n this._setMusicDimensions();\n // $(suiController.scrollable).height(window.innerHeight - $('.musicRelief').offset().top);\n\n window.addEventListener('resize', function () {\n self.resizeEvent();\n });\n\n let scrollCallback = (ev) => {\n self.handleScrollEvent(ev);\n };\n el.onscroll = scrollCallback;\n }", "function init() {\n \n if (initDone || !document.body) return;\n\n initDone = true;\n\n var body = document.body;\n var html = document.documentElement;\n var windowHeight = window.innerHeight; \n var scrollHeight = body.scrollHeight;\n \n // check compat mode for root element\n root = (document.compatMode.indexOf('CSS') >= 0) ? html : body;\n activeElement = body;\n \n initTest();\n\n // Checks if this script is running in a frame\n if (top != self) {\n isFrame = true;\n }\n\n /**\n * Please duplicate this radar for a Safari fix! \n * rdar://22376037\n * https://openradar.appspot.com/radar?id=4965070979203072\n * \n * Only applies to Safari now, Chrome fixed it in v45:\n * This fixes a bug where the areas left and right to \n * the content does not trigger the onmousewheel event\n * on some pages. e.g.: html, body { height: 100% }\n */\n else if (scrollHeight > windowHeight &&\n (body.offsetHeight <= windowHeight || \n html.offsetHeight <= windowHeight)) {\n\n var fullPageElem = document.createElement('div');\n fullPageElem.style.cssText = 'position:absolute; z-index:-10000; ' +\n 'top:0; left:0; right:0; height:' + \n root.scrollHeight + 'px';\n document.body.appendChild(fullPageElem);\n \n // DOM changed (throttled) to fix height\n var pendingRefresh;\n refreshSize = function () {\n if (pendingRefresh) return; // could also be: clearTimeout(pendingRefresh);\n pendingRefresh = setTimeout(function () {\n if (isExcluded) return; // could be running after cleanup\n fullPageElem.style.height = '0';\n fullPageElem.style.height = root.scrollHeight + 'px';\n pendingRefresh = null;\n }, 500); // act rarely to stay fast\n };\n \n setTimeout(refreshSize, 10);\n\n addEvent('resize', refreshSize);\n\n // TODO: attributeFilter?\n var config = {\n attributes: true, \n childList: true, \n characterData: false \n // subtree: true\n };\n\n observer = new MutationObserver(refreshSize);\n observer.observe(body, config);\n\n if (root.offsetHeight <= windowHeight) {\n var clearfix = document.createElement('div'); \n clearfix.style.clear = 'both';\n body.appendChild(clearfix);\n }\n }\n\n // disable fixed background\n if (!options.fixedBackground && !isExcluded) {\n body.style.backgroundAttachment = 'scroll';\n html.style.backgroundAttachment = 'scroll';\n }\n}", "function sizeSlider(scrollpane, scrollcontent, slider) {\n \n var scrollpane_h = scrollpane.height(),\n scrollcontent_h = scrollcontent.height(),\n scrollbar_wrap_h = scrollpane_h - scrollpane_h * 0.02,\n diff1\t = scrollcontent_h - scrollpane_h,\n prop\t = diff1 / scrollcontent_h,\n scroll_area = scrollbar_wrap_h - def_opt.btnsWidth * 2,\n stopScroll = Math.floor(scroll_area * prop),\n size_slider = scrollbar_wrap_h - def_opt.btnsWidth * 2 - stopScroll - def_opt.bordersWidth * 2,\n //multiple = diff1 / (scrollbar_wrap_h - def_opt.btnsWidth * 2 - size_slider),\n multiple = scrollcontent_h / scroll_area,\n percentContent = diff1 / 100,\n percentSlider = stopScroll / 100;\n\n /*if (slider !== undefined) {\n size_slider = height2;\n slider.height(height2);\n }*/\n\n return {\n // container height\n scrollpane_h: scrollpane_h,\n // content height\n scrollcontent_h: scrollcontent_h,\n // content stop coordinates\n scrollcontent_stop: scrollpane_h - scrollcontent_h,\n // scrollbar container height\n scrollbar_wrap_h: scrollbar_wrap_h,\n // slider height\n size_slider: size_slider,\n // content height growth while scrolling index\n multiple: multiple,\n // when the coordinate limit is reached than stop the scrollbar\n stopScroll: stopScroll,\n // the number of pixels in one percent of movement by the content\n percentContent: percentContent,\n // the number of pixels in one percent of movement by the slider\n percentSlider: percentSlider\n };\n }", "function refreshScrollForBillers() {\n\tif(mainScroll) {\n\t\tsetTimeout(function() {\n\t\t\tmainScroll.refresh(); \n\t\t}, 1000);\n\t}\n}", "_setContentSizeCss()\n {\n const clientRect = this.getBoundingClientRect();\n this.style.setProperty(\"--content-width\", `${clientRect.width}px`);\n this.style.setProperty(\"--content-height\", `${clientRect.height}px`);\n }", "function sizeScrollbar() {\r\n\t\t var remainder = scrollContent.width() - scrollPane.width();\r\n\t\t var proportion = scrollPane.width() / scrollContent.width(); //remainder / scrollContent.width();\r\n\t\t var handleSize = jQuery('.slider-lb:eq(0)').width(); //scrollPane.width() * proportion; // - (proportion * scrollPane.width());\r\n\t\t var pos = jQuery(jQuery(jQuery(scrollPane.next('.scroll-bar-container').children(\".scroll-bar-start\")).prev(\".scroll-bar-wrap\").children(\".scroll-bar\").children(\".slider-lb1\"))).position();\r\n\t\t scrollbar.find('.ui-slider-handle').css({\r\n\t\t\twidth: handleSize+100,\r\n\t\t\tleft: pos.left-50\r\n\t\t });\r\n\t\t// var scrollContentWidth = 1200;\r\n\t\t handleHelper.width('').width(scrollbar.width() - handleSize - 150);\r\n\t\t var scrollBarSize = jQuery(\".scroll-bar-container\").width()-100;\r\n\t\t var offsetFactor = Math.round(handleSize / 2) + 14; // for left padding scrollbar\r\n\t\t Group2First = (group1 * scrollBarSize) / (scrollContentWidth)\r\n\t\t Group3First = ((group1 + group2) * scrollBarSize) / (scrollContentWidth)\r\n\t\t Group4First = ((group1 + group2 + group3) * scrollBarSize) / (scrollContentWidth)\r\n\t\t jQuery(\".slider-lb2\").css('left', (Group2First + offsetFactor + 50) + 'px');\r\n\t\t jQuery(\".slider-lb3\").css('left', (Group3First + offsetFactor + 100) + 'px');\r\n\t\t /*trick to handle overlapping labels*/\r\n\t\t var group5Offset = (scrollBarSize - jQuery(\".slider-lb5\").width());\r\n\t\t var group4Offset = Group4First + offsetFactor;\r\n\t\t var fwLength = jQuery(\".slider-lb4\").width();\r\n\t\t if ((group4Offset + fwLength) > group5Offset) group4Offset -= ((group4Offset + fwLength) - group5Offset) + 35;\r\n\t\t if (((group4Offset + fwLength) - group5Offset) < 10) group4Offset -= 30;\r\n\t\t Group4First = group4Offset - offsetFactor;\r\n\t\t jQuery(\".slider-lb4\").css('left', group4Offset+150+'px');\r\n\t\t jQuery(\".slider-lb5\").css('left', group5Offset+50+'px');\r\n\t\t}", "function updateAllTransientScrollbars() {\n for (var i = 0; i < transientScrollbarEls.length; i++) {\n var el = transientScrollbarEls[i];\n updateTransientScrollbars(el);\n }\n}", "function init() {\n \n if (initDone || !document.body) return;\n\n initDone = true;\n\n var body = document.body;\n var html = document.documentElement;\n var windowHeight = window.innerHeight; \n var scrollHeight = body.scrollHeight;\n \n // check compat mode for root element\n root = (document.compatMode.indexOf('CSS') >= 0) ? html : body;\n activeElement = body;\n \n initTest();\n\n // Checks if this script is running in a frame\n if (top != self) {\n isFrame = true;\n }\n\n /**\n * Safari 10 fixed it, Chrome fixed it in v45:\n * This fixes a bug where the areas left and right to \n * the content does not trigger the onmousewheel event\n * on some pages. e.g.: html, body { height: 100% }\n */\n else if (isOldSafari &&\n scrollHeight > windowHeight &&\n (body.offsetHeight <= windowHeight || \n html.offsetHeight <= windowHeight)) {\n\n var fullPageElem = document.createElement('div');\n fullPageElem.style.cssText = 'position:absolute; z-index:-10000; ' +\n 'top:0; left:0; right:0; height:' + \n root.scrollHeight + 'px';\n document.body.appendChild(fullPageElem);\n \n // DOM changed (throttled) to fix height\n var pendingRefresh;\n refreshSize = function () {\n if (pendingRefresh) return; // could also be: clearTimeout(pendingRefresh);\n pendingRefresh = setTimeout(function () {\n if (isExcluded) return; // could be running after cleanup\n fullPageElem.style.height = '0';\n fullPageElem.style.height = root.scrollHeight + 'px';\n pendingRefresh = null;\n }, 500); // act rarely to stay fast\n };\n \n setTimeout(refreshSize, 10);\n\n addEvent('resize', refreshSize);\n\n // TODO: attributeFilter?\n var config = {\n attributes: true, \n childList: true, \n characterData: false \n // subtree: true\n };\n\n observer = new MutationObserver(refreshSize);\n observer.observe(body, config);\n\n if (root.offsetHeight <= windowHeight) {\n var clearfix = document.createElement('div'); \n clearfix.style.clear = 'both';\n body.appendChild(clearfix);\n }\n }\n\n // disable fixed background\n if (!options.fixedBackground && !isExcluded) {\n body.style.backgroundAttachment = 'scroll';\n html.style.backgroundAttachment = 'scroll';\n }\n}", "update() {\n\t\tthis.scroll.update();\n\t}", "_refreshLayout() {\n const that = this;\n const source = that.rows;\n\n if (that._layoutSuspended) {\n return;\n }\n\n that._visibleRows = null;\n that.__viewRows = null;\n that.__clientSize = null;\n that.__scrollHeight = null;\n that.__scrollWidth = null;\n that.__parentCells = null;\n\n that.$.columnFarContainer.classList.remove('vscroll');\n that.$.scrollView.classList.remove('hscroll');\n that.$.scrollView.classList.remove('vscroll');\n\n that._refreshElementsVisibility();\n that._refreshColumnHeights();\n that._refreshContentHeight();\n\n if (!(source && source.url)) {\n if (!source || source === null || source.length === 0 || that.columns.length === 0) {\n that.$.placeholder.classList.remove('jqx-hidden');\n\n that.scrollWidth = 0;\n that.scrollHeight = 0;\n\n return;\n }\n }\n\n if (!that.__columnHeaderHeight) {\n that.__columnHeaderHeight = that.$.columnHeader.offsetHeight;\n }\n\n if (!that.__filterFooterOffsetHeight) {\n that.__filterFooterOffsetHeight = that.$.filterFooter.classList.contains('jqx-hidden') ? 0 : that.$.filterFooter.offsetHeight;\n }\n\n const scrollViewOffsetHeight = that._contentHeight - that.__filterFooterOffsetHeight - that.__columnHeaderHeight;\n\n that.$.scrollView.style.height = scrollViewOffsetHeight + 'px';\n that.htmlColumnLastChild.style.height = that.__columnHeaderHeight + 'px';\n\n\n if (that.paging.spinner.enabled && that.paging.enabled) {\n if (!that.pageScroll) {\n const pageScroll = document.createElement('jqx-scroll-bar');\n\n pageScroll.orientation = 'vertical';\n pageScroll.style.height = '100%';\n pageScroll.style.width = '100%';\n pageScroll.max = Math.ceil(that.dataSource.length / that.paging.pageSize);\n pageScroll.step = that.paging.spinner.step;\n pageScroll.largeStep = that.paging.spinner.step;\n pageScroll.setAttribute('spinner', '');\n pageScroll.setAttribute('jqx-id', 'spinner');\n pageScroll.ownerElement = that;\n\n that.addPropertyBinding('[[paging_spinner_step]]', 'step', pageScroll, that.$.columnHeader);\n\n pageScroll.addEventListener('change', function (event) {\n that.paging.pageIndex = event.detail.value;\n });\n\n that.pageScroll = pageScroll;\n }\n\n that.htmlColumnLastChild.appendChild(that.pageScroll);\n }\n else {\n that.htmlColumnLastChild.innerHTML = '';\n }\n\n that._refreshScrollBars();\n\n }", "refreshVirtualScrollbars() {\n const { scrollBarWidth } = DomHelper;\n\n if (scrollBarWidth) {\n const me = this,\n { headerContainer, footerContainer, virtualScrollers } = me,\n hasVerticalOverflow = me.virtualScrollHeight > me.bodyHeight, //bodyContainer.scrollHeight > bodyContainer.clientHeight,\n // We need to ask each subGrid if it has horizontal overflow.\n // If any do, we show the virtual scroller, otherwise we hide it.\n hasHorizontalOverflow = Object.values(me.subGrids).some((subGrid) => subGrid.overflowingHorizontally);\n\n if (hasHorizontalOverflow) {\n virtualScrollers.classList.remove('b-hide-display');\n } else {\n virtualScrollers.classList.add('b-hide-display');\n }\n\n if (hasVerticalOverflow) {\n if (!headerContainer.classList.contains('b-grid-vertical-overflow')) {\n headerContainer.classList.add('b-grid-vertical-overflow');\n }\n } else {\n headerContainer.classList.remove('b-grid-vertical-overflow');\n }\n\n // can get called before headers are rendered. headers might also be hidden (such as in docs)\n const lastHeaderScroller = headerContainer.querySelector('.b-grid-header-scroller:last-child');\n if (lastHeaderScroller && hasVerticalOverflow) {\n const headerBorderWidth = parseInt(DomHelper.getStyleValue(lastHeaderScroller, 'border-right-width'));\n // Add a style to pad the header-container to clear the grid's vertical scrollbar\n // TODO: regions part of calculation is to compensate for 1px off with third region, but it should be solvable using CSS. Not finding how though...\n headerContainer.style.paddingRight =\n scrollBarWidth - headerBorderWidth + (me.regions.length > 2 ? 1 : 0) + 'px';\n footerContainer.style.paddingRight = `${scrollBarWidth}px`;\n } else {\n headerContainer.style.paddingRight = '0';\n footerContainer.style.paddingRight = '0';\n }\n }\n }", "resizeToFitContent() {}", "resizeToFitContent() {}" ]
[ "0.67457443", "0.6548727", "0.6544334", "0.6544334", "0.6544334", "0.6540867", "0.653737", "0.65143853", "0.6505358", "0.65028185", "0.6500194", "0.6498328", "0.64833677", "0.6422464", "0.6417735", "0.6417735", "0.6413763", "0.64106846", "0.64106846", "0.64106846", "0.64106846", "0.64106846", "0.64106846", "0.64106846", "0.64106846", "0.64106846", "0.64106846", "0.64106846", "0.6393036", "0.638042", "0.6378133", "0.6362488", "0.6362488", "0.6362488", "0.63470006", "0.63469267", "0.6322814", "0.62254125", "0.62127495", "0.6201523", "0.620004", "0.6194518", "0.6194518", "0.6194518", "0.61827624", "0.6172968", "0.6165301", "0.6160739", "0.615134", "0.6127675", "0.6036597", "0.5975394", "0.5975394", "0.5975394", "0.5975394", "0.5968176", "0.5956156", "0.59546065", "0.5953871", "0.5950941", "0.59209174", "0.5919125", "0.59059733", "0.59044415", "0.5902249", "0.5885158", "0.5883811", "0.587888", "0.58723986", "0.58504856", "0.58422935", "0.58319724", "0.5831573", "0.5828096", "0.5817307", "0.58171916", "0.58166164", "0.5810095", "0.5803818", "0.5793712", "0.5792886", "0.578939", "0.57850736", "0.57850736" ]
0.6532113
23
Start a new operation.
function startOperation(cm) { cm.curOp = { cm: cm, viewChanged: false, // Flag that indicates that lines might need to be redrawn startHeight: cm.doc.height, // Used to detect need to update scrollbar forceUpdate: false, // Used to force a redraw updateInput: 0, // Whether to reset the input textarea typing: false, // Whether this reset should be careful to leave existing text (for compositing) changeObjs: null, // Accumulated changes, for firing change events cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already selectionChanged: false, // Whether the selection needs to be redrawn updateMaxLine: false, // Set when the widest line needs to be determined anew scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet scrollToPos: null, // Used to scroll to a specific position focus: false, id: ++nextOpId // Unique ID }; pushOperation(cm.curOp); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function startNew(options) {\n if (options === void 0) { options = {}; }\n return default_1.DefaultKernel.startNew(options);\n }", "function startNew(options) {\n return Private.startNew(options);\n }", "function startNew(options) {\n return Private.startNew(options);\n }", "start() {\n this.do(\"start\")\n }", "start() {\n this.createContext();\n }", "started () { this.state = Command.STATE.CREATE; }", "function startOperation(cm) {\r\n cm.curOp = {\r\n cm: cm,\r\n viewChanged: false, // Flag that indicates that lines might need to be redrawn\r\n startHeight: cm.doc.height, // Used to detect need to update scrollbar\r\n forceUpdate: false, // Used to force a redraw\r\n updateInput: null, // Whether to reset the input textarea\r\n typing: false, // Whether this reset should be careful to leave existing text (for compositing)\r\n changeObjs: null, // Accumulated changes, for firing change events\r\n cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\r\n cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\r\n selectionChanged: false, // Whether the selection needs to be redrawn\r\n updateMaxLine: false, // Set when the widest line needs to be determined anew\r\n scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\r\n scrollToPos: null, // Used to scroll to a specific position\r\n id: ++nextOpId // Unique ID\r\n };\r\n if (operationGroup) {\r\n operationGroup.ops.push(cm.curOp);\r\n } else {\r\n cm.curOp.ownsGroup = operationGroup = {\r\n ops: [cm.curOp],\r\n delayedCallbacks: []\r\n };\r\n }\r\n }", "function startOperation(cm) {\n\t\t cm.curOp = {\n\t\t cm: cm,\n\t\t viewChanged: false, // Flag that indicates that lines might need to be redrawn\n\t\t startHeight: cm.doc.height, // Used to detect need to update scrollbar\n\t\t forceUpdate: false, // Used to force a redraw\n\t\t updateInput: null, // Whether to reset the input textarea\n\t\t typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n\t\t changeObjs: null, // Accumulated changes, for firing change events\n\t\t cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n\t\t cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n\t\t selectionChanged: false, // Whether the selection needs to be redrawn\n\t\t updateMaxLine: false, // Set when the widest line needs to be determined anew\n\t\t scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n\t\t scrollToPos: null, // Used to scroll to a specific position\n\t\t focus: false,\n\t\t id: ++nextOpId // Unique ID\n\t\t };\n\t\t if (operationGroup) {\n\t\t operationGroup.ops.push(cm.curOp);\n\t\t } else {\n\t\t cm.curOp.ownsGroup = operationGroup = {\n\t\t ops: [cm.curOp],\n\t\t delayedCallbacks: []\n\t\t };\n\t\t }\n\t\t }", "function startNew(options) {\n var settings = options.serverSettings || __1.ServerConnection.makeSettings();\n var request = {\n url: coreutils_1.URLExt.join(settings.baseUrl, KERNEL_SERVICE_URL),\n method: 'POST',\n data: JSON.stringify({ name: options.name }),\n contentType: 'application/json',\n cache: false\n };\n return __1.ServerConnection.makeRequest(request, settings).then(function (response) {\n if (response.xhr.status !== 201) {\n throw __1.ServerConnection.makeError(response);\n }\n validate.validateModel(response.data);\n return new DefaultKernel(__assign({}, options, { name: response.data.name, serverSettings: settings }), response.data.id);\n }, onKernelError);\n }", "function startOperation(cm) {\n\t cm.curOp = {\n\t cm: cm,\n\t viewChanged: false, // Flag that indicates that lines might need to be redrawn\n\t startHeight: cm.doc.height, // Used to detect need to update scrollbar\n\t forceUpdate: false, // Used to force a redraw\n\t updateInput: null, // Whether to reset the input textarea\n\t typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n\t changeObjs: null, // Accumulated changes, for firing change events\n\t cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n\t cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n\t selectionChanged: false, // Whether the selection needs to be redrawn\n\t updateMaxLine: false, // Set when the widest line needs to be determined anew\n\t scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n\t scrollToPos: null, // Used to scroll to a specific position\n\t focus: false,\n\t id: ++nextOpId // Unique ID\n\t };\n\t if (operationGroup) {\n\t operationGroup.ops.push(cm.curOp);\n\t } else {\n\t cm.curOp.ownsGroup = operationGroup = {\n\t ops: [cm.curOp],\n\t delayedCallbacks: []\n\t };\n\t }\n\t }", "function startOperation(cm) {\n\t cm.curOp = {\n\t cm: cm,\n\t viewChanged: false, // Flag that indicates that lines might need to be redrawn\n\t startHeight: cm.doc.height, // Used to detect need to update scrollbar\n\t forceUpdate: false, // Used to force a redraw\n\t updateInput: null, // Whether to reset the input textarea\n\t typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n\t changeObjs: null, // Accumulated changes, for firing change events\n\t cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n\t cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n\t selectionChanged: false, // Whether the selection needs to be redrawn\n\t updateMaxLine: false, // Set when the widest line needs to be determined anew\n\t scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n\t scrollToPos: null, // Used to scroll to a specific position\n\t focus: false,\n\t id: ++nextOpId // Unique ID\n\t };\n\t if (operationGroup) {\n\t operationGroup.ops.push(cm.curOp);\n\t } else {\n\t cm.curOp.ownsGroup = operationGroup = {\n\t ops: [cm.curOp],\n\t delayedCallbacks: []\n\t };\n\t }\n\t }", "function startOperation(cm) {\n\t cm.curOp = {\n\t cm: cm,\n\t viewChanged: false, // Flag that indicates that lines might need to be redrawn\n\t startHeight: cm.doc.height, // Used to detect need to update scrollbar\n\t forceUpdate: false, // Used to force a redraw\n\t updateInput: null, // Whether to reset the input textarea\n\t typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n\t changeObjs: null, // Accumulated changes, for firing change events\n\t cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n\t cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n\t selectionChanged: false, // Whether the selection needs to be redrawn\n\t updateMaxLine: false, // Set when the widest line needs to be determined anew\n\t scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n\t scrollToPos: null, // Used to scroll to a specific position\n\t focus: false,\n\t id: ++nextOpId // Unique ID\n\t };\n\t if (operationGroup) {\n\t operationGroup.ops.push(cm.curOp);\n\t } else {\n\t cm.curOp.ownsGroup = operationGroup = {\n\t ops: [cm.curOp],\n\t delayedCallbacks: []\n\t };\n\t }\n\t }", "addNewOp(opName, opId, opCode, parentPart, opIntervals, isSequential) {\n if (!isSequential) isSequential = false;\n return ops.create({\n opId: opId,\n opCode: opCode,\n opName: opName,\n parentPartId: parentPart,\n intervals: opIntervals,\n isSequential: isSequential\n });\n }", "function startOperation(cm) {\n\t\t cm.curOp = {\n\t\t cm: cm,\n\t\t viewChanged: false, // Flag that indicates that lines might need to be redrawn\n\t\t startHeight: cm.doc.height, // Used to detect need to update scrollbar\n\t\t forceUpdate: false, // Used to force a redraw\n\t\t updateInput: 0, // Whether to reset the input textarea\n\t\t typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n\t\t changeObjs: null, // Accumulated changes, for firing change events\n\t\t cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n\t\t cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n\t\t selectionChanged: false, // Whether the selection needs to be redrawn\n\t\t updateMaxLine: false, // Set when the widest line needs to be determined anew\n\t\t scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n\t\t scrollToPos: null, // Used to scroll to a specific position\n\t\t focus: false,\n\t\t id: ++nextOpId, // Unique ID\n\t\t markArrays: null // Used by addMarkedSpan\n\t\t };\n\t\t pushOperation(cm.curOp);\n\t\t }", "start() {\n this.isStarted = true;\n this._startRequest();\n }", "function startOperation(cm) {\n cm.curOp = {\n cm: cm,\n viewChanged: false, // Flag that indicates that lines might need to be redrawn\n startHeight: cm.doc.height, // Used to detect need to update scrollbar\n forceUpdate: false, // Used to force a redraw\n updateInput: null, // Whether to reset the input textarea\n typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n changeObjs: null, // Accumulated changes, for firing change events\n cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n selectionChanged: false, // Whether the selection needs to be redrawn\n updateMaxLine: false, // Set when the widest line needs to be determined anew\n scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n scrollToPos: null, // Used to scroll to a specific position\n id: ++nextOpId // Unique ID\n };\n if (operationGroup) {\n operationGroup.ops.push(cm.curOp);\n } else {\n cm.curOp.ownsGroup = operationGroup = {\n ops: [cm.curOp],\n delayedCallbacks: []\n };\n }\n }", "function startOperation(cm) {\n cm.curOp = {\n cm: cm,\n viewChanged: false, // Flag that indicates that lines might need to be redrawn\n startHeight: cm.doc.height, // Used to detect need to update scrollbar\n forceUpdate: false, // Used to force a redraw\n updateInput: null, // Whether to reset the input textarea\n typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n changeObjs: null, // Accumulated changes, for firing change events\n cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n selectionChanged: false, // Whether the selection needs to be redrawn\n updateMaxLine: false, // Set when the widest line needs to be determined anew\n scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n scrollToPos: null, // Used to scroll to a specific position\n id: ++nextOpId // Unique ID\n };\n if (operationGroup) {\n operationGroup.ops.push(cm.curOp);\n } else {\n cm.curOp.ownsGroup = operationGroup = {\n ops: [cm.curOp],\n delayedCallbacks: []\n };\n }\n }", "function startOperation(cm) {\n cm.curOp = {\n cm: cm,\n viewChanged: false, // Flag that indicates that lines might need to be redrawn\n startHeight: cm.doc.height, // Used to detect need to update scrollbar\n forceUpdate: false, // Used to force a redraw\n updateInput: null, // Whether to reset the input textarea\n typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n changeObjs: null, // Accumulated changes, for firing change events\n cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n selectionChanged: false, // Whether the selection needs to be redrawn\n updateMaxLine: false, // Set when the widest line needs to be determined anew\n scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n scrollToPos: null, // Used to scroll to a specific position\n id: ++nextOpId // Unique ID\n };\n if (operationGroup) {\n operationGroup.ops.push(cm.curOp);\n } else {\n cm.curOp.ownsGroup = operationGroup = {\n ops: [cm.curOp],\n delayedCallbacks: []\n };\n }\n }", "function startOperation(cm) {\n cm.curOp = {\n cm: cm,\n viewChanged: false, // Flag that indicates that lines might need to be redrawn\n startHeight: cm.doc.height, // Used to detect need to update scrollbar\n forceUpdate: false, // Used to force a redraw\n updateInput: null, // Whether to reset the input textarea\n typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n changeObjs: null, // Accumulated changes, for firing change events\n cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n selectionChanged: false, // Whether the selection needs to be redrawn\n updateMaxLine: false, // Set when the widest line needs to be determined anew\n scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n scrollToPos: null, // Used to scroll to a specific position\n id: ++nextOpId // Unique ID\n };\n if (operationGroup) {\n operationGroup.ops.push(cm.curOp);\n } else {\n cm.curOp.ownsGroup = operationGroup = {\n ops: [cm.curOp],\n delayedCallbacks: []\n };\n }\n }", "function startOperation(cm) {\n cm.curOp = {\n cm: cm,\n viewChanged: false, // Flag that indicates that lines might need to be redrawn\n startHeight: cm.doc.height, // Used to detect need to update scrollbar\n forceUpdate: false, // Used to force a redraw\n updateInput: null, // Whether to reset the input textarea\n typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n changeObjs: null, // Accumulated changes, for firing change events\n cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n selectionChanged: false, // Whether the selection needs to be redrawn\n updateMaxLine: false, // Set when the widest line needs to be determined anew\n scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n scrollToPos: null, // Used to scroll to a specific position\n id: ++nextOpId // Unique ID\n };\n if (operationGroup) {\n operationGroup.ops.push(cm.curOp);\n } else {\n cm.curOp.ownsGroup = operationGroup = {\n ops: [cm.curOp],\n delayedCallbacks: []\n };\n }\n }", "function startOperation(cm) {\n cm.curOp = {\n cm: cm,\n viewChanged: false, // Flag that indicates that lines might need to be redrawn\n startHeight: cm.doc.height, // Used to detect need to update scrollbar\n forceUpdate: false, // Used to force a redraw\n updateInput: null, // Whether to reset the input textarea\n typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n changeObjs: null, // Accumulated changes, for firing change events\n cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n selectionChanged: false, // Whether the selection needs to be redrawn\n updateMaxLine: false, // Set when the widest line needs to be determined anew\n scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n scrollToPos: null, // Used to scroll to a specific position\n focus: false,\n id: ++nextOpId // Unique ID\n };\n if (operationGroup) {\n operationGroup.ops.push(cm.curOp);\n } else {\n cm.curOp.ownsGroup = operationGroup = {\n ops: [cm.curOp],\n delayedCallbacks: []\n };\n }\n }", "function startOperation(cm) {\n cm.curOp = {\n cm: cm,\n viewChanged: false, // Flag that indicates that lines might need to be redrawn\n startHeight: cm.doc.height, // Used to detect need to update scrollbar\n forceUpdate: false, // Used to force a redraw\n updateInput: null, // Whether to reset the input textarea\n typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n changeObjs: null, // Accumulated changes, for firing change events\n cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n selectionChanged: false, // Whether the selection needs to be redrawn\n updateMaxLine: false, // Set when the widest line needs to be determined anew\n scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n scrollToPos: null, // Used to scroll to a specific position\n focus: false,\n id: ++nextOpId // Unique ID\n };\n if (operationGroup) {\n operationGroup.ops.push(cm.curOp);\n } else {\n cm.curOp.ownsGroup = operationGroup = {\n ops: [cm.curOp],\n delayedCallbacks: []\n };\n }\n }", "function startOperation(cm) {\n cm.curOp = {\n cm: cm,\n viewChanged: false, // Flag that indicates that lines might need to be redrawn\n startHeight: cm.doc.height, // Used to detect need to update scrollbar\n forceUpdate: false, // Used to force a redraw\n updateInput: 0, // Whether to reset the input textarea\n typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n changeObjs: null, // Accumulated changes, for firing change events\n cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n selectionChanged: false, // Whether the selection needs to be redrawn\n updateMaxLine: false, // Set when the widest line needs to be determined anew\n scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n scrollToPos: null, // Used to scroll to a specific position\n focus: false,\n id: ++nextOpId, // Unique ID\n markArrays: null // Used by addMarkedSpan\n };\n pushOperation(cm.curOp);\n }", "function startOperation(cm) {\n cm.curOp = {\n cm: cm,\n viewChanged: false, // Flag that indicates that lines might need to be redrawn\n startHeight: cm.doc.height, // Used to detect need to update scrollbar\n forceUpdate: false, // Used to force a redraw\n updateInput: 0, // Whether to reset the input textarea\n typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n changeObjs: null, // Accumulated changes, for firing change events\n cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n selectionChanged: false, // Whether the selection needs to be redrawn\n updateMaxLine: false, // Set when the widest line needs to be determined anew\n scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n scrollToPos: null, // Used to scroll to a specific position\n focus: false,\n id: ++nextOpId, // Unique ID\n markArrays: null // Used by addMarkedSpan\n };\n pushOperation(cm.curOp);\n }", "function startOperation(cm) {\n cm.curOp = {\n cm: cm,\n viewChanged: false, // Flag that indicates that lines might need to be redrawn\n startHeight: cm.doc.height, // Used to detect need to update scrollbar\n forceUpdate: false, // Used to force a redraw\n updateInput: 0, // Whether to reset the input textarea\n typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n changeObjs: null, // Accumulated changes, for firing change events\n cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n selectionChanged: false, // Whether the selection needs to be redrawn\n updateMaxLine: false, // Set when the widest line needs to be determined anew\n scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n scrollToPos: null, // Used to scroll to a specific position\n focus: false,\n id: ++nextOpId, // Unique ID\n markArrays: null // Used by addMarkedSpan\n };\n pushOperation(cm.curOp);\n }", "function startOperation(cm) {\n cm.curOp = {\n cm: cm,\n viewChanged: false, // Flag that indicates that lines might need to be redrawn\n startHeight: cm.doc.height, // Used to detect need to update scrollbar\n forceUpdate: false, // Used to force a redraw\n updateInput: null, // Whether to reset the input textarea\n typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n changeObjs: null, // Accumulated changes, for firing change events\n cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n selectionChanged: false, // Whether the selection needs to be redrawn\n updateMaxLine: false, // Set when the widest line needs to be determined anew\n scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n scrollToPos: null, // Used to scroll to a specific position\n focus: false,\n id: ++nextOpId // Unique ID\n };\n pushOperation(cm.curOp);\n }", "function startOperation(cm) {\n cm.curOp = {\n cm: cm,\n viewChanged: false, // Flag that indicates that lines might need to be redrawn\n startHeight: cm.doc.height, // Used to detect need to update scrollbar\n forceUpdate: false, // Used to force a redraw\n updateInput: null, // Whether to reset the input textarea\n typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n changeObjs: null, // Accumulated changes, for firing change events\n cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n selectionChanged: false, // Whether the selection needs to be redrawn\n updateMaxLine: false, // Set when the widest line needs to be determined anew\n scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n scrollToPos: null, // Used to scroll to a specific position\n focus: false,\n id: ++nextOpId // Unique ID\n };\n pushOperation(cm.curOp);\n }", "function startNewCall() {\n\n}", "function _startOperation(cm) {\n cm.curOp = {\n cm: cm,\n viewChanged: false,\n // Flag that indicates that lines might need to be redrawn\n startHeight: cm.doc.height,\n // Used to detect need to update scrollbar\n forceUpdate: false,\n // Used to force a redraw\n updateInput: 0,\n // Whether to reset the input textarea\n typing: false,\n // Whether this reset should be careful to leave existing text (for compositing)\n changeObjs: null,\n // Accumulated changes, for firing change events\n cursorActivityHandlers: null,\n // Set of handlers to fire cursorActivity on\n cursorActivityCalled: 0,\n // Tracks which cursorActivity handlers have been called already\n selectionChanged: false,\n // Whether the selection needs to be redrawn\n updateMaxLine: false,\n // Set when the widest line needs to be determined anew\n scrollLeft: null,\n scrollTop: null,\n // Intermediate scroll position, not pushed to DOM yet\n scrollToPos: null,\n // Used to scroll to a specific position\n focus: false,\n id: ++nextOpId // Unique ID\n\n };\n pushOperation(cm.curOp);\n } // Finish an operation, updating the display and signalling delayed events", "startEdit() {\n const basicProgram = this.trs80.getBasicProgramFromMemory();\n if (typeof basicProgram === \"string\") {\n // TODO show error.\n console.error(basicProgram);\n }\n else {\n this.wasStarted = this.trs80.stop();\n this.setProgram(basicProgram);\n this.show();\n }\n }", "function startOperation(cm) {\r\n cm.curOp = {\r\n cm: cm,\r\n viewChanged: false, // Flag that indicates that lines might need to be redrawn\r\n startHeight: cm.doc.height, // Used to detect need to update scrollbar\r\n forceUpdate: false, // Used to force a redraw\r\n updateInput: null, // Whether to reset the input textarea\r\n typing: false, // Whether this reset should be careful to leave existing text (for compositing)\r\n changeObjs: null, // Accumulated changes, for firing change events\r\n cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\r\n cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\r\n selectionChanged: false, // Whether the selection needs to be redrawn\r\n updateMaxLine: false, // Set when the widest line needs to be determined anew\r\n scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\r\n scrollToPos: null, // Used to scroll to a specific position\r\n focus: false,\r\n id: ++nextOpId // Unique ID\r\n };\r\n pushOperation(cm.curOp);\r\n}", "function startOperation(cm) {\n cm.curOp = {\n cm: cm,\n viewChanged: false, // Flag that indicates that lines might need to be redrawn\n startHeight: cm.doc.height, // Used to detect need to update scrollbar\n forceUpdate: false, // Used to force a redraw\n updateInput: null, // Whether to reset the input textarea\n typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n changeObjs: null, // Accumulated changes, for firing change events\n cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n selectionChanged: false, // Whether the selection needs to be redrawn\n updateMaxLine: false, // Set when the widest line needs to be determined anew\n scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n scrollToPos: null, // Used to scroll to a specific position\n focus: false,\n id: ++nextOpId // Unique ID\n }\n pushOperation(cm.curOp)\n}", "function startOperation(cm) {\n cm.curOp = {\n cm: cm,\n viewChanged: false, // Flag that indicates that lines might need to be redrawn\n startHeight: cm.doc.height, // Used to detect need to update scrollbar\n forceUpdate: false, // Used to force a redraw\n updateInput: null, // Whether to reset the input textarea\n typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n changeObjs: null, // Accumulated changes, for firing change events\n cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n selectionChanged: false, // Whether the selection needs to be redrawn\n updateMaxLine: false, // Set when the widest line needs to be determined anew\n scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n scrollToPos: null, // Used to scroll to a specific position\n focus: false,\n id: ++nextOpId // Unique ID\n }\n pushOperation(cm.curOp)\n}", "function startOperation(cm) {\n cm.curOp = {\n cm: cm,\n viewChanged: false, // Flag that indicates that lines might need to be redrawn\n startHeight: cm.doc.height, // Used to detect need to update scrollbar\n forceUpdate: false, // Used to force a redraw\n updateInput: null, // Whether to reset the input textarea\n typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n changeObjs: null, // Accumulated changes, for firing change events\n cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n selectionChanged: false, // Whether the selection needs to be redrawn\n updateMaxLine: false, // Set when the widest line needs to be determined anew\n scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n scrollToPos: null, // Used to scroll to a specific position\n focus: false,\n id: ++nextOpId // Unique ID\n };\n pushOperation(cm.curOp);\n}", "function startOperation(cm) {\n cm.curOp = {\n cm: cm,\n viewChanged: false, // Flag that indicates that lines might need to be redrawn\n startHeight: cm.doc.height, // Used to detect need to update scrollbar\n forceUpdate: false, // Used to force a redraw\n updateInput: null, // Whether to reset the input textarea\n typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n changeObjs: null, // Accumulated changes, for firing change events\n cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n selectionChanged: false, // Whether the selection needs to be redrawn\n updateMaxLine: false, // Set when the widest line needs to be determined anew\n scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n scrollToPos: null, // Used to scroll to a specific position\n focus: false,\n id: ++nextOpId // Unique ID\n };\n pushOperation(cm.curOp);\n}", "function startOperation(cm) {\n cm.curOp = {\n cm: cm,\n viewChanged: false, // Flag that indicates that lines might need to be redrawn\n startHeight: cm.doc.height, // Used to detect need to update scrollbar\n forceUpdate: false, // Used to force a redraw\n updateInput: null, // Whether to reset the input textarea\n typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n changeObjs: null, // Accumulated changes, for firing change events\n cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n selectionChanged: false, // Whether the selection needs to be redrawn\n updateMaxLine: false, // Set when the widest line needs to be determined anew\n scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n scrollToPos: null, // Used to scroll to a specific position\n focus: false,\n id: ++nextOpId // Unique ID\n };\n pushOperation(cm.curOp);\n}", "function startOperation(cm) {\n cm.curOp = {\n cm: cm,\n viewChanged: false, // Flag that indicates that lines might need to be redrawn\n startHeight: cm.doc.height, // Used to detect need to update scrollbar\n forceUpdate: false, // Used to force a redraw\n updateInput: null, // Whether to reset the input textarea\n typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n changeObjs: null, // Accumulated changes, for firing change events\n cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n selectionChanged: false, // Whether the selection needs to be redrawn\n updateMaxLine: false, // Set when the widest line needs to be determined anew\n scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n scrollToPos: null, // Used to scroll to a specific position\n focus: false,\n id: ++nextOpId // Unique ID\n };\n pushOperation(cm.curOp);\n}", "function startOperation(cm) {\n cm.curOp = {\n cm: cm,\n viewChanged: false, // Flag that indicates that lines might need to be redrawn\n startHeight: cm.doc.height, // Used to detect need to update scrollbar\n forceUpdate: false, // Used to force a redraw\n updateInput: null, // Whether to reset the input textarea\n typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n changeObjs: null, // Accumulated changes, for firing change events\n cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n selectionChanged: false, // Whether the selection needs to be redrawn\n updateMaxLine: false, // Set when the widest line needs to be determined anew\n scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n scrollToPos: null, // Used to scroll to a specific position\n focus: false,\n id: ++nextOpId // Unique ID\n };\n pushOperation(cm.curOp);\n}", "function startOperation(cm) {\n cm.curOp = {\n cm: cm,\n viewChanged: false, // Flag that indicates that lines might need to be redrawn\n startHeight: cm.doc.height, // Used to detect need to update scrollbar\n forceUpdate: false, // Used to force a redraw\n updateInput: null, // Whether to reset the input textarea\n typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n changeObjs: null, // Accumulated changes, for firing change events\n cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n selectionChanged: false, // Whether the selection needs to be redrawn\n updateMaxLine: false, // Set when the widest line needs to be determined anew\n scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n scrollToPos: null, // Used to scroll to a specific position\n focus: false,\n id: ++nextOpId // Unique ID\n };\n pushOperation(cm.curOp);\n}", "function startOperation(cm) {\n cm.curOp = {\n cm: cm,\n viewChanged: false, // Flag that indicates that lines might need to be redrawn\n startHeight: cm.doc.height, // Used to detect need to update scrollbar\n forceUpdate: false, // Used to force a redraw\n updateInput: null, // Whether to reset the input textarea\n typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n changeObjs: null, // Accumulated changes, for firing change events\n cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n selectionChanged: false, // Whether the selection needs to be redrawn\n updateMaxLine: false, // Set when the widest line needs to be determined anew\n scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n scrollToPos: null, // Used to scroll to a specific position\n focus: false,\n id: ++nextOpId // Unique ID\n };\n pushOperation(cm.curOp);\n}", "function startOperation(cm) {\n cm.curOp = {\n cm: cm,\n viewChanged: false, // Flag that indicates that lines might need to be redrawn\n startHeight: cm.doc.height, // Used to detect need to update scrollbar\n forceUpdate: false, // Used to force a redraw\n updateInput: null, // Whether to reset the input textarea\n typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n changeObjs: null, // Accumulated changes, for firing change events\n cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n selectionChanged: false, // Whether the selection needs to be redrawn\n updateMaxLine: false, // Set when the widest line needs to be determined anew\n scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n scrollToPos: null, // Used to scroll to a specific position\n focus: false,\n id: ++nextOpId // Unique ID\n };\n pushOperation(cm.curOp);\n}", "function startOperation(cm) {\n cm.curOp = {\n cm: cm,\n viewChanged: false, // Flag that indicates that lines might need to be redrawn\n startHeight: cm.doc.height, // Used to detect need to update scrollbar\n forceUpdate: false, // Used to force a redraw\n updateInput: null, // Whether to reset the input textarea\n typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n changeObjs: null, // Accumulated changes, for firing change events\n cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n selectionChanged: false, // Whether the selection needs to be redrawn\n updateMaxLine: false, // Set when the widest line needs to be determined anew\n scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n scrollToPos: null, // Used to scroll to a specific position\n focus: false,\n id: ++nextOpId // Unique ID\n };\n pushOperation(cm.curOp);\n}", "function startOperation(cm) {\n cm.curOp = {\n cm: cm,\n viewChanged: false, // Flag that indicates that lines might need to be redrawn\n startHeight: cm.doc.height, // Used to detect need to update scrollbar\n forceUpdate: false, // Used to force a redraw\n updateInput: null, // Whether to reset the input textarea\n typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n changeObjs: null, // Accumulated changes, for firing change events\n cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n selectionChanged: false, // Whether the selection needs to be redrawn\n updateMaxLine: false, // Set when the widest line needs to be determined anew\n scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n scrollToPos: null, // Used to scroll to a specific position\n focus: false,\n id: ++nextOpId // Unique ID\n };\n pushOperation(cm.curOp);\n}", "function startOperation(cm) {\n cm.curOp = {\n cm: cm,\n viewChanged: false, // Flag that indicates that lines might need to be redrawn\n startHeight: cm.doc.height, // Used to detect need to update scrollbar\n forceUpdate: false, // Used to force a redraw\n updateInput: null, // Whether to reset the input textarea\n typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n changeObjs: null, // Accumulated changes, for firing change events\n cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n selectionChanged: false, // Whether the selection needs to be redrawn\n updateMaxLine: false, // Set when the widest line needs to be determined anew\n scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n scrollToPos: null, // Used to scroll to a specific position\n focus: false,\n id: ++nextOpId // Unique ID\n };\n pushOperation(cm.curOp);\n}", "makeStart() {\n this.type = Node.START;\n this.state = null;\n }", "start() {}", "start() {}", "start() {}", "start() {}", "start() {}", "start() {}", "start() {\n this._child.send({\n cmd: 'start',\n data: null\n });\n }", "function startNew(options) {\n return default_1.DefaultTerminalSession.startNew(options);\n }", "_start_instruction() {\n\t\t\tthis.current_start_time = Date.now();\n\t\t\tthis._start_mouse_track();\n\t\t}", "function startOperation(cm) {\n if (cm.curOp) ++cm.curOp.depth;\n else cm.curOp = {\n // Nested operations delay update until the outermost one\n // finishes.\n depth: 1,\n // An array of ranges of lines that have to be updated. See\n // updateDisplay.\n changes: [],\n delayedCallbacks: [],\n updateInput: null,\n userSelChange: null,\n textChanged: null,\n selectionChanged: false,\n updateMaxLine: false,\n id: ++cm.nextOpId\n };\n }", "function startOperation(cm) {\n if (cm.curOp) ++cm.curOp.depth;\n else cm.curOp = {\n // Nested operations delay update until the outermost one\n // finishes.\n depth: 1,\n // An array of ranges of lines that have to be updated. See\n // updateDisplay.\n changes: [],\n delayedCallbacks: [],\n updateInput: null,\n userSelChange: null,\n textChanged: null,\n selectionChanged: false,\n updateMaxLine: false,\n id: ++cm.nextOpId\n };\n }", "function startOperation(cm) {\n if (cm.curOp) ++cm.curOp.depth;\n else cm.curOp = {\n // Nested operations delay update until the outermost one\n // finishes.\n depth: 1,\n // An array of ranges of lines that have to be updated. See\n // updateDisplay.\n changes: [],\n delayedCallbacks: [],\n updateInput: null,\n userSelChange: null,\n textChanged: null,\n selectionChanged: false,\n updateMaxLine: false,\n id: ++cm.nextOpId\n };\n }", "start () {}", "addOperation(operation) {\n this.operations.push(async () => {\n try {\n this.actives++;\n await operation();\n this.actives--;\n this.completed++;\n this.parallelExecute();\n }\n catch (error) {\n this.emitter.emit(\"error\", error);\n }\n });\n }", "addOperation(operation) {\n this.operations.push(async () => {\n try {\n this.actives++;\n await operation();\n this.actives--;\n this.completed++;\n this.parallelExecute();\n }\n catch (error) {\n this.emitter.emit(\"error\", error);\n }\n });\n }", "function startOperation() {\n updateInput = userSelChange = textChanged = null;\n changes = []; selectionChanged = false; callbacks = [];\n }", "function startOperation() {\n updateInput = userSelChange = textChanged = null;\n changes = []; selectionChanged = false; callbacks = [];\n }", "function startOperation() {\n updateInput = userSelChange = textChanged = null;\n changes = []; selectionChanged = false; callbacks = [];\n }", "get start() {}", "function start() {\n status = -1;\n action(1, 0, 0);\n}", "function vipsOperationNew (name) {\n return libvips.vips_operation_new(name);\n }", "function startNew(options) {\n return default_1.DefaultSession.startNew(options);\n }", "function op(id, nargs) {\n return function() {\n var r = new Operation(id);\n r.args = toArray(arguments).slice(0, nargs);\n return r;\n };\n }", "function start() {\r\n\tstatus = -1;\r\n\taction(1, 0, 0);\r\n}", "function executeOperation(source, type, id, operationName) {\n var btn = $(source);\n btn.button('loading');\n btn.append($('<input />', { type: 'hidden', name: 'instanceType', value: type }));\n btn.append($('<input />', { type: 'hidden', name: 'instanceId', value: id }));\n btn.append($('<input />', { type: 'hidden', name: 'operationName', value: operationName }));\n $(\"#outerForm\").attr(\"action\", \"operation\").submit();\n}", "function start() {\n init();\n run();\n }", "start() {\n if (!this.started) {\n this.started = true;\n this._requestIfNeeded();\n }\n }", "function startCreating() {\n mainVm.isCreating = true;\n mainVm.isEditing = false;\n }", "get isStarted () { return this.state == Command.STATE.CREATE; }", "start() {\n this.executeNextTask();\n }", "function start() {\r\n status = -1;\r\n action(1, 0, 0);\r\n}", "function StartSpeechSynthesisTaskCommand(input) {\n var _this = \n // Start section: command_constructor\n _super.call(this) || this;\n _this.input = input;\n return _this;\n // End section: command_constructor\n }", "function StartStreamProcessorCommand(input) {\n var _this = \n // Start section: command_constructor\n _super.call(this) || this;\n _this.input = input;\n return _this;\n // End section: command_constructor\n }", "function operation(operatorName, args) {\n\t return { type: 'operation', operator: operatorName, args: args || [] };\n\t }", "start() {\n const { creator, conf } = this;\n const upStreaming = conf.getVal('upStreaming');\n\n if (upStreaming) {\n this.liveOutput();\n } else if (ScenesUtil.isSingle(creator)) {\n this.mvOutput();\n } else {\n if (ScenesUtil.hasTransition(creator)) {\n ScenesUtil.fillTransition(creator);\n this.addXfadeInput();\n } else {\n this.addConcatInput();\n }\n\n this.addAudio();\n this.addOutputOptions();\n this.addCommandEvents();\n this.addOutput();\n this.command.run();\n }\n }", "function runInOp(cm, f) {\n\t\t if (cm.curOp) return f();\n\t\t startOperation(cm);\n\t\t try { return f(); }\n\t\t finally { endOperation(cm); }\n\t\t }", "start() {\n this.taskFunction_.apply(null, Array.prototype.slice.call(arguments));\n this.onTaskDone();\n }", "start() {\n this.running = true;\n }", "async start(options) {\n const job = {\n _id: self.apos.util.generateId(),\n good: 0,\n bad: 0,\n processed: 0,\n status: 'running',\n ended: false,\n when: new Date()\n };\n const context = {\n _id: job._id,\n options: options\n };\n\n await self.db.insertOne(job);\n return context;\n }", "function runInOp(cm, f) {\n\t if (cm.curOp) return f();\n\t startOperation(cm);\n\t try { return f(); }\n\t finally { endOperation(cm); }\n\t }", "function runInOp(cm, f) {\n\t if (cm.curOp) return f();\n\t startOperation(cm);\n\t try { return f(); }\n\t finally { endOperation(cm); }\n\t }", "function runInOp(cm, f) {\n\t if (cm.curOp) return f();\n\t startOperation(cm);\n\t try { return f(); }\n\t finally { endOperation(cm); }\n\t }", "function start() { \n initiate_graph_builder();\n initiate_job_info(); \n initiate_aggregate_info();\n initiate_node_info();\n}", "function startOperation() {\n updateInput = userSelChange = textChanged = null;\n changes = []; selectionChanged = false; callbacks = [];\n }" ]
[ "0.61408204", "0.61112124", "0.61112124", "0.5981286", "0.58847827", "0.5828475", "0.57273746", "0.57061714", "0.5692559", "0.5688068", "0.5688068", "0.5688068", "0.5681768", "0.5661453", "0.5646481", "0.5626896", "0.5626896", "0.5626896", "0.5626896", "0.5626896", "0.5621532", "0.5621532", "0.56057477", "0.56057477", "0.56057477", "0.55949545", "0.55949545", "0.5585921", "0.5567218", "0.55530095", "0.5552023", "0.5551109", "0.5551109", "0.5549228", "0.5549228", "0.5549228", "0.5549228", "0.5549228", "0.5549228", "0.5549228", "0.5549228", "0.5549228", "0.5549228", "0.5549228", "0.5537494", "0.5526427", "0.5526427", "0.5526427", "0.5526427", "0.5526427", "0.5526427", "0.55243653", "0.5485008", "0.5481153", "0.5472381", "0.5472381", "0.5472381", "0.5405285", "0.5403993", "0.5403993", "0.5394596", "0.5394596", "0.5394596", "0.534292", "0.534222", "0.5322331", "0.5317555", "0.53013676", "0.5300209", "0.52901477", "0.52826947", "0.52784973", "0.5278173", "0.52730346", "0.52554095", "0.52479094", "0.524491", "0.521709", "0.52167654", "0.52114916", "0.52078676", "0.52072483", "0.5200378", "0.5199619", "0.5194645", "0.5194645", "0.5194645", "0.5183839", "0.5169421" ]
0.5602222
32
Finish an operation, updating the display and signalling delayed events
function endOperation(cm) { var op = cm.curOp; if (op) { finishOperation(op, function (group) { for (var i = 0; i < group.ops.length; i++) { group.ops[i].cm.curOp = null; } endOperations(group); }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "finishProcessing() {\n this.busy = false;\n this.successful = true;\n }", "function handleFinish(values) {\n job.current = getJob(values, job.current, writeMessage);\n setBusy(job.current.pendingTime);\n }", "finish() {\n window.setTimeout(\n this.displayAbsorptionTexts.bind(this),\n absorptionDuration\n );\n const lastStep = this.measurementHistory.length - 1;\n window.setTimeout(\n this.displayMeasurementTexts.bind(this, lastStep),\n this.animationStepDuration\n );\n window.setTimeout(\n this.finishCallback.bind(this),\n this.absorptionDuration\n );\n window.setTimeout(\n () => {this.board.animationExists = false;},\n this.absorptionDuration\n );\n // Make text groups disappear\n window.setTimeout(\n this.removeTexts.bind(this),\n absorptionDuration + absorptionTextDuration\n );\n }", "function finishProcess(){\n self.updateBars(callback);\n }", "function finish() {\n// if (--finished == 0) {\n if (!isFinished) {\n isFinished = true;\n Physics.there.style(self.from.getContainerBodyId(), {\n opacity: 0\n });\n\n self.dfd.resolve();\n }\n }", "function renderUpdateComplete() {\n exportData.renderUpdateRunning = false;\n $loadingBar.css('opacity', 0);\n }", "onFinish() {\n\t\tif (this.props.onFinish) {\n\t\t\tthis.props.onFinish();\n\t\t}\n\t}", "function callbackDone() {\n module.presentation.set('contents', module.contents);\n module.callback(module.command);\n }", "onFinish() {}", "function finish() {\n var latency = Math.floor((+new Date) - check.start);\n check.start = +new Date;\n\n avg = Math.floor((avg + latency) / 2);\n latest = latency;\n max = latency > max ? latency : max;\n avg = avg ? avg : 100;\n\n add_result(latency);\n\n check.used = 0;\n clearTimeout(check.ival);\n p.css( delay, { opacity : '1' } )\n p.css( blink, { width : '0' } )\n }", "function complete()\n\t{\n\t\t_queryInProgress = false;\n\t\t_dispatcher.trigger(_options.completeEvent);\n\t}", "function finish() {\n\t if (!isIn) element.hide();\n\t reset();\n\t if (cb) cb.apply(element);\n\t }", "function finish() {\n if (!isIn) element.hide();\n reset();\n if (cb) cb.apply(element);\n }", "function finish() {\n if (!isIn) element.hide();\n reset();\n if (cb) cb.apply(element);\n }", "function finish() {\n if (!isIn) element.hide();\n reset();\n if (cb) cb.apply(element);\n }", "function finish() {\n if (!isIn) element.hide();\n reset();\n if (cb) cb.apply(element);\n }", "function finish() {\n if (!isIn) element.hide();\n reset();\n if (cb) cb.apply(element);\n }", "function complete() {\n // Play the animation and audio effect after task completion.\n\n setProperty(\"isComplete\", true);\n\n // Set distanceProgress to be at most the distance for the mission, subtract the difference from the offset.\n if (getProperty(\"missionType\") === \"audit\") {\n var distanceOver = getProperty(\"distanceProgress\") - getProperty(\"distance\");\n var oldOffset = svl.missionContainer.getTasksMissionsOffset();\n var newOffset = oldOffset - distanceOver;\n svl.missionContainer.setTasksMissionsOffset(newOffset);\n }\n\n // Reset the label counter\n if ('labelCounter' in svl) {\n labelCountsAtCompletion = {\n \"CurbRamp\": svl.labelCounter.countLabel(\"CurbRamp\"),\n \"NoCurbRamp\": svl.labelCounter.countLabel(\"NoCurbRamp\"),\n \"Obstacle\": svl.labelCounter.countLabel(\"Obstacle\"),\n \"SurfaceProblem\": svl.labelCounter.countLabel(\"SurfaceProblem\"),\n \"NoSidewalk\": svl.labelCounter.countLabel(\"NoSidewalk\"),\n \"Other\": svl.labelCounter.countLabel(\"Other\")\n };\n svl.labelCounter.reset();\n }\n\n if (!svl.isOnboarding()){\n svl.storage.set('completedFirstMission', true);\n }\n }", "function finish() {\n if (!isIn) element.hide();\n reset();\n if (cb) cb.apply(element);\n }", "function finish() {\n if (!isIn) element.hide();\n reset();\n if (cb) cb.apply(element);\n }", "function onFinish() {\n\t\tclbk();\n\t}", "done() {\n this.calc();\n this.stop();\n\n this.el.fire('drawdone');\n }", "handleUpdateFinished() {\n if(this.isLoop) {\n this.curTime = 0;\n }\n else {\n this.pause();\n }\n\n this.invokeResetter();\n }", "function doDone() {\r\n // in FF this is empty.\r\n\r\n }", "function doDone() {\r\n // in FF this is empty.\r\n\r\n }", "finish(){\n model.stat.timer.stop();\n alert(model.algorithm.getCurrStep().description+' '+model.algorithm.getCurrStep().help);\n\t\tdocument.getElementById('nextBtn').disabled=true;\n\t\tdocument.getElementById('autoRunBtn').disabled=true;\n }", "function finishTask() {\n var task_panel = GetId(\"task_panel\");\n setTimeout(() => fade1(task_panel), 500);\n setTimeout(() => removeElement(\"task_panel\"), 1000);\n setTimeout(loadNextTask, 1000);\n // loadNextTask();\n}", "end(){\n this.request({\"component\":this.component,\"method\":\"end\",\"args\":[\"\"]})\n this.running = false\n }", "_onEnd() {\n this._duringDisplayAnim = false;\n // - need to re render at the end of the display animation\n this._setAnimParams();\n }", "function taskDone(e) {\n\tJSL.event(e).stop();\n\tvar lnk = JSL.event(e).getTarget();\n\tvar data = {\"success\":\"Done\"};\n\tloading();\n\tJSL.ajax(lnk.href+\"&ajax=1\").load(function(data) {\n\t\tloaded();\n\t\tif(data.success) removeTask(lnk);\n\t\tshowMessage(data);\n\t},\"json\");\n}", "end () {\n this.html.classList.remove(Action.RUNNING_CLASS);\n\n const effect = {\n action: this.data,\n people: this.owner,\n };\n const data = this.mergeWithOption(this.chosenOptionId);\n this.chosenOptionId = null;\n\n this.owner.finishAction();\n\n // Effect\n if (Utils.isFunction(this.data.effect)) {\n this.data.effect(this, data, effect);\n }\n\n const result = this.resolveAction(effect, data);\n\n // Give\n if (result.give.length) {\n MessageBus.notify(MessageBus.MSG_TYPES.GIVE, {\n give: result.give,\n initiator: this,\n });\n }\n\n // Unlock for all\n if (result.unlock.forAll.length) {\n // add to all\n MessageBus.notify(MessageBus.MSG_TYPES.UNLOCK, result.unlock.forAll);\n }\n // add to owner\n this.owner.addAction(result.unlock.forOne);\n\n // Lock for all\n if (result.lock.forAll.length) {\n // lock to all\n MessageBus.notify(MessageBus.MSG_TYPES.LOCK, result.lock.forAll);\n }\n // lock to owner\n this.owner.lockAction(result.lock.forOne);\n\n // Build\n if (result.build) {\n MessageBus.notify(MessageBus.MSG_TYPES.BUILD, result.build);\n }\n\n MessageBus.notify(MessageBus.MSG_TYPES.ACTION_END, result.log);\n }", "end() {\n this.cancel();\n this.callback();\n }", "function doneWork() {\n updateHTML(false);\t\t\t/* input boolean parameter set to false */\n}", "function renderUpdateComplete() {\n autotrace.renderUpdateRunning = false;\n $loadingBar.css('opacity', 0);\n }", "function jscoverage_endLengthyOperation() {\n\tProgressBar.setPercentage(100, 'Done');\n\t// fadeToBackground\n\n\tsetTimeout(function () {\n\t\tjscoverage_inLengthyOperation = false;\n\t\tProgressBar.makeInvisible();\n\t}, 500);\n}", "finish() {\n this.done = true;\n }", "function onFinish() {\n console.log('finished!');\n}", "function doneUpdate(stringIfsuccessfulOrRequestIfNot, success, statusText){\n\t\t\t$(e).add(ersatz).removeClass('pending') ;\n\n\t\t\tif (success) {\n\t\t\t\tif ( e.originalHeight ) e.style.height = e.originalHeight ;\n\t\t\t\tif ( e.originalValue != null && e.value == sentValue ) e.value = e.originalValue ;\n\t\t\t} else if ( !isPeriodic ) { // periodic updater dies quietly\n\t\t\t\tvar tag = target.css('display') == 'block' ? 'div' : 'span';\n\t\t\t\ttarget.append('<'+tag+' class=\"error\"><strong>Error:</strong> '+statusText+'</'+tag+'>');\n\t\t\t\tif (e.htmlcode == '#') return;\n\t\t\t\tersatz.replaceWith(target);\n\t\t\t\te2(target); // jquery unbinds all the magic when you take it out of the DOM\n\t\t\t}\n\n\t\t\tif (hadFocus && $('#'+hadFocus).length)\n\t\t\t\te2(function(){$('#'+hadFocus).focus();}).defer() ; // IE8 fails without defer\n\t\t}", "_finishDismiss() {\n this._overlayRef.dispose();\n if (!this._onAction.closed) {\n this._onAction.complete();\n }\n this._afterDismissed.next({ dismissedByAction: this._dismissedByAction });\n this._afterDismissed.complete();\n this._dismissedByAction = false;\n }", "onFinish() {\n this.props.store.dispatch(ACTIONS.FINISH);\n }", "complete () {\n this.detailBox.innerHTML = 'Click to begin'\n this.container.addEventListener('click', this.begin.bind(this))\n }", "function runOperation() {\n\tsetConfig();\n\tcreatePrints();\n\trunDialog.close();\n}", "function complete() {\n Y.log('complete');\n }", "function complete() {\n Y.log('complete');\n }", "function complete() {\n Y.log('complete');\n }", "function complete() {\n Y.log('complete');\n }", "function complete() {\n Y.log('complete');\n }", "_complete() {\n this._resetCurrent(true);\n\n super._complete();\n }", "function showEnd() {\n $(\"#ui_3\").fadeOut(null, ()=>{\n $(\"#ui_end\").fadeIn();\n postLog();\n });\n}", "function endEdit(){\n // Reset task form and update UI\n displayTaskForm();\n updateUI()\n}", "_onComplete() {\n // Ensure worker queues for all paths are stopped at the end of the query\n this.stop();\n }", "_complete() {\n if(this.get('isDestroyed') || this.get('isDestroying')){\n return;\n }\n\n invokeAction(this, 'onDragStop', this.get('model'));\n this.set('isDropping', false);\n this.set('wasDropped', true);\n this._tellGroup('commit');\n }", "function _finishedLoading() {\n if ( that.lastFunction ){\n that.lastFunction();\n that.lastFunction = false;\n }\n that.ajaxBusy = false;\n\n // make sure the search menu is completed in error cases\n if ( that.currentControl === \"SEARCH_COLUMN\" && that.searchMenuCallback ) {\n that.searchMenuCallback( false );\n that.searchMenuCallback = null;\n that.searchMenu = null;\n }\n } // _finishedLoading", "finish() {\n\t\tthis.IS_STARTED = false;\n\t}", "function finishTask(pomoID) {\n setStatus(pomoID, SESSION_STATUS.complete);\n setCurrentPomo(INVALID_POMOID);\n closeFinishDialog();\n updateTable();\n}", "function handleComplete(size, status, index) {\n console.log(\"completed\");\n drawProgress(1, status);\n }", "function clickDone(data) {\n messageDiv.html(\"server response: \" + data);\n}", "function finish()\r\n{\r\n\t\t//Before calling any LMS function, we will always check for the API.\r\n\t\tAPI = GetAPI();\t\t\r\n\t\tif( API != null )\r\n\t\t{\r\n\t\t\t//Submit Data to the LMS\r\n\t\t\tset_val(\"cmi.suspend_data\",Bookmark_location);\t\t\t\r\n\t\t\tsTime=stopclock();\r\n\t\t\tsTime=String(sTime);\r\n\t\t\t//Submit Tile value to the LMS.\r\n\t\t\tset_val(\"cmi.core.session_time\",sTime);\t\t\r\n\t\t\t//call LMS Finish\r\n\t\t\tret1 = API.LMSFinish(\"\");\r\n\t\t\tfnCheckErrors();\t\r\n\t\t}\r\n\t\t\r\n}", "function finish(){\n if( settings.onFinish ) {\n settings.onFinish( data );\n }\n }", "onEnd(state) {\n this.status = 'answered';\n\n // Rerender prompt (and clean subline error)\n this.render();\n\n this.screen.done();\n cliCursor.show();\n this.done(state.value);\n }", "onEnd(state) {\n this.status = 'answered';\n\n // Rerender prompt (and clean subline error)\n this.render();\n\n this.screen.done();\n cliCursor.show();\n this.done(state.value);\n }", "function after() {\n\t\t\t\t// Re-display tip if loading and first time, and reset first flag\n\t\t\t\tif(hideFirst) { api.show(event.originalEvent); first = FALSE; }\n\n\t\t\t\t// Call users complete if it was defined\n\t\t\t\tif($.isFunction(opts.complete)) { opts.complete.apply(this, arguments); }\n\t\t\t}", "function done() {\n // User is done, remove buttons on the screen\n readNextInput = false;\n layout.RemoveChild(startButton);\n layout.RemoveChild(doneButton);\n text.SetText(\"Cool!\");\n console.log(\"Done.\");\n}", "function _complete() {\n\t\t\tif (_errorState) {\n\t\t\t\t_eventDispatcher.sendEvent(events.ERROR, {message: _errorMessage});\n\t\t\t} else if (!_iscomplete) {\n\t\t\t\t_iscomplete = true;\n\t\t\t\t_status = utils.loaderstatus.COMPLETE;\n\t\t\t\t_eventDispatcher.sendEvent(events.COMPLETE);\n\t\t\t}\n\t\t}", "function after_loop()\n {\n disable_buttons(); //Disable control buttons.\n display_output($result); //Display output based on the result; Error or Accept\n }", "function onComplete() {\n\t// Print the time response received\n\t$('#info').append('<p>Response received at: ' + new Date() + '</p>');\n}", "function WaitForPhotoshopRedraw()\n{\n\tvar desc = new ActionDescriptor();\n desc.putEnumerated( keyState, typeState, enumRedrawComplete );\n\texecuteAction( eventWait, desc, DialogModes.NO );\n}", "function done() {\n\tupdateProgressById(\"uploadProgress\", 95)\n\n\t// console.log('finished');\n}", "workFinishCall() {\n\t\t// all nodes have been downloaded\n if (this.finishCount === this.worklist.length) {\n this.state = 'finish'\n this.finishDate = utils.formatDate()\n userTasks.splice(userTasks.indexOf(this), 1)\n finishTasks.unshift(this)\n clearInterval(this.countSpeed)\n sendMessage()\n this.recordInfor(`${this.name} 下载完成`)\n this.finishStore()\n } else {\n\t\t\t// running next\n this.updateStore()\n this.downloadSchedule()\n }\n }", "transitionCompleted() {\n // implement if needed\n }", "function _on_timeout(){\n\t anchor.finish_wait();\n\t}", "function complete() {\n\tconsole.log('Completed');\n}", "function success_handler(object_link, desc, after) {\n\tif (job_count.length == 1 && after != null) {\n\t\tafter();\n\t}\n\n\tvar log = document.getElementById('log');\n\tlog.innerHTML = '&nbsp;' + job_count.pop() + ' ' + object_link + ' : <span class=\"text-success\">' + desc + \"</span><br/>\\n\" + log.innerHTML;\n\tif (job_count.length == 0) {\n\t\tlog.innerHTML = \"Done!\\n<br/>\"+log.innerHTML;\n $(\".stop_button\").hide();\n\t}\n}", "_onUpdateDisplay() {}", "function showEnd() {\n console.log(\"showEnd ran\");\n getResult();\n $(\"#topright\").hide();\n $(\"#gamecontents\").hide();\n $(\"#end\").show();\n }", "function actionCompleted () {\n\n\talert('Completed');\n}", "function doneTask() {\n if (currDuration == workingTime) {\n doneClicked = true;\n skipAdd = true;\n }\n}", "function completeDisplay () {\n savedFldrOpenList = undefined;\n isDisplayComplete = true;\n WaitingImg.hidden = true; // Stop displaying the waiting glass\n// if (options.delayLoad)\n//\tBookmarks.appendChild(docFragment); // Display the table of bookmarks + reflow\n endDisplayTime = (new Date ()).getTime();\n trace(\"Display duration: \"+(endDisplayTime - endGetTreetime)+\" ms\", true);\n trace(\"Total duration: \"+(endDisplayTime - startTime)+\" ms\", true);\n\n // Finish displaying favicons asynchronously\n if (!options.disableFavicons && !options.immediateFavDisplay) {\n\tsetTimeout(completeFavicons, 0);\n }\n\n // If 16x16 migration is planned but nothing scheduled yet, do it\n if (migration_img16 && (migrationTimeout == null)) {\n\tmigrationTimeout = setTimeout(trigMigrate16x16, Migr16x16Timeout);\n }\n\n\n // Setup mouse handlers for bookmarks and results\n SearchResult.addEventListener(\"mousedown\", resultsMouseDownHandler);\n Bookmarks.addEventListener(\"mousedown\", bkmkMouseDownHandler);\n SearchResult.addEventListener(\"click\", resultsMouseHandler);\n Bookmarks.addEventListener(\"click\", bkmkMouseHandler);\n SearchResult.addEventListener(\"contextmenu\", resultsContextHandler);\n Bookmarks.addEventListener(\"contextmenu\", bkmkContextHandler);\n SearchResult.addEventListener(\"auxclick\", resultsAuxHandler);\n Bookmarks.addEventListener(\"auxclick\", bkmkAuxHandler);\n SearchResult.addEventListener(\"scroll\", rsltScrollHandler);\n Bookmarks.addEventListener(\"scroll\", bkmkScrollHandler);\n if (isLinux) {\n\tBookmarks.addEventListener(\"dragenter\", bkmkMouseEnterHandler, true);\n\tBookmarks.addEventListener(\"dragexit\", bkmkMouseLeaveHandler, true);\n\tBookmarks.addEventListener(\"dragleave\", bkmkMouseLeaveHandler, true);\n\tSearchResult.addEventListener(\"dragenter\", rsltMouseEnterHandler, true);\n\tSearchResult.addEventListener(\"dragexit\", rsltMouseLeaveHandler, true);\n\tSearchResult.addEventListener(\"dragleave\", rsltMouseLeaveHandler, true);\n }\n\n // Setup mouse handlers for search buttons\n ResetFiltersButtonInput.addEventListener(\"click\", resetFiltersButtonHandler);\n SearchButtonInput.addEventListener(\"click\", searchButtonHandler);\n SearchButtonInput.addEventListener(\"contextmenu\", searchButtonHandler);\n SearchButtonInput.addEventListener(\"auxclick\", searchButtonSwitchMode);\n\n // General event handlers for a click anywhere in the document .. used to clear menus\n // and prevent default menus\n addEventListener(\"keydown\", keyHandler);\n addEventListener(\"click\", clickHandler);\n addEventListener(\"mousedown\", noDefaultAction);\n addEventListener(\"contextmenu\", noDefaultAction);\n addEventListener(\"auxclick\", noDefaultAction);\n addEventListener(\"blur\", onBlur);\n Bookmarks.addEventListener(\"focusout\", bookmarksFocusout);\n SearchResult.addEventListener(\"focusout\", resultsFocusout);\n Bookmarks.addEventListener(\"focusin\", bookmarksFocusin);\n SearchResult.addEventListener(\"focusin\", resultsFocusin);\n addEventListener('wheel', onWheel, {capture: true, passive: false}); // To disable zooming\n addEventListener('resize', windowSizeHandler);\n\n if (!beforeFF64) { // Handle integrated FF menu items on sidebar\n\tbrowser.menus.onClicked.addListener(onClickedContextMenuHandler);\n\tbrowser.menus.onHidden.addListener(onHiddenContextMenuHandler);\n }\n\n // Detect when sidebar is closed\n// addEventListener(\"beforeunload\", closeHandler);\n// addEventListener(\"pagehide\", closeHandler);\n addEventListener(\"unload\", closeHandler);\n// window.onclose = closeHandler;\n\n // Event handlers for drag & drop\n Bookmarks.addEventListener(\"dragstart\", bkmkDragStartHandler);\n Bookmarks.addEventListener(\"dragend\", bkmkDragEndHandler);\n SearchResult.addEventListener(\"dragstart\", resultsDragStartHandler);\n SearchResult.addEventListener(\"dragend\", resultsDragEndHandler);\n Bookmarks.addEventListener(\"dragenter\", bkmkDragEnterHandler);\n Bookmarks.addEventListener(\"dragover\", bkmkDragOverHandler);\n Bookmarks.addEventListener(\"dragleave\", bkmkDragLeaveHandler);\n Bookmarks.addEventListener(\"dragexit\", bkmkDragExitHandler);\n Bookmarks.addEventListener(\"drop\", bkmkDropHandler);\n SearchResult.addEventListener(\"dragenter\", rsltDragEnterHandler);\n SearchResult.addEventListener(\"dragover\", rsltDragOverHandler);\n SearchResult.addEventListener(\"dragleave\", rsltDragLeaveHandler);\n SearchResult.addEventListener(\"dragexit\", rsltDragExitHandler);\n\n let computedStyle = window.getComputedStyle(MyBProtMenu, null);\n trace(\"fontFamily = '\"+computedStyle[\"fontFamily\"]+\"'\", true);\n trace(\"fontSize = '\"+computedStyle[\"fontSize\"]+\"'\", true);\n// for (let prop in computedStyle) {\n// trace(prop+\" = '\"+computedStyle[prop]+\"'\");\n// }\n\n // If we are running in the sidebar, signal to background page we are here,\n // and show laat selected bookmark if any\n if (isInSidebar) {\n\tif (backgroundPage == undefined) {\n\t sendAddonMessage(\"New:\"+myWindowId);\n\t}\n\telse {\n\t // Trace stats\n\t trace(\"Stats:\\r\\n------\", true);\n\t trace(\"Bookmarks: \"+countBookmarks, true);\n\t trace(\"Favicons to fetch: \"+countFetchFav, true);\n\t trace(\"Unsuccessful favicons: \"+countNoFavicon, true);\n\t trace(\"Folders: \"+countFolders, true);\n\t trace(\"Separators: \"+countSeparators, true);\n\t trace(\"Oddities: \"+countOddities, true);\n\t trace(\"--------------------\", true);\n\n\t let bnId = backgroundPage.newSidebar(myWindowId);\n\t goBkmkItem(bnId);\n\t}\n }\n\n // Focus on searchtext input at initial load\n// window.focus();\n// SearchTextInput.focus();\n}", "function finishButtonListener() {\n\t$(\"#finish\").click(function(e) {\n\t\te.preventDefault();\n\t\tif (!$(this).hasClass('disabled')) {\n\t json_data.filled = 1;\n\t // json_data.is_public = $('#privacy_checkbox').is(\":checked\");\t// check privacy setting (true for public, false for private)\n\n\t\t\tconsole.log('finishButtonListener');\n\t\t\tconsole.log('json_data');\n\t\t\tconsole.log(json_data);\n\t\t\tconsole.log('fb_collage_id='+fb_collage_id);\n\t\t\tconsole.log('fb_tile_id='+fb_tile_id);\n\t\t\t$(\"#finish_waiting\").removeClass('hide_stuff');\n\t\t\t$(\"#finish\").addClass('disabled');\n\n\t\t\tfinishedTileIDs.push(fb_tile_id);\t// update finishedTileIDs array\n\n\t\t\tupdateTile(fb,fb_collage_id,fb_tile_id,json_data,onComplete);\n\n\t\t}\n\t});\n}", "function success() {\n finish( false );\n }", "function finishProgress ( progElem ) {\n\n // Leave up for a bit, then fade out\n\n delay( 500, function () {\n\n // Hide the message with fading, remove when invisible\n\n fadeOut ( progElem.parentNode, 0.1, function () {\n\n hideProgress( progElem );\n\n } );\n\n } );\n\n }", "function finish(){\n\n // sound-effect\n playIncorrect()\n // Disable buttons, because we don't need them.\n elements.correctButton.disabled = true\n elements.incorrectButton.disabled = true\n window.setTimeout(displayGameOver,1500)\n}", "static finishedRenderingComponent() {\n\t\trenderingComponents_.pop();\n\t}", "handleFinish(useful) {\n recordFinish(this.state.currentGuide.id, useful);\n closeGuide();\n }", "function ifComplete() {\r\n\t\t\t\t\tif (isFinished == false) {\r\n\t\t\t\t\t\tisFinished = true;\r\n\r\n\t\t\t\t\t\t// show the flag animation when a car reaches the finish line\r\n\t\t\t\t\t\tfinishedImage.attr('src', 'Assets/img/finish.gif');\r\n\r\n\t\t\t\t\t\t// add a background shadow effect while the flag animation is on\r\n\t\t\t\t\t\t$('#raceTrack').addClass('shadow');\r\n\r\n\t\t\t\t\t\t// timeout function for removal of flag animation and enable the buttons\r\n\t\t\t\t\t\tsetTimeout(function () {\r\n\r\n\t\t\t\t\t\t\t// remove flag animation and background shadow\r\n\t\t\t\t\t\t\tfinishedImage.attr('src', '');\r\n\t\t\t\t\t\t\t$('#raceTrack').removeClass('shadow');\r\n\r\n\t\t\t\t\t\t\t// set buttons to enable when the animation and race finish\r\n\t\t\t\t\t\t\traceBtn.prop(\"disabled\", false);\r\n\t\t\t\t\t\t\trestartBtn.prop(\"disabled\", false);\r\n\t\t\t\t\t\t}, 3500);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tfinishedIn = 'second';\r\n\t\t\t\t\t}\r\n\t\t\t\t}", "function finishTask(self){\n clearInterval(timeVar);\n var neededId = getNeededId(self);\n EndDate = new Date();\n EndTimeString = EndDate.toLocaleTimeString();\n EndDateString = EndDate.toLocaleDateString();\n e_datetime = EndDateString.concat('|',EndTimeString);\n updateTimeData(DateTimeStorage, e_datetime, 'finished', neededId);\n sel = '#'+neededId;\n $(sel).remove();\n}", "function _finish() {\n\t\t\t$('#jquery-lightbox').remove();\n\t\t\t$('#jquery-overlay').fadeOut(function() { $('#jquery-overlay').remove(); });\n\t\t\t// Show some elements to avoid conflict with overlay in IE. These elements appear above the overlay.\n\t\t\t$('embed, object, select').css({ 'visibility' : 'visible' });\n\t\t}", "function displayResult(result) {\n output.textContent = result;\n calculationIsDone = true;\n}", "async onFinished() {}", "function onClickManualOutputBtn() {\n $(\"#ConfigurePID_ContainerNewSetPoint\").hide();\n $(\"#ConfigurePID_ContainerNewRampTarget\").hide();\n $(\"#ConfigurePID_ContainerNewOutput\").show();\n\n writeCommand(\"manual\");\n\nfunction pausecomp(millis)\n {\n var date = new Date();\n var curDate = null;\n do { curDate = new Date(); }\n while(curDate-date < millis);\n}\npausecomp(500);\n\n\n writeCommand(\"manualSetOutput\");\n}", "function finishPendingActions() {\n if (grid.api) {\n grid.api.grid.refresh();\n }\n }", "function taskProgressChanged(data) {\n s.completionContainer.html(data.partial);\n }", "function _finishLoading() {\n loadsToFinish--;\n if (loadsToFinish <= 0) {\n loading = false;\n viewModel.set(\"loading\", loading);\n }\n}", "endUpdate() {\r\n\r\n }", "function _finish() {\n\t\t\t$('#jquery-largephotobox').remove();\n\t\t\t$('#jquery-overlay').fadeOut(function() { $('#jquery-overlay').remove(); });\n\t\t\t\n\t\t\t// Show some elements to avoid conflict with overlay in IE. These elements appear above the overlay.\n\t\t\t$('embed, object, select').css({ 'visibility' : 'visible' });\n\t\t}", "static finish() {\n this.progress = 100;\n setTimeout(() => {\n this.bar.style.width = `${this.progress}%`;\n }, 100);\n setTimeout(() => {\n this.parent.style.height = '0px';\n }, 1000);\n }", "function startOperation() {\n updateInput = null; changes = []; textChanged = selectionChanged = false;\n }", "function startOperation() {\n updateInput = null; changes = []; textChanged = selectionChanged = false;\n }", "function startOperation() {\n updateInput = null; changes = []; textChanged = selectionChanged = false;\n }", "function end() {\n\tsetTimeout(function () {\n\t\t$(\"#stage\").fadeOut();\n\t}, normalpause);\n\n\t$('#finished').append($('<p style=\"font-size:35px\">' + data.subject_id + '</p>'));\n\n\tshowSlide(\"finished\");\n\tdocument.body.style.background = \"black\";\n\t// upload_to_dropbox();\n}", "function endLoadImage(){\n\tchangeDisplayStatus( $('#ImageLoadZone'), $('#ImageZone') );\n}" ]
[ "0.629807", "0.61485785", "0.6140222", "0.612951", "0.6117914", "0.60944146", "0.6089772", "0.6063745", "0.60262775", "0.6023023", "0.6008797", "0.600425", "0.5962399", "0.5962399", "0.5962399", "0.5962399", "0.59612703", "0.5959648", "0.59489655", "0.59489655", "0.59301424", "0.5929254", "0.5908809", "0.5879156", "0.5879156", "0.5879149", "0.5874435", "0.5869639", "0.5868287", "0.58516204", "0.5812683", "0.58040595", "0.5796808", "0.5795641", "0.5777276", "0.5767292", "0.5753164", "0.5737934", "0.572212", "0.57156336", "0.57092804", "0.5682733", "0.5680992", "0.5680992", "0.5680992", "0.5680992", "0.5676923", "0.5675278", "0.56637776", "0.56451756", "0.563461", "0.5629639", "0.5609621", "0.5591602", "0.55851185", "0.5567095", "0.5565368", "0.555612", "0.5552872", "0.5550274", "0.5550274", "0.5548881", "0.55473274", "0.5531677", "0.5528604", "0.55175936", "0.551479", "0.5511867", "0.5510024", "0.5502329", "0.55007434", "0.54984105", "0.54960626", "0.5487551", "0.54859656", "0.5484753", "0.5483039", "0.5481966", "0.5476551", "0.5473203", "0.54717785", "0.54478484", "0.5447727", "0.54476917", "0.5438239", "0.54329014", "0.54230887", "0.5422582", "0.5413522", "0.5411376", "0.5408215", "0.5402292", "0.5394355", "0.5392536", "0.5391016", "0.5388278", "0.53833145", "0.53833145", "0.53833145", "0.5379617", "0.53754765" ]
0.0
-1
The DOM updates done when an operation finishes are batched so that the minimum number of relayouts are required.
function endOperations(group) { var ops = group.ops; for (var i = 0; i < ops.length; i++) // Read DOM { endOperation_R1(ops[i]); } for (var i$1 = 0; i$1 < ops.length; i$1++) // Write DOM (maybe) { endOperation_W1(ops[i$1]); } for (var i$2 = 0; i$2 < ops.length; i$2++) // Read DOM { endOperation_R2(ops[i$2]); } for (var i$3 = 0; i$3 < ops.length; i$3++) // Write DOM (maybe) { endOperation_W2(ops[i$3]); } for (var i$4 = 0; i$4 < ops.length; i$4++) // Read DOM { endOperation_finish(ops[i$4]); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function processQueue() {\n\t\t if (updateQueue.length) {\n\t\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t\t clearQueue();\n\t\t }\n\t\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(\n\t updateQueue,\n\t markupQueue\n\t );\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(\n\t updateQueue,\n\t markupQueue\n\t );\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(\n\t updateQueue,\n\t markupQueue\n\t );\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(\n\t updateQueue,\n\t markupQueue\n\t );\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(\n\t updateQueue,\n\t markupQueue\n\t );\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n clearQueue();\n }\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n clearQueue();\n }\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n clearQueue();\n }\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n clearQueue();\n }\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n clearQueue();\n }\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n clearQueue();\n }\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n clearQueue();\n }\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n clearQueue();\n }\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n clearQueue();\n }\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n clearQueue();\n }\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n clearQueue();\n }\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n clearQueue();\n }\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n clearQueue();\n }\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n clearQueue();\n }\n}", "function updateElements() { //Main loop logic here.\r\n updateResourceDisplay();\r\n updateCoreDisplay();\r\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponentEnvironment.processChildrenUpdates(\n updateQueue,\n markupQueue\n );\n clearQueue();\n }\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponentEnvironment.processChildrenUpdates(\n updateQueue,\n markupQueue\n );\n clearQueue();\n }\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponentEnvironment.processChildrenUpdates(\n updateQueue,\n markupQueue\n );\n clearQueue();\n }\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponentEnvironment.processChildrenUpdates(\n updateQueue,\n markupQueue\n );\n clearQueue();\n }\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponentEnvironment.processChildrenUpdates(\n updateQueue,\n markupQueue\n );\n clearQueue();\n }\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponentEnvironment.processChildrenUpdates(\n updateQueue,\n markupQueue\n );\n clearQueue();\n }\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponentEnvironment.processChildrenUpdates(\n updateQueue,\n markupQueue\n );\n clearQueue();\n }\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponentEnvironment.processChildrenUpdates(\n updateQueue,\n markupQueue\n );\n clearQueue();\n }\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponentEnvironment.processChildrenUpdates(\n updateQueue,\n markupQueue\n );\n clearQueue();\n }\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponentEnvironment.processChildrenUpdates(\n updateQueue,\n markupQueue\n );\n clearQueue();\n }\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponentEnvironment.processChildrenUpdates(\n updateQueue,\n markupQueue\n );\n clearQueue();\n }\n}", "function processQueue(){if(updateQueue.length){ReactComponentEnvironment.processChildrenUpdates(updateQueue,markupQueue);clearQueue();}}", "function processQueue(){if(updateQueue.length){ReactComponentEnvironment.processChildrenUpdates(updateQueue,markupQueue);clearQueue();}}", "function do_full_update() {\n const rendered_dom = exports.render_tag(new_dom);\n replace_content(rendered_dom);\n }", "_updateDOM() {\n this._updateAttributes();\n this._updateStyles();\n }", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponent.BackendIDOperations.dangerouslyProcessChildrenUpdates(\n\t updateQueue,\n\t markupQueue\n\t );\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponent.BackendIDOperations.dangerouslyProcessChildrenUpdates(\n\t updateQueue,\n\t markupQueue\n\t );\n\t clearQueue();\n\t }\n\t}", "function doneWork() {\n updateHTML(false);\t\t\t/* input boolean parameter set to false */\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponent.BackendIDOperations.dangerouslyProcessChildrenUpdates(\n updateQueue,\n markupQueue\n );\n clearQueue();\n }\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponent.BackendIDOperations.dangerouslyProcessChildrenUpdates(\n updateQueue,\n markupQueue\n );\n clearQueue();\n }\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponent.BackendIDOperations.dangerouslyProcessChildrenUpdates(\n updateQueue,\n markupQueue\n );\n clearQueue();\n }\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponent.BackendIDOperations.dangerouslyProcessChildrenUpdates(\n updateQueue,\n markupQueue\n );\n clearQueue();\n }\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponent.BackendIDOperations.dangerouslyProcessChildrenUpdates(\n updateQueue,\n markupQueue\n );\n clearQueue();\n }\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponent.BackendIDOperations.dangerouslyProcessChildrenUpdates(\n updateQueue,\n markupQueue\n );\n clearQueue();\n }\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponent.BackendIDOperations.dangerouslyProcessChildrenUpdates(\n updateQueue,\n markupQueue\n );\n clearQueue();\n }\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponent.BackendIDOperations.dangerouslyProcessChildrenUpdates(\n updateQueue,\n markupQueue\n );\n clearQueue();\n }\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponent.BackendIDOperations.dangerouslyProcessChildrenUpdates(\n updateQueue,\n markupQueue\n );\n clearQueue();\n }\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponent.BackendIDOperations.dangerouslyProcessChildrenUpdates(\n updateQueue,\n markupQueue\n );\n clearQueue();\n }\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponent.BackendIDOperations.dangerouslyProcessChildrenUpdates(\n updateQueue,\n markupQueue\n );\n clearQueue();\n }\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponent.BackendIDOperations.dangerouslyProcessChildrenUpdates(\n updateQueue,\n markupQueue\n );\n clearQueue();\n }\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponent.BackendIDOperations.dangerouslyProcessChildrenUpdates(\n updateQueue,\n markupQueue\n );\n clearQueue();\n }\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponent.BackendIDOperations.dangerouslyProcessChildrenUpdates(\n updateQueue,\n markupQueue\n );\n clearQueue();\n }\n}", "function processQueue() {\n if (updateQueue.length) {\n ReactComponent.BackendIDOperations.dangerouslyProcessChildrenUpdates(\n updateQueue,\n markupQueue\n );\n clearQueue();\n }\n}", "forceUpdate() {\n if (this[_queuedUpdate]) {\n this[_dirty] = true;\n return;\n }\n\n this[_virtualRender]();\n this[_queuedUpdate] = true;\n\n TaskQueue.push(() => {\n if (this[_dirty] && !this.isDisposed) {\n this[_virtualRender]();\n this[_dirty] = false;\n }\n this[_queuedUpdate] = false;\n });\n }", "function batchedUpdates(callback) {\n if (isBatchingUpdates) {\n // We're already executing in an environment where updates will be batched,\n // so this is a no-op.\n callback();\n return;\n }\n\n isBatchingUpdates = true;\n\n try {\n callback();\n // TODO: Sort components by depth such that parent components update first\n for (var i = 0; i < dirtyComponents.length; i++) {\n // If a component is unmounted before pending changes apply, ignore them\n // TODO: Queue unmounts in the same list to avoid this happening at all\n var component = dirtyComponents[i];\n if (component.isMounted()) {\n // If performUpdateIfNecessary happens to enqueue any new updates, we\n // shouldn't execute the callbacks until the next render happens, so\n // stash the callbacks first\n var callbacks = component._pendingCallbacks;\n component._pendingCallbacks = null;\n component.performUpdateIfNecessary();\n if (callbacks) {\n for (var j = 0; j < callbacks.length; j++) {\n callbacks[j].call(component);\n }\n }\n }\n }\n } catch (error) {\n // IE8 requires `catch` in order to use `finally`.\n throw error;\n } finally {\n dirtyComponents.length = 0;\n isBatchingUpdates = false;\n }\n}", "function work() {\n\t\t// Set running to true to prevent more calls until the first one is done\n\t\trunning = true;\n\t\t\n\t\t// Go through the DOM\n\t\twalk(document.body);\n\n\t\t// Set running to false to allow additional calls\n\t\trunning = false;\n\t}", "static whenDOMUpdated() {\n\t\tif (renderTaskPromise) {\n\t\t\treturn renderTaskPromise;\n\t\t}\n\n\t\trenderTaskPromise = new Promise(resolve => {\n\t\t\trenderTaskPromiseResolve = resolve;\n\t\t\twindow.requestAnimationFrame(() => {\n\t\t\t\tif (invalidatedWebComponents.getList().length === 0) {\n\t\t\t\t\trenderTaskPromise = undefined;\n\t\t\t\t\tresolve();\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\treturn renderTaskPromise;\n\t}", "function processNextUpdateRequest() {\n if(vis_queue.length > 0) {\n let temp = vis_queue.pop();\n update(temp.svg, temp.pack, temp.path, temp.id, temp.cb_keyword);\n } else {\n hook_busy = false;\n }\n}", "function updateDOM() {\n\tvar newTree = render(data);\n\tvar patches = diff(tree, newTree);\n\trootNode = patch(rootNode, patches);\n\ttree = newTree;\n}", "function rerenderall() {\n console.log(\"Step 4\");\n rerenderElements(\"runs\");\n rerenderElements(\"configs\");\n rerenderElements(\"evals\");\n rerenderElements(\"locations\");\n}", "function updateWatched() {\n var selectors = watching.sel.join(',');\n var selectedElements = getElementsList(selectors);\n var elements = Array.prototype.concat.apply(watching.el, selectedElements);\n balanceText(elements);\n }", "processQueue () {\n var isEmpty = !unwrap(this.data).length;\n var lowestIndexChanged = MAX_LIST_SIZE;\n\n this.startQueueFlush();\n\n arrayForEach(this.changeQueue, (changeItem) => {\n if (typeof changeItem.index === 'number') {\n lowestIndexChanged = Math.min(lowestIndexChanged, changeItem.index);\n }\n this[changeItem.status](changeItem);\n });\n this.flushPendingDeletes();\n this.rendering_queued = false;\n\n // Update our indexes.\n if (this.$indexHasBeenRequested) {\n this.updateIndexes(lowestIndexChanged);\n }\n\n this.endQueueFlush();\n this.changeQueue = [];\n\n // Update the conditional exposed on the domData\n if (isEmpty !== !this.isNotEmpty()) {\n this.isNotEmpty(!isEmpty);\n }\n }", "function flushToDom() {\n var oldDebounceRendering = n.debounceRendering; // orig\n var callbackQ = [];\n function execCallbackSync(callback) {\n callbackQ.push(callback);\n }\n n.debounceRendering = execCallbackSync;\n O(v(FakeComponent, {}), document.createElement('div'));\n while (callbackQ.length) {\n callbackQ.shift()();\n }\n n.debounceRendering = oldDebounceRendering;\n }", "function updateDOM() {\n backlogListArray = updateColumnInDOM(backlogList, arrayNames.indexOf('backlog'), backlogListArray);\n progressListArray = updateColumnInDOM(progressList, arrayNames.indexOf('progress'), progressListArray);\n completeListArray = updateColumnInDOM(completeList, arrayNames.indexOf('complete'), completeListArray);\n onHoldListArray = updateColumnInDOM(onHoldList, arrayNames.indexOf('onHold'), onHoldListArray);\n\n // Update Local Storage\n updateSavedColumns();\n}", "function endOperations(group) {\r\n var ops = group.ops;\r\n for (var i = 0; i < ops.length; i++) // Read DOM\r\n endOperation_R1(ops[i]);\r\n for (var i = 0; i < ops.length; i++) // Write DOM (maybe)\r\n endOperation_W1(ops[i]);\r\n for (var i = 0; i < ops.length; i++) // Read DOM\r\n endOperation_R2(ops[i]);\r\n for (var i = 0; i < ops.length; i++) // Write DOM (maybe)\r\n endOperation_W2(ops[i]);\r\n for (var i = 0; i < ops.length; i++) // Read DOM\r\n endOperation_finish(ops[i]);\r\n }", "function runUpdate(){\n people.forEach(function(element){\n element.update();\n });\n }", "function update()\n{\n // First, clear the page contents. Necessary because update() might be\n // called more than once due to ChildMemoryListener.\n var content = $(\"content\");\n content.parentNode.replaceChild(content.cloneNode(false), content);\n content = $(\"content\");\n\n if (gVerbose)\n content.parentNode.classList.add('verbose');\n else\n content.parentNode.classList.add('non-verbose');\n\n // Generate output for one process at a time. Always start with the\n // Main process.\n var reportersByProcess = getReportersByProcess();\n var text = genProcessText(\"Main\", reportersByProcess[\"Main\"]);\n for (var process in reportersByProcess) {\n if (process !== \"Main\") {\n text += genProcessText(process, reportersByProcess[process]);\n }\n }\n\n // Memory-related actions.\n const GCDesc = \"Do a global garbage collection.\";\n const CCDesc = \"Do a cycle collection.\";\n const MPDesc = \"Send three \\\"heap-minimize\\\" notifications in a \" +\n \"row. Each notification triggers a global garbage \" +\n \"collection followed by a cycle collection, and causes the \" +\n \"process to reduce memory usage in other ways, e.g. by \" +\n \"flushing various caches.\";\n\n text += \"<div>\" +\n \"<button title='\" + GCDesc + \"' onclick='doGlobalGC()'>GC</button>\" +\n \"<button title='\" + CCDesc + \"' onclick='doCC()'>CC</button>\" +\n \"<button title='\" + MPDesc + \"' onclick='sendHeapMinNotifications()'>\" + \"Minimize memory usage</button>\" +\n \"</div>\";\n\n // Generate verbosity option link at the bottom.\n text += \"<div>\";\n text += gVerbose\n ? \"<span class='option'><a href='about:memory'>Less verbose</a></span>\"\n : \"<span class='option'><a href='about:memory?verbose'>More verbose</a></span>\";\n text += \"</div>\";\n\n text += \"<div>\" +\n \"<span class='option'><a href='about:support'>Troubleshooting information</a></span>\" +\n \"</div>\";\n\n text += \"<div>\" +\n \"<span class='legend'>Hover the pointer over the name of a memory \" +\n \"reporter to see a detailed description of what it measures. Click a \" +\n \"heading to expand or collapse its tree.</span>\" +\n \"</div>\";\n\n var div = document.createElement(\"div\");\n div.innerHTML = text;\n content.appendChild(div);\n}", "function endOperations(group) {\n var ops = group.ops;\n for (var i = 0; i < ops.length; i++) // Read DOM\n endOperation_R1(ops[i]);\n for (var i = 0; i < ops.length; i++) // Write DOM (maybe)\n endOperation_W1(ops[i]);\n for (var i = 0; i < ops.length; i++) // Read DOM\n endOperation_R2(ops[i]);\n for (var i = 0; i < ops.length; i++) // Write DOM (maybe)\n endOperation_W2(ops[i]);\n for (var i = 0; i < ops.length; i++) // Read DOM\n endOperation_finish(ops[i]);\n }", "function endOperations(group) {\n var ops = group.ops;\n for (var i = 0; i < ops.length; i++) // Read DOM\n endOperation_R1(ops[i]);\n for (var i = 0; i < ops.length; i++) // Write DOM (maybe)\n endOperation_W1(ops[i]);\n for (var i = 0; i < ops.length; i++) // Read DOM\n endOperation_R2(ops[i]);\n for (var i = 0; i < ops.length; i++) // Write DOM (maybe)\n endOperation_W2(ops[i]);\n for (var i = 0; i < ops.length; i++) // Read DOM\n endOperation_finish(ops[i]);\n }", "function endOperations(group) {\n var ops = group.ops;\n for (var i = 0; i < ops.length; i++) // Read DOM\n endOperation_R1(ops[i]);\n for (var i = 0; i < ops.length; i++) // Write DOM (maybe)\n endOperation_W1(ops[i]);\n for (var i = 0; i < ops.length; i++) // Read DOM\n endOperation_R2(ops[i]);\n for (var i = 0; i < ops.length; i++) // Write DOM (maybe)\n endOperation_W2(ops[i]);\n for (var i = 0; i < ops.length; i++) // Read DOM\n endOperation_finish(ops[i]);\n }", "function endOperations(group) {\n var ops = group.ops;\n for (var i = 0; i < ops.length; i++) // Read DOM\n endOperation_R1(ops[i]);\n for (var i = 0; i < ops.length; i++) // Write DOM (maybe)\n endOperation_W1(ops[i]);\n for (var i = 0; i < ops.length; i++) // Read DOM\n endOperation_R2(ops[i]);\n for (var i = 0; i < ops.length; i++) // Write DOM (maybe)\n endOperation_W2(ops[i]);\n for (var i = 0; i < ops.length; i++) // Read DOM\n endOperation_finish(ops[i]);\n }", "function endOperations(group) {\n var ops = group.ops;\n for (var i = 0; i < ops.length; i++) // Read DOM\n endOperation_R1(ops[i]);\n for (var i = 0; i < ops.length; i++) // Write DOM (maybe)\n endOperation_W1(ops[i]);\n for (var i = 0; i < ops.length; i++) // Read DOM\n endOperation_R2(ops[i]);\n for (var i = 0; i < ops.length; i++) // Write DOM (maybe)\n endOperation_W2(ops[i]);\n for (var i = 0; i < ops.length; i++) // Read DOM\n endOperation_finish(ops[i]);\n }", "function endOperations(group) {\n var ops = group.ops;\n for (var i = 0; i < ops.length; i++) // Read DOM\n endOperation_R1(ops[i]);\n for (var i = 0; i < ops.length; i++) // Write DOM (maybe)\n endOperation_W1(ops[i]);\n for (var i = 0; i < ops.length; i++) // Read DOM\n endOperation_R2(ops[i]);\n for (var i = 0; i < ops.length; i++) // Write DOM (maybe)\n endOperation_W2(ops[i]);\n for (var i = 0; i < ops.length; i++) // Read DOM\n endOperation_finish(ops[i]);\n }", "function endOperations(group) {\n var ops = group.ops;\n for (var i = 0; i < ops.length; i++) // Read DOM\n endOperation_R1(ops[i]);\n for (var i = 0; i < ops.length; i++) // Write DOM (maybe)\n endOperation_W1(ops[i]);\n for (var i = 0; i < ops.length; i++) // Read DOM\n endOperation_R2(ops[i]);\n for (var i = 0; i < ops.length; i++) // Write DOM (maybe)\n endOperation_W2(ops[i]);\n for (var i = 0; i < ops.length; i++) // Read DOM\n endOperation_finish(ops[i]);\n }", "update() {\n\t\tif (this.hasChangedBesidesElement_() && this.shouldUpdate(this.changes_)) {\n\t\t\tthis.patch();\n\t\t\tthis.eventsCollector_.detachUnusedListeners();\n\t\t\tthis.disposeUnusedSubComponents_();\n\t\t}\n\t}", "function ReceiveUpdate(doc) {\n myDoc = doc;\n for (i = 0; i < functionQueue.length; i++) {\n var t = functionQueue[i];\n t[0](myDoc, t[1]);\n }\n Render(doc);\n}", "function updateAll() {\n\tdrawAll();\n\tblob.move();\n}" ]
[ "0.65626323", "0.65111285", "0.65111285", "0.65111285", "0.65111285", "0.65111285", "0.6498817", "0.6498817", "0.6498817", "0.6498817", "0.6498817", "0.6498817", "0.6498817", "0.6498817", "0.6498817", "0.6498817", "0.6498817", "0.6498817", "0.6498817", "0.6498817", "0.6498817", "0.6498817", "0.6498817", "0.6498817", "0.6498817", "0.6498817", "0.6498817", "0.6498817", "0.6498817", "0.6449645", "0.6449645", "0.6449645", "0.6449645", "0.6449645", "0.6449645", "0.6449645", "0.6449645", "0.6449645", "0.6449645", "0.6449645", "0.6449645", "0.6449645", "0.6449645", "0.64294183", "0.63624173", "0.63624173", "0.63624173", "0.63624173", "0.63624173", "0.63624173", "0.63624173", "0.63624173", "0.63624173", "0.63624173", "0.63624173", "0.6339942", "0.6339942", "0.6301519", "0.62429607", "0.6203184", "0.6203184", "0.6136623", "0.6024424", "0.6024424", "0.6024424", "0.6024424", "0.6024424", "0.6024424", "0.6024424", "0.6024424", "0.6024424", "0.6024424", "0.6024424", "0.6024424", "0.6024424", "0.6024424", "0.6024424", "0.5960287", "0.58971566", "0.5889751", "0.5888862", "0.58758694", "0.5873584", "0.5830148", "0.58234775", "0.5818635", "0.57527596", "0.5745011", "0.5743715", "0.5739892", "0.5738967", "0.5733866", "0.5733866", "0.5733866", "0.5733866", "0.5733866", "0.5733866", "0.5733866", "0.5719376", "0.5716648", "0.57118446" ]
0.0
-1
Run the given function in an operation
function runInOp(cm, f) { if (cm.curOp) { return f() } startOperation(cm); try { return f() } finally { endOperation(cm); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function runInOp(cm, f) {\n\t\t if (cm.curOp) { return f() }\n\t\t startOperation(cm);\n\t\t try { return f() }\n\t\t finally { endOperation(cm); }\n\t\t }", "function runInOp(cm, f) {\n\t if (cm.curOp) return f();\n\t startOperation(cm);\n\t try { return f(); }\n\t finally { endOperation(cm); }\n\t }", "function runInOp(cm, f) {\n\t if (cm.curOp) return f();\n\t startOperation(cm);\n\t try { return f(); }\n\t finally { endOperation(cm); }\n\t }", "function runInOp(cm, f) {\n\t if (cm.curOp) return f();\n\t startOperation(cm);\n\t try { return f(); }\n\t finally { endOperation(cm); }\n\t }", "function runInOp(cm, f) {\n\t\t if (cm.curOp) return f();\n\t\t startOperation(cm);\n\t\t try { return f(); }\n\t\t finally { endOperation(cm); }\n\t\t }", "function run(fun) {\n fun(); // Executa a funcao passada como parametro\n}", "function run (fun) {\n fun() \n}", "function run(fun){\n fun()\n}", "function run(fun){\n fun()\n}", "function run(fun){\n fun()\n}", "function runInOp(cm, f) {\n if (cm.curOp) return f();\n startOperation(cm);\n try { return f(); }\n finally { endOperation(cm); }\n }", "function runInOp(cm, f) {\n if (cm.curOp) return f();\n startOperation(cm);\n try { return f(); }\n finally { endOperation(cm); }\n }", "function runInOp(cm, f) {\n if (cm.curOp) return f();\n startOperation(cm);\n try { return f(); }\n finally { endOperation(cm); }\n }", "function runInOp(cm, f) {\n if (cm.curOp) return f();\n startOperation(cm);\n try { return f(); }\n finally { endOperation(cm); }\n }", "function runInOp(cm, f) {\n if (cm.curOp) return f();\n startOperation(cm);\n try { return f(); }\n finally { endOperation(cm); }\n }", "function runInOp(cm, f) {\n if (cm.curOp) return f();\n startOperation(cm);\n try { return f(); }\n finally { endOperation(cm); }\n }", "function runInOp(cm, f) {\n if (cm.curOp) return f();\n startOperation(cm);\n try { return f(); }\n finally { endOperation(cm); }\n }", "function runInOp(cm, f) {\n if (cm.curOp) return f();\n startOperation(cm);\n try { return f(); }\n finally { endOperation(cm); }\n }", "function runInOp(cm, f) {\r\n if (cm.curOp) return f();\r\n startOperation(cm);\r\n try { return f(); }\r\n finally { endOperation(cm); }\r\n }", "function run(fun) {\n fun()\n}", "function run(fun) {\n fun()\n}", "function run(fun) {\n fun()\n}", "function runInOp(cm, f) {\n if (cm.curOp) { return f() }\n startOperation(cm);\n try { return f() }\n finally { endOperation(cm); }\n}", "function runInOp(cm, f) {\n if (cm.curOp) { return f() }\n startOperation(cm);\n try { return f() }\n finally { endOperation(cm); }\n}", "function runInOp(cm, f) {\n if (cm.curOp) { return f() }\n startOperation(cm);\n try { return f() }\n finally { endOperation(cm); }\n}", "function runInOp(cm, f) {\n if (cm.curOp) { return f() }\n startOperation(cm);\n try { return f() }\n finally { endOperation(cm); }\n}", "function runInOp(cm, f) {\n if (cm.curOp) { return f() }\n startOperation(cm);\n try { return f() }\n finally { endOperation(cm); }\n}", "function runInOp(cm, f) {\n if (cm.curOp) { return f() }\n startOperation(cm);\n try { return f() }\n finally { endOperation(cm); }\n}", "function runInOp(cm, f) {\n if (cm.curOp) { return f() }\n startOperation(cm);\n try { return f() }\n finally { endOperation(cm); }\n}", "function runInOp(cm, f) {\n if (cm.curOp) { return f() }\n startOperation(cm);\n try { return f() }\n finally { endOperation(cm); }\n}", "function runInOp(cm, f) {\n if (cm.curOp) { return f() }\n startOperation(cm);\n try { return f() }\n finally { endOperation(cm); }\n}", "function runInOp(cm, f) {\n if (cm.curOp) { return f() }\n startOperation(cm);\n try { return f() }\n finally { endOperation(cm); }\n}", "function runInOp(cm, f) {\n if (cm.curOp) { return f() }\n startOperation(cm);\n try { return f() }\n finally { endOperation(cm); }\n}", "function runInOp(cm, f) {\n if (cm.curOp) { return f() }\n startOperation(cm)\n try { return f() }\n finally { endOperation(cm) }\n}", "function runInOp(cm, f) {\n if (cm.curOp) { return f() }\n startOperation(cm)\n try { return f() }\n finally { endOperation(cm) }\n}", "function runInOp(cm, f) {\r\n if (cm.curOp) { return f() }\r\n startOperation(cm);\r\n try { return f() }\r\n finally { endOperation(cm); }\r\n}", "function doOperationOn(x, operation){\n\treturn operation(x);\n}", "function op(f) {\n var keys = Object.keys(f);\n if (keys.length !== 1) {\n throw new Error(\"Please provide an object with a single key \" +\n \"(operation name) mapping to a function. Got an object with \" +\n (keys.length + \" keys.\"));\n }\n var opName = keys[0];\n var fn = f[opName];\n // Strip the underscore from the end of the function name.\n if (opName.endsWith('_')) {\n opName = opName.substring(0, opName.length - 1);\n }\n // tslint:disable-next-line:no-any\n var f2 = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n engine_1.ENGINE.startScope(opName);\n try {\n var result = fn.apply(void 0, args);\n if (result instanceof Promise) {\n console.error('Cannot return a Promise inside of tidy.');\n }\n engine_1.ENGINE.endScope(result);\n return result;\n }\n catch (ex) {\n engine_1.ENGINE.endScope(null);\n throw ex;\n }\n };\n Object.defineProperty(f2, 'name', { value: opName, configurable: true });\n // tslint:disable-next-line:no-any\n return f2;\n}", "function applyOp(node, func) {\n node = $(node);\n node.trigger(\"fluid-\"+func);\n node[func]();\n }", "function run(func, params) { window[func](params); }", "function run(func, params) { window[func](params); }", "function run (fun1) {\n fun1()\n}", "function operate(x, y, func) {\n return func(x, y);\n}", "function someRunner(anyFunction){ \n \tconsole.log(2+2); \n \tanyFunction(); \n }", "function op(f) {\n const keys = Object.keys(f);\n if (keys.length !== 1) {\n throw new Error(`Please provide an object with a single key ` +\n `(operation name) mapping to a function. Got an object with ` +\n `${keys.length} keys.`);\n }\n let opName = keys[0];\n const fn = f[opName];\n // Strip the underscore from the end of the function name.\n if (opName.endsWith('_')) {\n opName = opName.substring(0, opName.length - 1);\n }\n // add an __op suffix to distinguish ops from kernels in tf.profile\n opName = opName + OP_SCOPE_SUFFIX;\n // tslint:disable-next-line:no-any\n const f2 = (...args) => {\n _engine__WEBPACK_IMPORTED_MODULE_0__[\"ENGINE\"].startScope(opName);\n try {\n const result = fn(...args);\n if (Object(_util__WEBPACK_IMPORTED_MODULE_1__[\"isPromise\"])(result)) {\n console.error('Cannot return a Promise inside of tidy.');\n }\n _engine__WEBPACK_IMPORTED_MODULE_0__[\"ENGINE\"].endScope(result);\n return result;\n }\n catch (ex) {\n _engine__WEBPACK_IMPORTED_MODULE_0__[\"ENGINE\"].endScope(null);\n throw ex;\n }\n };\n Object.defineProperty(f2, 'name', { value: opName, configurable: true });\n // tslint:disable-next-line:no-any\n return f2;\n}", "function executaFuncao (funcao){\n funcao();\n}", "function operation(cm, f) {\n\t return function() {\n\t if (cm.curOp) return f.apply(cm, arguments);\n\t startOperation(cm);\n\t try { return f.apply(cm, arguments); }\n\t finally { endOperation(cm); }\n\t };\n\t }", "function operation(cm, f) {\n\t return function() {\n\t if (cm.curOp) return f.apply(cm, arguments);\n\t startOperation(cm);\n\t try { return f.apply(cm, arguments); }\n\t finally { endOperation(cm); }\n\t };\n\t }", "function operation(cm, f) {\n\t return function() {\n\t if (cm.curOp) return f.apply(cm, arguments);\n\t startOperation(cm);\n\t try { return f.apply(cm, arguments); }\n\t finally { endOperation(cm); }\n\t };\n\t }", "function operation(cm, f) {\n\t\t return function() {\n\t\t if (cm.curOp) { return f.apply(cm, arguments) }\n\t\t startOperation(cm);\n\t\t try { return f.apply(cm, arguments) }\n\t\t finally { endOperation(cm); }\n\t\t }\n\t\t }", "function operation(cm, f) {\n\t\t return function() {\n\t\t if (cm.curOp) return f.apply(cm, arguments);\n\t\t startOperation(cm);\n\t\t try { return f.apply(cm, arguments); }\n\t\t finally { endOperation(cm); }\n\t\t };\n\t\t }", "function doIt() {\n eval(func);\n }", "function run() {\n // do something\n}", "function operation(cm, f) {\n return function() {\n if (cm.curOp) return f.apply(cm, arguments);\n startOperation(cm);\n try { return f.apply(cm, arguments); }\n finally { endOperation(cm); }\n };\n }", "function operation(cm, f) {\n return function() {\n if (cm.curOp) return f.apply(cm, arguments);\n startOperation(cm);\n try { return f.apply(cm, arguments); }\n finally { endOperation(cm); }\n };\n }", "function operation(cm, f) {\n return function() {\n if (cm.curOp) return f.apply(cm, arguments);\n startOperation(cm);\n try { return f.apply(cm, arguments); }\n finally { endOperation(cm); }\n };\n }", "function operation(cm, f) {\n return function() {\n if (cm.curOp) return f.apply(cm, arguments);\n startOperation(cm);\n try { return f.apply(cm, arguments); }\n finally { endOperation(cm); }\n };\n }", "function operation(cm, f) {\n return function() {\n if (cm.curOp) return f.apply(cm, arguments);\n startOperation(cm);\n try { return f.apply(cm, arguments); }\n finally { endOperation(cm); }\n };\n }", "function operation(cm, f) {\n return function() {\n if (cm.curOp) return f.apply(cm, arguments);\n startOperation(cm);\n try { return f.apply(cm, arguments); }\n finally { endOperation(cm); }\n };\n }", "function operation(cm, f) {\n return function() {\n if (cm.curOp) return f.apply(cm, arguments);\n startOperation(cm);\n try { return f.apply(cm, arguments); }\n finally { endOperation(cm); }\n };\n }", "function operation(cm, f) {\n return function() {\n if (cm.curOp) return f.apply(cm, arguments);\n startOperation(cm);\n try { return f.apply(cm, arguments); }\n finally { endOperation(cm); }\n };\n }", "function run(func1){\n func1()\n}", "function run() {}", "function operation(cm, f) {\n return function() {\n if (cm.curOp) { return f.apply(cm, arguments) }\n startOperation(cm);\n try { return f.apply(cm, arguments) }\n finally { endOperation(cm); }\n }\n }", "function operation(cm, f) {\n return function() {\n if (cm.curOp) { return f.apply(cm, arguments) }\n startOperation(cm);\n try { return f.apply(cm, arguments) }\n finally { endOperation(cm); }\n }\n }", "function operation(cm, f) {\n return function() {\n if (cm.curOp) { return f.apply(cm, arguments) }\n startOperation(cm);\n try { return f.apply(cm, arguments) }\n finally { endOperation(cm); }\n }\n }", "function operation(cm, f) {\n return function() {\n if (cm.curOp) { return f.apply(cm, arguments) }\n startOperation(cm);\n try { return f.apply(cm, arguments) }\n finally { endOperation(cm); }\n }\n }", "function operation(cm, f) {\n return function() {\n if (cm.curOp) { return f.apply(cm, arguments) }\n startOperation(cm);\n try { return f.apply(cm, arguments) }\n finally { endOperation(cm); }\n }\n }", "function operation(cm, f) {\n return function() {\n if (cm.curOp) { return f.apply(cm, arguments) }\n startOperation(cm);\n try { return f.apply(cm, arguments) }\n finally { endOperation(cm); }\n }\n }", "function operation(cm, f) {\n return function() {\n if (cm.curOp) { return f.apply(cm, arguments) }\n startOperation(cm);\n try { return f.apply(cm, arguments) }\n finally { endOperation(cm); }\n }\n }", "function operation(cm, f) {\n return function() {\n if (cm.curOp) { return f.apply(cm, arguments) }\n startOperation(cm);\n try { return f.apply(cm, arguments) }\n finally { endOperation(cm); }\n }\n }", "function operation(cm, f) {\n return function() {\n if (cm.curOp) { return f.apply(cm, arguments) }\n startOperation(cm);\n try { return f.apply(cm, arguments) }\n finally { endOperation(cm); }\n }\n }", "function operation(cm, f) {\n return function() {\n if (cm.curOp) { return f.apply(cm, arguments) }\n startOperation(cm);\n try { return f.apply(cm, arguments) }\n finally { endOperation(cm); }\n }\n }", "function operation(cm, f) {\n return function() {\n if (cm.curOp) { return f.apply(cm, arguments) }\n startOperation(cm);\n try { return f.apply(cm, arguments) }\n finally { endOperation(cm); }\n }\n }", "function operation(cm, f) {\n return function() {\n if (cm.curOp) { return f.apply(cm, arguments) }\n startOperation(cm);\n try { return f.apply(cm, arguments) }\n finally { endOperation(cm); }\n }\n }", "function operation(cm, f) {\n return function() {\n if (cm.curOp) { return f.apply(cm, arguments) }\n startOperation(cm);\n try { return f.apply(cm, arguments) }\n finally { endOperation(cm); }\n }\n }", "function operation(cm, f) {\n return function() {\n if (cm.curOp) { return f.apply(cm, arguments) }\n startOperation(cm);\n try { return f.apply(cm, arguments) }\n finally { endOperation(cm); }\n }\n }", "function operation(cm, f) {\n return function() {\n if (cm.curOp) { return f.apply(cm, arguments) }\n startOperation(cm);\n try { return f.apply(cm, arguments) }\n finally { endOperation(cm); }\n }\n }", "function operation(cm, f) {\n return function() {\n if (cm.curOp) { return f.apply(cm, arguments) }\n startOperation(cm);\n try { return f.apply(cm, arguments) }\n finally { endOperation(cm); }\n }\n }", "function operation(cm, f) {\n return function() {\n if (cm.curOp) { return f.apply(cm, arguments) }\n startOperation(cm);\n try { return f.apply(cm, arguments) }\n finally { endOperation(cm); }\n }\n }", "function executeOp(node, tensorMap, context) {\n var value = (function (node, tensorMap, context) {\n switch (node.category) {\n case 'arithmetic':\n return arithmetic.executeOp(node, tensorMap, context);\n case 'basic_math':\n return basicMath.executeOp(node, tensorMap, context);\n case 'control':\n return control.executeOp(node, tensorMap, context);\n case 'convolution':\n return convolution.executeOp(node, tensorMap, context);\n case 'creation':\n return creation.executeOp(node, tensorMap, context);\n case 'dynamic':\n return dynamic.executeOp(node, tensorMap, context);\n case 'evaluation':\n return evaluation.executeOp(node, tensorMap, context);\n case 'image':\n return image.executeOp(node, tensorMap, context);\n case 'graph':\n return graph.executeOp(node, tensorMap, context);\n case 'logical':\n return logical.executeOp(node, tensorMap, context);\n case 'matrices':\n return matrices.executeOp(node, tensorMap, context);\n case 'normalization':\n return normalization.executeOp(node, tensorMap, context);\n case 'reduction':\n return reduction.executeOp(node, tensorMap, context);\n case 'slice_join':\n return sliceJoin.executeOp(node, tensorMap, context);\n case 'spectral':\n return spectral.executeOp(node, tensorMap, context);\n case 'transformation':\n return transformation.executeOp(node, tensorMap, context);\n case 'custom':\n var opMapper = register_1.getRegisteredOp(node.op);\n if (opMapper && opMapper.customExecutor) {\n return opMapper.customExecutor(new node_value_impl_1.NodeValueImpl(node, tensorMap, context));\n }\n else {\n throw TypeError(\"Custom op \" + node.op + \" is not registered.\");\n }\n default:\n throw TypeError(\"Unknown op '\" + node.op + \"'. File an issue at \" +\n \"https://github.com/tensorflow/tfjs/issues so we can add it\" +\n \", or register a custom execution with tf.registerOp()\");\n }\n })(node, tensorMap, context);\n if (value instanceof Promise) {\n return value.then(function (data) { return [].concat(data); });\n }\n return [].concat(value);\n}", "step_func(func) { func(); }", "function justInvoke(fn){\n return fn()\n}//justInvoke", "function operation(cm, f) {\n return function() {\n if (cm.curOp) { return f.apply(cm, arguments) }\n startOperation(cm)\n try { return f.apply(cm, arguments) }\n finally { endOperation(cm) }\n }\n}" ]
[ "0.721918", "0.7210265", "0.7210265", "0.7210265", "0.719278", "0.71893203", "0.7070357", "0.706983", "0.706983", "0.706983", "0.70266515", "0.70266515", "0.70266515", "0.70266515", "0.70266515", "0.70266515", "0.70266515", "0.70266515", "0.7011207", "0.69852394", "0.69852394", "0.69852394", "0.69049406", "0.69049406", "0.69049406", "0.69049406", "0.69049406", "0.69049406", "0.69049406", "0.69049406", "0.69049406", "0.69049406", "0.69049406", "0.6895877", "0.6895877", "0.6844194", "0.6832861", "0.6758503", "0.6655132", "0.66165185", "0.66165185", "0.6599112", "0.6598256", "0.64735264", "0.6467198", "0.64656496", "0.64313823", "0.64313823", "0.64313823", "0.64060974", "0.6398863", "0.6330993", "0.6313618", "0.6304018", "0.6304018", "0.6304018", "0.6304018", "0.6304018", "0.6304018", "0.6304018", "0.6304018", "0.62986183", "0.62882334", "0.6283502", "0.6283502", "0.6283502", "0.6283502", "0.6283502", "0.6283502", "0.6283502", "0.6283502", "0.6283502", "0.6283502", "0.6283502", "0.6283502", "0.6283502", "0.6283502", "0.6283502", "0.6283502", "0.6283502", "0.62778306", "0.6270989", "0.62057525", "0.6197981" ]
0.70376015
22
Wraps a function in an operation. Returns the wrapped function.
function operation(cm, f) { return function() { if (cm.curOp) { return f.apply(cm, arguments) } startOperation(cm); try { return f.apply(cm, arguments) } finally { endOperation(cm); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function wrap(func, wrapper) {\n return partial(wrapper, func);\n }", "function wrap(func, wrapper) {\n return partial(wrapper, func);\n }", "function wrap(func, wrapper) {\n return partial(wrapper, func);\n }", "function wrap(func, wrapper) {\n return partial(wrapper, func);\n }", "function wrap(func, wrapper) {\n return partial(wrapper, func);\n }", "function wrap(func, wrapper) {\n return partial(wrapper, func);\n }", "function wrap(func, wrapper) {\n return partial(wrapper, func);\n }", "function wrap(func, wrapper) {\n return partial(wrapper, func);\n }", "function wrap(func, wrapper) {\n return partial(wrapper, func);\n }", "function wrap(fn) {\n return helpers.wrap(fn)();\n}", "function op(f) {\n var keys = Object.keys(f);\n if (keys.length !== 1) {\n throw new Error(\"Please provide an object with a single key \" +\n \"(operation name) mapping to a function. Got an object with \" +\n (keys.length + \" keys.\"));\n }\n var opName = keys[0];\n var fn = f[opName];\n // Strip the underscore from the end of the function name.\n if (opName.endsWith('_')) {\n opName = opName.substring(0, opName.length - 1);\n }\n // tslint:disable-next-line:no-any\n var f2 = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n engine_1.ENGINE.startScope(opName);\n try {\n var result = fn.apply(void 0, args);\n if (result instanceof Promise) {\n console.error('Cannot return a Promise inside of tidy.');\n }\n engine_1.ENGINE.endScope(result);\n return result;\n }\n catch (ex) {\n engine_1.ENGINE.endScope(null);\n throw ex;\n }\n };\n Object.defineProperty(f2, 'name', { value: opName, configurable: true });\n // tslint:disable-next-line:no-any\n return f2;\n}", "function methodOp(f) {\n return function() {\n if (this.curOp) { return f.apply(this, arguments) }\n startOperation(this);\n try { return f.apply(this, arguments) }\n finally { endOperation(this); }\n }\n }", "function methodOp(f) {\n return function() {\n if (this.curOp) { return f.apply(this, arguments) }\n startOperation(this);\n try { return f.apply(this, arguments) }\n finally { endOperation(this); }\n }\n }", "function methodOp(f) {\n return function() {\n if (this.curOp) { return f.apply(this, arguments) }\n startOperation(this);\n try { return f.apply(this, arguments) }\n finally { endOperation(this); }\n }\n }", "function methodOp(f) {\n return function() {\n if (this.curOp) { return f.apply(this, arguments) }\n startOperation(this);\n try { return f.apply(this, arguments) }\n finally { endOperation(this); }\n }\n }", "function methodOp(f) {\n return function() {\n if (this.curOp) { return f.apply(this, arguments) }\n startOperation(this);\n try { return f.apply(this, arguments) }\n finally { endOperation(this); }\n }\n }", "function methodOp(f) {\n return function() {\n if (this.curOp) { return f.apply(this, arguments) }\n startOperation(this);\n try { return f.apply(this, arguments) }\n finally { endOperation(this); }\n }\n }", "function methodOp(f) {\n return function() {\n if (this.curOp) { return f.apply(this, arguments) }\n startOperation(this);\n try { return f.apply(this, arguments) }\n finally { endOperation(this); }\n }\n }", "function methodOp(f) {\n return function() {\n if (this.curOp) { return f.apply(this, arguments) }\n startOperation(this);\n try { return f.apply(this, arguments) }\n finally { endOperation(this); }\n }\n }", "function methodOp(f) {\n return function() {\n if (this.curOp) { return f.apply(this, arguments) }\n startOperation(this);\n try { return f.apply(this, arguments) }\n finally { endOperation(this); }\n }\n }", "function methodOp(f) {\n return function() {\n if (this.curOp) { return f.apply(this, arguments) }\n startOperation(this);\n try { return f.apply(this, arguments) }\n finally { endOperation(this); }\n }\n }", "function methodOp(f) {\n return function() {\n if (this.curOp) { return f.apply(this, arguments) }\n startOperation(this);\n try { return f.apply(this, arguments) }\n finally { endOperation(this); }\n }\n }", "function methodOp(f) {\n return function() {\n if (this.curOp) { return f.apply(this, arguments) }\n startOperation(this);\n try { return f.apply(this, arguments) }\n finally { endOperation(this); }\n }\n }", "function methodOp(f) {\n return function() {\n if (this.curOp) { return f.apply(this, arguments) }\n startOperation(this);\n try { return f.apply(this, arguments) }\n finally { endOperation(this); }\n }\n }", "function methodOp(f) {\n return function() {\n if (this.curOp) { return f.apply(this, arguments) }\n startOperation(this);\n try { return f.apply(this, arguments) }\n finally { endOperation(this); }\n }\n }", "function methodOp(f) {\n return function() {\n if (this.curOp) { return f.apply(this, arguments) }\n startOperation(this);\n try { return f.apply(this, arguments) }\n finally { endOperation(this); }\n }\n }", "function methodOp(f) {\n return function() {\n if (this.curOp) { return f.apply(this, arguments) }\n startOperation(this);\n try { return f.apply(this, arguments) }\n finally { endOperation(this); }\n }\n }", "function methodOp(f) {\n return function() {\n if (this.curOp) { return f.apply(this, arguments) }\n startOperation(this);\n try { return f.apply(this, arguments) }\n finally { endOperation(this); }\n }\n }", "function WrappedOperation (operation, meta) {\n this.wrapped = operation;\n this.meta = meta;\n }", "function WrappedOperation (operation, meta) {\n this.wrapped = operation;\n this.meta = meta;\n }", "function methodOp(f) {\n return function() {\n if (this.curOp) return f.apply(this, arguments);\n startOperation(this);\n try { return f.apply(this, arguments); }\n finally { endOperation(this); }\n };\n }", "function methodOp(f) {\n return function() {\n if (this.curOp) return f.apply(this, arguments);\n startOperation(this);\n try { return f.apply(this, arguments); }\n finally { endOperation(this); }\n };\n }", "function methodOp(f) {\n return function() {\n if (this.curOp) return f.apply(this, arguments);\n startOperation(this);\n try { return f.apply(this, arguments); }\n finally { endOperation(this); }\n };\n }", "function methodOp(f) {\n return function() {\n if (this.curOp) return f.apply(this, arguments);\n startOperation(this);\n try { return f.apply(this, arguments); }\n finally { endOperation(this); }\n };\n }", "function methodOp(f) {\n return function() {\n if (this.curOp) return f.apply(this, arguments);\n startOperation(this);\n try { return f.apply(this, arguments); }\n finally { endOperation(this); }\n };\n }", "function methodOp(f) {\n return function() {\n if (this.curOp) return f.apply(this, arguments);\n startOperation(this);\n try { return f.apply(this, arguments); }\n finally { endOperation(this); }\n };\n }", "function methodOp(f) {\n return function() {\n if (this.curOp) return f.apply(this, arguments);\n startOperation(this);\n try { return f.apply(this, arguments); }\n finally { endOperation(this); }\n };\n }", "function methodOp(f) {\n return function() {\n if (this.curOp) return f.apply(this, arguments);\n startOperation(this);\n try { return f.apply(this, arguments); }\n finally { endOperation(this); }\n };\n }", "function methodOp(f) {\n\t\t return function() {\n\t\t if (this.curOp) { return f.apply(this, arguments) }\n\t\t startOperation(this);\n\t\t try { return f.apply(this, arguments) }\n\t\t finally { endOperation(this); }\n\t\t }\n\t\t }", "function wrap(fn) {\n return function(cb) { fn.call(null, cb.bind(null, null)); };\n }", "function wrap(fn) {\n return function wrapper() {\n var cb = arguments[arguments.length - 1]\n try {\n var result = fn.apply(\n null,\n Array.prototype.slice.call(arguments, 0, arguments.length - 1)\n )\n cb(null, result)\n } catch (e) {\n cb(e)\n }\n }\n }", "function methodOp(f) {\n return function() {\n if (this.curOp) { return f.apply(this, arguments) }\n startOperation(this)\n try { return f.apply(this, arguments) }\n finally { endOperation(this) }\n }\n}", "function methodOp(f) {\n return function() {\n if (this.curOp) { return f.apply(this, arguments) }\n startOperation(this)\n try { return f.apply(this, arguments) }\n finally { endOperation(this) }\n }\n}", "function methodOp(f) {\n return function() {\n if (this.curOp) { return f.apply(this, arguments) }\n startOperation(this);\n try { return f.apply(this, arguments) }\n finally { endOperation(this); }\n }\n}", "function methodOp(f) {\n return function() {\n if (this.curOp) { return f.apply(this, arguments) }\n startOperation(this);\n try { return f.apply(this, arguments) }\n finally { endOperation(this); }\n }\n}", "function methodOp(f) {\n return function() {\n if (this.curOp) { return f.apply(this, arguments) }\n startOperation(this);\n try { return f.apply(this, arguments) }\n finally { endOperation(this); }\n }\n}", "function methodOp(f) {\n return function() {\n if (this.curOp) { return f.apply(this, arguments) }\n startOperation(this);\n try { return f.apply(this, arguments) }\n finally { endOperation(this); }\n }\n}", "function methodOp(f) {\n return function() {\n if (this.curOp) { return f.apply(this, arguments) }\n startOperation(this);\n try { return f.apply(this, arguments) }\n finally { endOperation(this); }\n }\n}", "function methodOp(f) {\n return function() {\n if (this.curOp) { return f.apply(this, arguments) }\n startOperation(this);\n try { return f.apply(this, arguments) }\n finally { endOperation(this); }\n }\n}", "function methodOp(f) {\n return function() {\n if (this.curOp) { return f.apply(this, arguments) }\n startOperation(this);\n try { return f.apply(this, arguments) }\n finally { endOperation(this); }\n }\n}", "function methodOp(f) {\n return function() {\n if (this.curOp) { return f.apply(this, arguments) }\n startOperation(this);\n try { return f.apply(this, arguments) }\n finally { endOperation(this); }\n }\n}", "function methodOp(f) {\n return function() {\n if (this.curOp) { return f.apply(this, arguments) }\n startOperation(this);\n try { return f.apply(this, arguments) }\n finally { endOperation(this); }\n }\n}", "function methodOp(f) {\n return function() {\n if (this.curOp) { return f.apply(this, arguments) }\n startOperation(this);\n try { return f.apply(this, arguments) }\n finally { endOperation(this); }\n }\n}", "function methodOp(f) {\n return function() {\n if (this.curOp) { return f.apply(this, arguments) }\n startOperation(this);\n try { return f.apply(this, arguments) }\n finally { endOperation(this); }\n }\n}", "function methodOp(f) {\n\t\t return function() {\n\t\t if (this.curOp) return f.apply(this, arguments);\n\t\t startOperation(this);\n\t\t try { return f.apply(this, arguments); }\n\t\t finally { endOperation(this); }\n\t\t };\n\t\t }", "function methodOp(f) {\r\n return function() {\r\n if (this.curOp) return f.apply(this, arguments);\r\n startOperation(this);\r\n try { return f.apply(this, arguments); }\r\n finally { endOperation(this); }\r\n };\r\n }", "function makeFunctionWrapper(original, functionName) {\n //log(\"wrap fn: \" + functionName);\n var f = original[functionName];\n return function() {\n //log(\"call: \" + functionName);\n var result = f.apply(original, arguments);\n return result;\n };\n}", "function methodOp(f) {\n\t return function() {\n\t if (this.curOp) return f.apply(this, arguments);\n\t startOperation(this);\n\t try { return f.apply(this, arguments); }\n\t finally { endOperation(this); }\n\t };\n\t }", "function methodOp(f) {\n\t return function() {\n\t if (this.curOp) return f.apply(this, arguments);\n\t startOperation(this);\n\t try { return f.apply(this, arguments); }\n\t finally { endOperation(this); }\n\t };\n\t }", "function methodOp(f) {\n\t return function() {\n\t if (this.curOp) return f.apply(this, arguments);\n\t startOperation(this);\n\t try { return f.apply(this, arguments); }\n\t finally { endOperation(this); }\n\t };\n\t }", "function createWrap(fn) {\n if (!fn)\n return fn;\n\n // Avoid double-wrapping the same callback\n if (fn._wrapped)\n return fn._wrapped;\n\n function wrap() {\n //log(\"wrap called: \", this);\n try {\n return fn.apply(this, arguments);\n }\n catch (e) {\n //log(\"wrap caught error\", e);\n reportError(e);\n if (_rethrow)\n throw e;\n }\n }\n\n fn._wrapped = wrap;\n\n return wrap;\n }", "function makeFunctionWrapper(original, functionName) {\n //log(\"wrap fn: \" + functionName);\n var f = original[functionName];\n return function() {\n //log(\"call: \" + functionName);\n var result = f.apply(original, arguments);\n return result;\n };\n }", "function wrapfunction (fn, message) {\n if (typeof fn !== 'function') {\n throw new TypeError('argument fn must be a function')\n }\n\n return fn\n}", "function wrapfunction (fn, message) {\n if (typeof fn !== 'function') {\n throw new TypeError('argument fn must be a function')\n }\n\n return fn\n}", "function wrapfunction (fn, message) {\n if (typeof fn !== 'function') {\n throw new TypeError('argument fn must be a function')\n }\n\n return fn\n}", "function wrapfunction (fn, message) {\n if (typeof fn !== 'function') {\n throw new TypeError('argument fn must be a function')\n }\n\n return fn\n}", "function methodOp(f) {\r\n return function() {\r\n if (this.curOp) { return f.apply(this, arguments) }\r\n startOperation(this);\r\n try { return f.apply(this, arguments) }\r\n finally { endOperation(this); }\r\n }\r\n}", "wrapFunction(fn, context, params) {\n return function() {\n fn.apply(context, params);\n }\n }", "function wrap$1(fn) {\n\t return wrap$2(fn)();\n\t}", "function wrap(fn, next) {\n return function () {\n fn(next);\n };\n}", "function operation(cm, f) {\n\t\t return function() {\n\t\t if (cm.curOp) { return f.apply(cm, arguments) }\n\t\t startOperation(cm);\n\t\t try { return f.apply(cm, arguments) }\n\t\t finally { endOperation(cm); }\n\t\t }\n\t\t }", "function operation(cm, f) {\n return function() {\n if (cm.curOp) { return f.apply(cm, arguments) }\n startOperation(cm)\n try { return f.apply(cm, arguments) }\n finally { endOperation(cm) }\n }\n}", "function operation(cm, f) {\n return function() {\n if (cm.curOp) { return f.apply(cm, arguments) }\n startOperation(cm)\n try { return f.apply(cm, arguments) }\n finally { endOperation(cm) }\n }\n}", "function operation(cm, f) {\n return function() {\n if (cm.curOp) { return f.apply(cm, arguments) }\n startOperation(cm);\n try { return f.apply(cm, arguments) }\n finally { endOperation(cm); }\n }\n}", "function operation(cm, f) {\n return function() {\n if (cm.curOp) { return f.apply(cm, arguments) }\n startOperation(cm);\n try { return f.apply(cm, arguments) }\n finally { endOperation(cm); }\n }\n}", "function operation(cm, f) {\n return function() {\n if (cm.curOp) { return f.apply(cm, arguments) }\n startOperation(cm);\n try { return f.apply(cm, arguments) }\n finally { endOperation(cm); }\n }\n}", "function operation(cm, f) {\n return function() {\n if (cm.curOp) { return f.apply(cm, arguments) }\n startOperation(cm);\n try { return f.apply(cm, arguments) }\n finally { endOperation(cm); }\n }\n}", "function operation(cm, f) {\n return function() {\n if (cm.curOp) { return f.apply(cm, arguments) }\n startOperation(cm);\n try { return f.apply(cm, arguments) }\n finally { endOperation(cm); }\n }\n}", "function operation(cm, f) {\n return function() {\n if (cm.curOp) { return f.apply(cm, arguments) }\n startOperation(cm);\n try { return f.apply(cm, arguments) }\n finally { endOperation(cm); }\n }\n}", "function operation(cm, f) {\n return function() {\n if (cm.curOp) { return f.apply(cm, arguments) }\n startOperation(cm);\n try { return f.apply(cm, arguments) }\n finally { endOperation(cm); }\n }\n}", "function operation(cm, f) {\n return function() {\n if (cm.curOp) { return f.apply(cm, arguments) }\n startOperation(cm);\n try { return f.apply(cm, arguments) }\n finally { endOperation(cm); }\n }\n}", "function operation(cm, f) {\n return function() {\n if (cm.curOp) { return f.apply(cm, arguments) }\n startOperation(cm);\n try { return f.apply(cm, arguments) }\n finally { endOperation(cm); }\n }\n}", "function operation(cm, f) {\n return function() {\n if (cm.curOp) { return f.apply(cm, arguments) }\n startOperation(cm);\n try { return f.apply(cm, arguments) }\n finally { endOperation(cm); }\n }\n}", "function operation(cm, f) {\n return function() {\n if (cm.curOp) { return f.apply(cm, arguments) }\n startOperation(cm);\n try { return f.apply(cm, arguments) }\n finally { endOperation(cm); }\n }\n}" ]
[ "0.6697798", "0.6697798", "0.6697798", "0.6697798", "0.6697798", "0.6697798", "0.6697798", "0.6697798", "0.6697798", "0.66419894", "0.6519431", "0.6468018", "0.6468018", "0.6468018", "0.6468018", "0.6468018", "0.6468018", "0.6468018", "0.6468018", "0.6468018", "0.6468018", "0.6468018", "0.6468018", "0.6468018", "0.6468018", "0.6468018", "0.6468018", "0.6468018", "0.6462634", "0.6462634", "0.6370824", "0.6370824", "0.6370824", "0.6370824", "0.6370824", "0.6370824", "0.6370824", "0.6370824", "0.635133", "0.6298327", "0.62904185", "0.6288899", "0.6288899", "0.62811697", "0.62811697", "0.62811697", "0.62811697", "0.62811697", "0.62811697", "0.62811697", "0.62811697", "0.62811697", "0.62811697", "0.62811697", "0.6259363", "0.62592185", "0.62557703", "0.6236797", "0.6236797", "0.6236797", "0.620545", "0.6194734", "0.61821824", "0.61821824", "0.61821824", "0.61821824", "0.61768866", "0.6150511", "0.6092285", "0.6087949", "0.60578036", "0.60563666", "0.60563666", "0.6025106", "0.6025106", "0.6025106", "0.6025106", "0.6025106", "0.6025106", "0.6025106", "0.6025106", "0.6025106", "0.6025106", "0.6025106" ]
0.6096213
80
Used to add methods to editor and doc instances, wrapping them in operations.
function methodOp(f) { return function() { if (this.curOp) { return f.apply(this, arguments) } startOperation(this); try { return f.apply(this, arguments) } finally { endOperation(this); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addEditorMethods(CodeMirror) {\n\t\t var optionHandlers = CodeMirror.optionHandlers;\n\n\t\t var helpers = CodeMirror.helpers = {};\n\n\t\t CodeMirror.prototype = {\n\t\t constructor: CodeMirror,\n\t\t focus: function(){win(this).focus(); this.display.input.focus();},\n\n\t\t setOption: function(option, value) {\n\t\t var options = this.options, old = options[option];\n\t\t if (options[option] == value && option != \"mode\") { return }\n\t\t options[option] = value;\n\t\t if (optionHandlers.hasOwnProperty(option))\n\t\t { operation(this, optionHandlers[option])(this, value, old); }\n\t\t signal(this, \"optionChange\", this, option);\n\t\t },\n\n\t\t getOption: function(option) {return this.options[option]},\n\t\t getDoc: function() {return this.doc},\n\n\t\t addKeyMap: function(map, bottom) {\n\t\t this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map));\n\t\t },\n\t\t removeKeyMap: function(map) {\n\t\t var maps = this.state.keyMaps;\n\t\t for (var i = 0; i < maps.length; ++i)\n\t\t { if (maps[i] == map || maps[i].name == map) {\n\t\t maps.splice(i, 1);\n\t\t return true\n\t\t } }\n\t\t },\n\n\t\t addOverlay: methodOp(function(spec, options) {\n\t\t var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n\t\t if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n\t\t insertSorted(this.state.overlays,\n\t\t {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n\t\t priority: (options && options.priority) || 0},\n\t\t function (overlay) { return overlay.priority; });\n\t\t this.state.modeGen++;\n\t\t regChange(this);\n\t\t }),\n\t\t removeOverlay: methodOp(function(spec) {\n\t\t var overlays = this.state.overlays;\n\t\t for (var i = 0; i < overlays.length; ++i) {\n\t\t var cur = overlays[i].modeSpec;\n\t\t if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n\t\t overlays.splice(i, 1);\n\t\t this.state.modeGen++;\n\t\t regChange(this);\n\t\t return\n\t\t }\n\t\t }\n\t\t }),\n\n\t\t indentLine: methodOp(function(n, dir, aggressive) {\n\t\t if (typeof dir != \"string\" && typeof dir != \"number\") {\n\t\t if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n\t\t else { dir = dir ? \"add\" : \"subtract\"; }\n\t\t }\n\t\t if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n\t\t }),\n\t\t indentSelection: methodOp(function(how) {\n\t\t var ranges = this.doc.sel.ranges, end = -1;\n\t\t for (var i = 0; i < ranges.length; i++) {\n\t\t var range = ranges[i];\n\t\t if (!range.empty()) {\n\t\t var from = range.from(), to = range.to();\n\t\t var start = Math.max(end, from.line);\n\t\t end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n\t\t for (var j = start; j < end; ++j)\n\t\t { indentLine(this, j, how); }\n\t\t var newRanges = this.doc.sel.ranges;\n\t\t if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n\t\t { replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n\t\t } else if (range.head.line > end) {\n\t\t indentLine(this, range.head.line, how, true);\n\t\t end = range.head.line;\n\t\t if (i == this.doc.sel.primIndex) { ensureCursorVisible(this); }\n\t\t }\n\t\t }\n\t\t }),\n\n\t\t // Fetch the parser token for a given character. Useful for hacks\n\t\t // that want to inspect the mode state (say, for completion).\n\t\t getTokenAt: function(pos, precise) {\n\t\t return takeToken(this, pos, precise)\n\t\t },\n\n\t\t getLineTokens: function(line, precise) {\n\t\t return takeToken(this, Pos(line), precise, true)\n\t\t },\n\n\t\t getTokenTypeAt: function(pos) {\n\t\t pos = clipPos(this.doc, pos);\n\t\t var styles = getLineStyles(this, getLine(this.doc, pos.line));\n\t\t var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n\t\t var type;\n\t\t if (ch == 0) { type = styles[2]; }\n\t\t else { for (;;) {\n\t\t var mid = (before + after) >> 1;\n\t\t if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n\t\t else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n\t\t else { type = styles[mid * 2 + 2]; break }\n\t\t } }\n\t\t var cut = type ? type.indexOf(\"overlay \") : -1;\n\t\t return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n\t\t },\n\n\t\t getModeAt: function(pos) {\n\t\t var mode = this.doc.mode;\n\t\t if (!mode.innerMode) { return mode }\n\t\t return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n\t\t },\n\n\t\t getHelper: function(pos, type) {\n\t\t return this.getHelpers(pos, type)[0]\n\t\t },\n\n\t\t getHelpers: function(pos, type) {\n\t\t var found = [];\n\t\t if (!helpers.hasOwnProperty(type)) { return found }\n\t\t var help = helpers[type], mode = this.getModeAt(pos);\n\t\t if (typeof mode[type] == \"string\") {\n\t\t if (help[mode[type]]) { found.push(help[mode[type]]); }\n\t\t } else if (mode[type]) {\n\t\t for (var i = 0; i < mode[type].length; i++) {\n\t\t var val = help[mode[type][i]];\n\t\t if (val) { found.push(val); }\n\t\t }\n\t\t } else if (mode.helperType && help[mode.helperType]) {\n\t\t found.push(help[mode.helperType]);\n\t\t } else if (help[mode.name]) {\n\t\t found.push(help[mode.name]);\n\t\t }\n\t\t for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n\t\t var cur = help._global[i$1];\n\t\t if (cur.pred(mode, this) && indexOf(found, cur.val) == -1)\n\t\t { found.push(cur.val); }\n\t\t }\n\t\t return found\n\t\t },\n\n\t\t getStateAfter: function(line, precise) {\n\t\t var doc = this.doc;\n\t\t line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n\t\t return getContextBefore(this, line + 1, precise).state\n\t\t },\n\n\t\t cursorCoords: function(start, mode) {\n\t\t var pos, range = this.doc.sel.primary();\n\t\t if (start == null) { pos = range.head; }\n\t\t else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n\t\t else { pos = start ? range.from() : range.to(); }\n\t\t return cursorCoords(this, pos, mode || \"page\")\n\t\t },\n\n\t\t charCoords: function(pos, mode) {\n\t\t return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n\t\t },\n\n\t\t coordsChar: function(coords, mode) {\n\t\t coords = fromCoordSystem(this, coords, mode || \"page\");\n\t\t return coordsChar(this, coords.left, coords.top)\n\t\t },\n\n\t\t lineAtHeight: function(height, mode) {\n\t\t height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n\t\t return lineAtHeight(this.doc, height + this.display.viewOffset)\n\t\t },\n\t\t heightAtLine: function(line, mode, includeWidgets) {\n\t\t var end = false, lineObj;\n\t\t if (typeof line == \"number\") {\n\t\t var last = this.doc.first + this.doc.size - 1;\n\t\t if (line < this.doc.first) { line = this.doc.first; }\n\t\t else if (line > last) { line = last; end = true; }\n\t\t lineObj = getLine(this.doc, line);\n\t\t } else {\n\t\t lineObj = line;\n\t\t }\n\t\t return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n\t\t (end ? this.doc.height - heightAtLine(lineObj) : 0)\n\t\t },\n\n\t\t defaultTextHeight: function() { return textHeight(this.display) },\n\t\t defaultCharWidth: function() { return charWidth(this.display) },\n\n\t\t getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n\t\t addWidget: function(pos, node, scroll, vert, horiz) {\n\t\t var display = this.display;\n\t\t pos = cursorCoords(this, clipPos(this.doc, pos));\n\t\t var top = pos.bottom, left = pos.left;\n\t\t node.style.position = \"absolute\";\n\t\t node.setAttribute(\"cm-ignore-events\", \"true\");\n\t\t this.display.input.setUneditable(node);\n\t\t display.sizer.appendChild(node);\n\t\t if (vert == \"over\") {\n\t\t top = pos.top;\n\t\t } else if (vert == \"above\" || vert == \"near\") {\n\t\t var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n\t\t hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n\t\t // Default to positioning above (if specified and possible); otherwise default to positioning below\n\t\t if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n\t\t { top = pos.top - node.offsetHeight; }\n\t\t else if (pos.bottom + node.offsetHeight <= vspace)\n\t\t { top = pos.bottom; }\n\t\t if (left + node.offsetWidth > hspace)\n\t\t { left = hspace - node.offsetWidth; }\n\t\t }\n\t\t node.style.top = top + \"px\";\n\t\t node.style.left = node.style.right = \"\";\n\t\t if (horiz == \"right\") {\n\t\t left = display.sizer.clientWidth - node.offsetWidth;\n\t\t node.style.right = \"0px\";\n\t\t } else {\n\t\t if (horiz == \"left\") { left = 0; }\n\t\t else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n\t\t node.style.left = left + \"px\";\n\t\t }\n\t\t if (scroll)\n\t\t { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n\t\t },\n\n\t\t triggerOnKeyDown: methodOp(onKeyDown),\n\t\t triggerOnKeyPress: methodOp(onKeyPress),\n\t\t triggerOnKeyUp: onKeyUp,\n\t\t triggerOnMouseDown: methodOp(onMouseDown),\n\n\t\t execCommand: function(cmd) {\n\t\t if (commands.hasOwnProperty(cmd))\n\t\t { return commands[cmd].call(null, this) }\n\t\t },\n\n\t\t triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n\t\t findPosH: function(from, amount, unit, visually) {\n\t\t var dir = 1;\n\t\t if (amount < 0) { dir = -1; amount = -amount; }\n\t\t var cur = clipPos(this.doc, from);\n\t\t for (var i = 0; i < amount; ++i) {\n\t\t cur = findPosH(this.doc, cur, dir, unit, visually);\n\t\t if (cur.hitSide) { break }\n\t\t }\n\t\t return cur\n\t\t },\n\n\t\t moveH: methodOp(function(dir, unit) {\n\t\t var this$1$1 = this;\n\n\t\t this.extendSelectionsBy(function (range) {\n\t\t if (this$1$1.display.shift || this$1$1.doc.extend || range.empty())\n\t\t { return findPosH(this$1$1.doc, range.head, dir, unit, this$1$1.options.rtlMoveVisually) }\n\t\t else\n\t\t { return dir < 0 ? range.from() : range.to() }\n\t\t }, sel_move);\n\t\t }),\n\n\t\t deleteH: methodOp(function(dir, unit) {\n\t\t var sel = this.doc.sel, doc = this.doc;\n\t\t if (sel.somethingSelected())\n\t\t { doc.replaceSelection(\"\", null, \"+delete\"); }\n\t\t else\n\t\t { deleteNearSelection(this, function (range) {\n\t\t var other = findPosH(doc, range.head, dir, unit, false);\n\t\t return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other}\n\t\t }); }\n\t\t }),\n\n\t\t findPosV: function(from, amount, unit, goalColumn) {\n\t\t var dir = 1, x = goalColumn;\n\t\t if (amount < 0) { dir = -1; amount = -amount; }\n\t\t var cur = clipPos(this.doc, from);\n\t\t for (var i = 0; i < amount; ++i) {\n\t\t var coords = cursorCoords(this, cur, \"div\");\n\t\t if (x == null) { x = coords.left; }\n\t\t else { coords.left = x; }\n\t\t cur = findPosV(this, coords, dir, unit);\n\t\t if (cur.hitSide) { break }\n\t\t }\n\t\t return cur\n\t\t },\n\n\t\t moveV: methodOp(function(dir, unit) {\n\t\t var this$1$1 = this;\n\n\t\t var doc = this.doc, goals = [];\n\t\t var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n\t\t doc.extendSelectionsBy(function (range) {\n\t\t if (collapse)\n\t\t { return dir < 0 ? range.from() : range.to() }\n\t\t var headPos = cursorCoords(this$1$1, range.head, \"div\");\n\t\t if (range.goalColumn != null) { headPos.left = range.goalColumn; }\n\t\t goals.push(headPos.left);\n\t\t var pos = findPosV(this$1$1, headPos, dir, unit);\n\t\t if (unit == \"page\" && range == doc.sel.primary())\n\t\t { addToScrollTop(this$1$1, charCoords(this$1$1, pos, \"div\").top - headPos.top); }\n\t\t return pos\n\t\t }, sel_move);\n\t\t if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n\t\t { doc.sel.ranges[i].goalColumn = goals[i]; } }\n\t\t }),\n\n\t\t // Find the word at the given position (as returned by coordsChar).\n\t\t findWordAt: function(pos) {\n\t\t var doc = this.doc, line = getLine(doc, pos.line).text;\n\t\t var start = pos.ch, end = pos.ch;\n\t\t if (line) {\n\t\t var helper = this.getHelper(pos, \"wordChars\");\n\t\t if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n\t\t var startChar = line.charAt(start);\n\t\t var check = isWordChar(startChar, helper)\n\t\t ? function (ch) { return isWordChar(ch, helper); }\n\t\t : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n\t\t : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n\t\t while (start > 0 && check(line.charAt(start - 1))) { --start; }\n\t\t while (end < line.length && check(line.charAt(end))) { ++end; }\n\t\t }\n\t\t return new Range(Pos(pos.line, start), Pos(pos.line, end))\n\t\t },\n\n\t\t toggleOverwrite: function(value) {\n\t\t if (value != null && value == this.state.overwrite) { return }\n\t\t if (this.state.overwrite = !this.state.overwrite)\n\t\t { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\t\t else\n\t\t { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n\t\t signal(this, \"overwriteToggle\", this, this.state.overwrite);\n\t\t },\n\t\t hasFocus: function() { return this.display.input.getField() == activeElt(doc(this)) },\n\t\t isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n\t\t scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n\t\t getScrollInfo: function() {\n\t\t var scroller = this.display.scroller;\n\t\t return {left: scroller.scrollLeft, top: scroller.scrollTop,\n\t\t height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n\t\t width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n\t\t clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n\t\t },\n\n\t\t scrollIntoView: methodOp(function(range, margin) {\n\t\t if (range == null) {\n\t\t range = {from: this.doc.sel.primary().head, to: null};\n\t\t if (margin == null) { margin = this.options.cursorScrollMargin; }\n\t\t } else if (typeof range == \"number\") {\n\t\t range = {from: Pos(range, 0), to: null};\n\t\t } else if (range.from == null) {\n\t\t range = {from: range, to: null};\n\t\t }\n\t\t if (!range.to) { range.to = range.from; }\n\t\t range.margin = margin || 0;\n\n\t\t if (range.from.line != null) {\n\t\t scrollToRange(this, range);\n\t\t } else {\n\t\t scrollToCoordsRange(this, range.from, range.to, range.margin);\n\t\t }\n\t\t }),\n\n\t\t setSize: methodOp(function(width, height) {\n\t\t var this$1$1 = this;\n\n\t\t var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n\t\t if (width != null) { this.display.wrapper.style.width = interpret(width); }\n\t\t if (height != null) { this.display.wrapper.style.height = interpret(height); }\n\t\t if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n\t\t var lineNo = this.display.viewFrom;\n\t\t this.doc.iter(lineNo, this.display.viewTo, function (line) {\n\t\t if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n\t\t { if (line.widgets[i].noHScroll) { regLineChange(this$1$1, lineNo, \"widget\"); break } } }\n\t\t ++lineNo;\n\t\t });\n\t\t this.curOp.forceUpdate = true;\n\t\t signal(this, \"refresh\", this);\n\t\t }),\n\n\t\t operation: function(f){return runInOp(this, f)},\n\t\t startOperation: function(){return startOperation(this)},\n\t\t endOperation: function(){return endOperation(this)},\n\n\t\t refresh: methodOp(function() {\n\t\t var oldHeight = this.display.cachedTextHeight;\n\t\t regChange(this);\n\t\t this.curOp.forceUpdate = true;\n\t\t clearCaches(this);\n\t\t scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n\t\t updateGutterSpace(this.display);\n\t\t if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5 || this.options.lineWrapping)\n\t\t { estimateLineHeights(this); }\n\t\t signal(this, \"refresh\", this);\n\t\t }),\n\n\t\t swapDoc: methodOp(function(doc) {\n\t\t var old = this.doc;\n\t\t old.cm = null;\n\t\t // Cancel the current text selection if any (#5821)\n\t\t if (this.state.selectingText) { this.state.selectingText(); }\n\t\t attachDoc(this, doc);\n\t\t clearCaches(this);\n\t\t this.display.input.reset();\n\t\t scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n\t\t this.curOp.forceScroll = true;\n\t\t signalLater(this, \"swapDoc\", this, old);\n\t\t return old\n\t\t }),\n\n\t\t phrase: function(phraseText) {\n\t\t var phrases = this.options.phrases;\n\t\t return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n\t\t },\n\n\t\t getInputField: function(){return this.display.input.getField()},\n\t\t getWrapperElement: function(){return this.display.wrapper},\n\t\t getScrollerElement: function(){return this.display.scroller},\n\t\t getGutterElement: function(){return this.display.gutters}\n\t\t };\n\t\t eventMixin(CodeMirror);\n\n\t\t CodeMirror.registerHelper = function(type, name, value) {\n\t\t if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n\t\t helpers[type][name] = value;\n\t\t };\n\t\t CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n\t\t CodeMirror.registerHelper(type, name, value);\n\t\t helpers[type]._global.push({pred: predicate, val: value});\n\t\t };\n\t\t }", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){win(this).focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map));\n },\n removeKeyMap: function(map) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map || maps[i].name == map) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this.state.modeGen++;\n regChange(this);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n if (!range.empty()) {\n var from = range.from(), to = range.to();\n var start = Math.max(end, from.line);\n end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this, j, how); }\n var newRanges = this.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range.head.line > end) {\n indentLine(this, range.head.line, how, true);\n end = range.head.line;\n if (i == this.doc.sel.primIndex) { ensureCursorVisible(this); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range = this.doc.sel.primary();\n if (start == null) { pos = range.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range.from() : range.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range) {\n if (this$1.display.shift || this$1.doc.extend || range.empty())\n { return findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range.from() : range.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range) {\n var other = findPosH(doc, range.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range) {\n if (collapse)\n { return dir < 0 ? range.from() : range.to() }\n var headPos = cursorCoords(this$1, range.head, \"div\");\n if (range.goalColumn != null) { headPos.left = range.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt(doc(this)) },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range, margin) {\n if (range == null) {\n range = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range == \"number\") {\n range = {from: Pos(range, 0), to: null};\n } else if (range.from == null) {\n range = {from: range, to: null};\n }\n if (!range.to) { range.to = range.from; }\n range.margin = margin || 0;\n\n if (range.from.line != null) {\n scrollToRange(this, range);\n } else {\n scrollToCoordsRange(this, range.from, range.to, range.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo = this.display.viewFrom;\n this.doc.iter(lineNo, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo, \"widget\"); break } } }\n ++lineNo;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this.display);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5 || this.options.lineWrapping)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n // Cancel the current text selection if any (#5821)\n if (this.state.selectingText) { this.state.selectingText(); }\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){win(this).focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map));\n },\n removeKeyMap: function(map) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map || maps[i].name == map) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this.state.modeGen++;\n regChange(this);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n if (!range.empty()) {\n var from = range.from(), to = range.to();\n var start = Math.max(end, from.line);\n end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this, j, how); }\n var newRanges = this.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range.head.line > end) {\n indentLine(this, range.head.line, how, true);\n end = range.head.line;\n if (i == this.doc.sel.primIndex) { ensureCursorVisible(this); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range = this.doc.sel.primary();\n if (start == null) { pos = range.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range.from() : range.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range) {\n if (this$1.display.shift || this$1.doc.extend || range.empty())\n { return findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range.from() : range.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range) {\n var other = findPosH(doc, range.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range) {\n if (collapse)\n { return dir < 0 ? range.from() : range.to() }\n var headPos = cursorCoords(this$1, range.head, \"div\");\n if (range.goalColumn != null) { headPos.left = range.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt(doc(this)) },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range, margin) {\n if (range == null) {\n range = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range == \"number\") {\n range = {from: Pos(range, 0), to: null};\n } else if (range.from == null) {\n range = {from: range, to: null};\n }\n if (!range.to) { range.to = range.from; }\n range.margin = margin || 0;\n\n if (range.from.line != null) {\n scrollToRange(this, range);\n } else {\n scrollToCoordsRange(this, range.from, range.to, range.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo = this.display.viewFrom;\n this.doc.iter(lineNo, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo, \"widget\"); break } } }\n ++lineNo;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this.display);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5 || this.options.lineWrapping)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n // Cancel the current text selection if any (#5821)\n if (this.state.selectingText) { this.state.selectingText(); }\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map$$1, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map$$1));\n },\n removeKeyMap: function(map$$1) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map$$1 || maps[i].name == map$$1) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var this$1 = this;\n\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this$1.state.modeGen++;\n regChange(this$1);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var this$1 = this;\n\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range$$1 = ranges[i];\n if (!range$$1.empty()) {\n var from = range$$1.from(), to = range$$1.to();\n var start = Math.max(end, from.line);\n end = Math.min(this$1.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this$1, j, how); }\n var newRanges = this$1.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range$$1.head.line > end) {\n indentLine(this$1, range$$1.head.line, how, true);\n end = range$$1.head.line;\n if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var this$1 = this;\n\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range$$1 = this.doc.sel.primary();\n if (start == null) { pos = range$$1.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range$$1.from() : range$$1.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var this$1 = this;\n\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this$1.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range$$1) {\n if (this$1.display.shift || this$1.doc.extend || range$$1.empty())\n { return findPosH(this$1.doc, range$$1.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range$$1.from() : range$$1.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range$$1) {\n var other = findPosH(doc, range$$1.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range$$1.head} : {from: range$$1.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var this$1 = this;\n\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this$1, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this$1, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range$$1) {\n if (collapse)\n { return dir < 0 ? range$$1.from() : range$$1.to() }\n var headPos = cursorCoords(this$1, range$$1.head, \"div\");\n if (range$$1.goalColumn != null) { headPos.left = range$$1.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range$$1 == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt() },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range$$1, margin) {\n if (range$$1 == null) {\n range$$1 = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range$$1 == \"number\") {\n range$$1 = {from: Pos(range$$1, 0), to: null};\n } else if (range$$1.from == null) {\n range$$1 = {from: range$$1, to: null};\n }\n if (!range$$1.to) { range$$1.to = range$$1.from; }\n range$$1.margin = margin || 0;\n\n if (range$$1.from.line != null) {\n scrollToRange(this, range$$1);\n } else {\n scrollToCoordsRange(this, range$$1.from, range$$1.to, range$$1.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo$$1 = this.display.viewFrom;\n this.doc.iter(lineNo$$1, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo$$1, \"widget\"); break } } }\n ++lineNo$$1;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this.display);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n // Cancel the current text selection if any (#5821)\n if (this.state.selectingText) { this.state.selectingText(); }\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map$$1, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map$$1));\n },\n removeKeyMap: function(map$$1) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map$$1 || maps[i].name == map$$1) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var this$1 = this;\n\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this$1.state.modeGen++;\n regChange(this$1);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var this$1 = this;\n\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range$$1 = ranges[i];\n if (!range$$1.empty()) {\n var from = range$$1.from(), to = range$$1.to();\n var start = Math.max(end, from.line);\n end = Math.min(this$1.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this$1, j, how); }\n var newRanges = this$1.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range$$1.head.line > end) {\n indentLine(this$1, range$$1.head.line, how, true);\n end = range$$1.head.line;\n if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var this$1 = this;\n\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range$$1 = this.doc.sel.primary();\n if (start == null) { pos = range$$1.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range$$1.from() : range$$1.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var this$1 = this;\n\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this$1.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range$$1) {\n if (this$1.display.shift || this$1.doc.extend || range$$1.empty())\n { return findPosH(this$1.doc, range$$1.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range$$1.from() : range$$1.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range$$1) {\n var other = findPosH(doc, range$$1.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range$$1.head} : {from: range$$1.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var this$1 = this;\n\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this$1, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this$1, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range$$1) {\n if (collapse)\n { return dir < 0 ? range$$1.from() : range$$1.to() }\n var headPos = cursorCoords(this$1, range$$1.head, \"div\");\n if (range$$1.goalColumn != null) { headPos.left = range$$1.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range$$1 == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt() },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range$$1, margin) {\n if (range$$1 == null) {\n range$$1 = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range$$1 == \"number\") {\n range$$1 = {from: Pos(range$$1, 0), to: null};\n } else if (range$$1.from == null) {\n range$$1 = {from: range$$1, to: null};\n }\n if (!range$$1.to) { range$$1.to = range$$1.from; }\n range$$1.margin = margin || 0;\n\n if (range$$1.from.line != null) {\n scrollToRange(this, range$$1);\n } else {\n scrollToCoordsRange(this, range$$1.from, range$$1.to, range$$1.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo$$1 = this.display.viewFrom;\n this.doc.iter(lineNo$$1, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo$$1, \"widget\"); break } } }\n ++lineNo$$1;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this.display);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n // Cancel the current text selection if any (#5821)\n if (this.state.selectingText) { this.state.selectingText(); }\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map$$1, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map$$1));\n },\n removeKeyMap: function(map$$1) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map$$1 || maps[i].name == map$$1) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var this$1 = this;\n\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this$1.state.modeGen++;\n regChange(this$1);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var this$1 = this;\n\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range$$1 = ranges[i];\n if (!range$$1.empty()) {\n var from = range$$1.from(), to = range$$1.to();\n var start = Math.max(end, from.line);\n end = Math.min(this$1.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this$1, j, how); }\n var newRanges = this$1.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range$$1.head.line > end) {\n indentLine(this$1, range$$1.head.line, how, true);\n end = range$$1.head.line;\n if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var this$1 = this;\n\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range$$1 = this.doc.sel.primary();\n if (start == null) { pos = range$$1.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range$$1.from() : range$$1.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var this$1 = this;\n\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this$1.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range$$1) {\n if (this$1.display.shift || this$1.doc.extend || range$$1.empty())\n { return findPosH(this$1.doc, range$$1.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range$$1.from() : range$$1.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range$$1) {\n var other = findPosH(doc, range$$1.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range$$1.head} : {from: range$$1.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var this$1 = this;\n\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this$1, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this$1, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range$$1) {\n if (collapse)\n { return dir < 0 ? range$$1.from() : range$$1.to() }\n var headPos = cursorCoords(this$1, range$$1.head, \"div\");\n if (range$$1.goalColumn != null) { headPos.left = range$$1.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range$$1 == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt() },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range$$1, margin) {\n if (range$$1 == null) {\n range$$1 = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range$$1 == \"number\") {\n range$$1 = {from: Pos(range$$1, 0), to: null};\n } else if (range$$1.from == null) {\n range$$1 = {from: range$$1, to: null};\n }\n if (!range$$1.to) { range$$1.to = range$$1.from; }\n range$$1.margin = margin || 0;\n\n if (range$$1.from.line != null) {\n scrollToRange(this, range$$1);\n } else {\n scrollToCoordsRange(this, range$$1.from, range$$1.to, range$$1.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo$$1 = this.display.viewFrom;\n this.doc.iter(lineNo$$1, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo$$1, \"widget\"); break } } }\n ++lineNo$$1;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this.display);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n // Cancel the current text selection if any (#5821)\n if (this.state.selectingText) { this.state.selectingText(); }\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map$$1, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map$$1));\n },\n removeKeyMap: function(map$$1) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map$$1 || maps[i].name == map$$1) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var this$1 = this;\n\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this$1.state.modeGen++;\n regChange(this$1);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var this$1 = this;\n\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range$$1 = ranges[i];\n if (!range$$1.empty()) {\n var from = range$$1.from(), to = range$$1.to();\n var start = Math.max(end, from.line);\n end = Math.min(this$1.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this$1, j, how); }\n var newRanges = this$1.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range$$1.head.line > end) {\n indentLine(this$1, range$$1.head.line, how, true);\n end = range$$1.head.line;\n if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var this$1 = this;\n\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range$$1 = this.doc.sel.primary();\n if (start == null) { pos = range$$1.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range$$1.from() : range$$1.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var this$1 = this;\n\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this$1.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range$$1) {\n if (this$1.display.shift || this$1.doc.extend || range$$1.empty())\n { return findPosH(this$1.doc, range$$1.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range$$1.from() : range$$1.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range$$1) {\n var other = findPosH(doc, range$$1.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range$$1.head} : {from: range$$1.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var this$1 = this;\n\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this$1, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this$1, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range$$1) {\n if (collapse)\n { return dir < 0 ? range$$1.from() : range$$1.to() }\n var headPos = cursorCoords(this$1, range$$1.head, \"div\");\n if (range$$1.goalColumn != null) { headPos.left = range$$1.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range$$1 == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt() },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range$$1, margin) {\n if (range$$1 == null) {\n range$$1 = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range$$1 == \"number\") {\n range$$1 = {from: Pos(range$$1, 0), to: null};\n } else if (range$$1.from == null) {\n range$$1 = {from: range$$1, to: null};\n }\n if (!range$$1.to) { range$$1.to = range$$1.from; }\n range$$1.margin = margin || 0;\n\n if (range$$1.from.line != null) {\n scrollToRange(this, range$$1);\n } else {\n scrollToCoordsRange(this, range$$1.from, range$$1.to, range$$1.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo$$1 = this.display.viewFrom;\n this.doc.iter(lineNo$$1, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo$$1, \"widget\"); break } } }\n ++lineNo$$1;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map$$1, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map$$1));\n },\n removeKeyMap: function(map$$1) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map$$1 || maps[i].name == map$$1) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var this$1 = this;\n\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this$1.state.modeGen++;\n regChange(this$1);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var this$1 = this;\n\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range$$1 = ranges[i];\n if (!range$$1.empty()) {\n var from = range$$1.from(), to = range$$1.to();\n var start = Math.max(end, from.line);\n end = Math.min(this$1.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this$1, j, how); }\n var newRanges = this$1.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range$$1.head.line > end) {\n indentLine(this$1, range$$1.head.line, how, true);\n end = range$$1.head.line;\n if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var this$1 = this;\n\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range$$1 = this.doc.sel.primary();\n if (start == null) { pos = range$$1.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range$$1.from() : range$$1.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var this$1 = this;\n\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this$1.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range$$1) {\n if (this$1.display.shift || this$1.doc.extend || range$$1.empty())\n { return findPosH(this$1.doc, range$$1.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range$$1.from() : range$$1.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range$$1) {\n var other = findPosH(doc, range$$1.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range$$1.head} : {from: range$$1.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var this$1 = this;\n\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this$1, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this$1, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range$$1) {\n if (collapse)\n { return dir < 0 ? range$$1.from() : range$$1.to() }\n var headPos = cursorCoords(this$1, range$$1.head, \"div\");\n if (range$$1.goalColumn != null) { headPos.left = range$$1.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range$$1 == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt() },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range$$1, margin) {\n if (range$$1 == null) {\n range$$1 = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range$$1 == \"number\") {\n range$$1 = {from: Pos(range$$1, 0), to: null};\n } else if (range$$1.from == null) {\n range$$1 = {from: range$$1, to: null};\n }\n if (!range$$1.to) { range$$1.to = range$$1.from; }\n range$$1.margin = margin || 0;\n\n if (range$$1.from.line != null) {\n scrollToRange(this, range$$1);\n } else {\n scrollToCoordsRange(this, range$$1.from, range$$1.to, range$$1.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo$$1 = this.display.viewFrom;\n this.doc.iter(lineNo$$1, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo$$1, \"widget\"); break } } }\n ++lineNo$$1;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this.display);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n // Cancel the current text selection if any (#5821)\n if (this.state.selectingText) { this.state.selectingText(); }\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map$$1, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map$$1));\n },\n removeKeyMap: function(map$$1) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map$$1 || maps[i].name == map$$1) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var this$1 = this;\n\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this$1.state.modeGen++;\n regChange(this$1);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var this$1 = this;\n\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range$$1 = ranges[i];\n if (!range$$1.empty()) {\n var from = range$$1.from(), to = range$$1.to();\n var start = Math.max(end, from.line);\n end = Math.min(this$1.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this$1, j, how); }\n var newRanges = this$1.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range$$1.head.line > end) {\n indentLine(this$1, range$$1.head.line, how, true);\n end = range$$1.head.line;\n if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var this$1 = this;\n\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range$$1 = this.doc.sel.primary();\n if (start == null) { pos = range$$1.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range$$1.from() : range$$1.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var this$1 = this;\n\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this$1.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range$$1) {\n if (this$1.display.shift || this$1.doc.extend || range$$1.empty())\n { return findPosH(this$1.doc, range$$1.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range$$1.from() : range$$1.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range$$1) {\n var other = findPosH(doc, range$$1.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range$$1.head} : {from: range$$1.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var this$1 = this;\n\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this$1, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this$1, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range$$1) {\n if (collapse)\n { return dir < 0 ? range$$1.from() : range$$1.to() }\n var headPos = cursorCoords(this$1, range$$1.head, \"div\");\n if (range$$1.goalColumn != null) { headPos.left = range$$1.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range$$1 == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt() },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range$$1, margin) {\n if (range$$1 == null) {\n range$$1 = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range$$1 == \"number\") {\n range$$1 = {from: Pos(range$$1, 0), to: null};\n } else if (range$$1.from == null) {\n range$$1 = {from: range$$1, to: null};\n }\n if (!range$$1.to) { range$$1.to = range$$1.from; }\n range$$1.margin = margin || 0;\n\n if (range$$1.from.line != null) {\n scrollToRange(this, range$$1);\n } else {\n scrollToCoordsRange(this, range$$1.from, range$$1.to, range$$1.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo$$1 = this.display.viewFrom;\n this.doc.iter(lineNo$$1, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo$$1, \"widget\"); break } } }\n ++lineNo$$1;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map$$1, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map$$1));\n },\n removeKeyMap: function(map$$1) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map$$1 || maps[i].name == map$$1) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var this$1 = this;\n\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this$1.state.modeGen++;\n regChange(this$1);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var this$1 = this;\n\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range$$1 = ranges[i];\n if (!range$$1.empty()) {\n var from = range$$1.from(), to = range$$1.to();\n var start = Math.max(end, from.line);\n end = Math.min(this$1.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this$1, j, how); }\n var newRanges = this$1.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range$$1.head.line > end) {\n indentLine(this$1, range$$1.head.line, how, true);\n end = range$$1.head.line;\n if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var this$1 = this;\n\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range$$1 = this.doc.sel.primary();\n if (start == null) { pos = range$$1.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range$$1.from() : range$$1.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var this$1 = this;\n\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this$1.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range$$1) {\n if (this$1.display.shift || this$1.doc.extend || range$$1.empty())\n { return findPosH(this$1.doc, range$$1.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range$$1.from() : range$$1.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range$$1) {\n var other = findPosH(doc, range$$1.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range$$1.head} : {from: range$$1.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var this$1 = this;\n\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this$1, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this$1, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range$$1) {\n if (collapse)\n { return dir < 0 ? range$$1.from() : range$$1.to() }\n var headPos = cursorCoords(this$1, range$$1.head, \"div\");\n if (range$$1.goalColumn != null) { headPos.left = range$$1.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range$$1 == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt() },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range$$1, margin) {\n if (range$$1 == null) {\n range$$1 = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range$$1 == \"number\") {\n range$$1 = {from: Pos(range$$1, 0), to: null};\n } else if (range$$1.from == null) {\n range$$1 = {from: range$$1, to: null};\n }\n if (!range$$1.to) { range$$1.to = range$$1.from; }\n range$$1.margin = margin || 0;\n\n if (range$$1.from.line != null) {\n scrollToRange(this, range$$1);\n } else {\n scrollToCoordsRange(this, range$$1.from, range$$1.to, range$$1.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo$$1 = this.display.viewFrom;\n this.doc.iter(lineNo$$1, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo$$1, \"widget\"); break } } }\n ++lineNo$$1;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this.display);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n // Cancel the current text selection if any (#5821)\n if (this.state.selectingText) { this.state.selectingText(); }\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map$$1, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map$$1));\n },\n removeKeyMap: function(map$$1) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map$$1 || maps[i].name == map$$1) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var this$1 = this;\n\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this$1.state.modeGen++;\n regChange(this$1);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var this$1 = this;\n\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range$$1 = ranges[i];\n if (!range$$1.empty()) {\n var from = range$$1.from(), to = range$$1.to();\n var start = Math.max(end, from.line);\n end = Math.min(this$1.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this$1, j, how); }\n var newRanges = this$1.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range$$1.head.line > end) {\n indentLine(this$1, range$$1.head.line, how, true);\n end = range$$1.head.line;\n if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var this$1 = this;\n\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range$$1 = this.doc.sel.primary();\n if (start == null) { pos = range$$1.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range$$1.from() : range$$1.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var this$1 = this;\n\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this$1.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range$$1) {\n if (this$1.display.shift || this$1.doc.extend || range$$1.empty())\n { return findPosH(this$1.doc, range$$1.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range$$1.from() : range$$1.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range$$1) {\n var other = findPosH(doc, range$$1.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range$$1.head} : {from: range$$1.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var this$1 = this;\n\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this$1, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this$1, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range$$1) {\n if (collapse)\n { return dir < 0 ? range$$1.from() : range$$1.to() }\n var headPos = cursorCoords(this$1, range$$1.head, \"div\");\n if (range$$1.goalColumn != null) { headPos.left = range$$1.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range$$1 == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt() },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range$$1, margin) {\n if (range$$1 == null) {\n range$$1 = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range$$1 == \"number\") {\n range$$1 = {from: Pos(range$$1, 0), to: null};\n } else if (range$$1.from == null) {\n range$$1 = {from: range$$1, to: null};\n }\n if (!range$$1.to) { range$$1.to = range$$1.from; }\n range$$1.margin = margin || 0;\n\n if (range$$1.from.line != null) {\n scrollToRange(this, range$$1);\n } else {\n scrollToCoordsRange(this, range$$1.from, range$$1.to, range$$1.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo$$1 = this.display.viewFrom;\n this.doc.iter(lineNo$$1, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo$$1, \"widget\"); break } } }\n ++lineNo$$1;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map$$1, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map$$1));\n },\n removeKeyMap: function(map$$1) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map$$1 || maps[i].name == map$$1) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var this$1 = this;\n\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this$1.state.modeGen++;\n regChange(this$1);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var this$1 = this;\n\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range$$1 = ranges[i];\n if (!range$$1.empty()) {\n var from = range$$1.from(), to = range$$1.to();\n var start = Math.max(end, from.line);\n end = Math.min(this$1.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this$1, j, how); }\n var newRanges = this$1.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range$$1.head.line > end) {\n indentLine(this$1, range$$1.head.line, how, true);\n end = range$$1.head.line;\n if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var this$1 = this;\n\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range$$1 = this.doc.sel.primary();\n if (start == null) { pos = range$$1.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range$$1.from() : range$$1.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var this$1 = this;\n\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this$1.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range$$1) {\n if (this$1.display.shift || this$1.doc.extend || range$$1.empty())\n { return findPosH(this$1.doc, range$$1.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range$$1.from() : range$$1.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range$$1) {\n var other = findPosH(doc, range$$1.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range$$1.head} : {from: range$$1.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var this$1 = this;\n\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this$1, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this$1, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range$$1) {\n if (collapse)\n { return dir < 0 ? range$$1.from() : range$$1.to() }\n var headPos = cursorCoords(this$1, range$$1.head, \"div\");\n if (range$$1.goalColumn != null) { headPos.left = range$$1.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range$$1 == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt() },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range$$1, margin) {\n if (range$$1 == null) {\n range$$1 = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range$$1 == \"number\") {\n range$$1 = {from: Pos(range$$1, 0), to: null};\n } else if (range$$1.from == null) {\n range$$1 = {from: range$$1, to: null};\n }\n if (!range$$1.to) { range$$1.to = range$$1.from; }\n range$$1.margin = margin || 0;\n\n if (range$$1.from.line != null) {\n scrollToRange(this, range$$1);\n } else {\n scrollToCoordsRange(this, range$$1.from, range$$1.to, range$$1.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo$$1 = this.display.viewFrom;\n this.doc.iter(lineNo$$1, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo$$1, \"widget\"); break } } }\n ++lineNo$$1;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map));\n },\n removeKeyMap: function(map) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map || maps[i].name == map) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this.state.modeGen++;\n regChange(this);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n if (!range.empty()) {\n var from = range.from(), to = range.to();\n var start = Math.max(end, from.line);\n end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this, j, how); }\n var newRanges = this.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range.head.line > end) {\n indentLine(this, range.head.line, how, true);\n end = range.head.line;\n if (i == this.doc.sel.primIndex) { ensureCursorVisible(this); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range = this.doc.sel.primary();\n if (start == null) { pos = range.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range.from() : range.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range) {\n if (this$1.display.shift || this$1.doc.extend || range.empty())\n { return findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range.from() : range.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range) {\n var other = findPosH(doc, range.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range) {\n if (collapse)\n { return dir < 0 ? range.from() : range.to() }\n var headPos = cursorCoords(this$1, range.head, \"div\");\n if (range.goalColumn != null) { headPos.left = range.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt() },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range, margin) {\n if (range == null) {\n range = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range == \"number\") {\n range = {from: Pos(range, 0), to: null};\n } else if (range.from == null) {\n range = {from: range, to: null};\n }\n if (!range.to) { range.to = range.from; }\n range.margin = margin || 0;\n\n if (range.from.line != null) {\n scrollToRange(this, range);\n } else {\n scrollToCoordsRange(this, range.from, range.to, range.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo = this.display.viewFrom;\n this.doc.iter(lineNo, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo, \"widget\"); break } } }\n ++lineNo;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this.display);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5 || this.options.lineWrapping)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n // Cancel the current text selection if any (#5821)\n if (this.state.selectingText) { this.state.selectingText(); }\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map));\n },\n removeKeyMap: function(map) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map || maps[i].name == map) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this.state.modeGen++;\n regChange(this);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n if (!range.empty()) {\n var from = range.from(), to = range.to();\n var start = Math.max(end, from.line);\n end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this, j, how); }\n var newRanges = this.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range.head.line > end) {\n indentLine(this, range.head.line, how, true);\n end = range.head.line;\n if (i == this.doc.sel.primIndex) { ensureCursorVisible(this); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range = this.doc.sel.primary();\n if (start == null) { pos = range.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range.from() : range.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range) {\n if (this$1.display.shift || this$1.doc.extend || range.empty())\n { return findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range.from() : range.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range) {\n var other = findPosH(doc, range.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range) {\n if (collapse)\n { return dir < 0 ? range.from() : range.to() }\n var headPos = cursorCoords(this$1, range.head, \"div\");\n if (range.goalColumn != null) { headPos.left = range.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt() },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range, margin) {\n if (range == null) {\n range = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range == \"number\") {\n range = {from: Pos(range, 0), to: null};\n } else if (range.from == null) {\n range = {from: range, to: null};\n }\n if (!range.to) { range.to = range.from; }\n range.margin = margin || 0;\n\n if (range.from.line != null) {\n scrollToRange(this, range);\n } else {\n scrollToCoordsRange(this, range.from, range.to, range.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo = this.display.viewFrom;\n this.doc.iter(lineNo, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo, \"widget\"); break } } }\n ++lineNo;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this.display);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5 || this.options.lineWrapping)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n // Cancel the current text selection if any (#5821)\n if (this.state.selectingText) { this.state.selectingText(); }\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map));\n },\n removeKeyMap: function(map) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map || maps[i].name == map) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this.state.modeGen++;\n regChange(this);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n if (!range.empty()) {\n var from = range.from(), to = range.to();\n var start = Math.max(end, from.line);\n end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this, j, how); }\n var newRanges = this.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range.head.line > end) {\n indentLine(this, range.head.line, how, true);\n end = range.head.line;\n if (i == this.doc.sel.primIndex) { ensureCursorVisible(this); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range = this.doc.sel.primary();\n if (start == null) { pos = range.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range.from() : range.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range) {\n if (this$1.display.shift || this$1.doc.extend || range.empty())\n { return findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range.from() : range.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range) {\n var other = findPosH(doc, range.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range) {\n if (collapse)\n { return dir < 0 ? range.from() : range.to() }\n var headPos = cursorCoords(this$1, range.head, \"div\");\n if (range.goalColumn != null) { headPos.left = range.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt() },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range, margin) {\n if (range == null) {\n range = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range == \"number\") {\n range = {from: Pos(range, 0), to: null};\n } else if (range.from == null) {\n range = {from: range, to: null};\n }\n if (!range.to) { range.to = range.from; }\n range.margin = margin || 0;\n\n if (range.from.line != null) {\n scrollToRange(this, range);\n } else {\n scrollToCoordsRange(this, range.from, range.to, range.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo = this.display.viewFrom;\n this.doc.iter(lineNo, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo, \"widget\"); break } } }\n ++lineNo;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this.display);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n // Cancel the current text selection if any (#5821)\n if (this.state.selectingText) { this.state.selectingText(); }\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map));\n },\n removeKeyMap: function(map) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map || maps[i].name == map) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this.state.modeGen++;\n regChange(this);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n if (!range.empty()) {\n var from = range.from(), to = range.to();\n var start = Math.max(end, from.line);\n end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this, j, how); }\n var newRanges = this.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range.head.line > end) {\n indentLine(this, range.head.line, how, true);\n end = range.head.line;\n if (i == this.doc.sel.primIndex) { ensureCursorVisible(this); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range = this.doc.sel.primary();\n if (start == null) { pos = range.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range.from() : range.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range) {\n if (this$1.display.shift || this$1.doc.extend || range.empty())\n { return findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range.from() : range.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range) {\n var other = findPosH(doc, range.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range) {\n if (collapse)\n { return dir < 0 ? range.from() : range.to() }\n var headPos = cursorCoords(this$1, range.head, \"div\");\n if (range.goalColumn != null) { headPos.left = range.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt() },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range, margin) {\n if (range == null) {\n range = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range == \"number\") {\n range = {from: Pos(range, 0), to: null};\n } else if (range.from == null) {\n range = {from: range, to: null};\n }\n if (!range.to) { range.to = range.from; }\n range.margin = margin || 0;\n\n if (range.from.line != null) {\n scrollToRange(this, range);\n } else {\n scrollToCoordsRange(this, range.from, range.to, range.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo = this.display.viewFrom;\n this.doc.iter(lineNo, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo, \"widget\"); break } } }\n ++lineNo;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this.display);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5 || this.options.lineWrapping)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n // Cancel the current text selection if any (#5821)\n if (this.state.selectingText) { this.state.selectingText(); }\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map));\n },\n removeKeyMap: function(map) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map || maps[i].name == map) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this.state.modeGen++;\n regChange(this);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n if (!range.empty()) {\n var from = range.from(), to = range.to();\n var start = Math.max(end, from.line);\n end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this, j, how); }\n var newRanges = this.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range.head.line > end) {\n indentLine(this, range.head.line, how, true);\n end = range.head.line;\n if (i == this.doc.sel.primIndex) { ensureCursorVisible(this); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range = this.doc.sel.primary();\n if (start == null) { pos = range.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range.from() : range.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range) {\n if (this$1.display.shift || this$1.doc.extend || range.empty())\n { return findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range.from() : range.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range) {\n var other = findPosH(doc, range.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range) {\n if (collapse)\n { return dir < 0 ? range.from() : range.to() }\n var headPos = cursorCoords(this$1, range.head, \"div\");\n if (range.goalColumn != null) { headPos.left = range.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt() },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range, margin) {\n if (range == null) {\n range = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range == \"number\") {\n range = {from: Pos(range, 0), to: null};\n } else if (range.from == null) {\n range = {from: range, to: null};\n }\n if (!range.to) { range.to = range.from; }\n range.margin = margin || 0;\n\n if (range.from.line != null) {\n scrollToRange(this, range);\n } else {\n scrollToCoordsRange(this, range.from, range.to, range.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo = this.display.viewFrom;\n this.doc.iter(lineNo, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo, \"widget\"); break } } }\n ++lineNo;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this.display);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5 || this.options.lineWrapping)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n // Cancel the current text selection if any (#5821)\n if (this.state.selectingText) { this.state.selectingText(); }\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map));\n },\n removeKeyMap: function(map) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map || maps[i].name == map) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this.state.modeGen++;\n regChange(this);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n if (!range.empty()) {\n var from = range.from(), to = range.to();\n var start = Math.max(end, from.line);\n end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this, j, how); }\n var newRanges = this.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range.head.line > end) {\n indentLine(this, range.head.line, how, true);\n end = range.head.line;\n if (i == this.doc.sel.primIndex) { ensureCursorVisible(this); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range = this.doc.sel.primary();\n if (start == null) { pos = range.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range.from() : range.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range) {\n if (this$1.display.shift || this$1.doc.extend || range.empty())\n { return findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range.from() : range.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range) {\n var other = findPosH(doc, range.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range) {\n if (collapse)\n { return dir < 0 ? range.from() : range.to() }\n var headPos = cursorCoords(this$1, range.head, \"div\");\n if (range.goalColumn != null) { headPos.left = range.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt() },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range, margin) {\n if (range == null) {\n range = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range == \"number\") {\n range = {from: Pos(range, 0), to: null};\n } else if (range.from == null) {\n range = {from: range, to: null};\n }\n if (!range.to) { range.to = range.from; }\n range.margin = margin || 0;\n\n if (range.from.line != null) {\n scrollToRange(this, range);\n } else {\n scrollToCoordsRange(this, range.from, range.to, range.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo = this.display.viewFrom;\n this.doc.iter(lineNo, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo, \"widget\"); break } } }\n ++lineNo;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this.display);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5 || this.options.lineWrapping)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n // Cancel the current text selection if any (#5821)\n if (this.state.selectingText) { this.state.selectingText(); }\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n var helpers = CodeMirror.helpers = {};\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function focus() {\n window.focus();\n this.display.input.focus();\n },\n setOption: function setOption(option, value) {\n var options = this.options,\n old = options[option];\n\n if (options[option] == value && option != \"mode\") {\n return;\n }\n\n options[option] = value;\n\n if (optionHandlers.hasOwnProperty(option)) {\n operation(this, optionHandlers[option])(this, value, old);\n }\n\n signal(this, \"optionChange\", this, option);\n },\n getOption: function getOption(option) {\n return this.options[option];\n },\n getDoc: function getDoc() {\n return this.doc;\n },\n addKeyMap: function addKeyMap(map, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map));\n },\n removeKeyMap: function removeKeyMap(map) {\n var maps = this.state.keyMaps;\n\n for (var i = 0; i < maps.length; ++i) {\n if (maps[i] == map || maps[i].name == map) {\n maps.splice(i, 1);\n return true;\n }\n }\n },\n addOverlay: methodOp(function (spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n\n if (mode.startState) {\n throw new Error(\"Overlays may not be stateful.\");\n }\n\n insertSorted(this.state.overlays, {\n mode: mode,\n modeSpec: spec,\n opaque: options && options.opaque,\n priority: options && options.priority || 0\n }, function (overlay) {\n return overlay.priority;\n });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function (spec) {\n var overlays = this.state.overlays;\n\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this.state.modeGen++;\n regChange(this);\n return;\n }\n }\n }),\n indentLine: methodOp(function (n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) {\n dir = this.options.smartIndent ? \"smart\" : \"prev\";\n } else {\n dir = dir ? \"add\" : \"subtract\";\n }\n }\n\n if (isLine(this.doc, n)) {\n indentLine(this, n, dir, aggressive);\n }\n }),\n indentSelection: methodOp(function (how) {\n var ranges = this.doc.sel.ranges,\n end = -1;\n\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n\n if (!range.empty()) {\n var from = range.from(),\n to = range.to();\n var start = Math.max(end, from.line);\n end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n\n for (var j = start; j < end; ++j) {\n indentLine(this, j, how);\n }\n\n var newRanges = this.doc.sel.ranges;\n\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0) {\n replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll);\n }\n } else if (range.head.line > end) {\n indentLine(this, range.head.line, how, true);\n end = range.head.line;\n\n if (i == this.doc.sel.primIndex) {\n ensureCursorVisible(this);\n }\n }\n }\n }),\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function getTokenAt(pos, precise) {\n return takeToken(this, pos, precise);\n },\n getLineTokens: function getLineTokens(line, precise) {\n return takeToken(this, Pos(line), precise, true);\n },\n getTokenTypeAt: function getTokenTypeAt(pos) {\n pos = _clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0,\n after = (styles.length - 1) / 2,\n ch = pos.ch;\n var type;\n\n if (ch == 0) {\n type = styles[2];\n } else {\n for (;;) {\n var mid = before + after >> 1;\n\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) {\n after = mid;\n } else if (styles[mid * 2 + 1] < ch) {\n before = mid + 1;\n } else {\n type = styles[mid * 2 + 2];\n break;\n }\n }\n }\n\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1);\n },\n getModeAt: function getModeAt(pos) {\n var mode = this.doc.mode;\n\n if (!mode.innerMode) {\n return mode;\n }\n\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode;\n },\n getHelper: function getHelper(pos, type) {\n return this.getHelpers(pos, type)[0];\n },\n getHelpers: function getHelpers(pos, type) {\n var found = [];\n\n if (!helpers.hasOwnProperty(type)) {\n return found;\n }\n\n var help = helpers[type],\n mode = this.getModeAt(pos);\n\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) {\n found.push(help[mode[type]]);\n }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n\n if (val) {\n found.push(val);\n }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n\n if (cur.pred(mode, this) && indexOf(found, cur.val) == -1) {\n found.push(cur.val);\n }\n }\n\n return found;\n },\n getStateAfter: function getStateAfter(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1 : line);\n return getContextBefore(this, line + 1, precise).state;\n },\n cursorCoords: function cursorCoords(start, mode) {\n var pos,\n range = this.doc.sel.primary();\n\n if (start == null) {\n pos = range.head;\n } else if (_typeof(start) == \"object\") {\n pos = _clipPos(this.doc, start);\n } else {\n pos = start ? range.from() : range.to();\n }\n\n return _cursorCoords(this, pos, mode || \"page\");\n },\n charCoords: function charCoords(pos, mode) {\n return _charCoords(this, _clipPos(this.doc, pos), mode || \"page\");\n },\n coordsChar: function coordsChar(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return _coordsChar(this, coords.left, coords.top);\n },\n lineAtHeight: function lineAtHeight(height, mode) {\n height = fromCoordSystem(this, {\n top: height,\n left: 0\n }, mode || \"page\").top;\n return _lineAtHeight(this.doc, height + this.display.viewOffset);\n },\n heightAtLine: function heightAtLine(line, mode, includeWidgets) {\n var end = false,\n lineObj;\n\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n\n if (line < this.doc.first) {\n line = this.doc.first;\n } else if (line > last) {\n line = last;\n end = true;\n }\n\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n\n return intoCoordSystem(this, lineObj, {\n top: 0,\n left: 0\n }, mode || \"page\", includeWidgets || end).top + (end ? this.doc.height - _heightAtLine(lineObj) : 0);\n },\n defaultTextHeight: function defaultTextHeight() {\n return textHeight(this.display);\n },\n defaultCharWidth: function defaultCharWidth() {\n return charWidth(this.display);\n },\n getViewport: function getViewport() {\n return {\n from: this.display.viewFrom,\n to: this.display.viewTo\n };\n },\n addWidget: function addWidget(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = _cursorCoords(this, _clipPos(this.doc, pos));\n var top = pos.bottom,\n left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth); // Default to positioning above (if specified and possible); otherwise default to positioning below\n\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight) {\n top = pos.top - node.offsetHeight;\n } else if (pos.bottom + node.offsetHeight <= vspace) {\n top = pos.bottom;\n }\n\n if (left + node.offsetWidth > hspace) {\n left = hspace - node.offsetWidth;\n }\n }\n\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") {\n left = 0;\n } else if (horiz == \"middle\") {\n left = (display.sizer.clientWidth - node.offsetWidth) / 2;\n }\n\n node.style.left = left + \"px\";\n }\n\n if (scroll) {\n scrollIntoView(this, {\n left: left,\n top: top,\n right: left + node.offsetWidth,\n bottom: top + node.offsetHeight\n });\n }\n },\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n execCommand: function execCommand(cmd) {\n if (commands.hasOwnProperty(cmd)) {\n return commands[cmd].call(null, this);\n }\n },\n triggerElectric: methodOp(function (text) {\n triggerElectric(this, text);\n }),\n findPosH: function findPosH(from, amount, unit, visually) {\n var dir = 1;\n\n if (amount < 0) {\n dir = -1;\n amount = -amount;\n }\n\n var cur = _clipPos(this.doc, from);\n\n for (var i = 0; i < amount; ++i) {\n cur = _findPosH(this.doc, cur, dir, unit, visually);\n\n if (cur.hitSide) {\n break;\n }\n }\n\n return cur;\n },\n moveH: methodOp(function (dir, unit) {\n var this$1 = this;\n this.extendSelectionsBy(function (range) {\n if (this$1.display.shift || this$1.doc.extend || range.empty()) {\n return _findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually);\n } else {\n return dir < 0 ? range.from() : range.to();\n }\n }, sel_move);\n }),\n deleteH: methodOp(function (dir, unit) {\n var sel = this.doc.sel,\n doc = this.doc;\n\n if (sel.somethingSelected()) {\n doc.replaceSelection(\"\", null, \"+delete\");\n } else {\n deleteNearSelection(this, function (range) {\n var other = _findPosH(doc, range.head, dir, unit, false);\n\n return dir < 0 ? {\n from: other,\n to: range.head\n } : {\n from: range.head,\n to: other\n };\n });\n }\n }),\n findPosV: function findPosV(from, amount, unit, goalColumn) {\n var dir = 1,\n x = goalColumn;\n\n if (amount < 0) {\n dir = -1;\n amount = -amount;\n }\n\n var cur = _clipPos(this.doc, from);\n\n for (var i = 0; i < amount; ++i) {\n var coords = _cursorCoords(this, cur, \"div\");\n\n if (x == null) {\n x = coords.left;\n } else {\n coords.left = x;\n }\n\n cur = _findPosV(this, coords, dir, unit);\n\n if (cur.hitSide) {\n break;\n }\n }\n\n return cur;\n },\n moveV: methodOp(function (dir, unit) {\n var this$1 = this;\n var doc = this.doc,\n goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range) {\n if (collapse) {\n return dir < 0 ? range.from() : range.to();\n }\n\n var headPos = _cursorCoords(this$1, range.head, \"div\");\n\n if (range.goalColumn != null) {\n headPos.left = range.goalColumn;\n }\n\n goals.push(headPos.left);\n\n var pos = _findPosV(this$1, headPos, dir, unit);\n\n if (unit == \"page\" && range == doc.sel.primary()) {\n addToScrollTop(this$1, _charCoords(this$1, pos, \"div\").top - headPos.top);\n }\n\n return pos;\n }, sel_move);\n\n if (goals.length) {\n for (var i = 0; i < doc.sel.ranges.length; i++) {\n doc.sel.ranges[i].goalColumn = goals[i];\n }\n }\n }),\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function findWordAt(pos) {\n var doc = this.doc,\n line = getLine(doc, pos.line).text;\n var start = pos.ch,\n end = pos.ch;\n\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n\n if ((pos.sticky == \"before\" || end == line.length) && start) {\n --start;\n } else {\n ++end;\n }\n\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper) ? function (ch) {\n return isWordChar(ch, helper);\n } : /\\s/.test(startChar) ? function (ch) {\n return /\\s/.test(ch);\n } : function (ch) {\n return !/\\s/.test(ch) && !isWordChar(ch);\n };\n\n while (start > 0 && check(line.charAt(start - 1))) {\n --start;\n }\n\n while (end < line.length && check(line.charAt(end))) {\n ++end;\n }\n }\n\n return new Range(Pos(pos.line, start), Pos(pos.line, end));\n },\n toggleOverwrite: function toggleOverwrite(value) {\n if (value != null && value == this.state.overwrite) {\n return;\n }\n\n if (this.state.overwrite = !this.state.overwrite) {\n addClass(this.display.cursorDiv, \"CodeMirror-overwrite\");\n } else {\n rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\");\n }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function hasFocus() {\n return this.display.input.getField() == activeElt();\n },\n isReadOnly: function isReadOnly() {\n return !!(this.options.readOnly || this.doc.cantEdit);\n },\n scrollTo: methodOp(function (x, y) {\n scrollToCoords(this, x, y);\n }),\n getScrollInfo: function getScrollInfo() {\n var scroller = this.display.scroller;\n return {\n left: scroller.scrollLeft,\n top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this),\n clientWidth: displayWidth(this)\n };\n },\n scrollIntoView: methodOp(function (range, margin) {\n if (range == null) {\n range = {\n from: this.doc.sel.primary().head,\n to: null\n };\n\n if (margin == null) {\n margin = this.options.cursorScrollMargin;\n }\n } else if (typeof range == \"number\") {\n range = {\n from: Pos(range, 0),\n to: null\n };\n } else if (range.from == null) {\n range = {\n from: range,\n to: null\n };\n }\n\n if (!range.to) {\n range.to = range.from;\n }\n\n range.margin = margin || 0;\n\n if (range.from.line != null) {\n scrollToRange(this, range);\n } else {\n scrollToCoordsRange(this, range.from, range.to, range.margin);\n }\n }),\n setSize: methodOp(function (width, height) {\n var this$1 = this;\n\n var interpret = function interpret(val) {\n return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val;\n };\n\n if (width != null) {\n this.display.wrapper.style.width = interpret(width);\n }\n\n if (height != null) {\n this.display.wrapper.style.height = interpret(height);\n }\n\n if (this.options.lineWrapping) {\n clearLineMeasurementCache(this);\n }\n\n var lineNo = this.display.viewFrom;\n this.doc.iter(lineNo, this.display.viewTo, function (line) {\n if (line.widgets) {\n for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].noHScroll) {\n regLineChange(this$1, lineNo, \"widget\");\n break;\n }\n }\n }\n\n ++lineNo;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n operation: function operation(f) {\n return runInOp(this, f);\n },\n startOperation: function startOperation() {\n return _startOperation(this);\n },\n endOperation: function endOperation() {\n return _endOperation(this);\n },\n refresh: methodOp(function () {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this.display);\n\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5 || this.options.lineWrapping) {\n estimateLineHeights(this);\n }\n\n signal(this, \"refresh\", this);\n }),\n swapDoc: methodOp(function (doc) {\n var old = this.doc;\n old.cm = null; // Cancel the current text selection if any (#5821)\n\n if (this.state.selectingText) {\n this.state.selectingText();\n }\n\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old;\n }),\n phrase: function phrase(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText;\n },\n getInputField: function getInputField() {\n return this.display.input.getField();\n },\n getWrapperElement: function getWrapperElement() {\n return this.display.wrapper;\n },\n getScrollerElement: function getScrollerElement() {\n return this.display.scroller;\n },\n getGutterElement: function getGutterElement() {\n return this.display.gutters;\n }\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function (type, name, value) {\n if (!helpers.hasOwnProperty(type)) {\n helpers[type] = CodeMirror[type] = {\n _global: []\n };\n }\n\n helpers[type][name] = value;\n };\n\n CodeMirror.registerGlobalHelper = function (type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n\n helpers[type]._global.push({\n pred: predicate,\n val: value\n });\n };\n } // Used for horizontal relative motion. Dir is -1 or 1 (left or", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers\n\n var helpers = CodeMirror.helpers = {}\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus()},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option]\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old) }\n signal(this, \"optionChange\", this, option)\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map))\n },\n removeKeyMap: function(map) {\n var maps = this.state.keyMaps\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map || maps[i].name == map) {\n maps.splice(i, 1)\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec)\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; })\n this.state.modeGen++\n regChange(this)\n }),\n removeOverlay: methodOp(function(spec) {\n var this$1 = this;\n\n var overlays = this.state.overlays\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1)\n this$1.state.modeGen++\n regChange(this$1)\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\" }\n else { dir = dir ? \"add\" : \"subtract\" }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive) }\n }),\n indentSelection: methodOp(function(how) {\n var this$1 = this;\n\n var ranges = this.doc.sel.ranges, end = -1\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i]\n if (!range.empty()) {\n var from = range.from(), to = range.to()\n var start = Math.max(end, from.line)\n end = Math.min(this$1.lastLine(), to.line - (to.ch ? 0 : 1)) + 1\n for (var j = start; j < end; ++j)\n { indentLine(this$1, j, how) }\n var newRanges = this$1.doc.sel.ranges\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll) }\n } else if (range.head.line > end) {\n indentLine(this$1, range.head.line, how, true)\n end = range.head.line\n if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1) }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos)\n var styles = getLineStyles(this, getLine(this.doc, pos.line))\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch\n var type\n if (ch == 0) { type = styles[2] }\n else { for (;;) {\n var mid = (before + after) >> 1\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1 }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var this$1 = this;\n\n var found = []\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos)\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]) }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]]\n if (val) { found.push(val) }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType])\n } else if (help[mode.name]) {\n found.push(help[mode.name])\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1]\n if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1)\n { found.push(cur.val) }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line)\n return getStateBefore(this, line + 1, precise)\n },\n\n cursorCoords: function(start, mode) {\n var pos, range = this.doc.sel.primary()\n if (start == null) { pos = range.head }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start) }\n else { pos = start ? range.from() : range.to() }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\")\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1\n if (line < this.doc.first) { line = this.doc.first }\n else if (line > last) { line = last; end = true }\n lineObj = getLine(this.doc, line)\n } else {\n lineObj = line\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display\n pos = cursorCoords(this, clipPos(this.doc, pos))\n var top = pos.bottom, left = pos.left\n node.style.position = \"absolute\"\n node.setAttribute(\"cm-ignore-events\", \"true\")\n this.display.input.setUneditable(node)\n display.sizer.appendChild(node)\n if (vert == \"over\") {\n top = pos.top\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth)\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth }\n }\n node.style.top = top + \"px\"\n node.style.left = node.style.right = \"\"\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth\n node.style.right = \"0px\"\n } else {\n if (horiz == \"left\") { left = 0 }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2 }\n node.style.left = left + \"px\"\n }\n if (scroll)\n { scrollIntoView(this, left, top, left + node.offsetWidth, top + node.offsetHeight) }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text) }),\n\n findPosH: function(from, amount, unit, visually) {\n var this$1 = this;\n\n var dir = 1\n if (amount < 0) { dir = -1; amount = -amount }\n var cur = clipPos(this.doc, from)\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this$1.doc, cur, dir, unit, visually)\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range) {\n if (this$1.display.shift || this$1.doc.extend || range.empty())\n { return findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range.from() : range.to() }\n }, sel_move)\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\") }\n else\n { deleteNearSelection(this, function (range) {\n var other = findPosH(doc, range.head, dir, unit, false)\n return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other}\n }) }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var this$1 = this;\n\n var dir = 1, x = goalColumn\n if (amount < 0) { dir = -1; amount = -amount }\n var cur = clipPos(this.doc, from)\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this$1, cur, \"div\")\n if (x == null) { x = coords.left }\n else { coords.left = x }\n cur = findPosV(this$1, coords, dir, unit)\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = []\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected()\n doc.extendSelectionsBy(function (range) {\n if (collapse)\n { return dir < 0 ? range.from() : range.to() }\n var headPos = cursorCoords(this$1, range.head, \"div\")\n if (range.goalColumn != null) { headPos.left = range.goalColumn }\n goals.push(headPos.left)\n var pos = findPosV(this$1, headPos, dir, unit)\n if (unit == \"page\" && range == doc.sel.primary())\n { addToScrollPos(this$1, null, charCoords(this$1, pos, \"div\").top - headPos.top) }\n return pos\n }, sel_move)\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i] } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text\n var start = pos.ch, end = pos.ch\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\")\n if ((pos.xRel < 0 || end == line.length) && start) { --start; } else { ++end }\n var startChar = line.charAt(start)\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); }\n while (start > 0 && check(line.charAt(start - 1))) { --start }\n while (end < line.length && check(line.charAt(end))) { ++end }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\") }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\") }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite)\n },\n hasFocus: function() { return this.display.input.getField() == activeElt() },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function(x, y) {\n if (x != null || y != null) { resolveScrollToPos(this) }\n if (x != null) { this.curOp.scrollLeft = x }\n if (y != null) { this.curOp.scrollTop = y }\n }),\n getScrollInfo: function() {\n var scroller = this.display.scroller\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range, margin) {\n if (range == null) {\n range = {from: this.doc.sel.primary().head, to: null}\n if (margin == null) { margin = this.options.cursorScrollMargin }\n } else if (typeof range == \"number\") {\n range = {from: Pos(range, 0), to: null}\n } else if (range.from == null) {\n range = {from: range, to: null}\n }\n if (!range.to) { range.to = range.from }\n range.margin = margin || 0\n\n if (range.from.line != null) {\n resolveScrollToPos(this)\n this.curOp.scrollToPos = range\n } else {\n var sPos = calculateScrollPos(this, Math.min(range.from.left, range.to.left),\n Math.min(range.from.top, range.to.top) - range.margin,\n Math.max(range.from.right, range.to.right),\n Math.max(range.from.bottom, range.to.bottom) + range.margin)\n this.scrollTo(sPos.scrollLeft, sPos.scrollTop)\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; }\n if (width != null) { this.display.wrapper.style.width = interpret(width) }\n if (height != null) { this.display.wrapper.style.height = interpret(height) }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this) }\n var lineNo = this.display.viewFrom\n this.doc.iter(lineNo, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo, \"widget\"); break } } }\n ++lineNo\n })\n this.curOp.forceUpdate = true\n signal(this, \"refresh\", this)\n }),\n\n operation: function(f){return runInOp(this, f)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight\n regChange(this)\n this.curOp.forceUpdate = true\n clearCaches(this)\n this.scrollTo(this.doc.scrollLeft, this.doc.scrollTop)\n updateGutterSpace(this)\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)\n { estimateLineHeights(this) }\n signal(this, \"refresh\", this)\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc\n old.cm = null\n attachDoc(this, doc)\n clearCaches(this)\n this.display.input.reset()\n this.scrollTo(doc.scrollLeft, doc.scrollTop)\n this.curOp.forceScroll = true\n signalLater(this, \"swapDoc\", this, old)\n return old\n }),\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n }\n eventMixin(CodeMirror)\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []} }\n helpers[type][name] = value\n }\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value)\n helpers[type]._global.push({pred: predicate, val: value})\n }\n}", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers\n\n var helpers = CodeMirror.helpers = {}\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus()},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option]\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old) }\n signal(this, \"optionChange\", this, option)\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map))\n },\n removeKeyMap: function(map) {\n var maps = this.state.keyMaps\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map || maps[i].name == map) {\n maps.splice(i, 1)\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec)\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; })\n this.state.modeGen++\n regChange(this)\n }),\n removeOverlay: methodOp(function(spec) {\n var this$1 = this;\n\n var overlays = this.state.overlays\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1)\n this$1.state.modeGen++\n regChange(this$1)\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\" }\n else { dir = dir ? \"add\" : \"subtract\" }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive) }\n }),\n indentSelection: methodOp(function(how) {\n var this$1 = this;\n\n var ranges = this.doc.sel.ranges, end = -1\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i]\n if (!range.empty()) {\n var from = range.from(), to = range.to()\n var start = Math.max(end, from.line)\n end = Math.min(this$1.lastLine(), to.line - (to.ch ? 0 : 1)) + 1\n for (var j = start; j < end; ++j)\n { indentLine(this$1, j, how) }\n var newRanges = this$1.doc.sel.ranges\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll) }\n } else if (range.head.line > end) {\n indentLine(this$1, range.head.line, how, true)\n end = range.head.line\n if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1) }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos)\n var styles = getLineStyles(this, getLine(this.doc, pos.line))\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch\n var type\n if (ch == 0) { type = styles[2] }\n else { for (;;) {\n var mid = (before + after) >> 1\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1 }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var this$1 = this;\n\n var found = []\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos)\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]) }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]]\n if (val) { found.push(val) }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType])\n } else if (help[mode.name]) {\n found.push(help[mode.name])\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1]\n if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1)\n { found.push(cur.val) }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line)\n return getStateBefore(this, line + 1, precise)\n },\n\n cursorCoords: function(start, mode) {\n var pos, range = this.doc.sel.primary()\n if (start == null) { pos = range.head }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start) }\n else { pos = start ? range.from() : range.to() }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\")\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1\n if (line < this.doc.first) { line = this.doc.first }\n else if (line > last) { line = last; end = true }\n lineObj = getLine(this.doc, line)\n } else {\n lineObj = line\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display\n pos = cursorCoords(this, clipPos(this.doc, pos))\n var top = pos.bottom, left = pos.left\n node.style.position = \"absolute\"\n node.setAttribute(\"cm-ignore-events\", \"true\")\n this.display.input.setUneditable(node)\n display.sizer.appendChild(node)\n if (vert == \"over\") {\n top = pos.top\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth)\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth }\n }\n node.style.top = top + \"px\"\n node.style.left = node.style.right = \"\"\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth\n node.style.right = \"0px\"\n } else {\n if (horiz == \"left\") { left = 0 }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2 }\n node.style.left = left + \"px\"\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}) }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text) }),\n\n findPosH: function(from, amount, unit, visually) {\n var this$1 = this;\n\n var dir = 1\n if (amount < 0) { dir = -1; amount = -amount }\n var cur = clipPos(this.doc, from)\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this$1.doc, cur, dir, unit, visually)\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range) {\n if (this$1.display.shift || this$1.doc.extend || range.empty())\n { return findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range.from() : range.to() }\n }, sel_move)\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\") }\n else\n { deleteNearSelection(this, function (range) {\n var other = findPosH(doc, range.head, dir, unit, false)\n return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other}\n }) }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var this$1 = this;\n\n var dir = 1, x = goalColumn\n if (amount < 0) { dir = -1; amount = -amount }\n var cur = clipPos(this.doc, from)\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this$1, cur, \"div\")\n if (x == null) { x = coords.left }\n else { coords.left = x }\n cur = findPosV(this$1, coords, dir, unit)\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = []\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected()\n doc.extendSelectionsBy(function (range) {\n if (collapse)\n { return dir < 0 ? range.from() : range.to() }\n var headPos = cursorCoords(this$1, range.head, \"div\")\n if (range.goalColumn != null) { headPos.left = range.goalColumn }\n goals.push(headPos.left)\n var pos = findPosV(this$1, headPos, dir, unit)\n if (unit == \"page\" && range == doc.sel.primary())\n { addToScrollPos(this$1, null, charCoords(this$1, pos, \"div\").top - headPos.top) }\n return pos\n }, sel_move)\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i] } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text\n var start = pos.ch, end = pos.ch\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\")\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end }\n var startChar = line.charAt(start)\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); }\n while (start > 0 && check(line.charAt(start - 1))) { --start }\n while (end < line.length && check(line.charAt(end))) { ++end }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\") }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\") }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite)\n },\n hasFocus: function() { return this.display.input.getField() == activeElt() },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function(x, y) {\n if (x != null || y != null) { resolveScrollToPos(this) }\n if (x != null) { this.curOp.scrollLeft = x }\n if (y != null) { this.curOp.scrollTop = y }\n }),\n getScrollInfo: function() {\n var scroller = this.display.scroller\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range, margin) {\n if (range == null) {\n range = {from: this.doc.sel.primary().head, to: null}\n if (margin == null) { margin = this.options.cursorScrollMargin }\n } else if (typeof range == \"number\") {\n range = {from: Pos(range, 0), to: null}\n } else if (range.from == null) {\n range = {from: range, to: null}\n }\n if (!range.to) { range.to = range.from }\n range.margin = margin || 0\n\n if (range.from.line != null) {\n resolveScrollToPos(this)\n this.curOp.scrollToPos = range\n } else {\n var sPos = calculateScrollPos(this, {\n left: Math.min(range.from.left, range.to.left),\n top: Math.min(range.from.top, range.to.top) - range.margin,\n right: Math.max(range.from.right, range.to.right),\n bottom: Math.max(range.from.bottom, range.to.bottom) + range.margin\n })\n this.scrollTo(sPos.scrollLeft, sPos.scrollTop)\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; }\n if (width != null) { this.display.wrapper.style.width = interpret(width) }\n if (height != null) { this.display.wrapper.style.height = interpret(height) }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this) }\n var lineNo = this.display.viewFrom\n this.doc.iter(lineNo, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo, \"widget\"); break } } }\n ++lineNo\n })\n this.curOp.forceUpdate = true\n signal(this, \"refresh\", this)\n }),\n\n operation: function(f){return runInOp(this, f)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight\n regChange(this)\n this.curOp.forceUpdate = true\n clearCaches(this)\n this.scrollTo(this.doc.scrollLeft, this.doc.scrollTop)\n updateGutterSpace(this)\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)\n { estimateLineHeights(this) }\n signal(this, \"refresh\", this)\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc\n old.cm = null\n attachDoc(this, doc)\n clearCaches(this)\n this.display.input.reset()\n this.scrollTo(doc.scrollLeft, doc.scrollTop)\n this.curOp.forceScroll = true\n signalLater(this, \"swapDoc\", this, old)\n return old\n }),\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n }\n eventMixin(CodeMirror)\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []} }\n helpers[type][name] = value\n }\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value)\n helpers[type]._global.push({pred: predicate, val: value})\n }\n}", "function ExtraMethods() {}", "function addMethod(name,fn){customMethods[name]=fn;return provider;}", "_addMethods(methods, namespace) {\n for (var name in methods) {\n if (methods.hasOwnProperty(name)) {\n if (!namespace) {\n this._addMethod(name, methods[name])\n } else {\n this._addMethod(name, methods[name], namespace)\n }\n\n }\n }\n return this\n }", "function insertMethod(method) {\r\n\tvar methods = hidden.value.split(\"\\n\");\r\n\texperior.editor.insertMethod(method);\r\n\texperior.contentWindow.focus();\r\n}", "generateOperations() {\n if (this._Operations) {\n return;\n }\n\n this._signHeadersList = this._signHeadersList || this.signHeadersList; // backward support\n this._serviceName = this._serviceName || this.serviceName;\n this._serviceVersion = this._serviceVersion || this.serviceVersion;\n\n // the holder class\n const Operations = function(needMeta, meta) {\n this.needMeta = needMeta;\n this.meta = meta;\n };\n\n // assign instance properties into prototype\n assign(Operations.prototype, this);\n\n // update supported methods, but need to bind it back to the original instance\n Operations.prototype.wmHeaders = this.wmHeaders.bind(this);\n\n this._Operations = Operations;\n\n // wrapper for each operation\n\n //\n // Each operation could specify multiple tags.\n // Each tag goes in swagger.apis[<tag>] as a group of all operations belonging to it\n // Any operations that don't have tags go into the default group.\n // In each group, there's apis object that holds the details of the operations inside it\n //\n each(this.swagger.apis, group => {\n if (!isFunction(group) && isObject(group)) {\n each(group, (fn, operationId) => {\n if (operationId !== \"help\" && isFunction(fn) && !Operations.prototype[operationId]) {\n const api = group.apis[operationId];\n const spec = this.swagger.spec.paths[api.path][api.method];\n Operations.prototype[operationId] = function swapiOperationWrapper(params, options) {\n const meta = this.useMeta();\n return apiFuncInvoke({\n api,\n spec,\n meta,\n client: this,\n fn,\n params,\n options: options || {},\n operationId\n });\n };\n // add details from Swagger\n Operations.prototype[operationId].details = group.operations[operationId];\n }\n });\n }\n });\n\n Operations.prototype.useMeta = function useMeta() {\n if (this.needMeta && !this.meta) {\n throw new Error(\"swapi operation needs meta\");\n }\n return this.meta;\n };\n\n Operations.prototype.invoke = function invoke(tag, operationId, params, options) {\n return invokeWithMeta({\n meta: this.useMeta(),\n client: this,\n tag,\n operationId,\n params,\n options\n });\n };\n }", "function createMethodsManager() {\n var methods = {};\n\n return {\n addMethod: addMethod,\n setTarget: setTarget\n };\n\n /*\n * Adds a method that will be available to extend the object.\n *\n * @param {string} name The method name\n * @param {function} [method] The handler for the specified method name.\n * @return {function} The handler for the specified method name.\n */\n function addMethod(name, method) {\n if (method !== undefined) {\n methods[name] = method;\n }\n return methods[name];\n }\n\n /*\n * Sets the target object to extend.\n *\n * @param {object} target The target object.\n */\n function setTarget(target) {\n var targetMethods = {};\n for (var name in methods) {\n targetMethods[name] = wrapMethod(target, methods[name]);\n }\n return targetMethods;\n }\n\n /*\n * Wraps the method so that it is executed with the appropriate\n * arguments.\n *\n * @param {object} target The target object.\n * @param {function} method The method to wrap.\n */\n function wrapMethod(target, method) {\n return function() {\n\n // Put arguments into a real array.\n var methodArgs = [];\n for (var i = 0; i < arguments.length; i++) {\n methodArgs.push(arguments[i]);\n }\n\n var params = method(target, parseMethodArgs, methodArgs);\n\n modifyTarget(target,\n params.source,\n params.sourceKeys,\n params.filters,\n params.overrideKeys);\n return this;\n };\n }\n}", "templateMethod() {\n this.baseOperation1();\n this.requiredOperations1();\n this.baseOperation2();\n this.hook1();\n this.requiredOperation2();\n this.baseOperation3();\n this.hook2();\n }", "function addMethod(name, fn) {\n customMethods[name] = fn;\n return provider;\n }", "function addMethod(name, fn) {\n customMethods[name] = fn;\n return provider;\n }", "function addMethod(name, fn) {\n customMethods[name] = fn;\n return provider;\n }", "function addMethod(name, fn) {\n customMethods[name] = fn;\n return provider;\n }", "function addMethod(name, fn) {\n customMethods[name] = fn;\n return provider;\n }", "setMethods(name, type){\r\n return \"\\tvoid set\" + name +\r\n \"(\" + type + \" val) {\\n \\t \\t\" + name + \" = val;\\n\\t} \\n\";\r\n }", "addExpr() {\n this.edit();\n }", "function addDWOperationFunctions() {\n\ttry {\n\t\tMM.BC.log(' ---- adding dw operations ---- ')\n\t\tif (globals.webKitWin.bcEndpoints) {\n\t\t\tglobals.webKitWin.bcEndpoints.openUrl = MM.BC.UI_UTILS.openPopupWindow;\n\t\t\tglobals.webKitWin.bcEndpoints.insertCode = function(code) {\n\t\t\t\twindow.close(); \n\t\t\t\tMM.BC.codeToInsert = code;\n\t if (typeof (dw.bcLog) == \"function\") {\n\t dw.bcLog(\"insert\");\n\t }\n\t\t\t}; \n\t\t\tglobals.webKitWin.bcEndpoints.onBrowseFile = onBrowseFile; \n\t\t\tglobals.webKitWin.bcEndpoints.closePopup = closePopup;\n\t\t\tglobals.webKitWin.bcEndpoints.getCurrentDocumentPath = MM.BC.UI_UTILS.getCurrentDocumentPath;\n\t\t\tglobals.webKitWin.bcEndpoints.showRetry = showCallFailed;\n\t\t\t\n\t\t\tsetWindowButtons();\n\t\t\t\n\t\t\t// Set focus to the small browser so the next tab key drills into the elements within//\n\t\t\tif (globals.browser) globals.browser.focus();\n\t\t}\n\t\n\t\n\t} catch (e) {\n\t\tlogMessage(REP_ITEM_NOTE, 'addDWOperationFunctions', 'error connecting to the web page end points');\n\t}\n}", "function addBindings() {\n\t\tfunction clickHandler(e) {\n\t\t\t// ignore non-left-mouse-clicks and clicks modified with ctrl / command, shift, or alt.\n\t\t\t// See: http://jacklmoore.com/notes/click-events/\n\t\t\tif (!(e.which > 1 || e.shiftKey || e.altKey || e.metaKey || e.ctrlKey)) {\n\t\t\t\te.preventDefault();\n\t\t\t\tlaunch(this);\n\t\t\t}\n\t\t}\n\n\t\tif ($box) {\n\t\t\tif (!init) {\n\t\t\t\tinit = true;\n\n\t\t\t\t// Anonymous functions here keep the public method from being cached, thereby allowing them to be redefined on the fly.\n\t\t\t\t$next.click(function () {\n\t\t\t\t\tpublicMethod.next();\n\t\t\t\t});\n\t\t\t\t$prev.click(function () {\n\t\t\t\t\tpublicMethod.prev();\n\t\t\t\t});\n\t\t\t\t$close.click(function () {\n\t\t\t\t\tpublicMethod.close();\n\t\t\t\t});\n\t\t\t\t$overlay.click(function () {\n\t\t\t\t\tif (settings.get('overlayClose')) {\n\t\t\t\t\t\tpublicMethod.close();\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\t// Key Bindings\n\t\t\t\t$(document).bind('keydown.' + prefix, function (e) {\n\t\t\t\t\tvar key = e.keyCode;\n\t\t\t\t\tif (open && settings.get('escKey') && key === 27) {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\tpublicMethod.close();\n\t\t\t\t\t}\n\t\t\t\t\tif (open && settings.get('arrowKey') && $related[1] && !e.altKey) {\n\t\t\t\t\t\tif (key === 37) {\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t$prev.click();\n\t\t\t\t\t\t} else if (key === 39) {\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t$next.click();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tif ($.isFunction($.fn.on)) {\n\t\t\t\t\t// For jQuery 1.7+\n\t\t\t\t\t$(document).on('click.'+prefix, '.'+boxElement, clickHandler);\n\t\t\t\t} else {\n\t\t\t\t\t// For jQuery 1.3.x -> 1.6.x\n\t\t\t\t\t// This code is never reached in jQuery 1.9, so do not contact me about 'live' being removed.\n\t\t\t\t\t// This is not here for jQuery 1.9, it's here for legacy users.\n\t\t\t\t\t$('.'+boxElement).live('click.'+prefix, clickHandler);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "function addBindings() {\n\t\tfunction clickHandler(e) {\n\t\t\t// ignore non-left-mouse-clicks and clicks modified with ctrl / command, shift, or alt.\n\t\t\t// See: http://jacklmoore.com/notes/click-events/\n\t\t\tif (!(e.which > 1 || e.shiftKey || e.altKey || e.metaKey || e.ctrlKey)) {\n\t\t\t\te.preventDefault();\n\t\t\t\tlaunch(this);\n\t\t\t}\n\t\t}\n\n\t\tif ($box) {\n\t\t\tif (!init) {\n\t\t\t\tinit = true;\n\n\t\t\t\t// Anonymous functions here keep the public method from being cached, thereby allowing them to be redefined on the fly.\n\t\t\t\t$next.click(function () {\n\t\t\t\t\tpublicMethod.next();\n\t\t\t\t});\n\t\t\t\t$prev.click(function () {\n\t\t\t\t\tpublicMethod.prev();\n\t\t\t\t});\n\t\t\t\t$close.click(function () {\n\t\t\t\t\tpublicMethod.close();\n\t\t\t\t});\n\t\t\t\t$overlay.click(function () {\n\t\t\t\t\tif (settings.get('overlayClose')) {\n\t\t\t\t\t\tpublicMethod.close();\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\t// Key Bindings\n\t\t\t\t$(document).bind('keydown.' + prefix, function (e) {\n\t\t\t\t\tvar key = e.keyCode;\n\t\t\t\t\tif (open && settings.get('escKey') && key === 27) {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\tpublicMethod.close();\n\t\t\t\t\t}\n\t\t\t\t\tif (open && settings.get('arrowKey') && $related[1] && !e.altKey) {\n\t\t\t\t\t\tif (key === 37) {\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t$prev.click();\n\t\t\t\t\t\t} else if (key === 39) {\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t$next.click();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tif ($.isFunction($.fn.on)) {\n\t\t\t\t\t// For jQuery 1.7+\n\t\t\t\t\t$(document).on('click.'+prefix, '.'+boxElement, clickHandler);\n\t\t\t\t} else {\n\t\t\t\t\t// For jQuery 1.3.x -> 1.6.x\n\t\t\t\t\t// This code is never reached in jQuery 1.9, so do not contact me about 'live' being removed.\n\t\t\t\t\t// This is not here for jQuery 1.9, it's here for legacy users.\n\t\t\t\t\t$('.'+boxElement).live('click.'+prefix, clickHandler);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "function addBindings() {\n\t\tfunction clickHandler(e) {\n\t\t\t// ignore non-left-mouse-clicks and clicks modified with ctrl / command, shift, or alt.\n\t\t\t// See: http://jacklmoore.com/notes/click-events/\n\t\t\tif (!(e.which > 1 || e.shiftKey || e.altKey || e.metaKey || e.ctrlKey)) {\n\t\t\t\te.preventDefault();\n\t\t\t\tlaunch(this);\n\t\t\t}\n\t\t}\n\n\t\tif ($box) {\n\t\t\tif (!init) {\n\t\t\t\tinit = true;\n\n\t\t\t\t// Anonymous functions here keep the public method from being cached, thereby allowing them to be redefined on the fly.\n\t\t\t\t$next.click(function () {\n\t\t\t\t\tpublicMethod.next();\n\t\t\t\t});\n\t\t\t\t$prev.click(function () {\n\t\t\t\t\tpublicMethod.prev();\n\t\t\t\t});\n\t\t\t\t$close.click(function () {\n\t\t\t\t\tpublicMethod.close();\n\t\t\t\t});\n\t\t\t\t$overlay.click(function () {\n\t\t\t\t\tif (settings.get('overlayClose')) {\n\t\t\t\t\t\tpublicMethod.close();\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\t// Key Bindings\n\t\t\t\t$(document).bind('keydown.' + prefix, function (e) {\n\t\t\t\t\tvar key = e.keyCode;\n\t\t\t\t\tif (open && settings.get('escKey') && key === 27) {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\tpublicMethod.close();\n\t\t\t\t\t}\n\t\t\t\t\tif (open && settings.get('arrowKey') && $related[1] && !e.altKey) {\n\t\t\t\t\t\tif (key === 37) {\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t$prev.click();\n\t\t\t\t\t\t} else if (key === 39) {\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t$next.click();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tif ($.isFunction($.fn.on)) {\n\t\t\t\t\t// For jQuery 1.7+\n\t\t\t\t\t$(document).on('click.'+prefix, '.'+boxElement, clickHandler);\n\t\t\t\t} else {\n\t\t\t\t\t// For jQuery 1.3.x -> 1.6.x\n\t\t\t\t\t// This code is never reached in jQuery 1.9, so do not contact me about 'live' being removed.\n\t\t\t\t\t// This is not here for jQuery 1.9, it's here for legacy users.\n\t\t\t\t\t$('.'+boxElement).live('click.'+prefix, clickHandler);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "function addBindings() {\n\t\tfunction clickHandler(e) {\n\t\t\t// ignore non-left-mouse-clicks and clicks modified with ctrl / command, shift, or alt.\n\t\t\t// See: http://jacklmoore.com/notes/click-events/\n\t\t\tif (!(e.which > 1 || e.shiftKey || e.altKey || e.metaKey || e.ctrlKey)) {\n\t\t\t\te.preventDefault();\n\t\t\t\tlaunch(this);\n\t\t\t}\n\t\t}\n\n\t\tif ($box) {\n\t\t\tif (!init) {\n\t\t\t\tinit = true;\n\n\t\t\t\t// Anonymous functions here keep the public method from being cached, thereby allowing them to be redefined on the fly.\n\t\t\t\t$next.click(function () {\n\t\t\t\t\tpublicMethod.next();\n\t\t\t\t});\n\t\t\t\t$prev.click(function () {\n\t\t\t\t\tpublicMethod.prev();\n\t\t\t\t});\n\t\t\t\t$close.click(function () {\n\t\t\t\t\tpublicMethod.close();\n\t\t\t\t});\n\t\t\t\t$overlay.click(function () {\n\t\t\t\t\tif (settings.get('overlayClose')) {\n\t\t\t\t\t\tpublicMethod.close();\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\t// Key Bindings\n\t\t\t\t$(document).bind('keydown.' + prefix, function (e) {\n\t\t\t\t\tvar key = e.keyCode;\n\t\t\t\t\tif (open && settings.get('escKey') && key === 27) {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\tpublicMethod.close();\n\t\t\t\t\t}\n\t\t\t\t\tif (open && settings.get('arrowKey') && $related[1] && !e.altKey) {\n\t\t\t\t\t\tif (key === 37) {\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t$prev.click();\n\t\t\t\t\t\t} else if (key === 39) {\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t$next.click();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tif ($.isFunction($.fn.on)) {\n\t\t\t\t\t// For jQuery 1.7+\n\t\t\t\t\t$(document).on('click.'+prefix, '.'+boxElement, clickHandler);\n\t\t\t\t} else {\n\t\t\t\t\t// For jQuery 1.3.x -> 1.6.x\n\t\t\t\t\t// This code is never reached in jQuery 1.9, so do not contact me about 'live' being removed.\n\t\t\t\t\t// This is not here for jQuery 1.9, it's here for legacy users.\n\t\t\t\t\t$('.'+boxElement).live('click.'+prefix, clickHandler);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "function addBindings() {\n\t\tfunction clickHandler(e) {\n\t\t\t// ignore non-left-mouse-clicks and clicks modified with ctrl / command, shift, or alt.\n\t\t\t// See: http://jacklmoore.com/notes/click-events/\n\t\t\tif (!(e.which > 1 || e.shiftKey || e.altKey || e.metaKey || e.ctrlKey)) {\n\t\t\t\te.preventDefault();\n\t\t\t\tlaunch(this);\n\t\t\t}\n\t\t}\n\n\t\tif ($box) {\n\t\t\tif (!init) {\n\t\t\t\tinit = true;\n\n\t\t\t\t// Anonymous functions here keep the public method from being cached, thereby allowing them to be redefined on the fly.\n\t\t\t\t$next.click(function () {\n\t\t\t\t\tpublicMethod.next();\n\t\t\t\t});\n\t\t\t\t$prev.click(function () {\n\t\t\t\t\tpublicMethod.prev();\n\t\t\t\t});\n\t\t\t\t$close.click(function () {\n\t\t\t\t\tpublicMethod.close();\n\t\t\t\t});\n\t\t\t\t$overlay.click(function () {\n\t\t\t\t\tif (settings.overlayClose) {\n\t\t\t\t\t\tpublicMethod.close();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\t\n\t\t\t\t// Key Bindings\n\t\t\t\t$(document).bind('keydown.' + prefix, function (e) {\n\t\t\t\t\tvar key = e.keyCode;\n\t\t\t\t\tif (open && settings.escKey && key === 27) {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\tpublicMethod.close();\n\t\t\t\t\t}\n\t\t\t\t\tif (open && settings.arrowKey && $related[1] && !e.altKey) {\n\t\t\t\t\t\tif (key === 37) {\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t$prev.click();\n\t\t\t\t\t\t} else if (key === 39) {\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t$next.click();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tif ($.isFunction($.fn.on)) {\n\t\t\t\t\t// For jQuery 1.7+\n\t\t\t\t\t$(document).on('click.'+prefix, '.'+boxElement, clickHandler);\n\t\t\t\t} else {\n\t\t\t\t\t// For jQuery 1.3.x -> 1.6.x\n\t\t\t\t\t// This code is never reached in jQuery 1.9, so do not contact me about 'live' being removed.\n\t\t\t\t\t// This is not here for jQuery 1.9, it's here for legacy users.\n\t\t\t\t\t$('.'+boxElement).live('click.'+prefix, clickHandler);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "addEventHandlers() {\n\n\t\tthis.elementConfig.addButton.on(\"click\",this.handleAdd);\n\t\tthis.elementConfig.cancelButton.on(\"click\",this.handleCancel);\n\t\tthis.elementConfig.retrieveButton.on(\"click\",this.retrieveData);\n\n\n\t}", "addEditor() {\n // Create new editor\n this.editor = $(`\n <div id=\"${this.id}-Editor\" class=\"editCell\">\n <div class=\"editHeader\">\n <p class=\"editHeaderTitle\">${this.id} Editor</p>\n </div>\n <div class=\"editOptionTable\">\n </div>\n </div>\n `);\n propertyEditor.append(this.editor[0]);\n\n // When working within an editor hilight the relevant shape\n this.editor.on(\"mouseenter\", () => {\n this.hover = true;\n canvas.redrawCanvas();\n });\n this.editor.on(\"mouseleave\", () => {\n this.hover = false;\n canvas.redrawCanvas();\n });\n\n // Add button for deleting a shape off of the canvas\n $(`<button class=\"editHeaderButton\">Delete Shape</button>`)\n .on(\"click\", () => canvas.removeShape(this))\n .appendTo(`div#${this.id}-Editor .editHeader`);\n\n // Fill the editor with options relevant to the shape\n this.refillOptions();\n }", "function addBindings() {\n function clickHandler(e) {\n // ignore non-left-mouse-clicks and clicks modified with ctrl / command, shift, or alt.\n // See: http://jacklmoore.com/notes/click-events/\n if (!(e.which > 1 || e.shiftKey || e.altKey || e.metaKey || e.ctrlKey)) {\n e.preventDefault();\n launch(this);\n }\n }\n\n if ($box) {\n if (!init) {\n init = true;\n\n // Anonymous functions here keep the public method from being cached, thereby allowing them to be redefined on the fly.\n $next.click(function () {\n publicMethod.next();\n });\n $prev.click(function () {\n publicMethod.prev();\n });\n $close.click(function () {\n publicMethod.close();\n });\n $overlay.click(function () {\n if (settings.get('overlayClose')) {\n publicMethod.close();\n }\n });\n\n // Key Bindings\n $(document).bind('keydown.' + prefix, function (e) {\n var key = e.keyCode;\n if (open && settings.get('escKey') && key === 27) {\n e.preventDefault();\n publicMethod.close();\n }\n if (open && settings.get('arrowKey') && $related[1] && !e.altKey) {\n if (key === 37) {\n e.preventDefault();\n $prev.click();\n } else if (key === 39) {\n e.preventDefault();\n $next.click();\n }\n }\n });\n\n if ($.isFunction($.fn.on)) {\n // For jQuery 1.7+\n $(document).on('click.'+prefix, '.'+boxElement, clickHandler);\n } else {\n // For jQuery 1.3.x -> 1.6.x\n // This code is never reached in jQuery 1.9, so do not contact me about 'live' being removed.\n // This is not here for jQuery 1.9, it's here for legacy users.\n $('.'+boxElement).live('click.'+prefix, clickHandler);\n }\n }\n return true;\n }\n return false;\n }", "function addCollectionMethod (methodName) {\n var method = Node.prototype[methodName];\n Collection.prototype[methodName] = function () {\n var result = new Collection();\n if (!this.length) {\n return result;\n }\n var args = Array.prototype.slice.apply(arguments);\n for (var i=0; i<this.length; i++) {\n var value = method.apply(this[i], args);\n if (value instanceof Collection) {\n result.push.apply(result, value);\n } else {\n result.push(value);\n }\n }\n return result;\n }\n }", "addMethod(structure) {\r\n return this.addMethods([structure])[0];\r\n }", "function WrappedOperation (operation, meta) {\n this.wrapped = operation;\n this.meta = meta;\n }", "function WrappedOperation (operation, meta) {\n this.wrapped = operation;\n this.meta = meta;\n }", "_addMethod(name, method, namespace, isNamespaceEnd) {\n\n let methodHandler = function () {\n var args = Array.prototype.slice.call(arguments)\n\n this.chain((next)=> {\n args.push(next)\n method.apply(this, args)\n })\n\n if (isNamespaceEnd || !namespace) {\n return this\n } else {\n return this[namespace]\n }\n\n }\n\n if (!namespace) {\n this[name] = methodHandler.bind(this)\n } else {\n if (!has(this, namespace)) this[namespace] = {}\n this[namespace][name] = methodHandler.bind(this)\n }\n\n return this\n }", "function addItem(method, ...args) {\n if (method == 'dropdown') {\n genDropDown(...args);\n } else if (method == 'shortinput') {\n genShortInput(...args);\n } else if (method == 'checkbox') {\n genCheckbox(...args);\n } else if (method == 'separator') {\n genSeparator(...args);\n }\n}", "function replaceEditor() {\r\n\t\treturn function () {\r\n\t\t\tvar editorInstance = CKEDITOR.replace(element, configObj);\r\n\t\t\tself.setEditorInstance(editorInstance);\r\n\t\t\t//See if we need to set the editor to mixed mode\r\n\t\t\teditorInstance.on('instanceReady', function () {\r\n\t\t\t\t//Perform any cleanup once the editor has been created.\r\n\t\t\t\tself.postEditorCleanup();\r\n\t\t\t\t//If we instantiated CKEditor on top of mixed content.. the editor alters content\r\n\t\t\t\t//We have to reset the content\r\n\t\t\t\t//Set the ddfreetext areas to be editable and apply css classes to top and bottom\r\n\t\t\t\tif (self.hasMixedContent()) {\r\n\t\t\t\t\teditorInstance.setData(self.getDocumentationContent());\r\n\t\t\t\t\tvar $freetextAreas = $(editorInstance.editable().$).find('.ddfreetext');\r\n\t\t\t\t\t$freetextAreas.attr('contenteditable', 'true');\r\n\t\t\t\t\teditorInstance.saveEditorSnapshot();\r\n\t\t\t\t\tself.enableMixedContent();\r\n\t\t\t\t\t$(editorInstance.editable().$).attr(\"ddactive\", true);\r\n\t\t\t\t\teditorInstance.fire('updateStructuredContent');\t\t\r\n\t\t\t\t} else {\r\n\t\t\t\t\tself.injectFreeTextElement();\r\n\t\t\t\t}\r\n\t\t\t\tif (self.isEmrEnabled()){\r\n\t\t\t\t\tself.updateEMRContent();\r\n\t\t\t\t}\r\n\t\t\t\t//After we have made all these changes, make sure to reset the undo stack. (undoing immediately could\r\n\t\t\t\t//cause severe DOM corruption).\r\n\t\t\t\teditorInstance.resetUndo();\r\n\t\t\t\t//Ensure that undo can properly go back to current state\r\n\t\t\t\tvar cernundo = editorInstance.plugins.cernundo;\r\n\t\t\t\tcernundo.handleBaseSnapshot(editorInstance);\r\n\t\t\t\t//If structure is enabled, enable the header toggle. The toggle was disabled until the editor instance\r\n\t\t\t\t//was ready, at which point it is considered safe to switch views.\r\n\t\t\t\tif (self.getStructuredDocInd()) {\r\n\t\t\t\t\tself.enableHeaderToggle(DocumentationBaseComponent.VIEWS.STRUCTURE);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\teditorInstance.on('structureElementClicked', function(event) {\r\n\t\t\t\tif (event.data) {\r\n\t\t\t\t\tself.showStructuredView(event.data);\r\n\t\t\t\t\tself.captureNavigationTimer();\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\teditorInstance.on('refreshStateChange', function(){\r\n\t\t\t\tif(editorInstance.refreshState === 'stable'){\r\n\t\t\t\t\tself.postEMRRefresh();\r\n\t\t\t\t}\r\n\t\t\t\t// Disable refreshing when refresh starts, enable after ending\r\n\t\t\t\tself.updateSaveButton();\r\n\t\t\t});\r\n\t\t\teditorInstance.on('refreshEmrFail', function(event) {\r\n\t\t\t\t//Display error message if emr refresh fails\r\n\t\t\t\tself.displayEMRError();\r\n\t\t\t});\r\n\t\t\teditorInstance.on('afterddremovesection', function(){\r\n\t\t\t\t//Update styling after removing sections\r\n\t\t\t\tself.handleEmptySections();\r\n\t\t\t});\r\n\r\n\t\t};\r\n\t}", "function addMethod(object, name, fn) {\r\n var old = object[ name ];\r\n object[ name ] = function () {\r\n if (fn.length === arguments.length)\r\n return fn.apply(this, arguments);\r\n else if (typeof old === 'function')\r\n return old.apply(this, arguments);\r\n };\r\n }", "function wrapmethods(sess) {\n var _reload = sess.reload\n var _save = sess.save;\n\n function reload(callback) {\n debug('reloading %s', this.id)\n // pass this and function that put wrapper to session\n _reload.call(this, function () {\n wrapmethods(req.session)\n callback.apply(this, arguments) // pass this and pass arguments\n })\n }\n\n function save() {\n debug('saving %s', this.id);\n savedHash = hash(this);\n _save.apply(this, arguments); // pass current this with arguments\n }\n // add property to current object, sess is object\n Object.defineProperty(sess, 'reload', {\n configurable: true,\n enumerable: false,\n value: reload, // reload is function define above\n writable: true\n })\n // add property save to object sess\n Object.defineProperty(sess, 'save', {\n configurable: true,\n enumerable: false,\n value: save, // save is function define above\n writable: true\n });\n } // function wrapmethods(sess) {", "insertMethods(index, structures) {\r\n return this._insertProperty(index, structures, () => this._context.structurePrinterFactory.forMethodDeclaration({ isAmbient: false }));\r\n }", "function createCodeModeModifierCtrl() {\n var codeModeModifier = {};\n \n // @interface\n codeModeModifier.update = function(modType, text) {\n var modTypeElt = codeModeModifier.get(modType);\n if (!modTypeElt) {\n _codeModeModifierDiv.insertAdjacentHTML(\n 'beforeend', '<span id=\"' + modType +'\"></span>');\n \n modTypeElt = codeModeModifier.get(modType);\n }\n // now the modType span is sure setup. Set the content; \n modTypeElt.innerText = text; \n }; // function update(..)\n \n // @interface\n codeModeModifier.remove = function(modType) {\n var modTypeElt = codeModeModifier.get(modType);\n if (modTypeElt) {\n modTypeElt.remove();\n }\n };\n \n // @interface\n codeModeModifier.get = function(modType) {\n return _codeModeModifierDiv.querySelector('#' + modType);\n } ;\n \n return codeModeModifier;\n } // function createCodeModeModifierCtrl(..)", "addEditorButton(callback) {\n this.addButton(EDIT_ICON, callback);\n }", "function add() {}", "_handleCustomOperations() {\n const that = this;\n\n that._filterOperationDescriptions = that._defaultFilterOperationDescriptions;\n\n for (let i = 0; i < that.customOperations.length; i++) {\n const operation = that.customOperations[i];\n\n that._filterOperationDescriptions.push({\n label: operation.label,\n value: operation.name,\n custom: true,\n index: i,\n editorTemplate: operation.editorTemplate,\n valueTemplate: operation.valueTemplate,\n handleValue: operation.handleValue\n });\n }\n }", "addBasicCommands() {\n this.addCommand(new commands.HelpCommand());\n }", "function extendComponent(parent, methods) {\n for (var name_1 in methods) {\n if (methods.hasOwnProperty(name_1)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n parent[name_1] = (0,_appendFunction__WEBPACK_IMPORTED_MODULE_0__.appendFunction)(parent, parent[name_1], methods[name_1]);\n }\n }\n}", "function extendComponent(parent, methods) {\n for (var name_1 in methods) {\n if (methods.hasOwnProperty(name_1)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n parent[name_1] = (0,_appendFunction__WEBPACK_IMPORTED_MODULE_0__.appendFunction)(parent, parent[name_1], methods[name_1]);\n }\n }\n}", "function augmentComponent(Component, methods) {\n Object.keys(methods).forEach(function (name) {\n var method = methods[name];\n if (typeof method !== 'function') {\n return;\n }\n var currentMethod = Component.prototype[name];\n Component.prototype[name] = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (typeof currentMethod === 'function') {\n currentMethod.call.apply(currentMethod, [this].concat(args));\n }\n method.call.apply(method, [this].concat(args));\n };\n });\n return Component;\n}", "_add () {\n throw new Error('not implemented')\n }", "function extendComponent(parent, methods) {\n for (var name_1 in methods) {\n if (methods.hasOwnProperty(name_1)) {\n // tslint:disable-next-line:no-any\n parent[name_1] = Object(_appendFunction__WEBPACK_IMPORTED_MODULE_0__[\"appendFunction\"])(parent, parent[name_1], methods[name_1]);\n }\n }\n}", "function augmentComponent(Component, methods) {\n Object.keys(methods).forEach(function (name) {\n var method = methods[name];\n\n if (typeof method !== 'function') {\n return;\n }\n\n var currentMethod = Component.prototype[name];\n\n Component.prototype[name] = function () {\n var args = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n\n if (typeof currentMethod === 'function') {\n currentMethod.call.apply(currentMethod, [this].concat(args));\n }\n\n method.call.apply(method, [this].concat(args));\n };\n });\n return Component;\n}", "function add() {\n // TODO: your code here\n}", "add () {\n }", "function methodOp(f) {\n\t\t return function() {\n\t\t if (this.curOp) { return f.apply(this, arguments) }\n\t\t startOperation(this);\n\t\t try { return f.apply(this, arguments) }\n\t\t finally { endOperation(this); }\n\t\t }\n\t\t }", "function addFunctions() {\n var divList = document.getElementsByClassName('cf_inplace')\n for (let i = 0; i < divList.length; i++) {\n //console.log(divList[i].children.length)\n for (let j = 0; j < divList[i].children.length; j++) {\n if(divList[i].children[j].tagName == \"IMG\") {\n divList[i].children[j].setAttribute('ondblclick', 'changeImage(this)')\n } else {\n divList[i].children[j].setAttribute('ondblclick', 'triggerChangeElement(this)')\n }\n }\n }\n\n for (let i = 0; i < divList.length; i++) {\n //console.log(\"add\")\n divList[i].appendChild(createEditButton(divList[i]))\n }\n}", "function methodOp(f) {\n\t\t return function() {\n\t\t if (this.curOp) return f.apply(this, arguments);\n\t\t startOperation(this);\n\t\t try { return f.apply(this, arguments); }\n\t\t finally { endOperation(this); }\n\t\t };\n\t\t }", "registerHooks() {\n this.addLocalHook('click', () => this.onClick());\n this.addLocalHook('keyup', event => this.onKeyup(event));\n }", "function addExtensionMethods() {\n var carrier = hub_1.getMainCarrier();\n if (carrier.__SENTRY__) {\n carrier.__SENTRY__.extensions = carrier.__SENTRY__.extensions || {};\n if (!carrier.__SENTRY__.extensions.startSpan) {\n carrier.__SENTRY__.extensions.startSpan = startSpan;\n }\n if (!carrier.__SENTRY__.extensions.traceHeaders) {\n carrier.__SENTRY__.extensions.traceHeaders = traceHeaders;\n }\n }\n}", "init() {\n module_utils.patchModule(\n 'openwhisk/lib/actions.js',\n 'invoke',\n openWhiskWrapper$1,\n actions => actions.prototype\n );\n }", "function wrapMethods (proto) {\n\t\tObject.keys(proto)\n\t\t\t.filter(function (prop) {\n\t\t\t\treturn typeof proto[prop] === 'function';\n\t\t\t})\n\t\t\t.forEach(function (method) {\n\t\t\t\tproto[method] = wrapFunction(proto[method]);\n\t\t\t});\n\t}", "_handleCustomOperations() {\n const that = this;\n\n that._filterOperationDescriptions = that._defaultFilterOperationDescriptions.slice(0);\n\n for (let i = 0; i < that.customOperations.length; i++) {\n const operation = that.customOperations[i];\n\n that._filterOperationDescriptions.push({\n label: operation.label,\n value: operation.name,\n custom: true,\n index: i,\n editorTemplate: operation.editorTemplate,\n valueTemplate: operation.valueTemplate,\n handleValue: operation.handleValue,\n hideValue: operation.hideValue\n });\n }\n }", "function Editor(el){\n\n // currentEl will hold the selected element\n this.currentEl = el;\n\n /* An example of a text editing method,\n ** will add text to selected element */\n this.text = function(text) {\n this.currentEl.textContent = text;\n return this;\n };\n\n /* An example of a style editing method,\n ** will updated style on selected element */\n this.css = function(property,value) {\n this.currentEl.style[property] = value;\n return this;\n };\n}", "function _registerHandlers(editor) {\n $(editor).on(\"keyEvent\", _cursorHandler);\n $(editor.document).one(\"change\", _handler);\n editor.document.addRef();\n }", "function createMethod() {\n person.display = function(){return this.name + \" \" + this.name;};\n country.display = function(){return this.country + \" \" + this.country;};\n}", "logic() {\n if (this.currentEditor != null) {\n this.currentEditor.logic();\n }\n }", "registerMethod(method) {\n for (var i in method) {\n var methodObj = method[i];\n if (methodObj.definition && typeof methodObj.definition == 'object' && methodObj.definition.script) {\n if (methodObj.dependency) {\n customMethods[methodObj.name] = new Function(\"obj\", \"callback\", methodObj.dependency, methodObj.definition.script);\n } else {\n customMethods[methodObj.name] = new Function(\"obj\", \"callback\", methodObj.definition.script);\n }\n }\n }\n }", "function MethodDefinition(node, print) {\n\t print.list(node.decorators, { separator: \"\" });\n\n\t if (node[\"static\"]) {\n\t this.push(\"static \");\n\t }\n\n\t this._method(node, print);\n\t}", "function MethodDefinition(node, print) {\n\t print.list(node.decorators, { separator: \"\" });\n\n\t if (node[\"static\"]) {\n\t this.push(\"static \");\n\t }\n\n\t this._method(node, print);\n\t}", "function DivsTool() {\n /* tool to add 'divs' */\n\n this.initialize = function(editor) {\n /* attach the event handlers */\n this.editor = editor;\n this.editor.logMessage(_(\"Div tool initialized\"));\n };\n\n\n this.createDiv = function(divclass) {\n /* create a div */\n var currnode = this.editor.getSelectedNode();\n var currp = this.editor.getNearestParentOfType(currnode, 'p');\n\n var doc = this.editor.getInnerDocument();\n var div = doc.createElement('div');\n div.id = \"createddiv_\" + (divids++);\n if (divclass) {\n div.className = divclass;\n };\n var selection = this.editor.getSelection();\n var fragment = selection ? selection.cloneContents() : undefined;\n if(fragment == undefined || fragment.firstChild == undefined || fragment.firstChild.nodeType == Node.TEXT_NODE) {\n var child = doc.createElement(\"p\");\n if (fragment != undefined) {\n child.appendChild(selection.cloneContents());\n }\n div.appendChild(child);\n if (child.childNodes.length == 0 || (child.childNodes.length == 1 && (child.firstChild.nodeValue == \"\" || child.firstChild.nodeValue == undefined))) {\n child.appendChild(doc.createTextNode(\".\"));\n }\n } else {\n div.appendChild(fragment);\n }\n\n //var ser = new XMLSerializer();\n //alert(\"inserting \" + ser.serializeToString(div));\n\n if (currp) {\n this.editor.logMessage(_(\"Found paragraph\"));\n currp.parentNode.insertBefore(div, currp);\n this.editor.insertNodeAtSelection(doc.createTextNode(\"\"), 1);\n } else {\n this.editor.logMessage(_(\"Didn't find paragraph\"));\n //alert(\"Inserting \" + div);\n div = this.editor.insertNodeAtSelection(div, 1);\n }\n\n this.editor.logMessage(_(\"Div inserted\"));\n this.editor.updateState();\n return div;\n };\n\n this.setDivClass = function(divclass) {\n /* set the class of the selected image */\n var currnode = this.editor.getSelectedNode();\n var currdiv = this.editor.getNearestParentOfType(currnode, 'div');\n if (currdiv) {\n currdiv.className = divclass;\n };\n };\n\n this.deleteDiv = function() {\n /* delete the current link */\n var currnode = this.editor.getSelectedNode();\n var linkel = this.editor.getNearestParentOfType(currnode, 'div');\n if (!linkel) {\n this.editor.logMessage(_('Not inside block'));\n return;\n };\n while (linkel.childNodes.length) {\n linkel.parentNode.insertBefore(linkel.childNodes[0], linkel);\n };\n linkel.parentNode.removeChild(linkel);\n\n this.editor.logMessage(_('Block removed'));\n this.editor.updateState();\n };\n\n this.createContextMenuElements = function(selNode, event) {\n /* create the 'Create link' or 'Remove link' menu elements */\n var ret = [];\n var link = this.editor.getNearestParentOfType(selNode, 'div');\n if (link) {\n ret.push(new ContextMenuElement(_('Delete block'), this.deleteDiv, this));\n }\n return ret;\n };\n\n}", "transform(editor, op) {\n editor.children = Object(__WEBPACK_IMPORTED_MODULE_1_immer__[\"a\" /* createDraft */])(editor.children);\n var selection = editor.selection && Object(__WEBPACK_IMPORTED_MODULE_1_immer__[\"a\" /* createDraft */])(editor.selection);\n\n switch (op.type) {\n case 'insert_node':\n {\n var {\n path,\n node\n } = op;\n var parent = Node.parent(editor, path);\n var index = path[path.length - 1];\n parent.children.splice(index, 0, node);\n\n if (selection) {\n for (var [point, key] of Range.points(selection)) {\n selection[key] = Point.transform(point, op);\n }\n }\n\n break;\n }\n\n case 'insert_text':\n {\n var {\n path: _path,\n offset,\n text\n } = op;\n\n var _node = Node.leaf(editor, _path);\n\n var before = _node.text.slice(0, offset);\n\n var after = _node.text.slice(offset);\n\n _node.text = before + text + after;\n\n if (selection) {\n for (var [_point, _key] of Range.points(selection)) {\n selection[_key] = Point.transform(_point, op);\n }\n }\n\n break;\n }\n\n case 'merge_node':\n {\n var {\n path: _path2\n } = op;\n\n var _node2 = Node.get(editor, _path2);\n\n var prevPath = Path.previous(_path2);\n var prev = Node.get(editor, prevPath);\n\n var _parent = Node.parent(editor, _path2);\n\n var _index = _path2[_path2.length - 1];\n\n if (Text.isText(_node2) && Text.isText(prev)) {\n prev.text += _node2.text;\n } else if (!Text.isText(_node2) && !Text.isText(prev)) {\n prev.children.push(..._node2.children);\n } else {\n throw new Error(\"Cannot apply a \\\"merge_node\\\" operation at path [\".concat(_path2, \"] to nodes of different interaces: \").concat(_node2, \" \").concat(prev));\n }\n\n _parent.children.splice(_index, 1);\n\n if (selection) {\n for (var [_point2, _key2] of Range.points(selection)) {\n selection[_key2] = Point.transform(_point2, op);\n }\n }\n\n break;\n }\n\n case 'move_node':\n {\n var {\n path: _path3,\n newPath\n } = op;\n\n if (Path.isAncestor(_path3, newPath)) {\n throw new Error(\"Cannot move a path [\".concat(_path3, \"] to new path [\").concat(newPath, \"] because the destination is inside itself.\"));\n }\n\n var _node3 = Node.get(editor, _path3);\n\n var _parent2 = Node.parent(editor, _path3);\n\n var _index2 = _path3[_path3.length - 1]; // This is tricky, but since the `path` and `newPath` both refer to\n // the same snapshot in time, there's a mismatch. After either\n // removing the original position, the second step's path can be out\n // of date. So instead of using the `op.newPath` directly, we\n // transform `op.path` to ascertain what the `newPath` would be after\n // the operation was applied.\n\n _parent2.children.splice(_index2, 1);\n\n var truePath = Path.transform(_path3, op);\n var newParent = Node.get(editor, Path.parent(truePath));\n var newIndex = truePath[truePath.length - 1];\n newParent.children.splice(newIndex, 0, _node3);\n\n if (selection) {\n for (var [_point3, _key3] of Range.points(selection)) {\n selection[_key3] = Point.transform(_point3, op);\n }\n }\n\n break;\n }\n\n case 'remove_node':\n {\n var {\n path: _path4\n } = op;\n var _index3 = _path4[_path4.length - 1];\n\n var _parent3 = Node.parent(editor, _path4);\n\n _parent3.children.splice(_index3, 1); // Transform all of the points in the value, but if the point was in the\n // node that was removed we need to update the range or remove it.\n\n\n if (selection) {\n for (var [_point4, _key4] of Range.points(selection)) {\n var result = Point.transform(_point4, op);\n\n if (selection != null && result != null) {\n selection[_key4] = result;\n } else {\n var _prev = void 0;\n\n var next = void 0;\n\n for (var [n, p] of Node.texts(editor)) {\n if (Path.compare(p, _path4) === -1) {\n _prev = [n, p];\n } else {\n next = [n, p];\n break;\n }\n }\n\n if (_prev) {\n _point4.path = _prev[1];\n _point4.offset = _prev[0].text.length;\n } else if (next) {\n _point4.path = next[1];\n _point4.offset = 0;\n } else {\n selection = null;\n }\n }\n }\n }\n\n break;\n }\n\n case 'remove_text':\n {\n var {\n path: _path5,\n offset: _offset,\n text: _text\n } = op;\n\n var _node4 = Node.leaf(editor, _path5);\n\n var _before = _node4.text.slice(0, _offset);\n\n var _after = _node4.text.slice(_offset + _text.length);\n\n _node4.text = _before + _after;\n\n if (selection) {\n for (var [_point5, _key5] of Range.points(selection)) {\n selection[_key5] = Point.transform(_point5, op);\n }\n }\n\n break;\n }\n\n case 'set_node':\n {\n var {\n path: _path6,\n newProperties\n } = op;\n\n if (_path6.length === 0) {\n throw new Error(\"Cannot set properties on the root node!\");\n }\n\n var _node5 = Node.get(editor, _path6);\n\n for (var _key6 in newProperties) {\n if (_key6 === 'children' || _key6 === 'text') {\n throw new Error(\"Cannot set the \\\"\".concat(_key6, \"\\\" property of nodes!\"));\n }\n\n var value = newProperties[_key6];\n\n if (value == null) {\n delete _node5[_key6];\n } else {\n _node5[_key6] = value;\n }\n }\n\n break;\n }\n\n case 'set_selection':\n {\n var {\n newProperties: _newProperties\n } = op;\n\n if (_newProperties == null) {\n selection = _newProperties;\n } else if (selection == null) {\n if (!Range.isRange(_newProperties)) {\n throw new Error(\"Cannot apply an incomplete \\\"set_selection\\\" operation properties \".concat(JSON.stringify(_newProperties), \" when there is no current selection.\"));\n }\n\n selection = _newProperties;\n } else {\n Object.assign(selection, _newProperties);\n }\n\n break;\n }\n\n case 'split_node':\n {\n var {\n path: _path7,\n position,\n properties\n } = op;\n\n if (_path7.length === 0) {\n throw new Error(\"Cannot apply a \\\"split_node\\\" operation at path [\".concat(_path7, \"] because the root node cannot be split.\"));\n }\n\n var _node6 = Node.get(editor, _path7);\n\n var _parent4 = Node.parent(editor, _path7);\n\n var _index4 = _path7[_path7.length - 1];\n var newNode;\n\n if (Text.isText(_node6)) {\n var _before2 = _node6.text.slice(0, position);\n\n var _after2 = _node6.text.slice(position);\n\n _node6.text = _before2;\n newNode = _objectSpread$5({}, _node6, {}, properties, {\n text: _after2\n });\n } else {\n var _before3 = _node6.children.slice(0, position);\n\n var _after3 = _node6.children.slice(position);\n\n _node6.children = _before3;\n newNode = _objectSpread$5({}, _node6, {}, properties, {\n children: _after3\n });\n }\n\n _parent4.children.splice(_index4 + 1, 0, newNode);\n\n if (selection) {\n for (var [_point6, _key7] of Range.points(selection)) {\n selection[_key7] = Point.transform(_point6, op);\n }\n }\n\n break;\n }\n }\n\n editor.children = Object(__WEBPACK_IMPORTED_MODULE_1_immer__[\"b\" /* finishDraft */])(editor.children);\n\n if (selection) {\n editor.selection = Object(__WEBPACK_IMPORTED_MODULE_1_immer__[\"c\" /* isDraft */])(selection) ? Object(__WEBPACK_IMPORTED_MODULE_1_immer__[\"b\" /* finishDraft */])(selection) : selection;\n } else {\n editor.selection = null;\n }\n }", "function Editor() { }", "function Editor() { }", "function IExposeCommandsEx() {}", "bind() {\n this.hook.appendChild(this.docElementNS);\n }", "bind() {\n this.hook.appendChild(this.docElementNS);\n }", "bind() {\n this.hook.appendChild(this.docElementNS);\n }", "function TableOperations(editor){this.editor=editor;var cfg=editor.config;var tt=TableOperations.I18N;var bl=TableOperations.btnList;var self=this;var toolbar=[\"linebreak\"];for(var i=0;i<bl.length;++i){var btn=bl[i];if(!btn){toolbar.push(\"separator\");}else{var id=\"TO-\"+btn[0];cfg.registerButton(id,tt[id],editor.imgURL(btn[0]+\".gif\",\"TableOperations\"),false,function(editor,id){self.buttonPress(editor,id);},btn[1]);toolbar.push(id);}}cfg.toolbar.push(toolbar);}", "onCreated() {\n\t\tlet brackets = null,\n\t\t\tDocumentManager = null,\n\t\t\tdoc = null;\n\t\tthis.classList.add('closet-instant-editor');\n\t\t$(document.body).append(this);\n\t\tbrackets = utils.checkGlobalContext('brackets');\n\t\tDocumentManager = brackets.getModule('document/DocumentManager');\n\t\tdoc = DocumentManager.createUntitledDocument(1, '.html');\n\t\tthis._textEditor = new TextEditor(doc, false, this.$el);\n\t\tthis._$textEditorEl = this._textEditor.$el;\n\n\t\tthis._$textEditorEl.addClass('closet-instant-editor-item');\n\t\tthis._$textEditorEl.attr('tabindex', 0);\n\n\t\tthis._currentGrammar = null;\n\t\tthis._targetModel = null;\n\n\t\tthis._opened = false;\n\t\tthis._bindEvent();\n\t}", "function addExtensionMethods() {\n\t _addTracingExtensions();\n\n\t // Detect and automatically load specified integrations.\n\t if (isNodeEnv()) {\n\t _autoloadDatabaseIntegrations();\n\t }\n\n\t // If an error happens globally, we should make sure transaction status is set to error.\n\t registerErrorInstrumentation();\n\t}", "bind() {\n this.hook.appendChild(this.docElementNS);\n }", "bind() {\n this.hook.appendChild(this.docElementNS);\n }", "bind() {\n if (this.hook && this.docElementNS) {\n this.hook.appendChild(this.docElementNS);\n }\n }", "bind() {\n if (this.hook && this.docElementNS) {\n this.hook.appendChild(this.docElementNS);\n }\n }", "init() {\n Nova.$on(`ckeditor:media:${this.attribute}:write`, this.writeContent.bind(this))\n this.ui.componentFactory.add('mediaBrowser', this.createButton.bind(this))\n }", "addCommands() {\n this.disposables.add(atom.commands.add('atom-workspace', {\n 'project-viewer-plus:open-editor': () => {\n this.openEditor();\n },\n 'project-viewer-plus:read-file': async () => {\n const content = await this.readFile();\n console.log(content);\n _state2.default.initializeState(content, true);\n },\n 'project-viewer-plus:read-legacy-file': async () => {\n const content = await this.readLegacyFile();\n _state2.default.initializeState((0, _legacy.transformLegacyContent)(content.root), true);\n },\n 'project-viewer-plus:toggle-visibility': () => this.toggleMainVisibility(),\n 'project-viewer-plus:toggle-focus': () => this.toggleMainFocus(),\n 'project-viewer-plus:toggle-list': () => this.toggleSelectList()\n }), atom.commands.add(this.mainContainer.element, {\n 'core:move-up': function () {\n console.log('core:move-up');\n },\n 'core:move-down': function () {\n console.log('core:move-down');\n },\n 'core:move-left': function () {\n console.log('core:move-left');\n },\n 'core:move-right': function () {\n console.log('core:move-right');\n },\n 'core:confirm': function () {\n console.log('core:confirm');\n }\n }), atom.workspace.getLeftDock().onDidStopChangingActivePaneItem(item => console.log('left', item)), atom.workspace.getRightDock().onDidStopChangingActivePaneItem(item => console.log('right', item)), atom.config.onDidChange(`${_base.PLUGIN_NAME}.dock.position`, () => {\n this.mainContainer.destroyMainItem();\n this.addItemToDock();\n this.mainContainer.update();\n }));\n }", "transform(editor, op) {\n editor.children = Object(__WEBPACK_IMPORTED_MODULE_1_immer__[\"a\" /* createDraft */])(editor.children);\n var selection = editor.selection && Object(__WEBPACK_IMPORTED_MODULE_1_immer__[\"a\" /* createDraft */])(editor.selection);\n\n switch (op.type) {\n case 'insert_node':\n {\n var {\n path,\n node\n } = op;\n var parent = Node.parent(editor, path);\n var index = path[path.length - 1];\n parent.children.splice(index, 0, node);\n\n if (selection) {\n for (var [point, key] of Range.points(selection)) {\n selection[key] = Point.transform(point, op);\n }\n }\n\n break;\n }\n\n case 'insert_text':\n {\n var {\n path: _path,\n offset,\n text\n } = op;\n\n var _node2 = Node.leaf(editor, _path);\n\n var before = _node2.text.slice(0, offset);\n\n var after = _node2.text.slice(offset);\n\n _node2.text = before + text + after;\n\n if (selection) {\n for (var [_point, _key] of Range.points(selection)) {\n selection[_key] = Point.transform(_point, op);\n }\n }\n\n break;\n }\n\n case 'merge_node':\n {\n var {\n path: _path2\n } = op;\n\n var _node3 = Node.get(editor, _path2);\n\n var prevPath = Path.previous(_path2);\n var prev = Node.get(editor, prevPath);\n\n var _parent = Node.parent(editor, _path2);\n\n var _index = _path2[_path2.length - 1];\n\n if (Text.isText(_node3) && Text.isText(prev)) {\n prev.text += _node3.text;\n } else if (!Text.isText(_node3) && !Text.isText(prev)) {\n prev.children.push(..._node3.children);\n } else {\n throw new Error(\"Cannot apply a \\\"merge_node\\\" operation at path [\".concat(_path2, \"] to nodes of different interaces: \").concat(_node3, \" \").concat(prev));\n }\n\n _parent.children.splice(_index, 1);\n\n if (selection) {\n for (var [_point2, _key2] of Range.points(selection)) {\n selection[_key2] = Point.transform(_point2, op);\n }\n }\n\n break;\n }\n\n case 'move_node':\n {\n var {\n path: _path3,\n newPath\n } = op;\n\n if (Path.isAncestor(_path3, newPath)) {\n throw new Error(\"Cannot move a path [\".concat(_path3, \"] to new path [\").concat(newPath, \"] because the destination is inside itself.\"));\n }\n\n var _node4 = Node.get(editor, _path3);\n\n var _parent2 = Node.parent(editor, _path3);\n\n var _index2 = _path3[_path3.length - 1]; // This is tricky, but since the `path` and `newPath` both refer to\n // the same snapshot in time, there's a mismatch. After either\n // removing the original position, the second step's path can be out\n // of date. So instead of using the `op.newPath` directly, we\n // transform `op.path` to ascertain what the `newPath` would be after\n // the operation was applied.\n\n _parent2.children.splice(_index2, 1);\n\n var truePath = Path.transform(_path3, op);\n var newParent = Node.get(editor, Path.parent(truePath));\n var newIndex = truePath[truePath.length - 1];\n newParent.children.splice(newIndex, 0, _node4);\n\n if (selection) {\n for (var [_point3, _key3] of Range.points(selection)) {\n selection[_key3] = Point.transform(_point3, op);\n }\n }\n\n break;\n }\n\n case 'remove_node':\n {\n var {\n path: _path4\n } = op;\n var _index3 = _path4[_path4.length - 1];\n\n var _parent3 = Node.parent(editor, _path4);\n\n _parent3.children.splice(_index3, 1); // Transform all of the points in the value, but if the point was in the\n // node that was removed we need to update the range or remove it.\n\n\n if (selection) {\n for (var [_point4, _key4] of Range.points(selection)) {\n var result = Point.transform(_point4, op);\n\n if (selection != null && result != null) {\n selection[_key4] = result;\n } else {\n var _prev = void 0;\n\n var next = void 0;\n\n for (var [n, p] of Node.texts(editor)) {\n if (Path.compare(p, _path4) === -1) {\n _prev = [n, p];\n } else {\n next = [n, p];\n break;\n }\n }\n\n if (_prev) {\n _point4.path = _prev[1];\n _point4.offset = _prev[0].text.length;\n } else if (next) {\n _point4.path = next[1];\n _point4.offset = 0;\n } else {\n selection = null;\n }\n }\n }\n }\n\n break;\n }\n\n case 'remove_text':\n {\n var {\n path: _path5,\n offset: _offset,\n text: _text2\n } = op;\n\n var _node5 = Node.leaf(editor, _path5);\n\n var _before = _node5.text.slice(0, _offset);\n\n var _after = _node5.text.slice(_offset + _text2.length);\n\n _node5.text = _before + _after;\n\n if (selection) {\n for (var [_point5, _key5] of Range.points(selection)) {\n selection[_key5] = Point.transform(_point5, op);\n }\n }\n\n break;\n }\n\n case 'set_node':\n {\n var {\n path: _path6,\n newProperties\n } = op;\n\n if (_path6.length === 0) {\n throw new Error(\"Cannot set properties on the root node!\");\n }\n\n var _node6 = Node.get(editor, _path6);\n\n for (var _key6 in newProperties) {\n if (_key6 === 'children' || _key6 === 'text') {\n throw new Error(\"Cannot set the \\\"\".concat(_key6, \"\\\" property of nodes!\"));\n }\n\n var value = newProperties[_key6];\n\n if (value == null) {\n delete _node6[_key6];\n } else {\n _node6[_key6] = value;\n }\n }\n\n break;\n }\n\n case 'set_selection':\n {\n var {\n newProperties: _newProperties\n } = op;\n\n if (_newProperties == null) {\n selection = _newProperties;\n } else if (selection == null) {\n if (!Range.isRange(_newProperties)) {\n throw new Error(\"Cannot apply an incomplete \\\"set_selection\\\" operation properties \".concat(JSON.stringify(_newProperties), \" when there is no current selection.\"));\n }\n\n selection = _newProperties;\n } else {\n Object.assign(selection, _newProperties);\n }\n\n break;\n }\n\n case 'split_node':\n {\n var {\n path: _path7,\n position,\n properties\n } = op;\n\n if (_path7.length === 0) {\n throw new Error(\"Cannot apply a \\\"split_node\\\" operation at path [\".concat(_path7, \"] because the root node cannot be split.\"));\n }\n\n var _node7 = Node.get(editor, _path7);\n\n var _parent4 = Node.parent(editor, _path7);\n\n var _index4 = _path7[_path7.length - 1];\n var newNode;\n\n if (Text.isText(_node7)) {\n var _before2 = _node7.text.slice(0, position);\n\n var _after2 = _node7.text.slice(position);\n\n _node7.text = _before2;\n newNode = _objectSpread({}, _node7, {}, properties, {\n text: _after2\n });\n } else {\n var _before3 = _node7.children.slice(0, position);\n\n var _after3 = _node7.children.slice(position);\n\n _node7.children = _before3;\n newNode = _objectSpread({}, _node7, {}, properties, {\n children: _after3\n });\n }\n\n _parent4.children.splice(_index4 + 1, 0, newNode);\n\n if (selection) {\n for (var [_point6, _key7] of Range.points(selection)) {\n selection[_key7] = Point.transform(_point6, op);\n }\n }\n\n break;\n }\n }\n\n editor.children = Object(__WEBPACK_IMPORTED_MODULE_1_immer__[\"b\" /* finishDraft */])(editor.children);\n\n if (selection) {\n editor.selection = Object(__WEBPACK_IMPORTED_MODULE_1_immer__[\"c\" /* isDraft */])(selection) ? Object(__WEBPACK_IMPORTED_MODULE_1_immer__[\"b\" /* finishDraft */])(selection) : selection;\n } else {\n editor.selection = null;\n }\n }", "addSampleCommands() {\n this.addCommand(new sampleCommands.MagicEightBallCommand());\n this.addCommand(new sampleCommands.RollCommand());\n }" ]
[ "0.6233383", "0.61421245", "0.61421245", "0.6118489", "0.6118489", "0.6118489", "0.6118489", "0.6118489", "0.6118489", "0.6118489", "0.6118489", "0.6118489", "0.61172724", "0.61172724", "0.61172724", "0.61172724", "0.61172724", "0.61172724", "0.60847", "0.60688365", "0.60688365", "0.60210526", "0.5792213", "0.5733056", "0.57118934", "0.56819314", "0.5585049", "0.5484896", "0.5444951", "0.5444951", "0.5444951", "0.5444951", "0.5424214", "0.53495616", "0.5348387", "0.5307714", "0.5288541", "0.5288541", "0.5288541", "0.5288541", "0.5257122", "0.5253723", "0.5241202", "0.52383435", "0.52184397", "0.52107733", "0.5209794", "0.5209794", "0.51955956", "0.51665866", "0.5165022", "0.5129643", "0.51271254", "0.51095253", "0.5106547", "0.5103138", "0.50934005", "0.5091436", "0.5088208", "0.5086518", "0.5086518", "0.50786316", "0.5078253", "0.50748706", "0.5065951", "0.5054215", "0.50456977", "0.5043615", "0.50400406", "0.50186116", "0.50154567", "0.5000867", "0.49900916", "0.4986553", "0.4976019", "0.49704853", "0.49633703", "0.49565977", "0.4953259", "0.49308276", "0.49238446", "0.49238446", "0.49144554", "0.4912185", "0.49029517", "0.49029517", "0.49017203", "0.4899949", "0.4899949", "0.4899949", "0.48916", "0.48901767", "0.48854446", "0.48825923", "0.48825923", "0.48801163", "0.48801163", "0.48785296", "0.48778617", "0.48759228", "0.48733997" ]
0.0
-1
Does the actual updating of the line display. Bails out (returning false) when there is nothing to be done and forced is false.
function updateDisplayIfNeeded(cm, update) { var display = cm.display, doc = cm.doc; if (update.editorIsHidden) { resetView(cm); return false } // Bail out if the visible area is already rendered and nothing changed. if (!update.force && update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo && (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) && display.renderedView == display.view && countDirtyView(cm) == 0) { return false } if (maybeUpdateLineNumberWidth(cm)) { resetView(cm); update.dims = getDimensions(cm); } // Compute a suitable new viewport (from & to) var end = doc.first + doc.size; var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first); var to = Math.min(end, update.visible.to + cm.options.viewportMargin); if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); } if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); } if (sawCollapsedSpans) { from = visualLineNo(cm.doc, from); to = visualLineEndNo(cm.doc, to); } var different = from != display.viewFrom || to != display.viewTo || display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth; adjustView(cm, from, to); display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom)); // Position the mover div to align with the current scroll position cm.display.mover.style.top = display.viewOffset + "px"; var toUpdate = countDirtyView(cm); if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view && (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo)) { return false } // For big changes, we hide the enclosing element during the // update, since that speeds up the operations on most browsers. var selSnapshot = selectionSnapshot(cm); if (toUpdate > 4) { display.lineDiv.style.display = "none"; } patchDisplay(cm, display.updateLineNumbers, update.dims); if (toUpdate > 4) { display.lineDiv.style.display = ""; } display.renderedView = display.view; // There might have been a widget with a focused element that got // hidden or updated, if so re-focus it. restoreSelection(selSnapshot); // Prevent selection and cursors from interfering with the scroll // width and height. removeChildren(display.cursorDiv); removeChildren(display.selectionDiv); display.gutters.style.height = display.sizer.style.minHeight = 0; if (different) { display.lastWrapHeight = update.wrapperHeight; display.lastWrapWidth = update.wrapperWidth; startWorker(cm, 400); } display.updateLineNumbers = null; return true }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawUpdate( current ) {\n\n\t\tif ( previous.x !== current.x || previous.y !== current.y ) {\n\t\t\tmultiline( previous.x, previous.y, current.x, current.y, splits, lineSymmetryCtrl.checked );\n\t\t}\n\t}", "function checkLineChanged(currLine){\n if (currLine != prevLine){\n return true;\n }\n return false;\n}", "function updateDisplayIfNeeded(cm, update) {\n\t var display = cm.display, doc = cm.doc;\n\n\t if (update.editorIsHidden) {\n\t resetView(cm);\n\t return false;\n\t }\n\n\t // Bail out if the visible area is already rendered and nothing changed.\n\t if (!update.force &&\n\t update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n\t (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n\t display.renderedView == display.view && countDirtyView(cm) == 0)\n\t return false;\n\n\t if (maybeUpdateLineNumberWidth(cm)) {\n\t resetView(cm);\n\t update.dims = getDimensions(cm);\n\t }\n\n\t // Compute a suitable new viewport (from & to)\n\t var end = doc.first + doc.size;\n\t var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n\t var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n\t if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\n\t if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\n\t if (sawCollapsedSpans) {\n\t from = visualLineNo(cm.doc, from);\n\t to = visualLineEndNo(cm.doc, to);\n\t }\n\n\t var different = from != display.viewFrom || to != display.viewTo ||\n\t display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n\t adjustView(cm, from, to);\n\n\t display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n\t // Position the mover div to align with the current scroll position\n\t cm.display.mover.style.top = display.viewOffset + \"px\";\n\n\t var toUpdate = countDirtyView(cm);\n\t if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n\t (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n\t return false;\n\n\t // For big changes, we hide the enclosing element during the\n\t // update, since that speeds up the operations on most browsers.\n\t var focused = activeElt();\n\t if (toUpdate > 4) display.lineDiv.style.display = \"none\";\n\t patchDisplay(cm, display.updateLineNumbers, update.dims);\n\t if (toUpdate > 4) display.lineDiv.style.display = \"\";\n\t display.renderedView = display.view;\n\t // There might have been a widget with a focused element that got\n\t // hidden or updated, if so re-focus it.\n\t if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\n\n\t // Prevent selection and cursors from interfering with the scroll\n\t // width and height.\n\t removeChildren(display.cursorDiv);\n\t removeChildren(display.selectionDiv);\n\t display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n\t if (different) {\n\t display.lastWrapHeight = update.wrapperHeight;\n\t display.lastWrapWidth = update.wrapperWidth;\n\t startWorker(cm, 400);\n\t }\n\n\t display.updateLineNumbers = null;\n\n\t return true;\n\t }", "function updateDisplayIfNeeded(cm, update) {\n\t var display = cm.display, doc = cm.doc;\n\n\t if (update.editorIsHidden) {\n\t resetView(cm);\n\t return false;\n\t }\n\n\t // Bail out if the visible area is already rendered and nothing changed.\n\t if (!update.force &&\n\t update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n\t (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n\t display.renderedView == display.view && countDirtyView(cm) == 0)\n\t return false;\n\n\t if (maybeUpdateLineNumberWidth(cm)) {\n\t resetView(cm);\n\t update.dims = getDimensions(cm);\n\t }\n\n\t // Compute a suitable new viewport (from & to)\n\t var end = doc.first + doc.size;\n\t var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n\t var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n\t if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\n\t if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\n\t if (sawCollapsedSpans) {\n\t from = visualLineNo(cm.doc, from);\n\t to = visualLineEndNo(cm.doc, to);\n\t }\n\n\t var different = from != display.viewFrom || to != display.viewTo ||\n\t display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n\t adjustView(cm, from, to);\n\n\t display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n\t // Position the mover div to align with the current scroll position\n\t cm.display.mover.style.top = display.viewOffset + \"px\";\n\n\t var toUpdate = countDirtyView(cm);\n\t if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n\t (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n\t return false;\n\n\t // For big changes, we hide the enclosing element during the\n\t // update, since that speeds up the operations on most browsers.\n\t var focused = activeElt();\n\t if (toUpdate > 4) display.lineDiv.style.display = \"none\";\n\t patchDisplay(cm, display.updateLineNumbers, update.dims);\n\t if (toUpdate > 4) display.lineDiv.style.display = \"\";\n\t display.renderedView = display.view;\n\t // There might have been a widget with a focused element that got\n\t // hidden or updated, if so re-focus it.\n\t if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\n\n\t // Prevent selection and cursors from interfering with the scroll\n\t // width and height.\n\t removeChildren(display.cursorDiv);\n\t removeChildren(display.selectionDiv);\n\t display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n\t if (different) {\n\t display.lastWrapHeight = update.wrapperHeight;\n\t display.lastWrapWidth = update.wrapperWidth;\n\t startWorker(cm, 400);\n\t }\n\n\t display.updateLineNumbers = null;\n\n\t return true;\n\t }", "function updateDisplayIfNeeded(cm, update) {\n\t\t var display = cm.display, doc = cm.doc;\n\n\t\t if (update.editorIsHidden) {\n\t\t resetView(cm);\n\t\t return false\n\t\t }\n\n\t\t // Bail out if the visible area is already rendered and nothing changed.\n\t\t if (!update.force &&\n\t\t update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n\t\t (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n\t\t display.renderedView == display.view && countDirtyView(cm) == 0)\n\t\t { return false }\n\n\t\t if (maybeUpdateLineNumberWidth(cm)) {\n\t\t resetView(cm);\n\t\t update.dims = getDimensions(cm);\n\t\t }\n\n\t\t // Compute a suitable new viewport (from & to)\n\t\t var end = doc.first + doc.size;\n\t\t var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n\t\t var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n\t\t if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n\t\t if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n\t\t if (sawCollapsedSpans) {\n\t\t from = visualLineNo(cm.doc, from);\n\t\t to = visualLineEndNo(cm.doc, to);\n\t\t }\n\n\t\t var different = from != display.viewFrom || to != display.viewTo ||\n\t\t display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n\t\t adjustView(cm, from, to);\n\n\t\t display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n\t\t // Position the mover div to align with the current scroll position\n\t\t cm.display.mover.style.top = display.viewOffset + \"px\";\n\n\t\t var toUpdate = countDirtyView(cm);\n\t\t if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n\t\t (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n\t\t { return false }\n\n\t\t // For big changes, we hide the enclosing element during the\n\t\t // update, since that speeds up the operations on most browsers.\n\t\t var selSnapshot = selectionSnapshot(cm);\n\t\t if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n\t\t patchDisplay(cm, display.updateLineNumbers, update.dims);\n\t\t if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n\t\t display.renderedView = display.view;\n\t\t // There might have been a widget with a focused element that got\n\t\t // hidden or updated, if so re-focus it.\n\t\t restoreSelection(selSnapshot);\n\n\t\t // Prevent selection and cursors from interfering with the scroll\n\t\t // width and height.\n\t\t removeChildren(display.cursorDiv);\n\t\t removeChildren(display.selectionDiv);\n\t\t display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n\t\t if (different) {\n\t\t display.lastWrapHeight = update.wrapperHeight;\n\t\t display.lastWrapWidth = update.wrapperWidth;\n\t\t startWorker(cm, 400);\n\t\t }\n\n\t\t display.updateLineNumbers = null;\n\n\t\t return true\n\t\t }", "function updateDisplayIfNeeded(cm, update) {\r\n var display = cm.display, doc = cm.doc;\r\n if (update.editorIsHidden) {\r\n resetView(cm);\r\n return false;\r\n }\r\n\r\n // Bail out if the visible area is already rendered and nothing changed.\r\n if (!update.force &&\r\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\r\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\r\n countDirtyView(cm) == 0)\r\n return false;\r\n\r\n if (maybeUpdateLineNumberWidth(cm)) {\r\n resetView(cm);\r\n update.dims = getDimensions(cm);\r\n }\r\n\r\n // Compute a suitable new viewport (from & to)\r\n var end = doc.first + doc.size;\r\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\r\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\r\n if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\r\n if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\r\n if (sawCollapsedSpans) {\r\n from = visualLineNo(cm.doc, from);\r\n to = visualLineEndNo(cm.doc, to);\r\n }\r\n\r\n var different = from != display.viewFrom || to != display.viewTo ||\r\n display.lastSizeC != update.wrapperHeight;\r\n adjustView(cm, from, to);\r\n\r\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\r\n // Position the mover div to align with the current scroll position\r\n cm.display.mover.style.top = display.viewOffset + \"px\";\r\n\r\n var toUpdate = countDirtyView(cm);\r\n if (!different && toUpdate == 0 && !update.force &&\r\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\r\n return false;\r\n\r\n // For big changes, we hide the enclosing element during the\r\n // update, since that speeds up the operations on most browsers.\r\n var focused = activeElt();\r\n if (toUpdate > 4) display.lineDiv.style.display = \"none\";\r\n patchDisplay(cm, display.updateLineNumbers, update.dims);\r\n if (toUpdate > 4) display.lineDiv.style.display = \"\";\r\n // There might have been a widget with a focused element that got\r\n // hidden or updated, if so re-focus it.\r\n if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\r\n\r\n // Prevent selection and cursors from interfering with the scroll\r\n // width.\r\n removeChildren(display.cursorDiv);\r\n removeChildren(display.selectionDiv);\r\n\r\n if (different) {\r\n display.lastSizeC = update.wrapperHeight;\r\n startWorker(cm, 400);\r\n }\r\n\r\n display.updateLineNumbers = null;\r\n\r\n return true;\r\n }", "function updateDisplayIfNeeded(cm, update) {\n\t\t var display = cm.display, doc = cm.doc;\n\t\t\n\t\t if (update.editorIsHidden) {\n\t\t resetView(cm);\n\t\t return false;\n\t\t }\n\t\t\n\t\t // Bail out if the visible area is already rendered and nothing changed.\n\t\t if (!update.force &&\n\t\t update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n\t\t (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n\t\t display.renderedView == display.view && countDirtyView(cm) == 0)\n\t\t return false;\n\t\t\n\t\t if (maybeUpdateLineNumberWidth(cm)) {\n\t\t resetView(cm);\n\t\t update.dims = getDimensions(cm);\n\t\t }\n\t\t\n\t\t // Compute a suitable new viewport (from & to)\n\t\t var end = doc.first + doc.size;\n\t\t var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n\t\t var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n\t\t if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\n\t\t if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\n\t\t if (sawCollapsedSpans) {\n\t\t from = visualLineNo(cm.doc, from);\n\t\t to = visualLineEndNo(cm.doc, to);\n\t\t }\n\t\t\n\t\t var different = from != display.viewFrom || to != display.viewTo ||\n\t\t display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n\t\t adjustView(cm, from, to);\n\t\t\n\t\t display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n\t\t // Position the mover div to align with the current scroll position\n\t\t cm.display.mover.style.top = display.viewOffset + \"px\";\n\t\t\n\t\t var toUpdate = countDirtyView(cm);\n\t\t if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n\t\t (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n\t\t return false;\n\t\t\n\t\t // For big changes, we hide the enclosing element during the\n\t\t // update, since that speeds up the operations on most browsers.\n\t\t var focused = activeElt();\n\t\t if (toUpdate > 4) display.lineDiv.style.display = \"none\";\n\t\t patchDisplay(cm, display.updateLineNumbers, update.dims);\n\t\t if (toUpdate > 4) display.lineDiv.style.display = \"\";\n\t\t display.renderedView = display.view;\n\t\t // There might have been a widget with a focused element that got\n\t\t // hidden or updated, if so re-focus it.\n\t\t if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\n\t\t\n\t\t // Prevent selection and cursors from interfering with the scroll\n\t\t // width and height.\n\t\t removeChildren(display.cursorDiv);\n\t\t removeChildren(display.selectionDiv);\n\t\t display.gutters.style.height = display.sizer.style.minHeight = 0;\n\t\t\n\t\t if (different) {\n\t\t display.lastWrapHeight = update.wrapperHeight;\n\t\t display.lastWrapWidth = update.wrapperWidth;\n\t\t startWorker(cm, 400);\n\t\t }\n\t\t\n\t\t display.updateLineNumbers = null;\n\t\t\n\t\t return true;\n\t\t }", "function drawPointsChanged() {\n if (!drawPoints) {\n drawPoints = true\n } else {\n drawPoints = false\n };\n renderJob1.renderText();\n }", "_shouldDisplayLine(line) {\r\n return line.length > 0 && !this._ignoredLine;\r\n }", "function updateDisplayIfNeeded(cm, update) {\n\t var display = cm.display, doc = cm.doc;\n\t\n\t if (update.editorIsHidden) {\n\t resetView(cm);\n\t return false;\n\t }\n\t\n\t // Bail out if the visible area is already rendered and nothing changed.\n\t if (!update.force &&\n\t update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n\t (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n\t display.renderedView == display.view && countDirtyView(cm) == 0)\n\t return false;\n\t\n\t if (maybeUpdateLineNumberWidth(cm)) {\n\t resetView(cm);\n\t update.dims = getDimensions(cm);\n\t }\n\t\n\t // Compute a suitable new viewport (from & to)\n\t var end = doc.first + doc.size;\n\t var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n\t var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n\t if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\n\t if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\n\t if (sawCollapsedSpans) {\n\t from = visualLineNo(cm.doc, from);\n\t to = visualLineEndNo(cm.doc, to);\n\t }\n\t\n\t var different = from != display.viewFrom || to != display.viewTo ||\n\t display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n\t adjustView(cm, from, to);\n\t\n\t display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n\t // Position the mover div to align with the current scroll position\n\t cm.display.mover.style.top = display.viewOffset + \"px\";\n\t\n\t var toUpdate = countDirtyView(cm);\n\t if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n\t (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n\t return false;\n\t\n\t // For big changes, we hide the enclosing element during the\n\t // update, since that speeds up the operations on most browsers.\n\t var focused = activeElt();\n\t if (toUpdate > 4) display.lineDiv.style.display = \"none\";\n\t patchDisplay(cm, display.updateLineNumbers, update.dims);\n\t if (toUpdate > 4) display.lineDiv.style.display = \"\";\n\t display.renderedView = display.view;\n\t // There might have been a widget with a focused element that got\n\t // hidden or updated, if so re-focus it.\n\t if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\n\t\n\t // Prevent selection and cursors from interfering with the scroll\n\t // width and height.\n\t removeChildren(display.cursorDiv);\n\t removeChildren(display.selectionDiv);\n\t display.gutters.style.height = display.sizer.style.minHeight = 0;\n\t\n\t if (different) {\n\t display.lastWrapHeight = update.wrapperHeight;\n\t display.lastWrapWidth = update.wrapperWidth;\n\t startWorker(cm, 400);\n\t }\n\t\n\t display.updateLineNumbers = null;\n\t\n\t return true;\n\t }", "forceUpdate() {\n this.updating = true;\n m.redraw();\n }", "function updateDisplay(cm, viewPort, forced) {\n var oldFrom = cm.display.viewFrom, oldTo = cm.display.viewTo, updated;\n var visible = visibleLines(cm.display, cm.doc, viewPort);\n for (var first = true;; first = false) {\n var oldWidth = cm.display.scroller.clientWidth;\n if (!updateDisplayInner(cm, visible, forced)) break;\n updated = true;\n\n // If the max line changed since it was last measured, measure it,\n // and ensure the document's width matches it.\n if (cm.display.maxLineChanged && !cm.options.lineWrapping)\n adjustContentWidth(cm);\n\n var barMeasure = measureForScrollbars(cm);\n updateSelection(cm);\n setDocumentHeight(cm, barMeasure);\n updateScrollbars(cm, barMeasure);\n if (webkit && cm.options.lineWrapping)\n checkForWebkitWidthBug(cm, barMeasure); // (Issue #2420)\n if (webkit && barMeasure.scrollWidth > barMeasure.clientWidth &&\n barMeasure.scrollWidth < barMeasure.clientWidth + 1 &&\n !hScrollbarTakesSpace(cm))\n updateScrollbars(cm); // (Issue #2562)\n if (first && cm.options.lineWrapping && oldWidth != cm.display.scroller.clientWidth) {\n forced = true;\n continue;\n }\n forced = false;\n\n // Clip forced viewport to actual scrollable area.\n if (viewPort && viewPort.top != null)\n viewPort = {top: Math.min(barMeasure.docHeight - scrollerCutOff - barMeasure.clientHeight, viewPort.top)};\n // Updated line heights might result in the drawn area not\n // actually covering the viewport. Keep looping until it does.\n visible = visibleLines(cm.display, cm.doc, viewPort);\n if (visible.from >= cm.display.viewFrom && visible.to <= cm.display.viewTo)\n break;\n }\n\n cm.display.updateLineNumbers = null;\n if (updated) {\n signalLater(cm, \"update\", cm);\n if (cm.display.viewFrom != oldFrom || cm.display.viewTo != oldTo)\n signalLater(cm, \"viewportChange\", cm, cm.display.viewFrom, cm.display.viewTo);\n }\n return updated;\n }", "function updateDisplayIfNeeded(cm, update) {\r\n var display = cm.display, doc = cm.doc;\r\n\r\n if (update.editorIsHidden) {\r\n resetView(cm);\r\n return false\r\n }\r\n\r\n // Bail out if the visible area is already rendered and nothing changed.\r\n if (!update.force &&\r\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\r\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\r\n display.renderedView == display.view && countDirtyView(cm) == 0)\r\n { return false }\r\n\r\n if (maybeUpdateLineNumberWidth(cm)) {\r\n resetView(cm);\r\n update.dims = getDimensions(cm);\r\n }\r\n\r\n // Compute a suitable new viewport (from & to)\r\n var end = doc.first + doc.size;\r\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\r\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\r\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\r\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\r\n if (sawCollapsedSpans) {\r\n from = visualLineNo(cm.doc, from);\r\n to = visualLineEndNo(cm.doc, to);\r\n }\r\n\r\n var different = from != display.viewFrom || to != display.viewTo ||\r\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\r\n adjustView(cm, from, to);\r\n\r\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\r\n // Position the mover div to align with the current scroll position\r\n cm.display.mover.style.top = display.viewOffset + \"px\";\r\n\r\n var toUpdate = countDirtyView(cm);\r\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\r\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\r\n { return false }\r\n\r\n // For big changes, we hide the enclosing element during the\r\n // update, since that speeds up the operations on most browsers.\r\n var selSnapshot = selectionSnapshot(cm);\r\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\r\n patchDisplay(cm, display.updateLineNumbers, update.dims);\r\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\r\n display.renderedView = display.view;\r\n // There might have been a widget with a focused element that got\r\n // hidden or updated, if so re-focus it.\r\n restoreSelection(selSnapshot);\r\n\r\n // Prevent selection and cursors from interfering with the scroll\r\n // width and height.\r\n removeChildren(display.cursorDiv);\r\n removeChildren(display.selectionDiv);\r\n display.gutters.style.height = display.sizer.style.minHeight = 0;\r\n\r\n if (different) {\r\n display.lastWrapHeight = update.wrapperHeight;\r\n display.lastWrapWidth = update.wrapperWidth;\r\n startWorker(cm, 400);\r\n }\r\n\r\n display.updateLineNumbers = null;\r\n\r\n return true\r\n}", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false;\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n return false;\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\n if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n return false;\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var focused = activeElt();\n if (toUpdate > 4) display.lineDiv.style.display = \"none\";\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) display.lineDiv.style.display = \"\";\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true;\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false;\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n return false;\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\n if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n return false;\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var focused = activeElt();\n if (toUpdate > 4) display.lineDiv.style.display = \"none\";\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) display.lineDiv.style.display = \"\";\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true;\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false;\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n return false;\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\n if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n return false;\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var focused = activeElt();\n if (toUpdate > 4) display.lineDiv.style.display = \"none\";\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) display.lineDiv.style.display = \"\";\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true;\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false;\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n return false;\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\n if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n return false;\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var focused = activeElt();\n if (toUpdate > 4) display.lineDiv.style.display = \"none\";\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) display.lineDiv.style.display = \"\";\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true;\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display,\n doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false;\n } // Bail out if the visible area is already rendered and nothing changed.\n\n\n if (!update.force && update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo && (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) && display.renderedView == display.view && countDirtyView(cm) == 0) {\n return false;\n }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n } // Compute a suitable new viewport (from & to)\n\n\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n\n if (display.viewFrom < from && from - display.viewFrom < 20) {\n from = Math.max(doc.first, display.viewFrom);\n }\n\n if (display.viewTo > to && display.viewTo - to < 20) {\n to = Math.min(end, display.viewTo);\n }\n\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo || display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n display.viewOffset = _heightAtLine(getLine(cm.doc, display.viewFrom)); // Position the mover div to align with the current scroll position\n\n cm.display.mover.style.top = display.viewOffset + \"px\";\n var toUpdate = countDirtyView(cm);\n\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view && (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo)) {\n return false;\n } // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n\n\n var selSnapshot = selectionSnapshot(cm);\n\n if (toUpdate > 4) {\n display.lineDiv.style.display = \"none\";\n }\n\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n\n if (toUpdate > 4) {\n display.lineDiv.style.display = \"\";\n }\n\n display.renderedView = display.view; // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n\n restoreSelection(selSnapshot); // Prevent selection and cursors from interfering with the scroll\n // width and height.\n\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n return true;\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n if (update.editorIsHidden) {\n resetView(cm);\n return false;\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n countDirtyView(cm) == 0)\n return false;\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\n if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n return false;\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var focused = activeElt();\n if (toUpdate > 4) display.lineDiv.style.display = \"none\";\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) display.lineDiv.style.display = \"\";\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\n\n // Prevent selection and cursors from interfering with the scroll\n // width.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true;\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n if (update.editorIsHidden) {\n resetView(cm);\n return false;\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n countDirtyView(cm) == 0)\n return false;\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\n if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastSizeC != update.wrapperHeight;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n return false;\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var focused = activeElt();\n if (toUpdate > 4) display.lineDiv.style.display = \"none\";\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) display.lineDiv.style.display = \"\";\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\n\n // Prevent selection and cursors from interfering with the scroll\n // width.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n\n if (different) {\n display.lastSizeC = update.wrapperHeight;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true;\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n if (update.editorIsHidden) {\n resetView(cm);\n return false;\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n countDirtyView(cm) == 0)\n return false;\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\n if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastSizeC != update.wrapperHeight;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n return false;\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var focused = activeElt();\n if (toUpdate > 4) display.lineDiv.style.display = \"none\";\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) display.lineDiv.style.display = \"\";\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\n\n // Prevent selection and cursors from interfering with the scroll\n // width.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n\n if (different) {\n display.lastSizeC = update.wrapperHeight;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true;\n }", "function checkVisibleLines () {\n\tif (allVisibleLinesJustified()) {\n\t\t$('#problemButton').show();\n\t\t$('#ruleInstructionsPartial').html('Correct! Click \\'Next Line\\' to continue.');\n\t}\n}", "update(redrawOnly = false) {\n this.graphics.clear();\n if (redrawOnly) {\n this.drawAppropriateLine();\n } else {\n this.draw(true);\n }\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n}", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n}", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n}", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n}", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n}", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n}", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n}", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n}", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n}", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n}", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n}", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc\n\n if (update.editorIsHidden) {\n resetView(cm)\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm)\n update.dims = getDimensions(cm)\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first)\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin)\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom) }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo) }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from)\n to = visualLineEndNo(cm.doc, to)\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth\n adjustView(cm, from, to)\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom))\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\"\n\n var toUpdate = countDirtyView(cm)\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var focused = activeElt()\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\" }\n patchDisplay(cm, display.updateLineNumbers, update.dims)\n if (toUpdate > 4) { display.lineDiv.style.display = \"\" }\n display.renderedView = display.view\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n if (focused && activeElt() != focused && focused.offsetHeight) { focused.focus() }\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv)\n removeChildren(display.selectionDiv)\n display.gutters.style.height = display.sizer.style.minHeight = 0\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight\n display.lastWrapWidth = update.wrapperWidth\n startWorker(cm, 400)\n }\n\n display.updateLineNumbers = null\n\n return true\n}", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc\n\n if (update.editorIsHidden) {\n resetView(cm)\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm)\n update.dims = getDimensions(cm)\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first)\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin)\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom) }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo) }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from)\n to = visualLineEndNo(cm.doc, to)\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth\n adjustView(cm, from, to)\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom))\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\"\n\n var toUpdate = countDirtyView(cm)\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var focused = activeElt()\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\" }\n patchDisplay(cm, display.updateLineNumbers, update.dims)\n if (toUpdate > 4) { display.lineDiv.style.display = \"\" }\n display.renderedView = display.view\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n if (focused && activeElt() != focused && focused.offsetHeight) { focused.focus() }\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv)\n removeChildren(display.selectionDiv)\n display.gutters.style.height = display.sizer.style.minHeight = 0\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight\n display.lastWrapWidth = update.wrapperWidth\n startWorker(cm, 400)\n }\n\n display.updateLineNumbers = null\n\n return true\n}", "moveToNextLine() {\n if (this.currentLineNb >= this.lines.length - 1) {\n return false;\n }\n this.currentLine = this.lines[++this.currentLineNb];\n return true;\n }", "function update() {\n\t\t\tif (textarea.value == mirror) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tvar insertedChars = (textarea.value.length - mirror.length), newData;\n\n\t\t\tif (textarea.value.length < offset ||\n\t\t\t selection.start < offset ||\n\t\t\t\tdata.length + insertedChars > options.maxLength) {\n\t\t\t\tpopup.hide();\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tnewData = textarea.value.slice(offset, offset + data.length + insertedChars);\n\n\t\t\tupdateCaret();\n\t\t\tif (newData == data) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tdata = newData;\n\t\t\tmirror = textarea.value;\n\t\t\treturn true;\n\t\t}", "function checkLines() {\n for (var y = 0; y < dimention[1]; y++) {\n var lineComplete = field[y].every(function(cell, x) {\n return field[y][x] === field[y][(x + 1) % dimention[0]];\n });\n // ..and if so, blow the line up\n if (lineComplete) {\n if (debug) { Render.drawState(field); debugger; }\n for (var x = 0; x < dimention[0]; x++) {\n field[y][x] = Render.isNeutral(x, y) ? 0 : -field[y][x];\n }\n if (debug) { Render.drawState(field); debugger; }\n // ..and make all top blocks fall\n if (dir === 1) { // ..down\n for (var row = y - 1; row >= 0; row--) {\n moveLineDown(row);\n }\n } else { // ..up\n for (var row = y + 1; row < dimention[1]; row++) {\n moveLineDown(row);\n }\n }\n if (debug) { Render.drawState(field); debugger; }\n }\n }\n }", "update() {\n if (!this.visible)\n\t return;\n }", "lineFeed() {\n // make buffer local for faster access\n const buffer = this._bufferService.buffer;\n this._dirtyRowService.markDirty(buffer.y);\n if (this._optionsService.options.convertEol) {\n buffer.x = 0;\n }\n buffer.y++;\n if (buffer.y === buffer.scrollBottom + 1) {\n buffer.y--;\n this._onRequestScroll.fire(this._eraseAttrData());\n }\n else if (buffer.y >= this._bufferService.rows) {\n buffer.y = this._bufferService.rows - 1;\n }\n // If the end of the line is hit, prevent this action from wrapping around to the next line.\n if (buffer.x >= this._bufferService.cols) {\n buffer.x--;\n }\n this._dirtyRowService.markDirty(buffer.y);\n this._onLineFeed.fire();\n return true;\n }", "function check_if_update(){\n if(total_results_past == total_results){\n read_speech(\"Here's a hint. You're supposed to say: \" + window.paragraph_list[window.curr_paragraph])\n } else{\n if(flip){\n if(conf_score == conf_score_past){\n read_speech(\"You seem lost. You're supposed to say: \" + window.paragraph_list[window.curr_paragraph])\n }\n conf_score_past = conf_score\n }\n }\n total_results_past = total_results\n flip = !flip;\n}", "function update(forced) {\n\t\t\t\t\t\n\t\t\t\t\t// Get curated content from the textarea.\n\t\t\t\t\tvar textareaContent = $textarea.val().replace(/&/g,'&amp;').replace(/ {2}/g, '&nbsp;').replace(/<|>/g, '&gt;').replace(/\\n/g, '<br />');\n\t\t\t\t\t\n\t\t\t\t\t// Compare curated content with curated twin.\n\t\t\t\t\tvar twinContent = $twin.html().replace(/<br>/ig,'<br />');\n\t\t\t\t\t\n\t\t\t\t\tif(forced || textareaContent+'&nbsp;' !== twinContent){\n\t\t\t\t\t\n\t\t\t\t\t\t// Add an extra white space so new rows are added when you are at the end of a row.\n\t\t\t\t\t\t$twin.html(textareaContent+'&nbsp;');\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Change textarea height if twin plus the height of one line differs more than 3 pixel from textarea height\n\t\t\t\t\t\tif(Math.abs($twin.height() + lineHeight - $textarea.height()) > 3){\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tvar goalheight = $twin.height()+lineHeight;\n\t\t\t\t\t\t\tif(goalheight >= maxheight) {\n\t\t\t\t\t\t\t\tsetHeightAndOverflow(maxheight,'auto');\n\t\t\t\t\t\t\t} else if(goalheight <= minheight) {\n\t\t\t\t\t\t\t\tsetHeightAndOverflow(minheight,'hidden');\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tsetHeightAndOverflow(goalheight,'hidden');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}", "function update(forced) {\n\t\t\t\t\t\n\t\t\t\t\t// Get curated content from the textarea.\n\t\t\t\t\tvar textareaContent = $textarea.val().replace(/&/g,'&amp;').replace(/ {2}/g, '&nbsp;').replace(/<|>/g, '&gt;').replace(/\\n/g, '<br />');\n\t\t\t\t\t\n\t\t\t\t\t// Compare curated content with curated twin.\n\t\t\t\t\tvar twinContent = $twin.html().replace(/<br>/ig,'<br />');\n\t\t\t\t\t\n\t\t\t\t\tif(forced || textareaContent+'&nbsp;' !== twinContent){\n\t\t\t\t\t\n\t\t\t\t\t\t// Add an extra white space so new rows are added when you are at the end of a row.\n\t\t\t\t\t\t$twin.html(textareaContent+'&nbsp;');\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Change textarea height if twin plus the height of one line differs more than 3 pixel from textarea height\n\t\t\t\t\t\tif(Math.abs($twin.height() + lineHeight - $textarea.height()) > 3){\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tvar goalheight = $twin.height()+lineHeight;\n\t\t\t\t\t\t\tif(goalheight >= maxheight) {\n\t\t\t\t\t\t\t\tsetHeightAndOverflow(maxheight,'auto');\n\t\t\t\t\t\t\t} else if(goalheight <= minheight) {\n\t\t\t\t\t\t\t\tsetHeightAndOverflow(minheight,'hidden');\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tsetHeightAndOverflow(goalheight,'hidden');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}", "function updateOutput() {\n if (!curTrace) {\n return;\n }\n\n useJsPlumbRendering = !($(\"#classicModeCheckbox\").prop(\"checked\"));\n\n var curEntry = curTrace[curInstr];\n var hasError = false;\n\n // render VCR controls:\n var totalInstrs = curTrace.length;\n\n // to be user-friendly, if we're on the LAST instruction, print \"Program has terminated\"\n // and DON'T highlight any lines of code in the code display\n if (curInstr == (totalInstrs-1)) {\n if (instrLimitReached) {\n $(\"#vcrControls #curInstr\").html(\"Instruction limit reached\");\n }\n else {\n $(\"#vcrControls #curInstr\").html(\"Program has terminated\");\n }\n }\n else {\n $(\"#vcrControls #curInstr\").html(\"About to do step \" + (curInstr + 1) + \" of \" + (totalInstrs-1));\n }\n\n $(\"#vcrControls #jmpFirstInstr\").attr(\"disabled\", false);\n $(\"#vcrControls #jmpStepBack\").attr(\"disabled\", false);\n $(\"#vcrControls #jmpStepFwd\").attr(\"disabled\", false);\n $(\"#vcrControls #jmpLastInstr\").attr(\"disabled\", false);\n\n if (curInstr == 0) {\n $(\"#vcrControls #jmpFirstInstr\").attr(\"disabled\", true);\n $(\"#vcrControls #jmpStepBack\").attr(\"disabled\", true);\n }\n if (curInstr == (totalInstrs-1)) {\n $(\"#vcrControls #jmpLastInstr\").attr(\"disabled\", true);\n $(\"#vcrControls #jmpStepFwd\").attr(\"disabled\", true);\n }\n\n\n // render error (if applicable):\n if (curEntry.event == 'exception' ||\n curEntry.event == 'uncaught_exception') {\n assert(curEntry.exception_msg);\n\n if (curEntry.exception_msg == \"Unknown error\") {\n $(\"#errorOutput\").html('Unknown error: Please email a bug report to [email protected]');\n }\n else {\n $(\"#errorOutput\").html(htmlspecialchars(curEntry.exception_msg));\n }\n\n $(\"#errorOutput\").show();\n\n hasError = true;\n }\n else {\n if (!instrLimitReached) { // ugly, I know :/\n $(\"#errorOutput\").hide();\n }\n }\n\n\n // render code output:\n if (curEntry.line) {\n // calculate all lines that have been 'visited' \n // by execution up to (but NOT INCLUDING) curInstr:\n var visitedLinesSet = {}\n for (var i = 0; i < curInstr; i++) {\n if (curTrace[i].line) {\n visitedLinesSet[curTrace[i].line] = true;\n }\n }\n highlightCodeLine(curEntry.line, visitedLinesSet, hasError,\n /* if instrLimitReached, then treat like a normal non-terminating line */\n (!instrLimitReached && (curInstr == (totalInstrs-1))));\n }\n\n\n // render stdout:\n\n // keep original horizontal scroll level:\n var oldLeft = $(\"#pyStdout\").scrollLeft();\n $(\"#pyStdout\").val(curEntry.stdout);\n\n $(\"#pyStdout\").scrollLeft(oldLeft);\n // scroll to bottom, tho:\n $(\"#pyStdout\").scrollTop($(\"#pyStdout\").attr('scrollHeight'));\n\n\n // finally, render all the data structures!!!\n renderDataStructures(curEntry, \"#dataViz\");\n}", "requestRedraw () {\n this.redrawRequested = true;\n }", "forceUpdate() {\n if (this[_queuedUpdate]) {\n this[_dirty] = true;\n return;\n }\n\n this[_virtualRender]();\n this[_queuedUpdate] = true;\n\n TaskQueue.push(() => {\n if (this[_dirty] && !this.isDisposed) {\n this[_virtualRender]();\n this[_dirty] = false;\n }\n this[_queuedUpdate] = false;\n });\n }", "function updateDisplay(changes, suppressCallback) {\n if (!scroller.clientWidth) {\n showingFrom = showingTo = displayOffset = 0;\n return;\n }\n // Compute the new visible window\n var visible = visibleLines();\n // Bail out if the visible area is already rendered and nothing changed.\n if (changes !== true && changes.length == 0 && visible.from >= showingFrom && visible.to <= showingTo) return;\n var from = Math.max(visible.from - 100, 0), to = Math.min(doc.size, visible.to + 100);\n if (showingFrom < from && from - showingFrom < 20) from = showingFrom;\n if (showingTo > to && showingTo - to < 20) to = Math.min(doc.size, showingTo);\n\n // Create a range of theoretically intact lines, and punch holes\n // in that using the change info.\n var intact = changes === true ? [] :\n computeIntact([{from: showingFrom, to: showingTo, domStart: 0}], changes);\n // Clip off the parts that won't be visible\n var intactLines = 0;\n for (var i = 0; i < intact.length; ++i) {\n var range = intact[i];\n if (range.from < from) {range.domStart += (from - range.from); range.from = from;}\n if (range.to > to) range.to = to;\n if (range.from >= range.to) intact.splice(i--, 1);\n else intactLines += range.to - range.from;\n }\n if (intactLines == to - from) return;\n intact.sort(function(a, b) {return a.domStart - b.domStart;});\n\n var th = textHeight(), gutterDisplay = gutter.style.display;\n lineDiv.style.display = gutter.style.display = \"none\";\n patchDisplay(from, to, intact);\n lineDiv.style.display = \"\";\n\n // Position the mover div to align with the lines it's supposed\n // to be showing (which will cover the visible display)\n var different = from != showingFrom || to != showingTo || lastSizeC != scroller.clientHeight + th;\n // This is just a bogus formula that detects when the editor is\n // resized or the font size changes.\n if (different) lastSizeC = scroller.clientHeight + th;\n showingFrom = from; showingTo = to;\n displayOffset = heightAtLine(doc, from);\n mover.style.top = (displayOffset * th) + \"px\";\n code.style.height = (doc.height * th + 2 * paddingTop()) + \"px\";\n\n // Since this is all rather error prone, it is honoured with the\n // only assertion in the whole file.\n if (lineDiv.childNodes.length != showingTo - showingFrom)\n throw new Error(\"BAD PATCH! \" + JSON.stringify(intact) + \" size=\" + (showingTo - showingFrom) +\n \" nodes=\" + lineDiv.childNodes.length);\n\n if (options.lineWrapping) {\n maxWidth = scroller.clientWidth;\n var curNode = lineDiv.firstChild;\n doc.iter(showingFrom, showingTo, function(line) {\n if (!line.hidden) {\n var height = Math.round(curNode.offsetHeight / th) || 1;\n if (line.height != height) {updateLineHeight(line, height); gutterDirty = true;}\n }\n curNode = curNode.nextSibling;\n });\n } else {\n if (maxWidth == null) maxWidth = stringWidth(maxLine);\n if (maxWidth > scroller.clientWidth) {\n lineSpace.style.width = maxWidth + \"px\";\n // Needed to prevent odd wrapping/hiding of widgets placed in here.\n code.style.width = \"\";\n code.style.width = scroller.scrollWidth + \"px\";\n } else {\n lineSpace.style.width = code.style.width = \"\";\n }\n }\n gutter.style.display = gutterDisplay;\n if (different || gutterDirty) updateGutter();\n updateCursor();\n if (!suppressCallback && options.onUpdate) options.onUpdate(instance);\n return true;\n }", "function updateState() {\n\n var isSeated = updatePoints();\n\n // var lastSignal = points.length - 1;\n // var isSeated = points[lastSignal][1] > 250;\n if (!error) {\n drawResult(isSeated);\n }\n}", "function updateDisplay(changes, suppressCallback) {\n if (!scroller.clientWidth) {\n showingFrom = showingTo = displayOffset = 0;\n return;\n }\n // Compute the new visible window\n var visible = visibleLines();\n // Bail out if the visible area is already rendered and nothing changed.\n if (changes !== true && changes.length == 0 && visible.from > showingFrom && visible.to < showingTo) return;\n var from = Math.max(visible.from - 100, 0), to = Math.min(doc.size, visible.to + 100);\n if (showingFrom < from && from - showingFrom < 20) from = showingFrom;\n if (showingTo > to && showingTo - to < 20) to = Math.min(doc.size, showingTo);\n\n // Create a range of theoretically intact lines, and punch holes\n // in that using the change info.\n var intact = changes === true ? [] :\n computeIntact([{from: showingFrom, to: showingTo, domStart: 0}], changes);\n // Clip off the parts that won't be visible\n var intactLines = 0;\n for (var i = 0; i < intact.length; ++i) {\n var range = intact[i];\n if (range.from < from) {range.domStart += (from - range.from); range.from = from;}\n if (range.to > to) range.to = to;\n if (range.from >= range.to) intact.splice(i--, 1);\n else intactLines += range.to - range.from;\n }\n if (intactLines == to - from && from == showingFrom && to == showingTo) return;\n intact.sort(function(a, b) {return a.domStart - b.domStart;});\n\n var th = textHeight(), gutterDisplay = gutter.style.display;\n lineDiv.style.display = \"none\";\n patchDisplay(from, to, intact);\n lineDiv.style.display = gutter.style.display = \"\";\n\n // Position the mover div to align with the lines it's supposed\n // to be showing (which will cover the visible display)\n var different = from != showingFrom || to != showingTo || lastSizeC != scroller.clientHeight + th;\n // This is just a bogus formula that detects when the editor is\n // resized or the font size changes.\n if (different) lastSizeC = scroller.clientHeight + th;\n showingFrom = from; showingTo = to;\n displayOffset = heightAtLine(doc, from);\n mover.style.top = (displayOffset * th) + \"px\";\n if (scroller.clientHeight)\n code.style.height = (doc.height * th + 2 * paddingTop()) + \"px\";\n\n // Since this is all rather error prone, it is honoured with the\n // only assertion in the whole file.\n if (lineDiv.childNodes.length != showingTo - showingFrom)\n throw new Error(\"BAD PATCH! \" + JSON.stringify(intact) + \" size=\" + (showingTo - showingFrom) +\n \" nodes=\" + lineDiv.childNodes.length);\n\n function checkHeights() {\n maxWidth = scroller.clientWidth;\n var curNode = lineDiv.firstChild, heightChanged = false;\n doc.iter(showingFrom, showingTo, function(line) {\n if (!line.hidden) {\n var height = Math.round(curNode.offsetHeight / th) || 1;\n if (line.height != height) {\n updateLineHeight(line, height);\n gutterDirty = heightChanged = true;\n }\n }\n curNode = curNode.nextSibling;\n });\n if (heightChanged)\n code.style.height = (doc.height * th + 2 * paddingTop()) + \"px\";\n return heightChanged;\n }\n\n if (options.lineWrapping) {\n checkHeights();\n } else {\n if (maxWidth == null) maxWidth = stringWidth(maxLine);\n if (maxWidth > scroller.clientWidth) {\n lineSpace.style.width = maxWidth + \"px\";\n // Needed to prevent odd wrapping/hiding of widgets placed in here.\n code.style.width = \"\";\n code.style.width = scroller.scrollWidth + \"px\";\n } else {\n lineSpace.style.width = code.style.width = \"\";\n }\n }\n\n gutter.style.display = gutterDisplay;\n if (different || gutterDirty) {\n // If the gutter grew in size, re-check heights. If those changed, re-draw gutter.\n updateGutter() && options.lineWrapping && checkHeights() && updateGutter();\n }\n updateSelection();\n if (!suppressCallback && options.onUpdate) options.onUpdate(instance);\n return true;\n }", "function updateDisplay(changes, suppressCallback) {\n if (!scroller.clientWidth) {\n showingFrom = showingTo = displayOffset = 0;\n return;\n }\n // Compute the new visible window\n var visible = visibleLines();\n // Bail out if the visible area is already rendered and nothing changed.\n if (changes !== true && changes.length == 0 && visible.from > showingFrom && visible.to < showingTo) return;\n var from = Math.max(visible.from - 100, 0), to = Math.min(doc.size, visible.to + 100);\n if (showingFrom < from && from - showingFrom < 20) from = showingFrom;\n if (showingTo > to && showingTo - to < 20) to = Math.min(doc.size, showingTo);\n\n // Create a range of theoretically intact lines, and punch holes\n // in that using the change info.\n var intact = changes === true ? [] :\n computeIntact([{from: showingFrom, to: showingTo, domStart: 0}], changes);\n // Clip off the parts that won't be visible\n var intactLines = 0;\n for (var i = 0; i < intact.length; ++i) {\n var range = intact[i];\n if (range.from < from) {range.domStart += (from - range.from); range.from = from;}\n if (range.to > to) range.to = to;\n if (range.from >= range.to) intact.splice(i--, 1);\n else intactLines += range.to - range.from;\n }\n if (intactLines == to - from && from == showingFrom && to == showingTo) return;\n intact.sort(function(a, b) {return a.domStart - b.domStart;});\n\n var th = textHeight(), gutterDisplay = gutter.style.display;\n lineDiv.style.display = \"none\";\n patchDisplay(from, to, intact);\n lineDiv.style.display = gutter.style.display = \"\";\n\n // Position the mover div to align with the lines it's supposed\n // to be showing (which will cover the visible display)\n var different = from != showingFrom || to != showingTo || lastSizeC != scroller.clientHeight + th;\n // This is just a bogus formula that detects when the editor is\n // resized or the font size changes.\n if (different) lastSizeC = scroller.clientHeight + th;\n showingFrom = from; showingTo = to;\n displayOffset = heightAtLine(doc, from);\n mover.style.top = (displayOffset * th) + \"px\";\n if (scroller.clientHeight)\n code.style.height = (doc.height * th + 2 * paddingTop()) + \"px\";\n\n // Since this is all rather error prone, it is honoured with the\n // only assertion in the whole file.\n if (lineDiv.childNodes.length != showingTo - showingFrom)\n throw new Error(\"BAD PATCH! \" + JSON.stringify(intact) + \" size=\" + (showingTo - showingFrom) +\n \" nodes=\" + lineDiv.childNodes.length);\n\n function checkHeights() {\n maxWidth = scroller.clientWidth;\n var curNode = lineDiv.firstChild, heightChanged = false;\n doc.iter(showingFrom, showingTo, function(line) {\n if (!line.hidden) {\n var height = Math.round(curNode.offsetHeight / th) || 1;\n if (line.height != height) {\n updateLineHeight(line, height);\n gutterDirty = heightChanged = true;\n }\n }\n curNode = curNode.nextSibling;\n });\n if (heightChanged)\n code.style.height = (doc.height * th + 2 * paddingTop()) + \"px\";\n return heightChanged;\n }\n\n if (options.lineWrapping) {\n checkHeights();\n } else {\n if (maxWidth == null) maxWidth = stringWidth(maxLine);\n if (maxWidth > scroller.clientWidth) {\n lineSpace.style.width = maxWidth + \"px\";\n // Needed to prevent odd wrapping/hiding of widgets placed in here.\n code.style.width = \"\";\n code.style.width = scroller.scrollWidth + \"px\";\n } else {\n lineSpace.style.width = code.style.width = \"\";\n }\n }\n\n gutter.style.display = gutterDisplay;\n if (different || gutterDirty) {\n // If the gutter grew in size, re-check heights. If those changed, re-draw gutter.\n updateGutter() && options.lineWrapping && checkHeights() && updateGutter();\n }\n updateSelection();\n if (!suppressCallback && options.onUpdate) options.onUpdate(instance);\n return true;\n }", "function updateDisplay(value){\n\tif(displayLength+1 < LIMIT){ \n\t\tif(value == '0' && prevValue == '/')\n\t\t\talert('You can\\'t divide by zero')\n\t\telse if(value >= '0' && value <= '9'){\n\t\t\tdisplayedContent.textContent += value;\n\t\t\tdisplayLength++;\n\t\t\tprevValue = value;\n\t\t}\n\t\telse if((prevValue >= '0' && prevValue <= '9') || (displayedContent.textContent=='' && value == '-')){\n\t\t\tif(value == '.'){\n\t\t\t\tdisplayedContent.textContent += value;\n\t\t\t\tdisplayLength++;\n\t\t\t\tprevValue = value;\n\t\t\t\tdocument.querySelector(\"#dot\").disabled = true;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tdisplayedContent.textContent += value;\n\t\t\t\tdisplayLength++;\n\t\t\t\tprevValue = value;\n\t\t\t\tdocument.querySelector(\"#dot\").disabled = false;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t\talert ('You can\\'t input operator that way!');\n\t}\n\telse\n\t\talert('There is no space for that!');\n}", "function updatePromptDisplay(){\n var line = promptText;\n var html = '';\n if (column > 0 && line == ''){\n // When we have an empty line just display a cursor.\n html = cursor;\n } else if (column == promptText.length){\n // We're at the end of the line, so we need to display\n // the text *and* cursor.\n html = htmlEncode(line) + cursor;\n } else {\n // Grab the current character, if there is one, and\n // make it the current cursor.\n var before = line.substring(0, column);\n var current = line.substring(column,column+1);\n if (current){\n current = \n '<span class=\"jquery-console-cursor\">' +\n htmlEncode(current) +\n '</span>';\n }\n var after = line.substring(column+1);\n html = htmlEncode(before) + current + htmlEncode(after);\n }\n prompt.html(html);\n scrollToBottom();\n }", "function isWholeLineUpdate(doc, change) {\n\t\t return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == \"\" &&\n\t\t (!doc.cm || doc.cm.options.wholeLineUpdateBefore)\n\t\t }", "function updateLine(line, fromX, fromY, toX, toY) {\n\n line.graphics.clear();\n line.graphics.alpha = 1.0;\n line.graphics.setStrokeStyle(1);\n line.graphics.beginStroke(color.GRAY);\n line.graphics.moveTo(fromX, fromY);\n line.graphics.lineTo(toX, toY);\n line.graphics.endStroke();\n}", "function checkLine () {\r\n let lineCount = 0;\r\n\r\n for ( let y = 0; y < FIELD_ROW; y++ ) {\r\n //Variable to see if a line is completed\r\n let isCompleted = true;\r\n\r\n //Check the completion\r\n for ( let x = 0; x < FIELD_COLUMN; x++ ) {\r\n //If NO block is found, it means the line is not completed yet\r\n if ( !field[y][x] ) {\r\n isCompleted = false;\r\n break;\r\n }\r\n }\r\n\r\n //Clear a completed line\r\n if ( isCompleted ) {\r\n lineCount++;\r\n\r\n for ( let newY = y; 0 < newY; newY-- ) {\r\n for ( let newX = 0; newX < FIELD_COLUMN; newX++ ) {\r\n //A new line will be updated as the upper line\r\n field[ newY ][ newX ] = field[ newY-1 ][ newX ];\r\n }\r\n }\r\n }\r\n }\r\n}", "_onUpdateDisplay() {}", "function update(position) {\n var len = storedLines.length;\n if(len==0) return;\n\n draw();\n ctx.fillStyle = \"yellow\";\n ctx.beginPath();\n ctx.arc(storedLines[0].x, storedLines[0].y, radius, 0, 2 * Math.PI, false);\n ctx.fill();\n\n ctx.strokeStyle = \"darkblue\";\n ctx.lineWidth = 1;\n ctx.beginPath();\n ctx.moveTo(storedLines[0].x, storedLines[0].y);\n for(var i=1; i<len; ++i) {\n ctx.lineTo(storedLines[i].x, storedLines[i].y)\n }\n ctx.lineTo(position.x, position.y);\n ctx.stroke();\n }", "function isWholeLineUpdate(doc, change) {\n\t\t return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == \"\" &&\n\t\t (!doc.cm || doc.cm.options.wholeLineUpdateBefore);\n\t\t }", "function isWholeLineUpdate(doc, change) {\n\t return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == \"\" &&\n\t (!doc.cm || doc.cm.options.wholeLineUpdateBefore);\n\t }", "function isWholeLineUpdate(doc, change) {\n\t return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == \"\" &&\n\t (!doc.cm || doc.cm.options.wholeLineUpdateBefore);\n\t }", "function isWholeLineUpdate(doc, change) {\n\t return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == \"\" &&\n\t (!doc.cm || doc.cm.options.wholeLineUpdateBefore);\n\t }", "isDraw() {\n\tif(!this.isFinished()||this.getWinner()!==null)\n return false;\n else\n return true;\n }", "function updateLines(){\n showLines.innerHTML = ++lineCounter;\n nextLevel(); \n}", "function updateLines(line) {\n\n\t\t \t// Make sure line is valid\n\t\t \tif(line[0] > 0 && line[1] > 0) {\n\t\t \t\tline[2] = false;\n\t\t \t}\n\n\t\t \t// Update line counts\n\t\t if(line[2] == true) {\n\t\t if(line[0] > 0) {\n\t\t player1Lines[line[0] - 1]++;\n\t\t }\n\t\t if(line[1] > 0) {\n\t\t player2Lines[line[1] - 1]++;\n\t\t }\n\t\t }\n\t\t }", "function updateDrawingLineOfAPeer(oldLineObj, newLineObj) {\n oldLineObj.set({\n x2: (newLineObj.x1 < 0) ? newLineObj.left + newLineObj.width : newLineObj.left ,\n y2: (newLineObj.y1 < 0) ? newLineObj.top + newLineObj.height : newLineObj.top\n });\n}", "function validateLine(rowId) {\n\t// If not modified, don't validate\n\tif (cellValue(rowId, \"updated\") != \"true\") {\n\t\treturn true;\n\t}\n\telse {\n\t\tvar price = cellValue(rowId, \"defaultPrice\");\n\t\tif (price != null && price.length > 0 && !isFloat(price)) {\n\t\t\t// Select the row with the error and grab the cursor there as well\n\t\t\tmygrid.selectRowById(rowId, null, false, false);\n\t\t\tdocument.getElementById(\"defaultPrice\" + rowId).focus();\n\t\t\talert(messagesData.notFloat);\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}", "function recalcLines() {\n if (verifyInterface(this._clientInterfaceObj) == true) {\n this._clientInterfaceObj.RecalcLines();\n }\n }", "forceUpdate() {\n return this._startUpdate();\n }", "update() {\r\n this.draw();\r\n inputChange();\r\n }", "function updateDisplay() {\n node\n .attr(\"r\", forceProperties.collide.radius)\n .attr(\"stroke\", forceProperties.charge.strength > 0 ? \"blue\" : \"red\")\n .attr(\"stroke-width\", forceProperties.charge.enabled == false ? 0 : Math.abs(forceProperties.charge.strength) / 15);\n\n \n link\n .attr(\"stroke-width\", forceProperties.link.enabled ? 3 : .5)\n .attr(\"opacity\", forceProperties.link.enabled ? 1 : 0);\n}", "function nextUpdate() {\n\tUPDATING = false;\n\trefreshTimeout = setTimeout(function(){ \n\t\tstartDrawingData(); \n\t}, UPDATE_INTERVAL * 1000);\n}", "function TreeViewItem_UpdateLine()\n{\n\t//have we got a valid html?\n\tif (!this.HTML)\n\t{\n\t\t//create a new line\n\t\tthis.HTML = this.TreeData.HTML.CONTENT.appendChild(document.createElement(\"div\"));\n\t\t//set its styles\n\t\tthis.HTML.style.cssText = \"position:absolute;width:100%;left:0px;overflow:visible;\";\n\t\tthis.HTML.style.height = this.TreeData.TreeLineHeight + (this.TreeData.SAPBelize ? -1 : 0) + \"px\";\n\t\tthis.HTML.style.top = this.Top + \"px\";\n\t\t//this belize look?\n\t\tif (this.TreeData.SAPBelize)\n\t\t{\n\t\t\t//switch background colour\n\t\t\tthis.HTML.style.backgroundColor = \"#ffffff\";\n\t\t\tthis.HTML.style.borderBottom = \"1px solid #E5E5E5\";\n\t\t}\n\t\t//add event\n\t\tBrowser_AddEvent(this.HTML, __BROWSER_EVENT_CLICK, TreeViewLine_MouseDown);\n\t\tBrowser_AddEvent(this.HTML, __BROWSER_EVENT_MOUSERIGHT, TreeViewLine_MouseDown);\n\t\tBrowser_AddEvent(this.HTML, __BROWSER_EVENT_DOUBLECLICK, TreeViewLine_MouseDown);\n\t\t//install the drag listener to the object\n\t\tBrowser_AddEvent(this.HTML, __BROWSER_EVENT_MOUSEDOWN, Dragging_DetectActionStart);\n\t\t//touch enabled?\n\t\tif (__BROWSER_IS_TOUCH_ENABLED)\n\t\t{\n\t\t\t//add double click listener\n\t\t\tBrowser_AddEvent(this.HTML, __BROWSER_EVENT_MOUSEDOWN, TreeViewLine_TouchDoubleClick);\n\t\t}\n\t}\n\t//first thing: update ourselves\n\tthis.HTML.Item = this;\n\t//and ensure our html line is visible\n\tthis.HTML.style.display = \"block\";\n\t//has html objects?\n\tif (!this.HTMLData[this.State])\n\t{\n\t\t//helpers\n\t\tvar buttonDiv, i, c;\n\t\t//position start\n\t\tvar nLeft = 0;\n\t\t//reset the line\n\t\tthis.HTML.innerHTML = \"\"; // SAFE\n\t\t//has lines?\n\t\tif (this.ShowLines)\n\t\t{\n\t\t\t//get parents\n\t\t\tvar parents = [];\n\t\t\tfor (var parent = this.Parent; parent != this.TreeData.Root; parent = parent.Parent)\n\t\t\t{\n\t\t\t\t//parent has sibling? and is showing lines\n\t\t\t\tif (parent.ParentIndex + 1 < parent.Parent.Children.length && parent.ShowLines)\n\t\t\t\t{\n\t\t\t\t\t//create the parent image\n\t\t\t\t\tbuttonDiv = this.HTML.appendChild(document.createElement(\"img\"));\n\t\t\t\t\t//set style and properties\n\t\t\t\t\tbuttonDiv.src = __NEMESIS_EMPTY_BG;\n\t\t\t\t\tbuttonDiv.style.cssText = \"position:absolute;height:100%;width:16px;background-image:url('\" + __HOST_LESSON_RESOURCES + \"ais_theme_classic_treeviews.png');background-position:-96px center;\";\n\t\t\t\t\t//add to the array\n\t\t\t\t\tparents[parents.length] = buttonDiv;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t//use null\n\t\t\t\t\tparents[parents.length] = null;\n\t\t\t\t}\n\t\t\t}\n\t\t\t//now loop through the parents in reverse order\n\t\t\tfor (i = parents.length - 1; i >= 0; i--)\n\t\t\t{\n\t\t\t\t//has image?\n\t\t\t\tif (parents[i] != null)\n\t\t\t\t{\n\t\t\t\t\t//set its left\n\t\t\t\t\tparents[i].style.left = nLeft + \"px\";\n\t\t\t\t}\n\t\t\t\t//increment the left\n\t\t\t\tnLeft += this.TreeData.DepthModifier;\n\t\t\t}\n\t\t\t//does this have siblings?\n\t\t\tvar bSiblings = this.ParentIndex + 1 < this.Parent.Children.length;\n\t\t\t//show button?\n\t\t\tif (this.HasButton())\n\t\t\t{\n\t\t\t\t//add the button\n\t\t\t\tbuttonDiv = this.HTML.appendChild(document.createElement(\"img\"));\n\t\t\t\t//set style and properties\n\t\t\t\tbuttonDiv.id = __TREEVIEW_ACTIONID_BUTTON;\n\t\t\t\tbuttonDiv.src = __NEMESIS_EMPTY_BG;\n\t\t\t\tbuttonDiv.style.cssText = \"position:absolute;height:100%;width:16px;background-image:url('\" + __HOST_LESSON_RESOURCES + \"ais_theme_classic_treeviews.png');\";\n\t\t\t\t//opened?\n\t\t\t\tif (this.Opened)\n\t\t\t\t{\n\t\t\t\t\t//set position\n\t\t\t\t\tbuttonDiv.style.backgroundPosition = bSiblings ? \"-32px center\" : \"-48px center\";\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t//set position\n\t\t\t\t\tbuttonDiv.style.backgroundPosition = bSiblings ? \"0px center\" : \"-16px center\";\n\t\t\t\t}\n\t\t\t\t//set left\n\t\t\t\tbuttonDiv.style.left = nLeft + \"px\";\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t//add the button\n\t\t\t\tbuttonDiv = this.HTML.appendChild(document.createElement(\"img\"));\n\t\t\t\t//set style and properties\n\t\t\t\tbuttonDiv.src = __NEMESIS_EMPTY_BG;\n\t\t\t\tbuttonDiv.style.cssText = \"position:absolute;height:100%;width:16px;background-image:url('\" + __HOST_LESSON_RESOURCES + \"ais_theme_classic_treeviews.png');\";\n\t\t\t\t//set position\n\t\t\t\tbuttonDiv.style.backgroundPosition = bSiblings ? \"-64px center\" : \"-80px center\";\n\t\t\t\t//set left\n\t\t\t\tbuttonDiv.style.left = nLeft + \"px\";\n\t\t\t}\n\t\t\t//advance left for button (whether we display it or not)\n\t\t\tnLeft += this.TreeData.DepthModifier;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t//advance depth\n\t\t\tnLeft = this.Depth * this.TreeData.DepthModifier;\n\t\t\t//show button?\n\t\t\tif (this.HasButton())\n\t\t\t{\n\t\t\t\t//add the button\n\t\t\t\tbuttonDiv = this.HTML.appendChild(document.createElement(\"img\"));\n\t\t\t\t//set style and properties\n\t\t\t\tbuttonDiv.id = __TREEVIEW_ACTIONID_BUTTON;\n\t\t\t\tbuttonDiv.src = __NEMESIS_EMPTY_BG;\n\t\t\t\tbuttonDiv.style.cssText = this.Opened ? this.TreeData.TreeButtonCssOpen : this.TreeData.TreeButtonCssClose;\n\t\t\t\tbuttonDiv.style.left = nLeft + (this.Opened ? this.TreeData.TreeButtonCssOpenWidthModifier : this.TreeData.TreeButtonCssCloseWidthModifier) + \"px\";\n\t\t\t}\n\t\t\t//has leaf icon?\n\t\t\telse if (this.TreeData.TreeButtonCssLeafWidthModifier)\n\t\t\t{\n\t\t\t\t//add the button\n\t\t\t\tbuttonDiv = this.HTML.appendChild(document.createElement(\"img\"));\n\t\t\t\t//set style and properties\n\t\t\t\tbuttonDiv.src = __NEMESIS_EMPTY_BG;\n\t\t\t\tbuttonDiv.style.cssText = this.TreeData.TreeButtonCssLeaf;\n\t\t\t\tbuttonDiv.style.left = nLeft + this.TreeData.TreeButtonCssLeafWidthModifier + \"px\";\n\t\t\t}\n\t\t\t//advance left for button (whether we display it or not)\n\t\t\tnLeft += this.TreeData.TreeButtonModifier;\n\t\t}\n\n\t\t//start of the selection\n\t\tvar nSelectionStart = nLeft;\n\t\t//has imagelist? and images?\n\t\tif (this.TreeData.ImageList && this.HasImages)\n\t\t{\n\t\t\t//create image for imagelist\n\t\t\tvar imgDiv = this.HTML.appendChild(document.createElement(\"img\"));\n\t\t\t//set style and properties\n\t\t\timgDiv.id = __TREEVIEW_ACTIONID_ITEM;\n\t\t\timgDiv.src = __NEMESIS_EMPTY_BG;\n\t\t\timgDiv.style.cssText = \"position:absolute;\";\n\t\t\tthis.TreeData.ImageList.SetImage(imgDiv, this.Opened ? this.BranchImageOpen : this.BranchImageClose);\n\t\t\timgDiv.style.width = this.TreeData.ImageList.ImageWidth + \"px\";\n\t\t\timgDiv.style.height = this.TreeData.ImageList.ImageHeight + \"px\";\n\t\t\timgDiv.style.left = nLeft + \"px\";\n\t\t\timgDiv.style.top = (this.TreeData.TreeLineHeight - this.TreeData.ImageList.ImageHeight) / 2 + \"px\";\n\t\t\t//advance left for button\n\t\t\tnLeft += this.TreeData.ImageList.ImageWidth;\n\t\t}\n\n\t\t//create the div text\n\t\tvar textDiv = this.HTML.appendChild(document.createElement(\"div\"));\n\t\ttextDiv.id = __TREEVIEW_ACTIONID_ITEM;\n\t\ttextDiv.style.cssText = \"position:absolute;overflow:hidden;padding-left:2px;padding-right:2px;white-space:nowrap;\" + Basic_GetFontStyle(this.TreeData.HTML.InterpreterObject.Properties[__NEMESIS_PROPERTY_FONT]);\n\t\ttextDiv.style.color = this.Selected ? this.FGColorHighlight : this.FGColor;\n\t\ttextDiv.style.backgroundColor = this.Selected ? \"transparent\" : this.BGColor;\n\t\ttextDiv.innerHTML = this.Text; // SAFE BY ENCODING\n\t\ttextDiv.style.left = nLeft + \"px\";\n\t\ttextDiv.style.top = (this.TreeData.TreeLineHeight - Browser_GetOffsetHeight(textDiv)) / 2 + \"px\";\n\n\t\t//has columns?\n\t\tif (this.Columns.length > 0)\n\t\t{\n\t\t\t//no positions?\n\t\t\tif (this.TreeData.ColumnPositions.length > 1)\n\t\t\t{\n\t\t\t\t//loop through the positions (skip first)\n\t\t\t\tfor (var iColPos = 1, cColPos = this.TreeData.ColumnPositions.length, nPreviousColLeft = 0; iColPos < cColPos; iColPos++)\n\t\t\t\t{\n\t\t\t\t\t//get this column's left\n\t\t\t\t\tvar nColLeft = Get_Number(this.TreeData.ColumnPositions[iColPos], 0);\n\t\t\t\t\t//first one?\n\t\t\t\t\tif (iColPos == 1)\n\t\t\t\t\t{\n\t\t\t\t\t\t//correct the width of the main text\n\t\t\t\t\t\ttextDiv.style.width = nColLeft - nLeft - 2 + \"px\";\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t//correct the width of the main text\n\t\t\t\t\t\tthis.HTML.lastChild.style.width = nColLeft - nPreviousColLeft - 2 + \"px\";\n\t\t\t\t\t}\n\t\t\t\t\t//amend last colLeft\n\t\t\t\t\tnPreviousColLeft = nColLeft;\n\t\t\t\t\t//create the div text\n\t\t\t\t\tvar colDiv = this.HTML.appendChild(document.createElement(\"div\"));\n\t\t\t\t\tcolDiv.id = __TREEVIEW_ACTIONID_ITEM;\n\t\t\t\t\t//set basic styles\n\t\t\t\t\tcolDiv.style.cssText = \"position:absolute;overflow:hidden;padding-left:2px;padding-right:2px;white-space:nowrap;\" + Basic_GetFontStyle(this.TreeData.HTML.InterpreterObject.Properties[__NEMESIS_PROPERTY_FONT]);\n\t\t\t\t\tcolDiv.style.color = this.Selected ? this.FGColorHighlight : this.FGColor;\n\t\t\t\t\tcolDiv.style.backgroundColor = this.Selected ? \"transparent\" : this.BGColor;\n\t\t\t\t\t//now prepare the text\n\t\t\t\t\tvar innerHTML = this.Columns[iColPos - 1]; // SAFE BY ENCODING\n\t\t\t\t\t//did we reach the end?\n\t\t\t\t\tif (iColPos + 1 >= cColPos)\n\t\t\t\t\t{\n\t\t\t\t\t\t//ensure we concatenate all the text\n\t\t\t\t\t\tfor (i = iColPos, c = this.Columns.length; i < c; i++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t//always add a separator, including if the text is bad\n\t\t\t\t\t\t\tinnerHTML += \"&nbsp;\" + this.Columns[i]; // SAFE BY ENCODING\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t//and set the text\n\t\t\t\t\tcolDiv.innerHTML = innerHTML; // SAFE BY ENCODING\n\t\t\t\t\t//and its positions (need text to calculate)\n\t\t\t\t\tcolDiv.style.left = nColLeft + \"px\";\n\t\t\t\t\tcolDiv.style.top = (this.TreeData.TreeLineHeight - Browser_GetOffsetHeight(colDiv)) / 2 + \"px\";\n\t\t\t\t}\n\t\t\t\t//correct left\n\t\t\t\tnLeft = Browser_GetScrollWidth(this.HTML);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t//just add to it\n\t\t\t\tfor (i = 0, c = this.Columns.length; i < c; i++)\n\t\t\t\t{\n\t\t\t\t\t//always add a separator, including if the text is bad\n\t\t\t\t\ttextDiv.innerHTML += \"&nbsp;\" + this.Columns[i]; // SAFE BY ENCODING\n\t\t\t\t}\n\t\t\t\t//advance left for text\n\t\t\t\tnLeft += Browser_GetOffsetWidth(textDiv);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t//advance left for text\n\t\t\tnLeft += Browser_GetOffsetWidth(textDiv);\n\t\t}\n\t\t//create selection div\n\t\tvar selectionDiv = this.HTML.insertBefore(document.createElement(\"div\"), this.HTML.firstChild);\n\t\tselectionDiv.id = __TREEVIEW_ACTIONID_ITEM;\n\t\tselectionDiv.style.cssText = \"position:absolute;\";\n\t\tselectionDiv.style.backgroundColor = this.Selected ? this.BGColorHighlight : \"transparent\";\n\t\tselectionDiv.style.left = nSelectionStart + \"px\";\n\t\tselectionDiv.style.width = nLeft - nSelectionStart + \"px\";\n\t\tselectionDiv.style.height = Browser_GetClientHeight(this.HTML) - 3 + \"px\";\n\t\tselectionDiv.style.border = this.Selected ? this.HighlightBorder : \"none\";\n\t\t//memorise our html\n\t\tthis.HTMLData[this.State] = this.HTML.innerHTML; // SAFE\n\t\t//update the treedata max scrol width\n\t\tthis.TreeData.MaxScrollWidth = Math.max(this.TreeData.MaxScrollWidth, nLeft);\n\t}\n\telse\n\t{\n\t\t//set it directly\n\t\tthis.HTML.innerHTML = this.HTMLData[this.State]; // SAFE BY ENCODING\n\t}\n\t//we have updated\n\tthis.Update = false;\n}", "function isWholeLineUpdate(doc, change) {\n return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == \"\" &&\n (!doc.cm || doc.cm.options.wholeLineUpdateBefore)\n }", "function isWholeLineUpdate(doc, change) {\n return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == \"\" &&\n (!doc.cm || doc.cm.options.wholeLineUpdateBefore)\n }", "function isWholeLineUpdate(doc, change) {\n return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == \"\" &&\n (!doc.cm || doc.cm.options.wholeLineUpdateBefore)\n }", "function isWholeLineUpdate(doc, change) {\n return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == \"\" &&\n (!doc.cm || doc.cm.options.wholeLineUpdateBefore)\n }", "function isWholeLineUpdate(doc, change) {\n return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == \"\" &&\n (!doc.cm || doc.cm.options.wholeLineUpdateBefore)\n }", "function isWholeLineUpdate(doc, change) {\n return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == \"\" &&\n (!doc.cm || doc.cm.options.wholeLineUpdateBefore)\n }", "function isWholeLineUpdate(doc, change) {\n return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == \"\" &&\n (!doc.cm || doc.cm.options.wholeLineUpdateBefore)\n }", "function isWholeLineUpdate(doc, change) {\n return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == \"\" &&\n (!doc.cm || doc.cm.options.wholeLineUpdateBefore)\n }", "function isWholeLineUpdate(doc, change) {\n return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == \"\" &&\n (!doc.cm || doc.cm.options.wholeLineUpdateBefore)\n }", "function isWholeLineUpdate(doc, change) {\n return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == \"\" &&\n (!doc.cm || doc.cm.options.wholeLineUpdateBefore)\n }", "function isWholeLineUpdate(doc, change) {\n return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == \"\" &&\n (!doc.cm || doc.cm.options.wholeLineUpdateBefore)\n }" ]
[ "0.61671597", "0.60710144", "0.60607845", "0.60607845", "0.6054482", "0.60209095", "0.6020216", "0.5998901", "0.5991269", "0.5989356", "0.59745157", "0.59646004", "0.5963395", "0.59491736", "0.59491736", "0.59491736", "0.59491736", "0.592617", "0.5924417", "0.5922792", "0.5922792", "0.5904136", "0.5903102", "0.58901155", "0.58901155", "0.58901155", "0.58901155", "0.58901155", "0.58901155", "0.58901155", "0.58901155", "0.58901155", "0.58901155", "0.58901155", "0.58761454", "0.58761454", "0.584967", "0.57424617", "0.5720997", "0.56494635", "0.56004304", "0.55967534", "0.55916345", "0.55916345", "0.553687", "0.55224806", "0.5514399", "0.5497786", "0.54955655", "0.5491717", "0.5491717", "0.54800767", "0.5476678", "0.5474502", "0.5472727", "0.54665", "0.54637074", "0.5458022", "0.54369116", "0.5424028", "0.5424028", "0.5424028", "0.5414548", "0.5406185", "0.5405018", "0.5400205", "0.53940654", "0.53896934", "0.53891796", "0.53810906", "0.5372263", "0.5370456", "0.53700507", "0.5368822", "0.5368822", "0.5368822", "0.5368822", "0.5368822", "0.5368822", "0.5368822", "0.5368822", "0.5368822", "0.5368822", "0.5368822" ]
0.59182984
32
Sync the actual display DOM structure with display.view, removing nodes for lines that are no longer in view, and creating the ones that are not there yet, and updating the ones that are out of date.
function patchDisplay(cm, updateNumbersFrom, dims) { var display = cm.display, lineNumbers = cm.options.lineNumbers; var container = display.lineDiv, cur = container.firstChild; function rm(node) { var next = node.nextSibling; // Works around a throw-scroll bug in OS X Webkit if (webkit && mac && cm.display.currentWheelTarget == node) { node.style.display = "none"; } else { node.parentNode.removeChild(node); } return next } var view = display.view, lineN = display.viewFrom; // Loop over the elements in the view, syncing cur (the DOM nodes // in display.lineDiv) with the view as we go. for (var i = 0; i < view.length; i++) { var lineView = view[i]; if (lineView.hidden) ; else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet var node = buildLineElement(cm, lineView, lineN, dims); container.insertBefore(node, cur); } else { // Already drawn while (cur != lineView.node) { cur = rm(cur); } var updateNumber = lineNumbers && updateNumbersFrom != null && updateNumbersFrom <= lineN && lineView.lineNumber; if (lineView.changes) { if (indexOf(lineView.changes, "gutter") > -1) { updateNumber = false; } updateLineForChanges(cm, lineView, lineN, dims); } if (updateNumber) { removeChildren(lineView.lineNumber); lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN))); } cur = lineView.node.nextSibling; } lineN += lineView.size; } while (cur) { cur = rm(cur); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function patchDisplay(cm, updateNumbersFrom, dims) {\n\t var display = cm.display, lineNumbers = cm.options.lineNumbers;\n\t var container = display.lineDiv, cur = container.firstChild;\n\t\n\t function rm(node) {\n\t var next = node.nextSibling;\n\t // Works around a throw-scroll bug in OS X Webkit\n\t if (webkit && mac && cm.display.currentWheelTarget == node)\n\t node.style.display = \"none\";\n\t else\n\t node.parentNode.removeChild(node);\n\t return next;\n\t }\n\t\n\t var view = display.view, lineN = display.viewFrom;\n\t // Loop over the elements in the view, syncing cur (the DOM nodes\n\t // in display.lineDiv) with the view as we go.\n\t for (var i = 0; i < view.length; i++) {\n\t var lineView = view[i];\n\t if (lineView.hidden) {\n\t } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet\n\t var node = buildLineElement(cm, lineView, lineN, dims);\n\t container.insertBefore(node, cur);\n\t } else { // Already drawn\n\t while (cur != lineView.node) cur = rm(cur);\n\t var updateNumber = lineNumbers && updateNumbersFrom != null &&\n\t updateNumbersFrom <= lineN && lineView.lineNumber;\n\t if (lineView.changes) {\n\t if (indexOf(lineView.changes, \"gutter\") > -1) updateNumber = false;\n\t updateLineForChanges(cm, lineView, lineN, dims);\n\t }\n\t if (updateNumber) {\n\t removeChildren(lineView.lineNumber);\n\t lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));\n\t }\n\t cur = lineView.node.nextSibling;\n\t }\n\t lineN += lineView.size;\n\t }\n\t while (cur) cur = rm(cur);\n\t }", "function patchDisplay(cm, updateNumbersFrom, dims) {\n\t var display = cm.display, lineNumbers = cm.options.lineNumbers;\n\t var container = display.lineDiv, cur = container.firstChild;\n\n\t function rm(node) {\n\t var next = node.nextSibling;\n\t // Works around a throw-scroll bug in OS X Webkit\n\t if (webkit && mac && cm.display.currentWheelTarget == node)\n\t node.style.display = \"none\";\n\t else\n\t node.parentNode.removeChild(node);\n\t return next;\n\t }\n\n\t var view = display.view, lineN = display.viewFrom;\n\t // Loop over the elements in the view, syncing cur (the DOM nodes\n\t // in display.lineDiv) with the view as we go.\n\t for (var i = 0; i < view.length; i++) {\n\t var lineView = view[i];\n\t if (lineView.hidden) {\n\t } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet\n\t var node = buildLineElement(cm, lineView, lineN, dims);\n\t container.insertBefore(node, cur);\n\t } else { // Already drawn\n\t while (cur != lineView.node) cur = rm(cur);\n\t var updateNumber = lineNumbers && updateNumbersFrom != null &&\n\t updateNumbersFrom <= lineN && lineView.lineNumber;\n\t if (lineView.changes) {\n\t if (indexOf(lineView.changes, \"gutter\") > -1) updateNumber = false;\n\t updateLineForChanges(cm, lineView, lineN, dims);\n\t }\n\t if (updateNumber) {\n\t removeChildren(lineView.lineNumber);\n\t lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));\n\t }\n\t cur = lineView.node.nextSibling;\n\t }\n\t lineN += lineView.size;\n\t }\n\t while (cur) cur = rm(cur);\n\t }", "function patchDisplay(cm, updateNumbersFrom, dims) {\n\t var display = cm.display, lineNumbers = cm.options.lineNumbers;\n\t var container = display.lineDiv, cur = container.firstChild;\n\n\t function rm(node) {\n\t var next = node.nextSibling;\n\t // Works around a throw-scroll bug in OS X Webkit\n\t if (webkit && mac && cm.display.currentWheelTarget == node)\n\t node.style.display = \"none\";\n\t else\n\t node.parentNode.removeChild(node);\n\t return next;\n\t }\n\n\t var view = display.view, lineN = display.viewFrom;\n\t // Loop over the elements in the view, syncing cur (the DOM nodes\n\t // in display.lineDiv) with the view as we go.\n\t for (var i = 0; i < view.length; i++) {\n\t var lineView = view[i];\n\t if (lineView.hidden) {\n\t } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet\n\t var node = buildLineElement(cm, lineView, lineN, dims);\n\t container.insertBefore(node, cur);\n\t } else { // Already drawn\n\t while (cur != lineView.node) cur = rm(cur);\n\t var updateNumber = lineNumbers && updateNumbersFrom != null &&\n\t updateNumbersFrom <= lineN && lineView.lineNumber;\n\t if (lineView.changes) {\n\t if (indexOf(lineView.changes, \"gutter\") > -1) updateNumber = false;\n\t updateLineForChanges(cm, lineView, lineN, dims);\n\t }\n\t if (updateNumber) {\n\t removeChildren(lineView.lineNumber);\n\t lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));\n\t }\n\t cur = lineView.node.nextSibling;\n\t }\n\t lineN += lineView.size;\n\t }\n\t while (cur) cur = rm(cur);\n\t }", "function patchDisplay(cm, updateNumbersFrom, dims) {\n\t\t var display = cm.display, lineNumbers = cm.options.lineNumbers;\n\t\t var container = display.lineDiv, cur = container.firstChild;\n\t\t\n\t\t function rm(node) {\n\t\t var next = node.nextSibling;\n\t\t // Works around a throw-scroll bug in OS X Webkit\n\t\t if (webkit && mac && cm.display.currentWheelTarget == node)\n\t\t node.style.display = \"none\";\n\t\t else\n\t\t node.parentNode.removeChild(node);\n\t\t return next;\n\t\t }\n\t\t\n\t\t var view = display.view, lineN = display.viewFrom;\n\t\t // Loop over the elements in the view, syncing cur (the DOM nodes\n\t\t // in display.lineDiv) with the view as we go.\n\t\t for (var i = 0; i < view.length; i++) {\n\t\t var lineView = view[i];\n\t\t if (lineView.hidden) {\n\t\t } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet\n\t\t var node = buildLineElement(cm, lineView, lineN, dims);\n\t\t container.insertBefore(node, cur);\n\t\t } else { // Already drawn\n\t\t while (cur != lineView.node) cur = rm(cur);\n\t\t var updateNumber = lineNumbers && updateNumbersFrom != null &&\n\t\t updateNumbersFrom <= lineN && lineView.lineNumber;\n\t\t if (lineView.changes) {\n\t\t if (indexOf(lineView.changes, \"gutter\") > -1) updateNumber = false;\n\t\t updateLineForChanges(cm, lineView, lineN, dims);\n\t\t }\n\t\t if (updateNumber) {\n\t\t removeChildren(lineView.lineNumber);\n\t\t lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));\n\t\t }\n\t\t cur = lineView.node.nextSibling;\n\t\t }\n\t\t lineN += lineView.size;\n\t\t }\n\t\t while (cur) cur = rm(cur);\n\t\t }", "function patchDisplay(cm, updateNumbersFrom, dims) {\n var display = cm.display,\n lineNumbers = cm.options.lineNumbers;\n var container = display.lineDiv,\n cur = container.firstChild;\n\n function rm(node) {\n var next = node.nextSibling; // Works around a throw-scroll bug in OS X Webkit\n\n if (webkit && mac && cm.display.currentWheelTarget == node) {\n node.style.display = \"none\";\n } else {\n node.parentNode.removeChild(node);\n }\n\n return next;\n }\n\n var view = display.view,\n lineN = display.viewFrom; // Loop over the elements in the view, syncing cur (the DOM nodes\n // in display.lineDiv) with the view as we go.\n\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (lineView.hidden) ;else if (!lineView.node || lineView.node.parentNode != container) {\n // Not drawn yet\n var node = buildLineElement(cm, lineView, lineN, dims);\n container.insertBefore(node, cur);\n } else {\n // Already drawn\n while (cur != lineView.node) {\n cur = rm(cur);\n }\n\n var updateNumber = lineNumbers && updateNumbersFrom != null && updateNumbersFrom <= lineN && lineView.lineNumber;\n\n if (lineView.changes) {\n if (indexOf(lineView.changes, \"gutter\") > -1) {\n updateNumber = false;\n }\n\n updateLineForChanges(cm, lineView, lineN, dims);\n }\n\n if (updateNumber) {\n removeChildren(lineView.lineNumber);\n lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));\n }\n\n cur = lineView.node.nextSibling;\n }\n lineN += lineView.size;\n }\n\n while (cur) {\n cur = rm(cur);\n }\n }", "function patchDisplay(cm, updateNumbersFrom, dims) {\n\t\t var display = cm.display, lineNumbers = cm.options.lineNumbers;\n\t\t var container = display.lineDiv, cur = container.firstChild;\n\n\t\t function rm(node) {\n\t\t var next = node.nextSibling;\n\t\t // Works around a throw-scroll bug in OS X Webkit\n\t\t if (webkit && mac && cm.display.currentWheelTarget == node)\n\t\t { node.style.display = \"none\"; }\n\t\t else\n\t\t { node.parentNode.removeChild(node); }\n\t\t return next\n\t\t }\n\n\t\t var view = display.view, lineN = display.viewFrom;\n\t\t // Loop over the elements in the view, syncing cur (the DOM nodes\n\t\t // in display.lineDiv) with the view as we go.\n\t\t for (var i = 0; i < view.length; i++) {\n\t\t var lineView = view[i];\n\t\t if (lineView.hidden) ; else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet\n\t\t var node = buildLineElement(cm, lineView, lineN, dims);\n\t\t container.insertBefore(node, cur);\n\t\t } else { // Already drawn\n\t\t while (cur != lineView.node) { cur = rm(cur); }\n\t\t var updateNumber = lineNumbers && updateNumbersFrom != null &&\n\t\t updateNumbersFrom <= lineN && lineView.lineNumber;\n\t\t if (lineView.changes) {\n\t\t if (indexOf(lineView.changes, \"gutter\") > -1) { updateNumber = false; }\n\t\t updateLineForChanges(cm, lineView, lineN, dims);\n\t\t }\n\t\t if (updateNumber) {\n\t\t removeChildren(lineView.lineNumber);\n\t\t lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));\n\t\t }\n\t\t cur = lineView.node.nextSibling;\n\t\t }\n\t\t lineN += lineView.size;\n\t\t }\n\t\t while (cur) { cur = rm(cur); }\n\t\t }", "function patchDisplay(cm, updateNumbersFrom, dims) {\n var display = cm.display, lineNumbers = cm.options.lineNumbers;\n var container = display.lineDiv, cur = container.firstChild;\n\n function rm(node) {\n var next = node.nextSibling;\n // Works around a throw-scroll bug in OS X Webkit\n if (webkit && mac && cm.display.currentWheelTarget == node)\n node.style.display = \"none\";\n else\n node.parentNode.removeChild(node);\n return next;\n }\n\n var view = display.view, lineN = display.viewFrom;\n // Loop over the elements in the view, syncing cur (the DOM nodes\n // in display.lineDiv) with the view as we go.\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (lineView.hidden) {\n } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet\n var node = buildLineElement(cm, lineView, lineN, dims);\n container.insertBefore(node, cur);\n } else { // Already drawn\n while (cur != lineView.node) cur = rm(cur);\n var updateNumber = lineNumbers && updateNumbersFrom != null &&\n updateNumbersFrom <= lineN && lineView.lineNumber;\n if (lineView.changes) {\n if (indexOf(lineView.changes, \"gutter\") > -1) updateNumber = false;\n updateLineForChanges(cm, lineView, lineN, dims);\n }\n if (updateNumber) {\n removeChildren(lineView.lineNumber);\n lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));\n }\n cur = lineView.node.nextSibling;\n }\n lineN += lineView.size;\n }\n while (cur) cur = rm(cur);\n }", "function patchDisplay(cm, updateNumbersFrom, dims) {\n var display = cm.display, lineNumbers = cm.options.lineNumbers;\n var container = display.lineDiv, cur = container.firstChild;\n\n function rm(node) {\n var next = node.nextSibling;\n // Works around a throw-scroll bug in OS X Webkit\n if (webkit && mac && cm.display.currentWheelTarget == node)\n node.style.display = \"none\";\n else\n node.parentNode.removeChild(node);\n return next;\n }\n\n var view = display.view, lineN = display.viewFrom;\n // Loop over the elements in the view, syncing cur (the DOM nodes\n // in display.lineDiv) with the view as we go.\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (lineView.hidden) {\n } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet\n var node = buildLineElement(cm, lineView, lineN, dims);\n container.insertBefore(node, cur);\n } else { // Already drawn\n while (cur != lineView.node) cur = rm(cur);\n var updateNumber = lineNumbers && updateNumbersFrom != null &&\n updateNumbersFrom <= lineN && lineView.lineNumber;\n if (lineView.changes) {\n if (indexOf(lineView.changes, \"gutter\") > -1) updateNumber = false;\n updateLineForChanges(cm, lineView, lineN, dims);\n }\n if (updateNumber) {\n removeChildren(lineView.lineNumber);\n lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));\n }\n cur = lineView.node.nextSibling;\n }\n lineN += lineView.size;\n }\n while (cur) cur = rm(cur);\n }", "function patchDisplay(cm, updateNumbersFrom, dims) {\n var display = cm.display, lineNumbers = cm.options.lineNumbers;\n var container = display.lineDiv, cur = container.firstChild;\n\n function rm(node) {\n var next = node.nextSibling;\n // Works around a throw-scroll bug in OS X Webkit\n if (webkit && mac && cm.display.currentWheelTarget == node)\n node.style.display = \"none\";\n else\n node.parentNode.removeChild(node);\n return next;\n }\n\n var view = display.view, lineN = display.viewFrom;\n // Loop over the elements in the view, syncing cur (the DOM nodes\n // in display.lineDiv) with the view as we go.\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (lineView.hidden) {\n } else if (!lineView.node) { // Not drawn yet\n var node = buildLineElement(cm, lineView, lineN, dims);\n container.insertBefore(node, cur);\n } else { // Already drawn\n while (cur != lineView.node) cur = rm(cur);\n var updateNumber = lineNumbers && updateNumbersFrom != null &&\n updateNumbersFrom <= lineN && lineView.lineNumber;\n if (lineView.changes) {\n if (indexOf(lineView.changes, \"gutter\") > -1) updateNumber = false;\n updateLineForChanges(cm, lineView, lineN, dims);\n }\n if (updateNumber) {\n removeChildren(lineView.lineNumber);\n lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));\n }\n cur = lineView.node.nextSibling;\n }\n lineN += lineView.size;\n }\n while (cur) cur = rm(cur);\n }", "function patchDisplay(cm, updateNumbersFrom, dims) {\n var display = cm.display, lineNumbers = cm.options.lineNumbers;\n var container = display.lineDiv, cur = container.firstChild;\n\n function rm(node) {\n var next = node.nextSibling;\n // Works around a throw-scroll bug in OS X Webkit\n if (webkit && mac && cm.display.currentWheelTarget == node)\n node.style.display = \"none\";\n else\n node.parentNode.removeChild(node);\n return next;\n }\n\n var view = display.view, lineN = display.viewFrom;\n // Loop over the elements in the view, syncing cur (the DOM nodes\n // in display.lineDiv) with the view as we go.\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (lineView.hidden) {\n } else if (!lineView.node) { // Not drawn yet\n var node = buildLineElement(cm, lineView, lineN, dims);\n container.insertBefore(node, cur);\n } else { // Already drawn\n while (cur != lineView.node) cur = rm(cur);\n var updateNumber = lineNumbers && updateNumbersFrom != null &&\n updateNumbersFrom <= lineN && lineView.lineNumber;\n if (lineView.changes) {\n if (indexOf(lineView.changes, \"gutter\") > -1) updateNumber = false;\n updateLineForChanges(cm, lineView, lineN, dims);\n }\n if (updateNumber) {\n removeChildren(lineView.lineNumber);\n lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));\n }\n cur = lineView.node.nextSibling;\n }\n lineN += lineView.size;\n }\n while (cur) cur = rm(cur);\n }", "function patchDisplay(cm, updateNumbersFrom, dims) {\n var display = cm.display, lineNumbers = cm.options.lineNumbers;\n var container = display.lineDiv, cur = container.firstChild;\n\n function rm(node) {\n var next = node.nextSibling;\n // Works around a throw-scroll bug in OS X Webkit\n if (webkit && mac && cm.display.currentWheelTarget == node)\n node.style.display = \"none\";\n else\n node.parentNode.removeChild(node);\n return next;\n }\n\n var view = display.view, lineN = display.viewFrom;\n // Loop over the elements in the view, syncing cur (the DOM nodes\n // in display.lineDiv) with the view as we go.\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (lineView.hidden) {\n } else if (!lineView.node) { // Not drawn yet\n var node = buildLineElement(cm, lineView, lineN, dims);\n container.insertBefore(node, cur);\n } else { // Already drawn\n while (cur != lineView.node) cur = rm(cur);\n var updateNumber = lineNumbers && updateNumbersFrom != null &&\n updateNumbersFrom <= lineN && lineView.lineNumber;\n if (lineView.changes) {\n if (indexOf(lineView.changes, \"gutter\") > -1) updateNumber = false;\n updateLineForChanges(cm, lineView, lineN, dims);\n }\n if (updateNumber) {\n removeChildren(lineView.lineNumber);\n lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));\n }\n cur = lineView.node.nextSibling;\n }\n lineN += lineView.size;\n }\n while (cur) cur = rm(cur);\n }", "function patchDisplay(cm, updateNumbersFrom, dims) {\n var display = cm.display, lineNumbers = cm.options.lineNumbers;\n var container = display.lineDiv, cur = container.firstChild;\n\n function rm(node) {\n var next = node.nextSibling;\n // Works around a throw-scroll bug in OS X Webkit\n if (webkit && mac && cm.display.currentWheelTarget == node)\n node.style.display = \"none\";\n else\n node.parentNode.removeChild(node);\n return next;\n }\n\n var view = display.view, lineN = display.viewFrom;\n // Loop over the elements in the view, syncing cur (the DOM nodes\n // in display.lineDiv) with the view as we go.\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (lineView.hidden) {\n } else if (!lineView.node) { // Not drawn yet\n var node = buildLineElement(cm, lineView, lineN, dims);\n container.insertBefore(node, cur);\n } else { // Already drawn\n while (cur != lineView.node) cur = rm(cur);\n var updateNumber = lineNumbers && updateNumbersFrom != null &&\n updateNumbersFrom <= lineN && lineView.lineNumber;\n if (lineView.changes) {\n if (indexOf(lineView.changes, \"gutter\") > -1) updateNumber = false;\n updateLineForChanges(cm, lineView, lineN, dims);\n }\n if (updateNumber) {\n removeChildren(lineView.lineNumber);\n lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));\n }\n cur = lineView.node.nextSibling;\n }\n lineN += lineView.size;\n }\n while (cur) cur = rm(cur);\n }", "function patchDisplay(cm, updateNumbersFrom, dims) {\n var display = cm.display, lineNumbers = cm.options.lineNumbers;\n var container = display.lineDiv, cur = container.firstChild;\n\n function rm(node) {\n var next = node.nextSibling;\n // Works around a throw-scroll bug in OS X Webkit\n if (webkit && mac && cm.display.currentWheelTarget == node)\n node.style.display = \"none\";\n else\n node.parentNode.removeChild(node);\n return next;\n }\n\n var view = display.view, lineN = display.viewFrom;\n // Loop over the elements in the view, syncing cur (the DOM nodes\n // in display.lineDiv) with the view as we go.\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (lineView.hidden) {\n } else if (!lineView.node) { // Not drawn yet\n var node = buildLineElement(cm, lineView, lineN, dims);\n container.insertBefore(node, cur);\n } else { // Already drawn\n while (cur != lineView.node) cur = rm(cur);\n var updateNumber = lineNumbers && updateNumbersFrom != null &&\n updateNumbersFrom <= lineN && lineView.lineNumber;\n if (lineView.changes) {\n if (indexOf(lineView.changes, \"gutter\") > -1) updateNumber = false;\n updateLineForChanges(cm, lineView, lineN, dims);\n }\n if (updateNumber) {\n removeChildren(lineView.lineNumber);\n lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));\n }\n cur = lineView.node.nextSibling;\n }\n lineN += lineView.size;\n }\n while (cur) cur = rm(cur);\n }", "function patchDisplay(cm, updateNumbersFrom, dims) {\n var display = cm.display, lineNumbers = cm.options.lineNumbers;\n var container = display.lineDiv, cur = container.firstChild;\n\n function rm(node) {\n var next = node.nextSibling;\n // Works around a throw-scroll bug in OS X Webkit\n if (webkit && mac && cm.display.currentWheelTarget == node)\n node.style.display = \"none\";\n else\n node.parentNode.removeChild(node);\n return next;\n }\n\n var view = display.view, lineN = display.viewFrom;\n // Loop over the elements in the view, syncing cur (the DOM nodes\n // in display.lineDiv) with the view as we go.\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (lineView.hidden) {\n } else if (!lineView.node) { // Not drawn yet\n var node = buildLineElement(cm, lineView, lineN, dims);\n container.insertBefore(node, cur);\n } else { // Already drawn\n while (cur != lineView.node) cur = rm(cur);\n var updateNumber = lineNumbers && updateNumbersFrom != null &&\n updateNumbersFrom <= lineN && lineView.lineNumber;\n if (lineView.changes) {\n if (indexOf(lineView.changes, \"gutter\") > -1) updateNumber = false;\n updateLineForChanges(cm, lineView, lineN, dims);\n }\n if (updateNumber) {\n removeChildren(lineView.lineNumber);\n lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));\n }\n cur = lineView.node.nextSibling;\n }\n lineN += lineView.size;\n }\n while (cur) cur = rm(cur);\n }", "function patchDisplay(cm, updateNumbersFrom, dims) {\n let display = cm.display, lineNumbers = cm.options.lineNumbers\n let container = display.lineDiv, cur = container.firstChild\n\n function rm(node) {\n let next = node.nextSibling\n // Works around a throw-scroll bug in OS X Webkit\n if (webkit && mac && cm.display.currentWheelTarget == node)\n node.style.display = \"none\"\n else\n node.parentNode.removeChild(node)\n return next\n }\n\n let view = display.view, lineN = display.viewFrom\n // Loop over the elements in the view, syncing cur (the DOM nodes\n // in display.lineDiv) with the view as we go.\n for (let i = 0; i < view.length; i++) {\n let lineView = view[i]\n if (lineView.hidden) {\n } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet\n let node = buildLineElement(cm, lineView, lineN, dims)\n container.insertBefore(node, cur)\n } else { // Already drawn\n while (cur != lineView.node) cur = rm(cur)\n let updateNumber = lineNumbers && updateNumbersFrom != null &&\n updateNumbersFrom <= lineN && lineView.lineNumber\n if (lineView.changes) {\n if (indexOf(lineView.changes, \"gutter\") > -1) updateNumber = false\n updateLineForChanges(cm, lineView, lineN, dims)\n }\n if (updateNumber) {\n removeChildren(lineView.lineNumber)\n lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)))\n }\n cur = lineView.node.nextSibling\n }\n lineN += lineView.size\n }\n while (cur) cur = rm(cur)\n}", "function patchDisplay(cm, updateNumbersFrom, dims) {\r\n var display = cm.display, lineNumbers = cm.options.lineNumbers;\r\n var container = display.lineDiv, cur = container.firstChild;\r\n\r\n function rm(node) {\r\n var next = node.nextSibling;\r\n // Works around a throw-scroll bug in OS X Webkit\r\n if (webkit && mac && cm.display.currentWheelTarget == node)\r\n node.style.display = \"none\";\r\n else\r\n node.parentNode.removeChild(node);\r\n return next;\r\n }\r\n\r\n var view = display.view, lineN = display.viewFrom;\r\n // Loop over the elements in the view, syncing cur (the DOM nodes\r\n // in display.lineDiv) with the view as we go.\r\n for (var i = 0; i < view.length; i++) {\r\n var lineView = view[i];\r\n if (lineView.hidden) {\r\n } else if (!lineView.node) { // Not drawn yet\r\n var node = buildLineElement(cm, lineView, lineN, dims);\r\n container.insertBefore(node, cur);\r\n } else { // Already drawn\r\n while (cur != lineView.node) cur = rm(cur);\r\n var updateNumber = lineNumbers && updateNumbersFrom != null &&\r\n updateNumbersFrom <= lineN && lineView.lineNumber;\r\n if (lineView.changes) {\r\n if (indexOf(lineView.changes, \"gutter\") > -1) updateNumber = false;\r\n updateLineForChanges(cm, lineView, lineN, dims);\r\n }\r\n if (updateNumber) {\r\n removeChildren(lineView.lineNumber);\r\n lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));\r\n }\r\n cur = lineView.node.nextSibling;\r\n }\r\n lineN += lineView.size;\r\n }\r\n while (cur) cur = rm(cur);\r\n }", "function patchDisplay(cm, updateNumbersFrom, dims) {\n var display = cm.display, lineNumbers = cm.options.lineNumbers\n var container = display.lineDiv, cur = container.firstChild\n\n function rm(node) {\n var next = node.nextSibling\n // Works around a throw-scroll bug in OS X Webkit\n if (webkit && mac && cm.display.currentWheelTarget == node)\n { node.style.display = \"none\" }\n else\n { node.parentNode.removeChild(node) }\n return next\n }\n\n var view = display.view, lineN = display.viewFrom\n // Loop over the elements in the view, syncing cur (the DOM nodes\n // in display.lineDiv) with the view as we go.\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i]\n if (lineView.hidden) {\n } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet\n var node = buildLineElement(cm, lineView, lineN, dims)\n container.insertBefore(node, cur)\n } else { // Already drawn\n while (cur != lineView.node) { cur = rm(cur) }\n var updateNumber = lineNumbers && updateNumbersFrom != null &&\n updateNumbersFrom <= lineN && lineView.lineNumber\n if (lineView.changes) {\n if (indexOf(lineView.changes, \"gutter\") > -1) { updateNumber = false }\n updateLineForChanges(cm, lineView, lineN, dims)\n }\n if (updateNumber) {\n removeChildren(lineView.lineNumber)\n lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)))\n }\n cur = lineView.node.nextSibling\n }\n lineN += lineView.size\n }\n while (cur) { cur = rm(cur) }\n}", "function patchDisplay(cm, updateNumbersFrom, dims) {\n var display = cm.display, lineNumbers = cm.options.lineNumbers\n var container = display.lineDiv, cur = container.firstChild\n\n function rm(node) {\n var next = node.nextSibling\n // Works around a throw-scroll bug in OS X Webkit\n if (webkit && mac && cm.display.currentWheelTarget == node)\n { node.style.display = \"none\" }\n else\n { node.parentNode.removeChild(node) }\n return next\n }\n\n var view = display.view, lineN = display.viewFrom\n // Loop over the elements in the view, syncing cur (the DOM nodes\n // in display.lineDiv) with the view as we go.\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i]\n if (lineView.hidden) {\n } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet\n var node = buildLineElement(cm, lineView, lineN, dims)\n container.insertBefore(node, cur)\n } else { // Already drawn\n while (cur != lineView.node) { cur = rm(cur) }\n var updateNumber = lineNumbers && updateNumbersFrom != null &&\n updateNumbersFrom <= lineN && lineView.lineNumber\n if (lineView.changes) {\n if (indexOf(lineView.changes, \"gutter\") > -1) { updateNumber = false }\n updateLineForChanges(cm, lineView, lineN, dims)\n }\n if (updateNumber) {\n removeChildren(lineView.lineNumber)\n lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)))\n }\n cur = lineView.node.nextSibling\n }\n lineN += lineView.size\n }\n while (cur) { cur = rm(cur) }\n}", "function patchDisplay(cm, updateNumbersFrom, dims) {\n var display = cm.display, lineNumbers = cm.options.lineNumbers;\n var container = display.lineDiv, cur = container.firstChild;\n\n function rm(node) {\n var next = node.nextSibling;\n // Works around a throw-scroll bug in OS X Webkit\n if (webkit && mac && cm.display.currentWheelTarget == node)\n { node.style.display = \"none\"; }\n else\n { node.parentNode.removeChild(node); }\n return next\n }\n\n var view = display.view, lineN = display.viewFrom;\n // Loop over the elements in the view, syncing cur (the DOM nodes\n // in display.lineDiv) with the view as we go.\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (lineView.hidden) {\n } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet\n var node = buildLineElement(cm, lineView, lineN, dims);\n container.insertBefore(node, cur);\n } else { // Already drawn\n while (cur != lineView.node) { cur = rm(cur); }\n var updateNumber = lineNumbers && updateNumbersFrom != null &&\n updateNumbersFrom <= lineN && lineView.lineNumber;\n if (lineView.changes) {\n if (indexOf(lineView.changes, \"gutter\") > -1) { updateNumber = false; }\n updateLineForChanges(cm, lineView, lineN, dims);\n }\n if (updateNumber) {\n removeChildren(lineView.lineNumber);\n lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));\n }\n cur = lineView.node.nextSibling;\n }\n lineN += lineView.size;\n }\n while (cur) { cur = rm(cur); }\n}", "function patchDisplay(cm, updateNumbersFrom, dims) {\n var display = cm.display, lineNumbers = cm.options.lineNumbers;\n var container = display.lineDiv, cur = container.firstChild;\n\n function rm(node) {\n var next = node.nextSibling;\n // Works around a throw-scroll bug in OS X Webkit\n if (webkit && mac && cm.display.currentWheelTarget == node)\n { node.style.display = \"none\"; }\n else\n { node.parentNode.removeChild(node); }\n return next\n }\n\n var view = display.view, lineN = display.viewFrom;\n // Loop over the elements in the view, syncing cur (the DOM nodes\n // in display.lineDiv) with the view as we go.\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (lineView.hidden) {\n } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet\n var node = buildLineElement(cm, lineView, lineN, dims);\n container.insertBefore(node, cur);\n } else { // Already drawn\n while (cur != lineView.node) { cur = rm(cur); }\n var updateNumber = lineNumbers && updateNumbersFrom != null &&\n updateNumbersFrom <= lineN && lineView.lineNumber;\n if (lineView.changes) {\n if (indexOf(lineView.changes, \"gutter\") > -1) { updateNumber = false; }\n updateLineForChanges(cm, lineView, lineN, dims);\n }\n if (updateNumber) {\n removeChildren(lineView.lineNumber);\n lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));\n }\n cur = lineView.node.nextSibling;\n }\n lineN += lineView.size;\n }\n while (cur) { cur = rm(cur); }\n}", "function patchDisplay(cm, updateNumbersFrom, dims) {\n var display = cm.display, lineNumbers = cm.options.lineNumbers;\n var container = display.lineDiv, cur = container.firstChild;\n\n function rm(node) {\n var next = node.nextSibling;\n // Works around a throw-scroll bug in OS X Webkit\n if (webkit && mac && cm.display.currentWheelTarget == node)\n { node.style.display = \"none\"; }\n else\n { node.parentNode.removeChild(node); }\n return next\n }\n\n var view = display.view, lineN = display.viewFrom;\n // Loop over the elements in the view, syncing cur (the DOM nodes\n // in display.lineDiv) with the view as we go.\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (lineView.hidden) {\n } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet\n var node = buildLineElement(cm, lineView, lineN, dims);\n container.insertBefore(node, cur);\n } else { // Already drawn\n while (cur != lineView.node) { cur = rm(cur); }\n var updateNumber = lineNumbers && updateNumbersFrom != null &&\n updateNumbersFrom <= lineN && lineView.lineNumber;\n if (lineView.changes) {\n if (indexOf(lineView.changes, \"gutter\") > -1) { updateNumber = false; }\n updateLineForChanges(cm, lineView, lineN, dims);\n }\n if (updateNumber) {\n removeChildren(lineView.lineNumber);\n lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));\n }\n cur = lineView.node.nextSibling;\n }\n lineN += lineView.size;\n }\n while (cur) { cur = rm(cur); }\n}", "function patchDisplay(cm, updateNumbersFrom, dims) {\n var display = cm.display, lineNumbers = cm.options.lineNumbers;\n var container = display.lineDiv, cur = container.firstChild;\n\n function rm(node) {\n var next = node.nextSibling;\n // Works around a throw-scroll bug in OS X Webkit\n if (webkit && mac && cm.display.currentWheelTarget == node)\n { node.style.display = \"none\"; }\n else\n { node.parentNode.removeChild(node); }\n return next\n }\n\n var view = display.view, lineN = display.viewFrom;\n // Loop over the elements in the view, syncing cur (the DOM nodes\n // in display.lineDiv) with the view as we go.\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (lineView.hidden) {\n } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet\n var node = buildLineElement(cm, lineView, lineN, dims);\n container.insertBefore(node, cur);\n } else { // Already drawn\n while (cur != lineView.node) { cur = rm(cur); }\n var updateNumber = lineNumbers && updateNumbersFrom != null &&\n updateNumbersFrom <= lineN && lineView.lineNumber;\n if (lineView.changes) {\n if (indexOf(lineView.changes, \"gutter\") > -1) { updateNumber = false; }\n updateLineForChanges(cm, lineView, lineN, dims);\n }\n if (updateNumber) {\n removeChildren(lineView.lineNumber);\n lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));\n }\n cur = lineView.node.nextSibling;\n }\n lineN += lineView.size;\n }\n while (cur) { cur = rm(cur); }\n}", "function patchDisplay(cm, updateNumbersFrom, dims) {\n var display = cm.display, lineNumbers = cm.options.lineNumbers;\n var container = display.lineDiv, cur = container.firstChild;\n\n function rm(node) {\n var next = node.nextSibling;\n // Works around a throw-scroll bug in OS X Webkit\n if (webkit && mac && cm.display.currentWheelTarget == node)\n { node.style.display = \"none\"; }\n else\n { node.parentNode.removeChild(node); }\n return next\n }\n\n var view = display.view, lineN = display.viewFrom;\n // Loop over the elements in the view, syncing cur (the DOM nodes\n // in display.lineDiv) with the view as we go.\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (lineView.hidden) {\n } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet\n var node = buildLineElement(cm, lineView, lineN, dims);\n container.insertBefore(node, cur);\n } else { // Already drawn\n while (cur != lineView.node) { cur = rm(cur); }\n var updateNumber = lineNumbers && updateNumbersFrom != null &&\n updateNumbersFrom <= lineN && lineView.lineNumber;\n if (lineView.changes) {\n if (indexOf(lineView.changes, \"gutter\") > -1) { updateNumber = false; }\n updateLineForChanges(cm, lineView, lineN, dims);\n }\n if (updateNumber) {\n removeChildren(lineView.lineNumber);\n lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));\n }\n cur = lineView.node.nextSibling;\n }\n lineN += lineView.size;\n }\n while (cur) { cur = rm(cur); }\n}", "function patchDisplay(cm, updateNumbersFrom, dims) {\n var display = cm.display, lineNumbers = cm.options.lineNumbers;\n var container = display.lineDiv, cur = container.firstChild;\n\n function rm(node) {\n var next = node.nextSibling;\n // Works around a throw-scroll bug in OS X Webkit\n if (webkit && mac && cm.display.currentWheelTarget == node)\n { node.style.display = \"none\"; }\n else\n { node.parentNode.removeChild(node); }\n return next\n }\n\n var view = display.view, lineN = display.viewFrom;\n // Loop over the elements in the view, syncing cur (the DOM nodes\n // in display.lineDiv) with the view as we go.\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (lineView.hidden) {\n } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet\n var node = buildLineElement(cm, lineView, lineN, dims);\n container.insertBefore(node, cur);\n } else { // Already drawn\n while (cur != lineView.node) { cur = rm(cur); }\n var updateNumber = lineNumbers && updateNumbersFrom != null &&\n updateNumbersFrom <= lineN && lineView.lineNumber;\n if (lineView.changes) {\n if (indexOf(lineView.changes, \"gutter\") > -1) { updateNumber = false; }\n updateLineForChanges(cm, lineView, lineN, dims);\n }\n if (updateNumber) {\n removeChildren(lineView.lineNumber);\n lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));\n }\n cur = lineView.node.nextSibling;\n }\n lineN += lineView.size;\n }\n while (cur) { cur = rm(cur); }\n}", "function patchDisplay(cm, updateNumbersFrom, dims) {\n var display = cm.display, lineNumbers = cm.options.lineNumbers;\n var container = display.lineDiv, cur = container.firstChild;\n\n function rm(node) {\n var next = node.nextSibling;\n // Works around a throw-scroll bug in OS X Webkit\n if (webkit && mac && cm.display.currentWheelTarget == node)\n { node.style.display = \"none\"; }\n else\n { node.parentNode.removeChild(node); }\n return next\n }\n\n var view = display.view, lineN = display.viewFrom;\n // Loop over the elements in the view, syncing cur (the DOM nodes\n // in display.lineDiv) with the view as we go.\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (lineView.hidden) {\n } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet\n var node = buildLineElement(cm, lineView, lineN, dims);\n container.insertBefore(node, cur);\n } else { // Already drawn\n while (cur != lineView.node) { cur = rm(cur); }\n var updateNumber = lineNumbers && updateNumbersFrom != null &&\n updateNumbersFrom <= lineN && lineView.lineNumber;\n if (lineView.changes) {\n if (indexOf(lineView.changes, \"gutter\") > -1) { updateNumber = false; }\n updateLineForChanges(cm, lineView, lineN, dims);\n }\n if (updateNumber) {\n removeChildren(lineView.lineNumber);\n lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));\n }\n cur = lineView.node.nextSibling;\n }\n lineN += lineView.size;\n }\n while (cur) { cur = rm(cur); }\n}", "function patchDisplay(cm, updateNumbersFrom, dims) {\n var display = cm.display, lineNumbers = cm.options.lineNumbers;\n var container = display.lineDiv, cur = container.firstChild;\n\n function rm(node) {\n var next = node.nextSibling;\n // Works around a throw-scroll bug in OS X Webkit\n if (webkit && mac && cm.display.currentWheelTarget == node)\n { node.style.display = \"none\"; }\n else\n { node.parentNode.removeChild(node); }\n return next\n }\n\n var view = display.view, lineN = display.viewFrom;\n // Loop over the elements in the view, syncing cur (the DOM nodes\n // in display.lineDiv) with the view as we go.\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (lineView.hidden) {\n } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet\n var node = buildLineElement(cm, lineView, lineN, dims);\n container.insertBefore(node, cur);\n } else { // Already drawn\n while (cur != lineView.node) { cur = rm(cur); }\n var updateNumber = lineNumbers && updateNumbersFrom != null &&\n updateNumbersFrom <= lineN && lineView.lineNumber;\n if (lineView.changes) {\n if (indexOf(lineView.changes, \"gutter\") > -1) { updateNumber = false; }\n updateLineForChanges(cm, lineView, lineN, dims);\n }\n if (updateNumber) {\n removeChildren(lineView.lineNumber);\n lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));\n }\n cur = lineView.node.nextSibling;\n }\n lineN += lineView.size;\n }\n while (cur) { cur = rm(cur); }\n}", "function patchDisplay(cm, updateNumbersFrom, dims) {\n var display = cm.display, lineNumbers = cm.options.lineNumbers;\n var container = display.lineDiv, cur = container.firstChild;\n\n function rm(node) {\n var next = node.nextSibling;\n // Works around a throw-scroll bug in OS X Webkit\n if (webkit && mac && cm.display.currentWheelTarget == node)\n { node.style.display = \"none\"; }\n else\n { node.parentNode.removeChild(node); }\n return next\n }\n\n var view = display.view, lineN = display.viewFrom;\n // Loop over the elements in the view, syncing cur (the DOM nodes\n // in display.lineDiv) with the view as we go.\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (lineView.hidden) {\n } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet\n var node = buildLineElement(cm, lineView, lineN, dims);\n container.insertBefore(node, cur);\n } else { // Already drawn\n while (cur != lineView.node) { cur = rm(cur); }\n var updateNumber = lineNumbers && updateNumbersFrom != null &&\n updateNumbersFrom <= lineN && lineView.lineNumber;\n if (lineView.changes) {\n if (indexOf(lineView.changes, \"gutter\") > -1) { updateNumber = false; }\n updateLineForChanges(cm, lineView, lineN, dims);\n }\n if (updateNumber) {\n removeChildren(lineView.lineNumber);\n lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));\n }\n cur = lineView.node.nextSibling;\n }\n lineN += lineView.size;\n }\n while (cur) { cur = rm(cur); }\n}", "function patchDisplay(cm, updateNumbersFrom, dims) {\n var display = cm.display, lineNumbers = cm.options.lineNumbers;\n var container = display.lineDiv, cur = container.firstChild;\n\n function rm(node) {\n var next = node.nextSibling;\n // Works around a throw-scroll bug in OS X Webkit\n if (webkit && mac && cm.display.currentWheelTarget == node)\n { node.style.display = \"none\"; }\n else\n { node.parentNode.removeChild(node); }\n return next\n }\n\n var view = display.view, lineN = display.viewFrom;\n // Loop over the elements in the view, syncing cur (the DOM nodes\n // in display.lineDiv) with the view as we go.\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (lineView.hidden) {\n } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet\n var node = buildLineElement(cm, lineView, lineN, dims);\n container.insertBefore(node, cur);\n } else { // Already drawn\n while (cur != lineView.node) { cur = rm(cur); }\n var updateNumber = lineNumbers && updateNumbersFrom != null &&\n updateNumbersFrom <= lineN && lineView.lineNumber;\n if (lineView.changes) {\n if (indexOf(lineView.changes, \"gutter\") > -1) { updateNumber = false; }\n updateLineForChanges(cm, lineView, lineN, dims);\n }\n if (updateNumber) {\n removeChildren(lineView.lineNumber);\n lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));\n }\n cur = lineView.node.nextSibling;\n }\n lineN += lineView.size;\n }\n while (cur) { cur = rm(cur); }\n}", "function patchDisplay(cm, updateNumbersFrom, dims) {\n var display = cm.display, lineNumbers = cm.options.lineNumbers;\n var container = display.lineDiv, cur = container.firstChild;\n\n function rm(node) {\n var next = node.nextSibling;\n // Works around a throw-scroll bug in OS X Webkit\n if (webkit && mac && cm.display.currentWheelTarget == node)\n { node.style.display = \"none\"; }\n else\n { node.parentNode.removeChild(node); }\n return next\n }\n\n var view = display.view, lineN = display.viewFrom;\n // Loop over the elements in the view, syncing cur (the DOM nodes\n // in display.lineDiv) with the view as we go.\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (lineView.hidden) {\n } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet\n var node = buildLineElement(cm, lineView, lineN, dims);\n container.insertBefore(node, cur);\n } else { // Already drawn\n while (cur != lineView.node) { cur = rm(cur); }\n var updateNumber = lineNumbers && updateNumbersFrom != null &&\n updateNumbersFrom <= lineN && lineView.lineNumber;\n if (lineView.changes) {\n if (indexOf(lineView.changes, \"gutter\") > -1) { updateNumber = false; }\n updateLineForChanges(cm, lineView, lineN, dims);\n }\n if (updateNumber) {\n removeChildren(lineView.lineNumber);\n lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));\n }\n cur = lineView.node.nextSibling;\n }\n lineN += lineView.size;\n }\n while (cur) { cur = rm(cur); }\n}", "function patchDisplay(cm, updateNumbersFrom, dims) {\r\n var display = cm.display, lineNumbers = cm.options.lineNumbers;\r\n var container = display.lineDiv, cur = container.firstChild;\r\n\r\n function rm(node) {\r\n var next = node.nextSibling;\r\n // Works around a throw-scroll bug in OS X Webkit\r\n if (webkit && mac && cm.display.currentWheelTarget == node)\r\n { node.style.display = \"none\"; }\r\n else\r\n { node.parentNode.removeChild(node); }\r\n return next\r\n }\r\n\r\n var view = display.view, lineN = display.viewFrom;\r\n // Loop over the elements in the view, syncing cur (the DOM nodes\r\n // in display.lineDiv) with the view as we go.\r\n for (var i = 0; i < view.length; i++) {\r\n var lineView = view[i];\r\n if (lineView.hidden) {\r\n } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet\r\n var node = buildLineElement(cm, lineView, lineN, dims);\r\n container.insertBefore(node, cur);\r\n } else { // Already drawn\r\n while (cur != lineView.node) { cur = rm(cur); }\r\n var updateNumber = lineNumbers && updateNumbersFrom != null &&\r\n updateNumbersFrom <= lineN && lineView.lineNumber;\r\n if (lineView.changes) {\r\n if (indexOf(lineView.changes, \"gutter\") > -1) { updateNumber = false; }\r\n updateLineForChanges(cm, lineView, lineN, dims);\r\n }\r\n if (updateNumber) {\r\n removeChildren(lineView.lineNumber);\r\n lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));\r\n }\r\n cur = lineView.node.nextSibling;\r\n }\r\n lineN += lineView.size;\r\n }\r\n while (cur) { cur = rm(cur); }\r\n}", "function updateDisplay(changes, suppressCallback) {\n if (!scroller.clientWidth) {\n showingFrom = showingTo = displayOffset = 0;\n return;\n }\n // Compute the new visible window\n var visible = visibleLines();\n // Bail out if the visible area is already rendered and nothing changed.\n if (changes !== true && changes.length == 0 && visible.from >= showingFrom && visible.to <= showingTo) return;\n var from = Math.max(visible.from - 100, 0), to = Math.min(doc.size, visible.to + 100);\n if (showingFrom < from && from - showingFrom < 20) from = showingFrom;\n if (showingTo > to && showingTo - to < 20) to = Math.min(doc.size, showingTo);\n\n // Create a range of theoretically intact lines, and punch holes\n // in that using the change info.\n var intact = changes === true ? [] :\n computeIntact([{from: showingFrom, to: showingTo, domStart: 0}], changes);\n // Clip off the parts that won't be visible\n var intactLines = 0;\n for (var i = 0; i < intact.length; ++i) {\n var range = intact[i];\n if (range.from < from) {range.domStart += (from - range.from); range.from = from;}\n if (range.to > to) range.to = to;\n if (range.from >= range.to) intact.splice(i--, 1);\n else intactLines += range.to - range.from;\n }\n if (intactLines == to - from) return;\n intact.sort(function(a, b) {return a.domStart - b.domStart;});\n\n var th = textHeight(), gutterDisplay = gutter.style.display;\n lineDiv.style.display = gutter.style.display = \"none\";\n patchDisplay(from, to, intact);\n lineDiv.style.display = \"\";\n\n // Position the mover div to align with the lines it's supposed\n // to be showing (which will cover the visible display)\n var different = from != showingFrom || to != showingTo || lastSizeC != scroller.clientHeight + th;\n // This is just a bogus formula that detects when the editor is\n // resized or the font size changes.\n if (different) lastSizeC = scroller.clientHeight + th;\n showingFrom = from; showingTo = to;\n displayOffset = heightAtLine(doc, from);\n mover.style.top = (displayOffset * th) + \"px\";\n code.style.height = (doc.height * th + 2 * paddingTop()) + \"px\";\n\n // Since this is all rather error prone, it is honoured with the\n // only assertion in the whole file.\n if (lineDiv.childNodes.length != showingTo - showingFrom)\n throw new Error(\"BAD PATCH! \" + JSON.stringify(intact) + \" size=\" + (showingTo - showingFrom) +\n \" nodes=\" + lineDiv.childNodes.length);\n\n if (options.lineWrapping) {\n maxWidth = scroller.clientWidth;\n var curNode = lineDiv.firstChild;\n doc.iter(showingFrom, showingTo, function(line) {\n if (!line.hidden) {\n var height = Math.round(curNode.offsetHeight / th) || 1;\n if (line.height != height) {updateLineHeight(line, height); gutterDirty = true;}\n }\n curNode = curNode.nextSibling;\n });\n } else {\n if (maxWidth == null) maxWidth = stringWidth(maxLine);\n if (maxWidth > scroller.clientWidth) {\n lineSpace.style.width = maxWidth + \"px\";\n // Needed to prevent odd wrapping/hiding of widgets placed in here.\n code.style.width = \"\";\n code.style.width = scroller.scrollWidth + \"px\";\n } else {\n lineSpace.style.width = code.style.width = \"\";\n }\n }\n gutter.style.display = gutterDisplay;\n if (different || gutterDirty) updateGutter();\n updateCursor();\n if (!suppressCallback && options.onUpdate) options.onUpdate(instance);\n return true;\n }", "function updateDisplay(changes) {\n if (!scroller.clientWidth) {\n showingFrom = showingTo = 0;\n return;\n }\n // First create a range of theoretically intact lines, and punch\n // holes in that using the change info.\n var intact = changes === true ? [] : [{from: showingFrom, to: showingTo, domStart: 0}];\n for (var i = 0, l = changes.length || 0; i < l; ++i) {\n var change = changes[i], intact2 = [], diff = change.diff || 0;\n for (var j = 0, l2 = intact.length; j < l2; ++j) {\n var range = intact[j];\n if (change.to <= range.from)\n intact2.push({from: range.from + diff, to: range.to + diff, domStart: range.domStart});\n else if (range.to <= change.from)\n intact2.push(range);\n else {\n if (change.from > range.from)\n intact2.push({from: range.from, to: change.from, domStart: range.domStart})\n if (change.to < range.to)\n intact2.push({from: change.to + diff, to: range.to + diff,\n domStart: range.domStart + (change.to - range.from)});\n }\n }\n intact = intact2;\n }\n\n // Then, determine which lines we'd want to see, and which\n // updates have to be made to get there.\n var visible = visibleLines();\n var from = Math.min(showingFrom, Math.max(visible.from - 3, 0)),\n to = Math.min(lines.length, Math.max(showingTo, visible.to + 3)),\n updates = [], domPos = 0, domEnd = showingTo - showingFrom, pos = from, changedLines = 0;\n\n for (var i = 0, l = intact.length; i < l; ++i) {\n var range = intact[i];\n if (range.to <= from) continue;\n if (range.from >= to) break;\n if (range.domStart > domPos || range.from > pos) {\n updates.push({from: pos, to: range.from, domSize: range.domStart - domPos, domStart: domPos});\n changedLines += range.from - pos;\n }\n pos = range.to;\n domPos = range.domStart + (range.to - range.from);\n }\n if (domPos != domEnd || pos != to) {\n changedLines += Math.abs(to - pos);\n updates.push({from: pos, to: to, domSize: domEnd - domPos, domStart: domPos});\n }\n\n if (!updates.length) return;\n lineDiv.style.display = \"none\";\n // If more than 30% of the screen needs update, just do a full\n // redraw (which is quicker than patching)\n if (changedLines > (visible.to - visible.from) * .3)\n refreshDisplay(from = Math.max(visible.from - 10, 0), to = Math.min(visible.to + 7, lines.length));\n // Otherwise, only update the stuff that needs updating.\n else\n patchDisplay(updates);\n lineDiv.style.display = \"\";\n\n // Position the mover div to align with the lines it's supposed\n // to be showing (which will cover the visible display)\n var different = from != showingFrom || to != showingTo || lastHeight != scroller.clientHeight;\n showingFrom = from; showingTo = to;\n mover.style.top = (from * lineHeight()) + \"px\";\n if (different) {\n lastHeight = scroller.clientHeight;\n code.style.height = (lines.length * lineHeight() + 2 * paddingTop()) + \"px\";\n updateGutter();\n }\n\n if (maxWidth == null) maxWidth = stringWidth(maxLine);\n if (maxWidth > scroller.clientWidth) {\n lineSpace.style.width = maxWidth + \"px\";\n // Needed to prevent odd wrapping/hiding of widgets placed in here.\n code.style.width = \"\";\n code.style.width = scroller.scrollWidth + \"px\";\n } else {\n lineSpace.style.width = code.style.width = \"\";\n }\n\n // Since this is all rather error prone, it is honoured with the\n // only assertion in the whole file.\n if (lineDiv.childNodes.length != showingTo - showingFrom)\n throw new Error(\"BAD PATCH! \" + JSON.stringify(updates) + \" size=\" + (showingTo - showingFrom) +\n \" nodes=\" + lineDiv.childNodes.length);\n updateCursor();\n }", "function updateDisplay(changes) {\n if (!scroller.clientWidth) {\n showingFrom = showingTo = 0;\n return;\n }\n // First create a range of theoretically intact lines, and punch\n // holes in that using the change info.\n var intact = changes === true ? [] : [{from: showingFrom, to: showingTo, domStart: 0}];\n for (var i = 0, l = changes.length || 0; i < l; ++i) {\n var change = changes[i], intact2 = [], diff = change.diff || 0;\n for (var j = 0, l2 = intact.length; j < l2; ++j) {\n var range = intact[j];\n if (change.to <= range.from)\n intact2.push({from: range.from + diff, to: range.to + diff, domStart: range.domStart});\n else if (range.to <= change.from)\n intact2.push(range);\n else {\n if (change.from > range.from)\n intact2.push({from: range.from, to: change.from, domStart: range.domStart})\n if (change.to < range.to)\n intact2.push({from: change.to + diff, to: range.to + diff,\n domStart: range.domStart + (change.to - range.from)});\n }\n }\n intact = intact2;\n }\n\n // Then, determine which lines we'd want to see, and which\n // updates have to be made to get there.\n var visible = visibleLines();\n var from = Math.min(showingFrom, Math.max(visible.from - 3, 0)),\n to = Math.min(lines.length, Math.max(showingTo, visible.to + 3)),\n updates = [], domPos = 0, domEnd = showingTo - showingFrom, pos = from, changedLines = 0;\n\n for (var i = 0, l = intact.length; i < l; ++i) {\n var range = intact[i];\n if (range.to <= from) continue;\n if (range.from >= to) break;\n if (range.domStart > domPos || range.from > pos) {\n updates.push({from: pos, to: range.from, domSize: range.domStart - domPos, domStart: domPos});\n changedLines += range.from - pos;\n }\n pos = range.to;\n domPos = range.domStart + (range.to - range.from);\n }\n if (domPos != domEnd || pos != to) {\n changedLines += Math.abs(to - pos);\n updates.push({from: pos, to: to, domSize: domEnd - domPos, domStart: domPos});\n }\n\n if (!updates.length) return;\n lineDiv.style.display = \"none\";\n // If more than 30% of the screen needs update, just do a full\n // redraw (which is quicker than patching)\n if (changedLines > (visible.to - visible.from) * .3)\n refreshDisplay(from = Math.max(visible.from - 10, 0), to = Math.min(visible.to + 7, lines.length));\n // Otherwise, only update the stuff that needs updating.\n else\n patchDisplay(updates);\n lineDiv.style.display = \"\";\n\n // Position the mover div to align with the lines it's supposed\n // to be showing (which will cover the visible display)\n var different = from != showingFrom || to != showingTo || lastHeight != scroller.clientHeight;\n showingFrom = from; showingTo = to;\n mover.style.top = (from * lineHeight()) + \"px\";\n if (different) {\n lastHeight = scroller.clientHeight;\n code.style.height = (lines.length * lineHeight() + 2 * paddingTop()) + \"px\";\n updateGutter();\n }\n\n if (maxWidth == null) maxWidth = stringWidth(maxLine);\n if (maxWidth > scroller.clientWidth) {\n lineSpace.style.width = maxWidth + \"px\";\n // Needed to prevent odd wrapping/hiding of widgets placed in here.\n code.style.width = \"\";\n code.style.width = scroller.scrollWidth + \"px\";\n } else {\n lineSpace.style.width = code.style.width = \"\";\n }\n\n // Since this is all rather error prone, it is honoured with the\n // only assertion in the whole file.\n if (lineDiv.childNodes.length != showingTo - showingFrom)\n throw new Error(\"BAD PATCH! \" + JSON.stringify(updates) + \" size=\" + (showingTo - showingFrom) +\n \" nodes=\" + lineDiv.childNodes.length);\n updateCursor();\n }", "function updateDisplay(changes) {\n if (!scroller.clientWidth) {\n showingFrom = showingTo = 0;\n return;\n }\n // First create a range of theoretically intact lines, and punch\n // holes in that using the change info.\n var intact = changes === true ? [] : [{from: showingFrom, to: showingTo, domStart: 0}];\n for (var i = 0, l = changes.length || 0; i < l; ++i) {\n var change = changes[i], intact2 = [], diff = change.diff || 0;\n for (var j = 0, l2 = intact.length; j < l2; ++j) {\n var range = intact[j];\n if (change.to <= range.from)\n intact2.push({from: range.from + diff, to: range.to + diff, domStart: range.domStart});\n else if (range.to <= change.from)\n intact2.push(range);\n else {\n if (change.from > range.from)\n intact2.push({from: range.from, to: change.from, domStart: range.domStart});\n if (change.to < range.to)\n intact2.push({from: change.to + diff, to: range.to + diff,\n domStart: range.domStart + (change.to - range.from)});\n }\n }\n intact = intact2;\n }\n\n // Then, determine which lines we'd want to see, and which\n // updates have to be made to get there.\n var visible = visibleLines();\n var from = Math.min(showingFrom, Math.max(visible.from - 3, 0)),\n to = Math.min(lines.length, Math.max(showingTo, visible.to + 3)),\n updates = [], domPos = 0, domEnd = showingTo - showingFrom, pos = from, changedLines = 0;\n\n for (var i = 0, l = intact.length; i < l; ++i) {\n var range = intact[i];\n if (range.to <= from) continue;\n if (range.from >= to) break;\n if (range.domStart > domPos || range.from > pos) {\n updates.push({from: pos, to: range.from, domSize: range.domStart - domPos, domStart: domPos});\n changedLines += range.from - pos;\n }\n pos = range.to;\n domPos = range.domStart + (range.to - range.from);\n }\n if (domPos != domEnd || pos != to) {\n changedLines += Math.abs(to - pos);\n updates.push({from: pos, to: to, domSize: domEnd - domPos, domStart: domPos});\n if (to - pos != domEnd - domPos) gutterDirty = true;\n }\n\n if (!updates.length) return;\n lineDiv.style.display = \"none\";\n // If more than 30% of the screen needs update, just do a full\n // redraw (which is quicker than patching)\n if (changedLines > (visible.to - visible.from) * .3)\n refreshDisplay(from = Math.max(visible.from - 10, 0), to = Math.min(visible.to + 7, lines.length));\n // Otherwise, only update the stuff that needs updating.\n else\n patchDisplay(updates);\n lineDiv.style.display = \"\";\n\n // Position the mover div to align with the lines it's supposed\n // to be showing (which will cover the visible display)\n var different = from != showingFrom || to != showingTo || lastHeight != scroller.clientHeight;\n showingFrom = from; showingTo = to;\n mover.style.top = (from * lineHeight()) + \"px\";\n if (different) {\n lastHeight = scroller.clientHeight;\n code.style.height = (lines.length * lineHeight() + 2 * paddingTop()) + \"px\";\n }\n if (different || gutterDirty) updateGutter();\n\n if (maxWidth == null) maxWidth = stringWidth(maxLine);\n if (maxWidth > scroller.clientWidth) {\n lineSpace.style.width = maxWidth + \"px\";\n // Needed to prevent odd wrapping/hiding of widgets placed in here.\n code.style.width = \"\";\n code.style.width = scroller.scrollWidth + \"px\";\n } else {\n lineSpace.style.width = code.style.width = \"\";\n }\n\n // Since this is all rather error prone, it is honoured with the\n // only assertion in the whole file.\n if (lineDiv.childNodes.length != showingTo - showingFrom)\n throw new Error(\"BAD PATCH! \" + JSON.stringify(updates) + \" size=\" + (showingTo - showingFrom) +\n \" nodes=\" + lineDiv.childNodes.length);\n updateCursor();\n }", "function Interpreter_UpdateDisplay()\n{\n\t//helpers\n\tvar uidObject, theObject;\n\t//loop through all of our iframes\n\tfor (uidObject in this.LoadedIFrames)\n\t{\n\t\t//get the object\n\t\ttheObject = this.LoadedIFrames[uidObject];\n\t\t//valid?\n\t\tif (theObject && theObject.HTML)\n\t\t{\n\t\t\t//purge all css data\n\t\t\tBrowser_RemoveCSSData_Purge(theObject.HTML.contentDocument);\n\t\t}\n\t}\n\t//purge all css data from main doc too\n\tBrowser_RemoveCSSData_Purge(document);\n\t//loop through all toplevel objects\n\tfor (uidObject in this.TopLevelObjects)\n\t{\n\t\t//get the object\n\t\ttheObject = this.TopLevelObjects[uidObject];\n\t\t//valid?\n\t\tif (theObject)\n\t\t{\n\t\t\t//update it with full recursion\n\t\t\ttheObject.UpdateDisplay(true);\n\t\t}\n\t}\n\t//rearrange the forms\n\tForm_RearrangeForms(this.FocusedFormId);\n\t//and reset this\n\tthis.FocusedFormId = [];\n\t//have we got a focused object id? (AND NOT IN DESIGNER)\n\tif (this.State && this.State.FocusedObjectId > 0)\n\t{\n\t\t//memorise it\n\t\tthis.FocusedObjectId = this.State.FocusedObjectId;\n\t}\n\t//we need to handle the tabs here\n\tthis.PreUpdatePostDisplay();\n}", "function updateDisplay(changes, suppressCallback) {\n if (!scroller.clientWidth) {\n showingFrom = showingTo = displayOffset = 0;\n return;\n }\n // Compute the new visible window\n var visible = visibleLines();\n // Bail out if the visible area is already rendered and nothing changed.\n if (changes !== true && changes.length == 0 && visible.from > showingFrom && visible.to < showingTo) return;\n var from = Math.max(visible.from - 100, 0), to = Math.min(doc.size, visible.to + 100);\n if (showingFrom < from && from - showingFrom < 20) from = showingFrom;\n if (showingTo > to && showingTo - to < 20) to = Math.min(doc.size, showingTo);\n\n // Create a range of theoretically intact lines, and punch holes\n // in that using the change info.\n var intact = changes === true ? [] :\n computeIntact([{from: showingFrom, to: showingTo, domStart: 0}], changes);\n // Clip off the parts that won't be visible\n var intactLines = 0;\n for (var i = 0; i < intact.length; ++i) {\n var range = intact[i];\n if (range.from < from) {range.domStart += (from - range.from); range.from = from;}\n if (range.to > to) range.to = to;\n if (range.from >= range.to) intact.splice(i--, 1);\n else intactLines += range.to - range.from;\n }\n if (intactLines == to - from && from == showingFrom && to == showingTo) return;\n intact.sort(function(a, b) {return a.domStart - b.domStart;});\n\n var th = textHeight(), gutterDisplay = gutter.style.display;\n lineDiv.style.display = \"none\";\n patchDisplay(from, to, intact);\n lineDiv.style.display = gutter.style.display = \"\";\n\n // Position the mover div to align with the lines it's supposed\n // to be showing (which will cover the visible display)\n var different = from != showingFrom || to != showingTo || lastSizeC != scroller.clientHeight + th;\n // This is just a bogus formula that detects when the editor is\n // resized or the font size changes.\n if (different) lastSizeC = scroller.clientHeight + th;\n showingFrom = from; showingTo = to;\n displayOffset = heightAtLine(doc, from);\n mover.style.top = (displayOffset * th) + \"px\";\n if (scroller.clientHeight)\n code.style.height = (doc.height * th + 2 * paddingTop()) + \"px\";\n\n // Since this is all rather error prone, it is honoured with the\n // only assertion in the whole file.\n if (lineDiv.childNodes.length != showingTo - showingFrom)\n throw new Error(\"BAD PATCH! \" + JSON.stringify(intact) + \" size=\" + (showingTo - showingFrom) +\n \" nodes=\" + lineDiv.childNodes.length);\n\n function checkHeights() {\n maxWidth = scroller.clientWidth;\n var curNode = lineDiv.firstChild, heightChanged = false;\n doc.iter(showingFrom, showingTo, function(line) {\n if (!line.hidden) {\n var height = Math.round(curNode.offsetHeight / th) || 1;\n if (line.height != height) {\n updateLineHeight(line, height);\n gutterDirty = heightChanged = true;\n }\n }\n curNode = curNode.nextSibling;\n });\n if (heightChanged)\n code.style.height = (doc.height * th + 2 * paddingTop()) + \"px\";\n return heightChanged;\n }\n\n if (options.lineWrapping) {\n checkHeights();\n } else {\n if (maxWidth == null) maxWidth = stringWidth(maxLine);\n if (maxWidth > scroller.clientWidth) {\n lineSpace.style.width = maxWidth + \"px\";\n // Needed to prevent odd wrapping/hiding of widgets placed in here.\n code.style.width = \"\";\n code.style.width = scroller.scrollWidth + \"px\";\n } else {\n lineSpace.style.width = code.style.width = \"\";\n }\n }\n\n gutter.style.display = gutterDisplay;\n if (different || gutterDirty) {\n // If the gutter grew in size, re-check heights. If those changed, re-draw gutter.\n updateGutter() && options.lineWrapping && checkHeights() && updateGutter();\n }\n updateSelection();\n if (!suppressCallback && options.onUpdate) options.onUpdate(instance);\n return true;\n }", "function updateDisplay(changes, suppressCallback) {\n if (!scroller.clientWidth) {\n showingFrom = showingTo = displayOffset = 0;\n return;\n }\n // Compute the new visible window\n var visible = visibleLines();\n // Bail out if the visible area is already rendered and nothing changed.\n if (changes !== true && changes.length == 0 && visible.from > showingFrom && visible.to < showingTo) return;\n var from = Math.max(visible.from - 100, 0), to = Math.min(doc.size, visible.to + 100);\n if (showingFrom < from && from - showingFrom < 20) from = showingFrom;\n if (showingTo > to && showingTo - to < 20) to = Math.min(doc.size, showingTo);\n\n // Create a range of theoretically intact lines, and punch holes\n // in that using the change info.\n var intact = changes === true ? [] :\n computeIntact([{from: showingFrom, to: showingTo, domStart: 0}], changes);\n // Clip off the parts that won't be visible\n var intactLines = 0;\n for (var i = 0; i < intact.length; ++i) {\n var range = intact[i];\n if (range.from < from) {range.domStart += (from - range.from); range.from = from;}\n if (range.to > to) range.to = to;\n if (range.from >= range.to) intact.splice(i--, 1);\n else intactLines += range.to - range.from;\n }\n if (intactLines == to - from && from == showingFrom && to == showingTo) return;\n intact.sort(function(a, b) {return a.domStart - b.domStart;});\n\n var th = textHeight(), gutterDisplay = gutter.style.display;\n lineDiv.style.display = \"none\";\n patchDisplay(from, to, intact);\n lineDiv.style.display = gutter.style.display = \"\";\n\n // Position the mover div to align with the lines it's supposed\n // to be showing (which will cover the visible display)\n var different = from != showingFrom || to != showingTo || lastSizeC != scroller.clientHeight + th;\n // This is just a bogus formula that detects when the editor is\n // resized or the font size changes.\n if (different) lastSizeC = scroller.clientHeight + th;\n showingFrom = from; showingTo = to;\n displayOffset = heightAtLine(doc, from);\n mover.style.top = (displayOffset * th) + \"px\";\n if (scroller.clientHeight)\n code.style.height = (doc.height * th + 2 * paddingTop()) + \"px\";\n\n // Since this is all rather error prone, it is honoured with the\n // only assertion in the whole file.\n if (lineDiv.childNodes.length != showingTo - showingFrom)\n throw new Error(\"BAD PATCH! \" + JSON.stringify(intact) + \" size=\" + (showingTo - showingFrom) +\n \" nodes=\" + lineDiv.childNodes.length);\n\n function checkHeights() {\n maxWidth = scroller.clientWidth;\n var curNode = lineDiv.firstChild, heightChanged = false;\n doc.iter(showingFrom, showingTo, function(line) {\n if (!line.hidden) {\n var height = Math.round(curNode.offsetHeight / th) || 1;\n if (line.height != height) {\n updateLineHeight(line, height);\n gutterDirty = heightChanged = true;\n }\n }\n curNode = curNode.nextSibling;\n });\n if (heightChanged)\n code.style.height = (doc.height * th + 2 * paddingTop()) + \"px\";\n return heightChanged;\n }\n\n if (options.lineWrapping) {\n checkHeights();\n } else {\n if (maxWidth == null) maxWidth = stringWidth(maxLine);\n if (maxWidth > scroller.clientWidth) {\n lineSpace.style.width = maxWidth + \"px\";\n // Needed to prevent odd wrapping/hiding of widgets placed in here.\n code.style.width = \"\";\n code.style.width = scroller.scrollWidth + \"px\";\n } else {\n lineSpace.style.width = code.style.width = \"\";\n }\n }\n\n gutter.style.display = gutterDisplay;\n if (different || gutterDirty) {\n // If the gutter grew in size, re-check heights. If those changed, re-draw gutter.\n updateGutter() && options.lineWrapping && checkHeights() && updateGutter();\n }\n updateSelection();\n if (!suppressCallback && options.onUpdate) options.onUpdate(instance);\n return true;\n }", "function updateView(){\n\tmainContents = clearView();\n\tdocument.getElementById('main').innerHTML = mainContents;\n}", "function updateDisplayList() {\n\tvar topStart = initStart;\n\t\n\tif (commentVBox != null) {\n\t\tTi.API.info('updateDisplayList: Removing commentVBox ...');\n\t\twin.remove(commentVBox);\n\t}\n\n\t// list of comment components\t\n\tvar commentList = [];\n\t\n\tTi.API.info('updateDisplayList: counter: ' + msgEvent.commentCounter);\n\t\t\n\tif (msgEvent.commentCounter > 0) {\n\t\tfor (i=0; i<msgEvent.commentCounter; i++) {\n\t\t\tvar commentInst = msgEvent.comments[i];\n\t\t\tvar r = createExistingCommentRow(commentInst, i);\n\t\t\tcommentList.push(r);\n\t\t}\n\t}\n\t\n\t//\n\t// component for user to add new comments section\n\t//\n\tif (localFlag) {\n\t\tvar last = createNewCommentsSection(msgEvent);\n\t\tcommentList.push(last);\n\t}\n\t\n\tcommentVBox = Titanium.UI.createTableView({\n\t\tscrollable:true,\n\t\tmoving:false,\n\t\tselectionStyle:Ti.UI.iPhone.TableViewCellSelectionStyle.GRAY,\n\t\tdata:commentList,\n\t\tseparatorColor:CSSMgr.color0,\n\t\ttop:topStart,\n\t\tleft:0,\n\t\theight:240,\n\t\tfilterAttribute:'filter'\n\t});\n\tcommentVBox.backgroundImage = '../images/Background.png';\n\twin.add(commentVBox);\n\t\n\tvar reportAbuseBtn = Titanium.UI.createButton({\n \t\ttitle:'Report Abuse',\n\t\tcolor:CSSMgr.color2,\n\t\tbackgroundColor:CSSMgr.color0,\n \t\tfont:{fontSize:12, fontFamily:model.myFont, fontWeight:'bold'},\n\t\tstyle:Titanium.UI.iPhone.SystemButtonStyle.PLAIN,\n\t\twidth:100,\n \t\theight:30,\n\t\tbottom:0,\n\t\tright:0\n\t});\n\treportAbuseBtn.addEventListener('click', function(e) {\n\t\tvar w = Titanium.UI.createWindow({\n\t\t\turl:'reportAbuseList.js',\n\t\t\tmodel:win.model,\n\t\t\tmsgEvent:msgEvent,\n\t\t\tbackgroundColor:CSSMgr.color0,\n \t\t\tbarColor:CSSMgr.color0,\n\t\t\tbarImage: '../images/Header.png'\n\t\t});\n\t\tTitanium.UI.currentTab.open(w, {animated:true});\n\t});\n\twin.add(reportAbuseBtn);\n}", "function updateDOM() {\n\tvar newTree = render(data);\n\tvar patches = diff(tree, newTree);\n\trootNode = patch(rootNode, patches);\n\ttree = newTree;\n}", "function updateDisplayInner(cm, changes, visible, forced) {\n var display = cm.display, doc = cm.doc;\n if (!display.wrapper.clientWidth) {\n display.showingFrom = display.showingTo = doc.first;\n display.viewOffset = 0;\n return;\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!forced && changes.length == 0 &&\n visible.from > display.showingFrom && visible.to < display.showingTo)\n return;\n\n if (maybeUpdateLineNumberWidth(cm))\n changes = [{from: doc.first, to: doc.first + doc.size}];\n var gutterW = display.sizer.style.marginLeft = display.gutters.offsetWidth + \"px\";\n display.scrollbarH.style.left = cm.options.fixedGutter ? gutterW : \"0\";\n\n // Used to determine which lines need their line numbers updated\n var positionsChangedFrom = Infinity;\n if (cm.options.lineNumbers)\n for (var i = 0; i < changes.length; ++i)\n if (changes[i].diff && changes[i].from < positionsChangedFrom) { positionsChangedFrom = changes[i].from; }\n\n var end = doc.first + doc.size;\n var from = Math.max(visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, visible.to + cm.options.viewportMargin);\n if (display.showingFrom < from && from - display.showingFrom < 20) from = Math.max(doc.first, display.showingFrom);\n if (display.showingTo > to && display.showingTo - to < 20) to = Math.min(end, display.showingTo);\n if (sawCollapsedSpans) {\n from = lineNo(visualLine(doc, getLine(doc, from)));\n while (to < end && lineIsHidden(doc, getLine(doc, to))) ++to;\n }\n\n // Create a range of theoretically intact lines, and punch holes\n // in that using the change info.\n var intact = [{from: Math.max(display.showingFrom, doc.first),\n to: Math.min(display.showingTo, end)}];\n if (intact[0].from >= intact[0].to) intact = [];\n else intact = computeIntact(intact, changes);\n // When merged lines are present, we might have to reduce the\n // intact ranges because changes in continued fragments of the\n // intact lines do require the lines to be redrawn.\n if (sawCollapsedSpans)\n for (var i = 0; i < intact.length; ++i) {\n var range = intact[i], merged;\n while (merged = collapsedSpanAtEnd(getLine(doc, range.to - 1))) {\n var newTo = merged.find().from.line;\n if (newTo > range.from) range.to = newTo;\n else { intact.splice(i--, 1); break; }\n }\n }\n\n // Clip off the parts that won't be visible\n var intactLines = 0;\n for (var i = 0; i < intact.length; ++i) {\n var range = intact[i];\n if (range.from < from) range.from = from;\n if (range.to > to) range.to = to;\n if (range.from >= range.to) intact.splice(i--, 1);\n else intactLines += range.to - range.from;\n }\n if (!forced && intactLines == to - from && from == display.showingFrom && to == display.showingTo) {\n updateViewOffset(cm);\n return;\n }\n intact.sort(function(a, b) {return a.from - b.from;});\n\n // Avoid crashing on IE's \"unspecified error\" when in iframes\n try {\n var focused = document.activeElement;\n } catch(e) {}\n if (intactLines < (to - from) * .7) display.lineDiv.style.display = \"none\";\n patchDisplay(cm, from, to, intact, positionsChangedFrom);\n display.lineDiv.style.display = \"\";\n if (focused && document.activeElement != focused && focused.offsetHeight) focused.focus();\n\n var different = from != display.showingFrom || to != display.showingTo ||\n display.lastSizeC != display.wrapper.clientHeight;\n // This is just a bogus formula that detects when the editor is\n // resized or the font size changes.\n if (different) {\n display.lastSizeC = display.wrapper.clientHeight;\n startWorker(cm, 400);\n }\n display.showingFrom = from; display.showingTo = to;\n\n updateHeightsInViewport(cm);\n updateViewOffset(cm);\n\n return true;\n }", "function updateDisplayInner(cm, changes, visible, forced) {\n var display = cm.display, doc = cm.doc;\n if (!display.wrapper.clientWidth) {\n display.showingFrom = display.showingTo = doc.first;\n display.viewOffset = 0;\n return;\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!forced && changes.length == 0 &&\n visible.from > display.showingFrom && visible.to < display.showingTo)\n return;\n\n if (maybeUpdateLineNumberWidth(cm))\n changes = [{from: doc.first, to: doc.first + doc.size}];\n var gutterW = display.sizer.style.marginLeft = display.gutters.offsetWidth + \"px\";\n display.scrollbarH.style.left = cm.options.fixedGutter ? gutterW : \"0\";\n\n // Used to determine which lines need their line numbers updated\n var positionsChangedFrom = Infinity;\n if (cm.options.lineNumbers)\n for (var i = 0; i < changes.length; ++i)\n if (changes[i].diff && changes[i].from < positionsChangedFrom) { positionsChangedFrom = changes[i].from; }\n\n var end = doc.first + doc.size;\n var from = Math.max(visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, visible.to + cm.options.viewportMargin);\n if (display.showingFrom < from && from - display.showingFrom < 20) from = Math.max(doc.first, display.showingFrom);\n if (display.showingTo > to && display.showingTo - to < 20) to = Math.min(end, display.showingTo);\n if (sawCollapsedSpans) {\n from = lineNo(visualLine(doc, getLine(doc, from)));\n while (to < end && lineIsHidden(doc, getLine(doc, to))) ++to;\n }\n\n // Create a range of theoretically intact lines, and punch holes\n // in that using the change info.\n var intact = [{from: Math.max(display.showingFrom, doc.first),\n to: Math.min(display.showingTo, end)}];\n if (intact[0].from >= intact[0].to) intact = [];\n else intact = computeIntact(intact, changes);\n // When merged lines are present, we might have to reduce the\n // intact ranges because changes in continued fragments of the\n // intact lines do require the lines to be redrawn.\n if (sawCollapsedSpans)\n for (var i = 0; i < intact.length; ++i) {\n var range = intact[i], merged;\n while (merged = collapsedSpanAtEnd(getLine(doc, range.to - 1))) {\n var newTo = merged.find().from.line;\n if (newTo > range.from) range.to = newTo;\n else { intact.splice(i--, 1); break; }\n }\n }\n\n // Clip off the parts that won't be visible\n var intactLines = 0;\n for (var i = 0; i < intact.length; ++i) {\n var range = intact[i];\n if (range.from < from) range.from = from;\n if (range.to > to) range.to = to;\n if (range.from >= range.to) intact.splice(i--, 1);\n else intactLines += range.to - range.from;\n }\n if (!forced && intactLines == to - from && from == display.showingFrom && to == display.showingTo) {\n updateViewOffset(cm);\n return;\n }\n intact.sort(function(a, b) {return a.from - b.from;});\n\n // Avoid crashing on IE's \"unspecified error\" when in iframes\n try {\n var focused = document.activeElement;\n } catch(e) {}\n if (intactLines < (to - from) * .7) display.lineDiv.style.display = \"none\";\n patchDisplay(cm, from, to, intact, positionsChangedFrom);\n display.lineDiv.style.display = \"\";\n if (focused && document.activeElement != focused && focused.offsetHeight) focused.focus();\n\n var different = from != display.showingFrom || to != display.showingTo ||\n display.lastSizeC != display.wrapper.clientHeight;\n // This is just a bogus formula that detects when the editor is\n // resized or the font size changes.\n if (different) {\n display.lastSizeC = display.wrapper.clientHeight;\n startWorker(cm, 400);\n }\n display.showingFrom = from; display.showingTo = to;\n\n updateHeightsInViewport(cm);\n updateViewOffset(cm);\n\n return true;\n }", "function updateDisplayInner(cm, changes, visible, forced) {\n var display = cm.display, doc = cm.doc;\n if (!display.wrapper.clientWidth) {\n display.showingFrom = display.showingTo = doc.first;\n display.viewOffset = 0;\n return;\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!forced && changes.length == 0 &&\n visible.from > display.showingFrom && visible.to < display.showingTo)\n return;\n\n if (maybeUpdateLineNumberWidth(cm))\n changes = [{from: doc.first, to: doc.first + doc.size}];\n var gutterW = display.sizer.style.marginLeft = display.gutters.offsetWidth + \"px\";\n display.scrollbarH.style.left = cm.options.fixedGutter ? gutterW : \"0\";\n\n // Used to determine which lines need their line numbers updated\n var positionsChangedFrom = Infinity;\n if (cm.options.lineNumbers)\n for (var i = 0; i < changes.length; ++i)\n if (changes[i].diff) { positionsChangedFrom = changes[i].from; break; }\n\n var end = doc.first + doc.size;\n var from = Math.max(visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, visible.to + cm.options.viewportMargin);\n if (display.showingFrom < from && from - display.showingFrom < 20) from = Math.max(doc.first, display.showingFrom);\n if (display.showingTo > to && display.showingTo - to < 20) to = Math.min(end, display.showingTo);\n if (sawCollapsedSpans) {\n from = lineNo(visualLine(doc, getLine(doc, from)));\n while (to < end && lineIsHidden(doc, getLine(doc, to))) ++to;\n }\n\n // Create a range of theoretically intact lines, and punch holes\n // in that using the change info.\n var intact = [{from: Math.max(display.showingFrom, doc.first),\n to: Math.min(display.showingTo, end)}];\n if (intact[0].from >= intact[0].to) intact = [];\n else intact = computeIntact(intact, changes);\n // When merged lines are present, we might have to reduce the\n // intact ranges because changes in continued fragments of the\n // intact lines do require the lines to be redrawn.\n if (sawCollapsedSpans)\n for (var i = 0; i < intact.length; ++i) {\n var range = intact[i], merged;\n while (merged = collapsedSpanAtEnd(getLine(doc, range.to - 1))) {\n var newTo = merged.find().from.line;\n if (newTo > range.from) range.to = newTo;\n else { intact.splice(i--, 1); break; }\n }\n }\n\n // Clip off the parts that won't be visible\n var intactLines = 0;\n for (var i = 0; i < intact.length; ++i) {\n var range = intact[i];\n if (range.from < from) range.from = from;\n if (range.to > to) range.to = to;\n if (range.from >= range.to) intact.splice(i--, 1);\n else intactLines += range.to - range.from;\n }\n if (!forced && intactLines == to - from && from == display.showingFrom && to == display.showingTo) {\n updateViewOffset(cm);\n return;\n }\n intact.sort(function(a, b) {return a.from - b.from;});\n\n // Avoid crashing on IE's \"unspecified error\" when in iframes\n try {\n var focused = document.activeElement;\n } catch(e) {}\n if (intactLines < (to - from) * .7) display.lineDiv.style.display = \"none\";\n patchDisplay(cm, from, to, intact, positionsChangedFrom);\n display.lineDiv.style.display = \"\";\n if (focused && document.activeElement != focused && focused.offsetHeight) focused.focus();\n\n var different = from != display.showingFrom || to != display.showingTo ||\n display.lastSizeC != display.wrapper.clientHeight;\n // This is just a bogus formula that detects when the editor is\n // resized or the font size changes.\n if (different) {\n display.lastSizeC = display.wrapper.clientHeight;\n startWorker(cm, 400);\n }\n display.showingFrom = from; display.showingTo = to;\n\n updateHeightsInViewport(cm);\n updateViewOffset(cm);\n\n return true;\n }", "function refreshDisplay() {\r\n\r\n if (useOfflineSync) {\r\n syncLocalTable().then(displayItems);\r\n } else {\r\n displayItems();\r\n }\r\n }", "function updateDisplayIfNeeded(cm, update) {\n\t\t var display = cm.display, doc = cm.doc;\n\n\t\t if (update.editorIsHidden) {\n\t\t resetView(cm);\n\t\t return false\n\t\t }\n\n\t\t // Bail out if the visible area is already rendered and nothing changed.\n\t\t if (!update.force &&\n\t\t update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n\t\t (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n\t\t display.renderedView == display.view && countDirtyView(cm) == 0)\n\t\t { return false }\n\n\t\t if (maybeUpdateLineNumberWidth(cm)) {\n\t\t resetView(cm);\n\t\t update.dims = getDimensions(cm);\n\t\t }\n\n\t\t // Compute a suitable new viewport (from & to)\n\t\t var end = doc.first + doc.size;\n\t\t var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n\t\t var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n\t\t if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n\t\t if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n\t\t if (sawCollapsedSpans) {\n\t\t from = visualLineNo(cm.doc, from);\n\t\t to = visualLineEndNo(cm.doc, to);\n\t\t }\n\n\t\t var different = from != display.viewFrom || to != display.viewTo ||\n\t\t display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n\t\t adjustView(cm, from, to);\n\n\t\t display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n\t\t // Position the mover div to align with the current scroll position\n\t\t cm.display.mover.style.top = display.viewOffset + \"px\";\n\n\t\t var toUpdate = countDirtyView(cm);\n\t\t if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n\t\t (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n\t\t { return false }\n\n\t\t // For big changes, we hide the enclosing element during the\n\t\t // update, since that speeds up the operations on most browsers.\n\t\t var selSnapshot = selectionSnapshot(cm);\n\t\t if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n\t\t patchDisplay(cm, display.updateLineNumbers, update.dims);\n\t\t if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n\t\t display.renderedView = display.view;\n\t\t // There might have been a widget with a focused element that got\n\t\t // hidden or updated, if so re-focus it.\n\t\t restoreSelection(selSnapshot);\n\n\t\t // Prevent selection and cursors from interfering with the scroll\n\t\t // width and height.\n\t\t removeChildren(display.cursorDiv);\n\t\t removeChildren(display.selectionDiv);\n\t\t display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n\t\t if (different) {\n\t\t display.lastWrapHeight = update.wrapperHeight;\n\t\t display.lastWrapWidth = update.wrapperWidth;\n\t\t startWorker(cm, 400);\n\t\t }\n\n\t\t display.updateLineNumbers = null;\n\n\t\t return true\n\t\t }", "function updateDisplayIfNeeded(cm, update) {\n\t var display = cm.display, doc = cm.doc;\n\t\n\t if (update.editorIsHidden) {\n\t resetView(cm);\n\t return false;\n\t }\n\t\n\t // Bail out if the visible area is already rendered and nothing changed.\n\t if (!update.force &&\n\t update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n\t (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n\t display.renderedView == display.view && countDirtyView(cm) == 0)\n\t return false;\n\t\n\t if (maybeUpdateLineNumberWidth(cm)) {\n\t resetView(cm);\n\t update.dims = getDimensions(cm);\n\t }\n\t\n\t // Compute a suitable new viewport (from & to)\n\t var end = doc.first + doc.size;\n\t var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n\t var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n\t if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\n\t if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\n\t if (sawCollapsedSpans) {\n\t from = visualLineNo(cm.doc, from);\n\t to = visualLineEndNo(cm.doc, to);\n\t }\n\t\n\t var different = from != display.viewFrom || to != display.viewTo ||\n\t display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n\t adjustView(cm, from, to);\n\t\n\t display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n\t // Position the mover div to align with the current scroll position\n\t cm.display.mover.style.top = display.viewOffset + \"px\";\n\t\n\t var toUpdate = countDirtyView(cm);\n\t if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n\t (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n\t return false;\n\t\n\t // For big changes, we hide the enclosing element during the\n\t // update, since that speeds up the operations on most browsers.\n\t var focused = activeElt();\n\t if (toUpdate > 4) display.lineDiv.style.display = \"none\";\n\t patchDisplay(cm, display.updateLineNumbers, update.dims);\n\t if (toUpdate > 4) display.lineDiv.style.display = \"\";\n\t display.renderedView = display.view;\n\t // There might have been a widget with a focused element that got\n\t // hidden or updated, if so re-focus it.\n\t if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\n\t\n\t // Prevent selection and cursors from interfering with the scroll\n\t // width and height.\n\t removeChildren(display.cursorDiv);\n\t removeChildren(display.selectionDiv);\n\t display.gutters.style.height = display.sizer.style.minHeight = 0;\n\t\n\t if (different) {\n\t display.lastWrapHeight = update.wrapperHeight;\n\t display.lastWrapWidth = update.wrapperWidth;\n\t startWorker(cm, 400);\n\t }\n\t\n\t display.updateLineNumbers = null;\n\t\n\t return true;\n\t }", "function updateDisplayInner(cm, changes, visible, forced) {\n var display = cm.display, doc = cm.doc;\n if (!display.wrapper.offsetWidth) {\n display.showingFrom = display.showingTo = doc.first;\n display.viewOffset = 0;\n return;\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!forced && changes.length == 0 &&\n visible.from > display.showingFrom && visible.to < display.showingTo)\n return;\n\n if (maybeUpdateLineNumberWidth(cm))\n changes = [{from: doc.first, to: doc.first + doc.size}];\n var gutterW = display.sizer.style.marginLeft = display.gutters.offsetWidth + \"px\";\n display.scrollbarH.style.left = cm.options.fixedGutter ? gutterW : \"0\";\n\n // Used to determine which lines need their line numbers updated\n var positionsChangedFrom = Infinity;\n if (cm.options.lineNumbers)\n for (var i = 0; i < changes.length; ++i)\n if (changes[i].diff && changes[i].from < positionsChangedFrom) { positionsChangedFrom = changes[i].from; }\n\n var end = doc.first + doc.size;\n var from = Math.max(visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, visible.to + cm.options.viewportMargin);\n if (display.showingFrom < from && from - display.showingFrom < 20) from = Math.max(doc.first, display.showingFrom);\n if (display.showingTo > to && display.showingTo - to < 20) to = Math.min(end, display.showingTo);\n if (sawCollapsedSpans) {\n from = lineNo(visualLine(doc, getLine(doc, from)));\n while (to < end && lineIsHidden(doc, getLine(doc, to))) ++to;\n }\n\n // Create a range of theoretically intact lines, and punch holes\n // in that using the change info.\n var intact = [{from: Math.max(display.showingFrom, doc.first),\n to: Math.min(display.showingTo, end)}];\n if (intact[0].from >= intact[0].to) intact = [];\n else intact = computeIntact(intact, changes);\n // When merged lines are present, we might have to reduce the\n // intact ranges because changes in continued fragments of the\n // intact lines do require the lines to be redrawn.\n if (sawCollapsedSpans)\n for (var i = 0; i < intact.length; ++i) {\n var range = intact[i], merged;\n while (merged = collapsedSpanAtEnd(getLine(doc, range.to - 1))) {\n var newTo = merged.find().from.line;\n if (newTo > range.from) range.to = newTo;\n else { intact.splice(i--, 1); break; }\n }\n }\n\n // Clip off the parts that won't be visible\n var intactLines = 0;\n for (var i = 0; i < intact.length; ++i) {\n var range = intact[i];\n if (range.from < from) range.from = from;\n if (range.to > to) range.to = to;\n if (range.from >= range.to) intact.splice(i--, 1);\n else intactLines += range.to - range.from;\n }\n if (!forced && intactLines == to - from && from == display.showingFrom && to == display.showingTo) {\n updateViewOffset(cm);\n return;\n }\n intact.sort(function(a, b) {return a.from - b.from;});\n\n // Avoid crashing on IE's \"unspecified error\" when in iframes\n try {\n var focused = document.activeElement;\n } catch(e) {}\n if (intactLines < (to - from) * .7) display.lineDiv.style.display = \"none\";\n patchDisplay(cm, from, to, intact, positionsChangedFrom);\n display.lineDiv.style.display = \"\";\n if (focused && document.activeElement != focused && focused.offsetHeight) focused.focus();\n\n var different = from != display.showingFrom || to != display.showingTo ||\n display.lastSizeC != display.wrapper.clientHeight;\n // This is just a bogus formula that detects when the editor is\n // resized or the font size changes.\n if (different) {\n display.lastSizeC = display.wrapper.clientHeight;\n startWorker(cm, 400);\n }\n display.showingFrom = from; display.showingTo = to;\n\n display.gutters.style.height = \"\";\n updateHeightsInViewport(cm);\n updateViewOffset(cm);\n\n return true;\n }", "function updateDisplayIfNeeded(cm, update) {\n\t var display = cm.display, doc = cm.doc;\n\n\t if (update.editorIsHidden) {\n\t resetView(cm);\n\t return false;\n\t }\n\n\t // Bail out if the visible area is already rendered and nothing changed.\n\t if (!update.force &&\n\t update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n\t (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n\t display.renderedView == display.view && countDirtyView(cm) == 0)\n\t return false;\n\n\t if (maybeUpdateLineNumberWidth(cm)) {\n\t resetView(cm);\n\t update.dims = getDimensions(cm);\n\t }\n\n\t // Compute a suitable new viewport (from & to)\n\t var end = doc.first + doc.size;\n\t var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n\t var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n\t if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\n\t if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\n\t if (sawCollapsedSpans) {\n\t from = visualLineNo(cm.doc, from);\n\t to = visualLineEndNo(cm.doc, to);\n\t }\n\n\t var different = from != display.viewFrom || to != display.viewTo ||\n\t display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n\t adjustView(cm, from, to);\n\n\t display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n\t // Position the mover div to align with the current scroll position\n\t cm.display.mover.style.top = display.viewOffset + \"px\";\n\n\t var toUpdate = countDirtyView(cm);\n\t if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n\t (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n\t return false;\n\n\t // For big changes, we hide the enclosing element during the\n\t // update, since that speeds up the operations on most browsers.\n\t var focused = activeElt();\n\t if (toUpdate > 4) display.lineDiv.style.display = \"none\";\n\t patchDisplay(cm, display.updateLineNumbers, update.dims);\n\t if (toUpdate > 4) display.lineDiv.style.display = \"\";\n\t display.renderedView = display.view;\n\t // There might have been a widget with a focused element that got\n\t // hidden or updated, if so re-focus it.\n\t if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\n\n\t // Prevent selection and cursors from interfering with the scroll\n\t // width and height.\n\t removeChildren(display.cursorDiv);\n\t removeChildren(display.selectionDiv);\n\t display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n\t if (different) {\n\t display.lastWrapHeight = update.wrapperHeight;\n\t display.lastWrapWidth = update.wrapperWidth;\n\t startWorker(cm, 400);\n\t }\n\n\t display.updateLineNumbers = null;\n\n\t return true;\n\t }", "function updateDisplayIfNeeded(cm, update) {\n\t var display = cm.display, doc = cm.doc;\n\n\t if (update.editorIsHidden) {\n\t resetView(cm);\n\t return false;\n\t }\n\n\t // Bail out if the visible area is already rendered and nothing changed.\n\t if (!update.force &&\n\t update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n\t (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n\t display.renderedView == display.view && countDirtyView(cm) == 0)\n\t return false;\n\n\t if (maybeUpdateLineNumberWidth(cm)) {\n\t resetView(cm);\n\t update.dims = getDimensions(cm);\n\t }\n\n\t // Compute a suitable new viewport (from & to)\n\t var end = doc.first + doc.size;\n\t var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n\t var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n\t if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\n\t if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\n\t if (sawCollapsedSpans) {\n\t from = visualLineNo(cm.doc, from);\n\t to = visualLineEndNo(cm.doc, to);\n\t }\n\n\t var different = from != display.viewFrom || to != display.viewTo ||\n\t display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n\t adjustView(cm, from, to);\n\n\t display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n\t // Position the mover div to align with the current scroll position\n\t cm.display.mover.style.top = display.viewOffset + \"px\";\n\n\t var toUpdate = countDirtyView(cm);\n\t if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n\t (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n\t return false;\n\n\t // For big changes, we hide the enclosing element during the\n\t // update, since that speeds up the operations on most browsers.\n\t var focused = activeElt();\n\t if (toUpdate > 4) display.lineDiv.style.display = \"none\";\n\t patchDisplay(cm, display.updateLineNumbers, update.dims);\n\t if (toUpdate > 4) display.lineDiv.style.display = \"\";\n\t display.renderedView = display.view;\n\t // There might have been a widget with a focused element that got\n\t // hidden or updated, if so re-focus it.\n\t if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\n\n\t // Prevent selection and cursors from interfering with the scroll\n\t // width and height.\n\t removeChildren(display.cursorDiv);\n\t removeChildren(display.selectionDiv);\n\t display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n\t if (different) {\n\t display.lastWrapHeight = update.wrapperHeight;\n\t display.lastWrapWidth = update.wrapperWidth;\n\t startWorker(cm, 400);\n\t }\n\n\t display.updateLineNumbers = null;\n\n\t return true;\n\t }", "function update() {\n\n\t\tif (root == null) {\n\t\t\treturn\n\t\t}\n\n\t\tlet bounds = element.bounds()\n\t\tlet fontSize = element.css('font-size')\n\t\tlet fontWeight = element.css('font-weight')\n\n\t\tif (measuredWidth == bounds.width &&\n\t\t\tmeasuredHeight == bounds.height &&\n\t\t\tmeasuredFontSize == fontSize &&\n\t\t\tmeasuredFontWeight == fontWeight) {\n\n\t\t\t/*\n\t\t\t * The area did not change thus the lines should remain\n\t\t\t * the same.\n\t\t\t */\n\n\t\t\treturn\n\t\t}\n\n\t\tmeasuredWidth = bounds.width\n\t\tmeasuredHeight = bounds.height\n\t\tmeasuredFontSize = fontSize\n\t\tmeasuredFontWeight = fontWeight\n\n\t\troot.innerHTML = html\n\n\t\telement.toggleClass('multiline', false)\n\n\t\tlet fragment = document.createDocumentFragment()\n\n\t\tbreakNode(root, fragment)\n\t\temptyNode(root)\n\n\t\troot.appendChild(fragment)\n\n\t\telement.toggleClass('multiline', true)\n\n\t\telement.find('.line').each((i, line) => {\n\n\t\t\tline = $(line)\n\t\t\tline.attr('data-nth-line', i + 1);\n\n\t\t\tline.attr('data-text', line.text())\n\n\t\t\tlet others = line.find(':not(.word)')\n\t\t\tline.toggleClass('plain', others.length == 0)\n\t\t\tline.toggleClass('mixed', others.length != 0)\n\n\t\t})\n\n\t\tif (options &&\n\t\t\toptions.onComplete) {\n\t\t\toptions.onComplete(element)\n\t\t}\n\n\t\telement.emit('breaklines/complete', element)\n\t}", "function update() {\n\n // calculate the x,y coordinates of the currentRoot\n tree(currentRoot);\n\n // create KV for simple access\n var currentRootKV = currentRoot.descendants().reduce(function(kv, el) {kv[el.data.id] = el; return kv},{});\n\n // the currentRoot contains the correct XY positions for all the nodes\n // minus the ones that need to be hidden. We don't want to limit the\n // number of nodes for our data elements, since that causes text and lines to\n // `jump` around. So we need to make sure we have the same amount of elements\n // and hide rendering the hidden ones.\n var toRender = root.descendants().map(function(el) {\n if (currentRootKV[el.data.id]) {\n var newNode = currentRootKV[el.data.id];\n return newNode;\n } else {\n // if the child is not in the KV map, it is hidden. We\n // now need to set its position to the calculated position of\n // the first visible parent. In other words, the first one\n // which is in the currentRootKV map.\n var fromRoot = _.cloneDeep(el);\n var parent = fromRoot.parent;\n while (!currentRootKV[parent.data.id]) {\n parent = parent.parent;\n }\n var newParent = currentRootKV[parent.data.id];\n\n fromRoot.hidden = true;\n fromRoot.x = newParent.x;\n fromRoot.y = newParent.y;\n\n // we also set the parents x,y since the lines need to\n // be drawn from this position.\n fromRoot.parent.x = newParent.x;\n fromRoot.parent.y = newParent.y;\n\n return fromRoot;\n }\n });\n\n // now that we have to correct data, create the links\n var links = chart.selectAll(\".link\")\n .data(toRender.slice(1));\n\n var linksEnter = links.enter().append(\"path\")\n .attr(\"class\", \"link\")\n .attr(\"d\", diagonal({x:0, y:0, parent: {x:0, y:0}}))\n .style(\"stroke\", function(d) {return colorScale(d.data.group)});\n\n links.merge(linksEnter)\n .transition().duration(2000).attr(\"d\", diagonal);\n\n // create the groups that hold the circle and the text elements\n var nodes = chart.selectAll(\".node\").data(toRender);\n\n var nodesEnter = nodes.enter().append(\"g\")\n .attr(\"class\", \"node\")\n .on(\"click\", click)\n\n nodesEnter.append(\"circle\")\n .attr(\"r\", 2.5)\n .style(\"fill\", function(d) {return colorScale(d.data.group)});\n\n nodesEnter.append(\"text\")\n .attr(\"dy\", \".31em\")\n\n // combine the updated and new nodes\n var nodesUpdate = nodes.merge(nodesEnter);\n\n // transition the nodes (circles & text)\n nodesUpdate.transition().duration(2000)\n .attr(\"transform\", function(d) { return \"translate(\" + project(d.x, d.y) + \")\"; })\n .style(\"opacity\", function(d) { return !d.hidden ? 1 : 0} )\n .on(\"end\", function(d) {d.hidden ? d3.select(this).attr(\"display\", \"none\"): \"\"})\n .on(\"start\", function(d) {!d.hidden ? d3.select(this).attr(\"display\", \"\"): \"\"});\n\n nodesUpdate.select(\"text\")\n .attr(\"x\", function(d) { return d.x < 180 === !d.children ? 6 : -6; })\n .text(function(d) {return d.data.name; })\n // we could also tween the anchor see chapter 2\n .style(\"text-anchor\", function(d) {\n // for the right side\n if (d.x < 180 && d.children) return \"end\"\n else if (d.x < 180 && !d.children) return \"start\"\n // for the left side\n else if (d.x >= 180 && !d.children) return \"end\"\n else if (d.x >= 180 && d.children) return \"start\"\n })\n .transition().duration(2000)\n .attr(\"transform\", function(d) {\n // called once to determine the target value, and tween the values\n return \"rotate(\" + (d.x < 180 ? d.x - 90 : d.x + 90) + \")\";\n })\n }", "function updateDisplayIfNeeded(cm, update) {\n\t\t var display = cm.display, doc = cm.doc;\n\t\t\n\t\t if (update.editorIsHidden) {\n\t\t resetView(cm);\n\t\t return false;\n\t\t }\n\t\t\n\t\t // Bail out if the visible area is already rendered and nothing changed.\n\t\t if (!update.force &&\n\t\t update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n\t\t (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n\t\t display.renderedView == display.view && countDirtyView(cm) == 0)\n\t\t return false;\n\t\t\n\t\t if (maybeUpdateLineNumberWidth(cm)) {\n\t\t resetView(cm);\n\t\t update.dims = getDimensions(cm);\n\t\t }\n\t\t\n\t\t // Compute a suitable new viewport (from & to)\n\t\t var end = doc.first + doc.size;\n\t\t var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n\t\t var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n\t\t if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\n\t\t if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\n\t\t if (sawCollapsedSpans) {\n\t\t from = visualLineNo(cm.doc, from);\n\t\t to = visualLineEndNo(cm.doc, to);\n\t\t }\n\t\t\n\t\t var different = from != display.viewFrom || to != display.viewTo ||\n\t\t display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n\t\t adjustView(cm, from, to);\n\t\t\n\t\t display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n\t\t // Position the mover div to align with the current scroll position\n\t\t cm.display.mover.style.top = display.viewOffset + \"px\";\n\t\t\n\t\t var toUpdate = countDirtyView(cm);\n\t\t if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n\t\t (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n\t\t return false;\n\t\t\n\t\t // For big changes, we hide the enclosing element during the\n\t\t // update, since that speeds up the operations on most browsers.\n\t\t var focused = activeElt();\n\t\t if (toUpdate > 4) display.lineDiv.style.display = \"none\";\n\t\t patchDisplay(cm, display.updateLineNumbers, update.dims);\n\t\t if (toUpdate > 4) display.lineDiv.style.display = \"\";\n\t\t display.renderedView = display.view;\n\t\t // There might have been a widget with a focused element that got\n\t\t // hidden or updated, if so re-focus it.\n\t\t if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\n\t\t\n\t\t // Prevent selection and cursors from interfering with the scroll\n\t\t // width and height.\n\t\t removeChildren(display.cursorDiv);\n\t\t removeChildren(display.selectionDiv);\n\t\t display.gutters.style.height = display.sizer.style.minHeight = 0;\n\t\t\n\t\t if (different) {\n\t\t display.lastWrapHeight = update.wrapperHeight;\n\t\t display.lastWrapWidth = update.wrapperWidth;\n\t\t startWorker(cm, 400);\n\t\t }\n\t\t\n\t\t display.updateLineNumbers = null;\n\t\t\n\t\t return true;\n\t\t }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display,\n doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false;\n } // Bail out if the visible area is already rendered and nothing changed.\n\n\n if (!update.force && update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo && (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) && display.renderedView == display.view && countDirtyView(cm) == 0) {\n return false;\n }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n } // Compute a suitable new viewport (from & to)\n\n\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n\n if (display.viewFrom < from && from - display.viewFrom < 20) {\n from = Math.max(doc.first, display.viewFrom);\n }\n\n if (display.viewTo > to && display.viewTo - to < 20) {\n to = Math.min(end, display.viewTo);\n }\n\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo || display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n display.viewOffset = _heightAtLine(getLine(cm.doc, display.viewFrom)); // Position the mover div to align with the current scroll position\n\n cm.display.mover.style.top = display.viewOffset + \"px\";\n var toUpdate = countDirtyView(cm);\n\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view && (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo)) {\n return false;\n } // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n\n\n var selSnapshot = selectionSnapshot(cm);\n\n if (toUpdate > 4) {\n display.lineDiv.style.display = \"none\";\n }\n\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n\n if (toUpdate > 4) {\n display.lineDiv.style.display = \"\";\n }\n\n display.renderedView = display.view; // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n\n restoreSelection(selSnapshot); // Prevent selection and cursors from interfering with the scroll\n // width and height.\n\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n return true;\n }", "function updateDisplay(changes, suppressCallback, scrollTop) {\n if (!scroller.clientWidth) {\n showingFrom = showingTo = displayOffset = 0;\n return;\n }\n // Compute the new visible window\n // If scrollTop is specified, use that to determine which lines\n // to render instead of the current scrollbar position.\n var visible = visibleLines(scrollTop);\n // Bail out if the visible area is already rendered and nothing changed.\n if (changes !== true && changes.length == 0 && visible.from > showingFrom && visible.to < showingTo) {\n updateVerticalScroll(scrollTop);\n return;\n }\n var from = Math.max(visible.from - 100, 0), to = Math.min(doc.size, visible.to + 100);\n if (showingFrom < from && from - showingFrom < 20) from = showingFrom;\n if (showingTo > to && showingTo - to < 20) to = Math.min(doc.size, showingTo);\n\n // Create a range of theoretically intact lines, and punch holes\n // in that using the change info.\n var intact = changes === true ? [] :\n computeIntact([{from: showingFrom, to: showingTo, domStart: 0}], changes);\n // Clip off the parts that won't be visible\n var intactLines = 0;\n for (var i = 0; i < intact.length; ++i) {\n var range = intact[i];\n if (range.from < from) {range.domStart += (from - range.from); range.from = from;}\n if (range.to > to) range.to = to;\n if (range.from >= range.to) intact.splice(i--, 1);\n else intactLines += range.to - range.from;\n }\n if (intactLines == to - from && from == showingFrom && to == showingTo) {\n updateVerticalScroll(scrollTop);\n return;\n }\n intact.sort(function(a, b) {return a.domStart - b.domStart;});\n\n var th = textHeight(), gutterDisplay = gutter.style.display;\n lineDiv.style.display = \"none\";\n patchDisplay(from, to, intact);\n lineDiv.style.display = gutter.style.display = \"\";\n\n var different = from != showingFrom || to != showingTo || lastSizeC != scroller.clientHeight + th;\n // This is just a bogus formula that detects when the editor is\n // resized or the font size changes.\n if (different) lastSizeC = scroller.clientHeight + th;\n showingFrom = from; showingTo = to;\n displayOffset = heightAtLine(doc, from);\n\n // Since this is all rather error prone, it is honoured with the\n // only assertion in the whole file.\n if (lineDiv.childNodes.length != showingTo - showingFrom)\n throw new Error(\"BAD PATCH! \" + JSON.stringify(intact) + \" size=\" + (showingTo - showingFrom) +\n \" nodes=\" + lineDiv.childNodes.length);\n\n function checkHeights() {\n var curNode = lineDiv.firstChild, heightChanged = false;\n doc.iter(showingFrom, showingTo, function(line) {\n if (!line.hidden) {\n var height = Math.round(curNode.offsetHeight / th) || 1;\n if (line.height != height) {\n updateLineHeight(line, height);\n gutterDirty = heightChanged = true;\n }\n }\n curNode = curNode.nextSibling;\n });\n return heightChanged;\n }\n\n if (options.lineWrapping) {\n // Guess whether we're going to need the scrollbar, so that we don't end up changing the linewrapping\n // after the scrollbar appears (during updateVerticalScroll()). Only do this if the scrollbar is\n // appearing (if it's disappearing, we don't have to worry about the scroll position, and there are\n // issues on IE7 if we turn it off too early).\n var virtualHeight = Math.floor(doc.height * th + 2 * paddingTop()), scrollbarHeight = scroller.clientHeight;\n if (virtualHeight > scrollbarHeight) scrollbar.style.display = \"block\";\n checkHeights();\n }\n\n gutter.style.display = gutterDisplay;\n if (different || gutterDirty) {\n // If the gutter grew in size, re-check heights. If those changed, re-draw gutter.\n updateGutter() && options.lineWrapping && checkHeights() && updateGutter();\n }\n updateSelection();\n updateVerticalScroll(scrollTop);\n if (!suppressCallback && options.onUpdate) options.onUpdate(instance);\n return true;\n }", "function updateDisplay() {\n\n crawlerModel.user = _useVenueData ? _venueData.messages : _deviceData.messages;\n $scope.mode = ( _useVenueData ? _venueData.mode : _deviceData.mode ) || 'full-size';\n $scope.mode = 'full-size';\n\n getTVGrid();\n\n ogAds.getCurrentAd()\n .then( function ( currentAd ) {\n crawlerModel.ads = currentAd.textAds || [];\n } )\n .then( reloadTweets )\n .then( function () {\n\n $log.debug( \"Rebuilding hz scroller feed\" );\n var tempArr = [];\n crawlerModel.user.forEach( function ( um ) {\n tempArr.push( { text: um, style: { color: '#ffffff' } } )\n } );\n\n crawlerModel.twitter.forEach( function ( um ) {\n tempArr.push( { text: um, style: { color: '#87CEEB' } } )\n } );\n\n crawlerModel.ads.forEach( function ( um ) {\n tempArr.push( { text: um, style: { color: '#ccf936' } } )\n } );\n\n tempArr = tempArr.filter( function ( x ) {\n return (x !== (undefined || !x.message));\n } );\n\n $scope.crawlerMessages = _.shuffle( tempArr );\n } );\n\n }", "function clearDisplay() {\n hideContainers();\n resetCopyNotes();\n resetClipboardNote();\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n if (update.editorIsHidden) {\n resetView(cm);\n return false;\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n countDirtyView(cm) == 0)\n return false;\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\n if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n return false;\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var focused = activeElt();\n if (toUpdate > 4) display.lineDiv.style.display = \"none\";\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) display.lineDiv.style.display = \"\";\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\n\n // Prevent selection and cursors from interfering with the scroll\n // width.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true;\n }", "update() {\n\n\t\tconst depth = (this.octree !== null) ? this.octree.getDepth() : -1;\n\n\t\tlet level = 0;\n\t\tlet result;\n\n\t\t// Remove existing geometry.\n\t\tthis.dispose();\n\n\t\twhile(level <= depth) {\n\n\t\t\tresult = this.octree.findNodesByLevel(level);\n\n\t\t\tthis.createLineSegments(\n\t\t\t\tresult[Symbol.iterator](),\n\t\t\t\t(typeof result.size === \"number\") ? result.size : result.length\n\t\t\t);\n\n\t\t\t++level;\n\n\t\t}\n\n\t}", "function updateDisplayIfNeeded(cm, update) {\r\n var display = cm.display, doc = cm.doc;\r\n if (update.editorIsHidden) {\r\n resetView(cm);\r\n return false;\r\n }\r\n\r\n // Bail out if the visible area is already rendered and nothing changed.\r\n if (!update.force &&\r\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\r\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\r\n countDirtyView(cm) == 0)\r\n return false;\r\n\r\n if (maybeUpdateLineNumberWidth(cm)) {\r\n resetView(cm);\r\n update.dims = getDimensions(cm);\r\n }\r\n\r\n // Compute a suitable new viewport (from & to)\r\n var end = doc.first + doc.size;\r\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\r\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\r\n if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\r\n if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\r\n if (sawCollapsedSpans) {\r\n from = visualLineNo(cm.doc, from);\r\n to = visualLineEndNo(cm.doc, to);\r\n }\r\n\r\n var different = from != display.viewFrom || to != display.viewTo ||\r\n display.lastSizeC != update.wrapperHeight;\r\n adjustView(cm, from, to);\r\n\r\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\r\n // Position the mover div to align with the current scroll position\r\n cm.display.mover.style.top = display.viewOffset + \"px\";\r\n\r\n var toUpdate = countDirtyView(cm);\r\n if (!different && toUpdate == 0 && !update.force &&\r\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\r\n return false;\r\n\r\n // For big changes, we hide the enclosing element during the\r\n // update, since that speeds up the operations on most browsers.\r\n var focused = activeElt();\r\n if (toUpdate > 4) display.lineDiv.style.display = \"none\";\r\n patchDisplay(cm, display.updateLineNumbers, update.dims);\r\n if (toUpdate > 4) display.lineDiv.style.display = \"\";\r\n // There might have been a widget with a focused element that got\r\n // hidden or updated, if so re-focus it.\r\n if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\r\n\r\n // Prevent selection and cursors from interfering with the scroll\r\n // width.\r\n removeChildren(display.cursorDiv);\r\n removeChildren(display.selectionDiv);\r\n\r\n if (different) {\r\n display.lastSizeC = update.wrapperHeight;\r\n startWorker(cm, 400);\r\n }\r\n\r\n display.updateLineNumbers = null;\r\n\r\n return true;\r\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false;\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n return false;\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\n if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n return false;\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var focused = activeElt();\n if (toUpdate > 4) display.lineDiv.style.display = \"none\";\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) display.lineDiv.style.display = \"\";\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true;\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false;\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n return false;\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\n if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n return false;\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var focused = activeElt();\n if (toUpdate > 4) display.lineDiv.style.display = \"none\";\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) display.lineDiv.style.display = \"\";\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true;\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false;\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n return false;\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\n if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n return false;\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var focused = activeElt();\n if (toUpdate > 4) display.lineDiv.style.display = \"none\";\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) display.lineDiv.style.display = \"\";\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true;\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false;\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n return false;\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\n if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n return false;\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var focused = activeElt();\n if (toUpdate > 4) display.lineDiv.style.display = \"none\";\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) display.lineDiv.style.display = \"\";\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true;\n }", "function resetLineDisplay() {\n var tempLineDisplay = [];\n for (var i = 0; i < Trends.MaxLineNumber; i++) {\n tempLineDisplay[i] = true;\n }\n DataViz.mainApp.Configuration.set(DataViz.Config.Trends.wellKnownKeys.lineDisplay, tempLineDisplay);\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n if (update.editorIsHidden) {\n resetView(cm);\n return false;\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n countDirtyView(cm) == 0)\n return false;\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\n if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastSizeC != update.wrapperHeight;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n return false;\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var focused = activeElt();\n if (toUpdate > 4) display.lineDiv.style.display = \"none\";\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) display.lineDiv.style.display = \"\";\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\n\n // Prevent selection and cursors from interfering with the scroll\n // width.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n\n if (different) {\n display.lastSizeC = update.wrapperHeight;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true;\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n if (update.editorIsHidden) {\n resetView(cm);\n return false;\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n countDirtyView(cm) == 0)\n return false;\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\n if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastSizeC != update.wrapperHeight;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n return false;\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var focused = activeElt();\n if (toUpdate > 4) display.lineDiv.style.display = \"none\";\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) display.lineDiv.style.display = \"\";\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\n\n // Prevent selection and cursors from interfering with the scroll\n // width.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n\n if (different) {\n display.lastSizeC = update.wrapperHeight;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true;\n }", "refresh() {\n this.viewDiv.node().style.top = this._position.y + \"px\";\n this.viewDiv.node().style.left = this._position.x + \"px\";\n }" ]
[ "0.6638065", "0.66379964", "0.66379964", "0.66375774", "0.66260344", "0.6615293", "0.65646994", "0.65646994", "0.65557706", "0.65557706", "0.65557706", "0.65557706", "0.65557706", "0.65557706", "0.6532206", "0.6509948", "0.65085167", "0.65085167", "0.646983", "0.646983", "0.646983", "0.646983", "0.646983", "0.646983", "0.646983", "0.646983", "0.646983", "0.646983", "0.646983", "0.64503807", "0.6060548", "0.6030941", "0.6030941", "0.6028667", "0.60248756", "0.5999286", "0.5999286", "0.59929085", "0.59837526", "0.59834856", "0.5923233", "0.5923233", "0.59202695", "0.59190136", "0.58763516", "0.58742356", "0.58739823", "0.5866954", "0.5866954", "0.58466876", "0.58278996", "0.58096945", "0.57965475", "0.5773144", "0.5772396", "0.57528514", "0.5749526", "0.5738198", "0.5737629", "0.5732618", "0.5732618", "0.5732618", "0.5732618", "0.573088", "0.5722221", "0.5722221", "0.5722221", "0.5722221", "0.5722221", "0.5722221", "0.5722221", "0.5722221", "0.5722221", "0.5722221", "0.5722221", "0.5722221", "0.5722221", "0.5722221", "0.5722221", "0.5722221", "0.5722221", "0.57162565", "0.57162565", "0.5703595" ]
0.65705675
19
Realign line numbers and gutter marks to compensate for horizontal scrolling.
function alignHorizontally(cm) { var display = cm.display, view = display.view; if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return } var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft; var gutterW = display.gutters.offsetWidth, left = comp + "px"; for (var i = 0; i < view.length; i++) { if (!view[i].hidden) { if (cm.options.fixedGutter) { if (view[i].gutter) { view[i].gutter.style.left = left; } if (view[i].gutterBackground) { view[i].gutterBackground.style.left = left; } } var align = view[i].alignable; if (align) { for (var j = 0; j < align.length; j++) { align[j].style.left = left; } } } } if (cm.options.fixedGutter) { display.gutters.style.left = (comp + gutterW) + "px"; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "ensureLineGaps(current, mayMeasure) {\n let wrapping = this.heightOracle.lineWrapping;\n let margin = wrapping ? 10000 /* MarginWrap */ : 2000 /* Margin */, halfMargin = margin >> 1, doubleMargin = margin << 1;\n // The non-wrapping logic won't work at all in predominantly right-to-left text.\n if (this.defaultTextDirection != exports.Direction.LTR && !wrapping)\n return [];\n let gaps = [];\n let addGap = (from, to, line, structure) => {\n if (to - from < halfMargin)\n return;\n let sel = this.state.selection.main, avoid = [sel.from];\n if (!sel.empty)\n avoid.push(sel.to);\n for (let pos of avoid) {\n if (pos > from && pos < to) {\n addGap(from, pos - 10 /* SelectionMargin */, line, structure);\n addGap(pos + 10 /* SelectionMargin */, to, line, structure);\n return;\n }\n }\n let gap = find(current, gap => gap.from >= line.from && gap.to <= line.to &&\n Math.abs(gap.from - from) < halfMargin && Math.abs(gap.to - to) < halfMargin &&\n !avoid.some(pos => gap.from < pos && gap.to > pos));\n if (!gap) {\n // When scrolling down, snap gap ends to line starts to avoid shifts in wrapping\n if (to < line.to && mayMeasure && wrapping &&\n mayMeasure.visibleRanges.some(r => r.from <= to && r.to >= to)) {\n let lineStart = mayMeasure.moveToLineBoundary(state.EditorSelection.cursor(to), false, true).head;\n if (lineStart > from)\n to = lineStart;\n }\n gap = new LineGap(from, to, this.gapSize(line, from, to, structure));\n }\n gaps.push(gap);\n };\n for (let line of this.viewportLines) {\n if (line.length < doubleMargin)\n continue;\n let structure = lineStructure(line.from, line.to, this.stateDeco);\n if (structure.total < doubleMargin)\n continue;\n let target = this.scrollTarget ? this.scrollTarget.range.head : null;\n let viewFrom, viewTo;\n if (wrapping) {\n let marginHeight = (margin / this.heightOracle.lineLength) * this.heightOracle.lineHeight;\n let top, bot;\n if (target != null) {\n let targetFrac = findFraction(structure, target);\n let spaceFrac = ((this.visibleBottom - this.visibleTop) / 2 + marginHeight) / line.height;\n top = targetFrac - spaceFrac;\n bot = targetFrac + spaceFrac;\n }\n else {\n top = (this.visibleTop - line.top - marginHeight) / line.height;\n bot = (this.visibleBottom - line.top + marginHeight) / line.height;\n }\n viewFrom = findPosition(structure, top);\n viewTo = findPosition(structure, bot);\n }\n else {\n let totalWidth = structure.total * this.heightOracle.charWidth;\n let marginWidth = margin * this.heightOracle.charWidth;\n let left, right;\n if (target != null) {\n let targetFrac = findFraction(structure, target);\n let spaceFrac = ((this.pixelViewport.right - this.pixelViewport.left) / 2 + marginWidth) / totalWidth;\n left = targetFrac - spaceFrac;\n right = targetFrac + spaceFrac;\n }\n else {\n left = (this.pixelViewport.left - marginWidth) / totalWidth;\n right = (this.pixelViewport.right + marginWidth) / totalWidth;\n }\n viewFrom = findPosition(structure, left);\n viewTo = findPosition(structure, right);\n }\n if (viewFrom > line.from)\n addGap(line.from, viewFrom, line, structure);\n if (viewTo < line.to)\n addGap(viewTo, line.to, line, structure);\n }\n return gaps;\n }", "function maybeUpdateLineNumberWidth(cm) {\n\t\t if (!cm.options.lineNumbers) return false;\n\t\t var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n\t\t if (last.length != display.lineNumChars) {\n\t\t var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n\t\t \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n\t\t var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n\t\t display.lineGutter.style.width = \"\";\n\t\t display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n\t\t display.lineNumWidth = display.lineNumInnerWidth + padding;\n\t\t display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n\t\t display.lineGutter.style.width = display.lineNumWidth + \"px\";\n\t\t updateGutterSpace(cm);\n\t\t return true;\n\t\t }\n\t\t return false;\n\t\t }", "function maybeUpdateLineNumberWidth(cm) {\n\t\t if (!cm.options.lineNumbers) { return false }\n\t\t var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n\t\t if (last.length != display.lineNumChars) {\n\t\t var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n\t\t \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n\t\t var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n\t\t display.lineGutter.style.width = \"\";\n\t\t display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n\t\t display.lineNumWidth = display.lineNumInnerWidth + padding;\n\t\t display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n\t\t display.lineGutter.style.width = display.lineNumWidth + \"px\";\n\t\t updateGutterSpace(cm.display);\n\t\t return true\n\t\t }\n\t\t return false\n\t\t }", "function maybeUpdateLineNumberWidth(cm) {\n\t if (!cm.options.lineNumbers) return false;\n\t var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n\t if (last.length != display.lineNumChars) {\n\t var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n\t \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n\t var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n\t display.lineGutter.style.width = \"\";\n\t display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n\t display.lineNumWidth = display.lineNumInnerWidth + padding;\n\t display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n\t display.lineGutter.style.width = display.lineNumWidth + \"px\";\n\t updateGutterSpace(cm);\n\t return true;\n\t }\n\t return false;\n\t }", "function maybeUpdateLineNumberWidth(cm) {\n\t if (!cm.options.lineNumbers) return false;\n\t var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n\t if (last.length != display.lineNumChars) {\n\t var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n\t \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n\t var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n\t display.lineGutter.style.width = \"\";\n\t display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n\t display.lineNumWidth = display.lineNumInnerWidth + padding;\n\t display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n\t display.lineGutter.style.width = display.lineNumWidth + \"px\";\n\t updateGutterSpace(cm);\n\t return true;\n\t }\n\t return false;\n\t }", "function maybeUpdateLineNumberWidth(cm) {\n\t if (!cm.options.lineNumbers) return false;\n\t var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n\t if (last.length != display.lineNumChars) {\n\t var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n\t \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n\t var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n\t display.lineGutter.style.width = \"\";\n\t display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n\t display.lineNumWidth = display.lineNumInnerWidth + padding;\n\t display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n\t display.lineGutter.style.width = display.lineNumWidth + \"px\";\n\t updateGutterSpace(cm);\n\t return true;\n\t }\n\t return false;\n\t }", "function maybeUpdateLineNumberWidth(cm) {\r\n if (!cm.options.lineNumbers) return false;\r\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\r\n if (last.length != display.lineNumChars) {\r\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\r\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\r\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\r\n display.lineGutter.style.width = \"\";\r\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding);\r\n display.lineNumWidth = display.lineNumInnerWidth + padding;\r\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\r\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\r\n updateGutterSpace(cm);\r\n return true;\r\n }\r\n return false;\r\n }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true\n }\n return false\n }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true\n }\n return false\n }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true\n }\n return false\n }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true\n }\n return false\n }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) return false;\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding);\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true;\n }\n return false;\n }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) return false;\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding);\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true;\n }\n return false;\n }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) return false;\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding);\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true;\n }\n return false;\n }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) return false;\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding);\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true;\n }\n return false;\n }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) return false;\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding);\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true;\n }\n return false;\n }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) return false;\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding);\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true;\n }\n return false;\n }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) return false;\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true;\n }\n return false;\n }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) return false;\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true;\n }\n return false;\n }", "function alignHorizontally(cm) {\n\t\t var display = cm.display, view = display.view;\n\t\t if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n\t\t var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n\t\t var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n\t\t for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n\t\t if (cm.options.fixedGutter) {\n\t\t if (view[i].gutter)\n\t\t { view[i].gutter.style.left = left; }\n\t\t if (view[i].gutterBackground)\n\t\t { view[i].gutterBackground.style.left = left; }\n\t\t }\n\t\t var align = view[i].alignable;\n\t\t if (align) { for (var j = 0; j < align.length; j++)\n\t\t { align[j].style.left = left; } }\n\t\t } }\n\t\t if (cm.options.fixedGutter)\n\t\t { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n\t\t }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm.display);\n return true\n }\n return false\n }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm.display);\n return true\n }\n return false\n }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm.display);\n return true\n }\n return false\n }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm.display);\n return true\n }\n return false\n }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm.display);\n return true\n }\n return false\n }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm.display);\n return true\n }\n return false\n }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm.display);\n return true\n }\n return false\n }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm.display);\n return true\n }\n return false\n }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm.display);\n return true\n }\n return false\n }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm.display);\n return true\n }\n return false\n }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm.display);\n return true\n }\n return false\n }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm.display);\n return true\n }\n return false\n }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm.display);\n return true\n }\n return false\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n view[i].gutter.style.left = left;\n if (view[i].gutterBackground)\n view[i].gutterBackground.style.left = left;\n }\n var align = view[i].alignable;\n if (align) for (var j = 0; j < align.length; j++)\n align[j].style.left = left;\n }\n if (cm.options.fixedGutter)\n display.gutters.style.left = (comp + gutterW) + \"px\";\n }", "function alignHorizontally(cm) {\n\t\t var display = cm.display, view = display.view;\n\t\t if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\n\t\t var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n\t\t var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n\t\t for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\n\t\t if (cm.options.fixedGutter) {\n\t\t if (view[i].gutter)\n\t\t view[i].gutter.style.left = left;\n\t\t if (view[i].gutterBackground)\n\t\t view[i].gutterBackground.style.left = left;\n\t\t }\n\t\t var align = view[i].alignable;\n\t\t if (align) for (var j = 0; j < align.length; j++)\n\t\t align[j].style.left = left;\n\t\t }\n\t\t if (cm.options.fixedGutter)\n\t\t display.gutters.style.left = (comp + gutterW) + \"px\";\n\t\t }", "function za(e){if(!e.options.lineNumbers)return!1;var t=e.doc,a=L(e.options,t.first+t.size-1),r=e.display;if(a.length!=r.lineNumChars){var f=r.measure.appendChild(n(\"div\",[n(\"div\",a)],\"CodeMirror-linenumber CodeMirror-gutter-elt\")),o=f.firstChild.offsetWidth,i=f.offsetWidth-o;return r.lineGutter.style.width=\"\",r.lineNumInnerWidth=Math.max(o,r.lineGutter.offsetWidth-i)+1,r.lineNumWidth=r.lineNumInnerWidth+i,r.lineNumChars=r.lineNumInnerWidth?a.length:-1,r.lineGutter.style.width=r.lineNumWidth+\"px\",In(e),!0}return!1}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\n if (cm.options.fixedGutter && view[i].gutter)\n view[i].gutter.style.left = left;\n var align = view[i].alignable;\n if (align) for (var j = 0; j < align.length; j++)\n align[j].style.left = left;\n }\n if (cm.options.fixedGutter)\n display.gutters.style.left = (comp + gutterW) + \"px\";\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\n if (cm.options.fixedGutter && view[i].gutter)\n view[i].gutter.style.left = left;\n var align = view[i].alignable;\n if (align) for (var j = 0; j < align.length; j++)\n align[j].style.left = left;\n }\n if (cm.options.fixedGutter)\n display.gutters.style.left = (comp + gutterW) + \"px\";\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\n if (cm.options.fixedGutter && view[i].gutter)\n view[i].gutter.style.left = left;\n var align = view[i].alignable;\n if (align) for (var j = 0; j < align.length; j++)\n align[j].style.left = left;\n }\n if (cm.options.fixedGutter)\n display.gutters.style.left = (comp + gutterW) + \"px\";\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\n if (cm.options.fixedGutter && view[i].gutter)\n view[i].gutter.style.left = left;\n var align = view[i].alignable;\n if (align) for (var j = 0; j < align.length; j++)\n align[j].style.left = left;\n }\n if (cm.options.fixedGutter)\n display.gutters.style.left = (comp + gutterW) + \"px\";\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\n if (cm.options.fixedGutter && view[i].gutter)\n view[i].gutter.style.left = left;\n var align = view[i].alignable;\n if (align) for (var j = 0; j < align.length; j++)\n align[j].style.left = left;\n }\n if (cm.options.fixedGutter)\n display.gutters.style.left = (comp + gutterW) + \"px\";\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\n if (cm.options.fixedGutter && view[i].gutter)\n view[i].gutter.style.left = left;\n var align = view[i].alignable;\n if (align) for (var j = 0; j < align.length; j++)\n align[j].style.left = left;\n }\n if (cm.options.fixedGutter)\n display.gutters.style.left = (comp + gutterW) + \"px\";\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\n if (cm.options.fixedGutter && view[i].gutter)\n view[i].gutter.style.left = left;\n var align = view[i].alignable;\n if (align) for (var j = 0; j < align.length; j++)\n align[j].style.left = left;\n }\n if (cm.options.fixedGutter)\n display.gutters.style.left = (comp + gutterW) + \"px\";\n }", "function alignHorizontally(cm) {\r\n var display = cm.display, view = display.view;\r\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\r\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\r\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\r\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\r\n if (cm.options.fixedGutter) {\r\n if (view[i].gutter)\r\n { view[i].gutter.style.left = left; }\r\n if (view[i].gutterBackground)\r\n { view[i].gutterBackground.style.left = left; }\r\n }\r\n var align = view[i].alignable;\r\n if (align) { for (var j = 0; j < align.length; j++)\r\n { align[j].style.left = left; } }\r\n } }\r\n if (cm.options.fixedGutter)\r\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\r\n}", "function alignHorizontally(cm) {\r\n var display = cm.display, view = display.view;\r\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\r\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\r\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\r\n for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\r\n if (cm.options.fixedGutter && view[i].gutter)\r\n view[i].gutter.style.left = left;\r\n var align = view[i].alignable;\r\n if (align) for (var j = 0; j < align.length; j++)\r\n align[j].style.left = left;\r\n }\r\n if (cm.options.fixedGutter)\r\n display.gutters.style.left = (comp + gutterW) + \"px\";\r\n }", "function maybeUpdateLineNumberWidth(cm) {\r\n if (!cm.options.lineNumbers) { return false }\r\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\r\n if (last.length != display.lineNumChars) {\r\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\r\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\r\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\r\n display.lineGutter.style.width = \"\";\r\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\r\n display.lineNumWidth = display.lineNumInnerWidth + padding;\r\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\r\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\r\n updateGutterSpace(cm);\r\n return true\r\n }\r\n return false\r\n}", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true\n }\n return false\n}", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true\n }\n return false\n}", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true\n }\n return false\n}", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true\n }\n return false\n}", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true\n }\n return false\n}", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true\n }\n return false\n}", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true\n }\n return false\n}", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true\n }\n return false\n}", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true\n }\n return false\n}", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true\n }\n return false\n}", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true\n }\n return false\n}", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"))\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW\n display.lineGutter.style.width = \"\"\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1\n display.lineNumWidth = display.lineNumInnerWidth + padding\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1\n display.lineGutter.style.width = display.lineNumWidth + \"px\"\n updateGutterSpace(cm)\n return true\n }\n return false\n}", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"))\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW\n display.lineGutter.style.width = \"\"\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1\n display.lineNumWidth = display.lineNumInnerWidth + padding\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1\n display.lineGutter.style.width = display.lineNumWidth + \"px\"\n updateGutterSpace(cm)\n return true\n }\n return false\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\"\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left }\n }\n var align = view[i].alignable\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\" }\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\"\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left }\n }\n var align = view[i].alignable\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\" }\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n}", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) {\n return false;\n }\n\n var doc = cm.doc,\n last = lineNumberFor(cm.options, doc.first + doc.size - 1),\n display = cm.display;\n\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)], \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth,\n padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm.display);\n return true;\n }\n\n return false;\n }", "_justify() {\n let hIx = 0;\n let left = 0;\n let minx = 0;\n let maxx = 0;\n let lvl = 0;\n let maxwidth = 0;\n let runningWidth = 0;\n let runningHeight = 0;\n if (!this.inlineBlocks.length) {\n return;\n }\n minx = this.inlineBlocks[0].text.startX;\n // We justify relative to first block x/y.\n const initialX = this.inlineBlocks[0].text.startX;\n const initialY = this.inlineBlocks[0].text.startY;\n const vert = {};\n this.inlineBlocks.forEach((inlineBlock) => {\n const block = inlineBlock.text;\n const blockBox = block.getLogicalBox();\n // If this is a horizontal positioning, reset to first blokc position\n //\n if (hIx > 0) {\n block.startX = initialX;\n block.startY = initialY;\n }\n minx = block.startX < minx ? block.startX : minx;\n maxx = (block.startX + blockBox.width) > maxx ? block.startX + blockBox.width : maxx;\n\n lvl = inlineBlock.position === SmoTextGroup.relativePositions.ABOVE ? lvl + 1 : lvl;\n lvl = inlineBlock.position === SmoTextGroup.relativePositions.BELOW ? lvl - 1 : lvl;\n if (inlineBlock.position === SmoTextGroup.relativePositions.RIGHT) {\n block.startX += runningWidth;\n if (hIx > 0) {\n block.startX += this.spacing;\n }\n }\n if (inlineBlock.position === SmoTextGroup.relativePositions.LEFT) {\n if (hIx > 0) {\n block.startX = minx - blockBox.width;\n minx = block.startX;\n block.startX -= this.spacing;\n }\n }\n if (inlineBlock.position === SmoTextGroup.relativePositions.BELOW) {\n block.startY += runningHeight;\n if (hIx > 0) {\n block.startY += this.spacing;\n }\n }\n if (inlineBlock.position === SmoTextGroup.relativePositions.ABOVE) {\n block.startY -= runningHeight;\n if (hIx > 0) {\n block.startY -= this.spacing;\n }\n }\n if (!vert[lvl]) {\n vert[lvl] = {};\n vert[lvl].blocks = [block];\n vert[lvl].minx = block.startX;\n vert[lvl].maxx = block.startX + blockBox.width;\n maxwidth = vert[lvl].width = blockBox.width;\n } else {\n vert[lvl].blocks.push(block);\n vert[lvl].minx = vert[lvl].minx < block.startX ? vert[lvl].minx : block.startX;\n vert[lvl].maxx = vert[lvl].maxx > (block.startX + blockBox.width) ?\n vert[lvl].maxx : (block.startX + blockBox.width);\n vert[lvl].width += blockBox.width;\n maxwidth = maxwidth > vert[lvl].width ? maxwidth : vert[lvl].width;\n }\n runningWidth += blockBox.width;\n runningHeight += blockBox.height;\n hIx += 1;\n block.updatedMetrics = false;\n });\n\n const levels = Object.keys(vert);\n\n // Horizontal justify the vertical blocks\n levels.forEach((level) => {\n const vobj = vert[level];\n if (this.justification === SmoTextGroup.justifications.LEFT) {\n left = minx - vobj.minx;\n } else if (this.justification === SmoTextGroup.justifications.RIGHT) {\n left = maxx - vobj.maxx;\n } else {\n left = (maxwidth / 2) - (vobj.width / 2);\n left += minx - vobj.minx;\n }\n vobj.blocks.forEach((block) => {\n block.offsetStartX(left);\n });\n });\n }", "function leftAlign(){\n\tvar baseX = 999999;\n\tfor(var i=0; i<currentShapes.length; i++){\n\t\tif(baseX>currentShapes[i].getX()){\n\t\t\tbaseX = currentShapes[i].getX();\n\t\t}\n\t}\n\tfor(var k=0; k<currentShapes.length; k++){\n\t\tcurrentShapes[k].setX(baseX);\n\t}\n\tlayer.draw();\n\thatioGroupRevised();\n}", "function alignHorizontally(cm) {\n\t var display = cm.display, view = display.view;\n\t if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\n\t var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n\t var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n\t for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\n\t if (cm.options.fixedGutter) {\n\t if (view[i].gutter)\n\t view[i].gutter.style.left = left;\n\t if (view[i].gutterBackground)\n\t view[i].gutterBackground.style.left = left;\n\t }\n\t var align = view[i].alignable;\n\t if (align) for (var j = 0; j < align.length; j++)\n\t align[j].style.left = left;\n\t }\n\t if (cm.options.fixedGutter)\n\t display.gutters.style.left = (comp + gutterW) + \"px\";\n\t }", "function alignHorizontally(cm) {\n\t var display = cm.display, view = display.view;\n\t if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\n\t var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n\t var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n\t for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\n\t if (cm.options.fixedGutter && view[i].gutter)\n\t view[i].gutter.style.left = left;\n\t var align = view[i].alignable;\n\t if (align) for (var j = 0; j < align.length; j++)\n\t align[j].style.left = left;\n\t }\n\t if (cm.options.fixedGutter)\n\t display.gutters.style.left = (comp + gutterW) + \"px\";\n\t }", "function alignHorizontally(cm) {\n\t var display = cm.display, view = display.view;\n\t if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\n\t var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n\t var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n\t for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\n\t if (cm.options.fixedGutter && view[i].gutter)\n\t view[i].gutter.style.left = left;\n\t var align = view[i].alignable;\n\t if (align) for (var j = 0; j < align.length; j++)\n\t align[j].style.left = left;\n\t }\n\t if (cm.options.fixedGutter)\n\t display.gutters.style.left = (comp + gutterW) + \"px\";\n\t }", "realignInkBar() {\n if (this._tabHeader) {\n this._tabHeader._alignInkBarToSelectedTab();\n }\n }", "SameLine(offset_from_start_x=0, spacing_w=-1)\n {\n let win = this.getCurrentWindow();\n if (win.SkipItems)\n return;\n\n let g = this.guictx;\n if (offset_from_start_x != 0)\n {\n if (spacing_w < 0.) spacing_w = 0.;\n win.DC.CursorPos.x = win.Pos.x - win.Scroll.x + offset_from_start_x +\n spacing_w + win.DC.GroupOffset.x + win.DC.ColumnsOffset.x;\n win.DC.CursorPos.y = win.DC.CursorPosPrevLine.y;\n }\n else\n {\n if (spacing_w < 0) spacing_w = g.Style.ItemSpacing.x;\n win.DC.CursorPos.x = win.DC.CursorPosPrevLine.x + spacing_w;\n win.DC.CursorPos.y = win.DC.CursorPosPrevLine.y;\n }\n win.DC.CurrentLineHeight = win.DC.PrevLineHeight;\n win.DC.CurrentLineHeightMax = win.DC.PrevLineHeightMax;\n win.DC.CurrentLineTextBaseOffset = win.DC.PrevLineTextBaseOffset;\n }", "async _indentMagikLines(\n lines,\n firstRow,\n lastRow,\n updateRangeOnly,\n checkOnly\n ) {\n const editor = vscode.window.activeTextEditor;\n const doc = editor.document;\n\n const lineIndents = [];\n const assignIndentKeywords = [];\n const arrowAssignRows = [];\n const outdentWords = [];\n let indent = 0;\n let tempIndent = false;\n\n const edit = new vscode.WorkspaceEdit();\n\n for (let row = 0; row < lines.length; row++) {\n const text = lines[row];\n const textLength = text.length;\n let testString = text.trim();\n let start = text.search(/\\S/);\n let matches;\n\n if (start === -1) start = textLength;\n\n // Don't reduce indent when chaining method calls when line starts with ').'\n if (testString[0] !== '#' && !/^\\)\\.\\s*(#|$)/.test(testString)) {\n const decWordsLength = MagikUtils.INDENT_DEC_WORDS.length;\n for (let i = 0; i < decWordsLength; i++) {\n if (testString.startsWith(MagikUtils.INDENT_DEC_WORDS[i])) {\n indent--;\n break;\n }\n }\n }\n\n const indentText = '\\t'.repeat(Math.max(indent, 0));\n\n lineIndents.push(indent);\n\n if (\n !checkOnly &&\n indentText !== text.slice(0, start) &&\n (!lastRow ||\n (!updateRangeOnly && firstRow + row === lastRow) ||\n (updateRangeOnly && firstRow + row <= lastRow))\n ) {\n const range = new vscode.Range(\n firstRow + row,\n 0,\n firstRow + row,\n start\n );\n edit.replace(doc.uri, range, indentText);\n }\n\n\n if (firstRow + row === lastRow) break;\n\n if (NO_CODE.test(testString)) {\n if (arrowAssignRows.length > 0) {\n // Defer checking for a statement as the line is empty\n arrowAssignRows[arrowAssignRows.length - 1]++;\n }\n } else {\n testString = MagikUtils.stringBeforeComment(testString).trim();\n\n if (arrowAssignRows.length > 0) {\n if (row === arrowAssignRows.slice(-1)[0] + 1) {\n const startAssignWordsLength = MagikUtils.START_ASSIGN_WORDS.length;\n let assignIndentKeyword;\n for (let i = 0; i < startAssignWordsLength; i++) {\n if (testString.startsWith(MagikUtils.START_ASSIGN_WORDS[i])) {\n assignIndentKeyword = MagikUtils.START_ASSIGN_WORDS[i];\n assignIndentKeywords.push(assignIndentKeyword);\n break;\n }\n }\n if (!assignIndentKeyword) {\n if (this._incompleteInvocationTest(testString)) {\n // Defer checking for a statement as the line is incomplete\n arrowAssignRows[arrowAssignRows.length - 1]++;\n } else {\n indent--;\n arrowAssignRows.pop();\n }\n }\n }\n if (\n arrowAssignRows.length > 0 &&\n this._cancelAssignIndent(\n testString,\n assignIndentKeywords.slice(-1)[0]\n )\n ) {\n indent--;\n arrowAssignRows.pop();\n assignIndentKeywords.pop();\n }\n } else if (assignIndentKeywords.length > 0) {\n if (\n this._cancelAssignIndent(\n testString,\n assignIndentKeywords.slice(-1)[0]\n )\n ) {\n indent--;\n assignIndentKeywords.pop();\n }\n }\n\n if (tempIndent && !/[,(]$/.test(testString)) {\n indent--;\n tempIndent = false;\n }\n\n if (/^\\)\\.$/.test(testString)) {\n // Don't increase indent when chaining method calls\n } else if (this._methodStartTest(testString)) {\n indent++;\n outdentWords[indent] = '_endmethod';\n } else {\n const statementAssignKeyword = this._statementAssignTest(testString);\n if (statementAssignKeyword) {\n indent++;\n assignIndentKeywords.push(statementAssignKeyword);\n if (INDENT_INC_STATEMENT_WORDS.includes(statementAssignKeyword)) {\n indent++;\n }\n outdentWords[indent] = INDENT_PAIRS[statementAssignKeyword];\n } else if (/^[)}]/.test(testString)) {\n // Starts with bracket - explicitly handled here as not included in INDENT_INC_WORDS test below\n indent++;\n } else if (/\\s+_then(\\s+|$)/.test(testString)) {\n indent++;\n if (/(\\s+|;)_endif$/.test(testString)) {\n indent--;\n }\n } else {\n const incWordsLength = MagikUtils.INDENT_INC_WORDS.length;\n for (let i = 0; i < incWordsLength; i++) {\n const iWord = MagikUtils.INDENT_INC_WORDS[i];\n if (testString === iWord || testString.startsWith(`${iWord} `)) {\n indent++;\n outdentWords[indent] = INDENT_PAIRS[iWord];\n break;\n }\n }\n if (this._startProcTest(testString)) {\n indent++;\n outdentWords[indent] = '_endproc';\n }\n if (this._endStatementTest(testString)) {\n indent--;\n }\n }\n }\n\n if (this._arrowAssignTest(testString)) {\n indent++;\n arrowAssignRows.push(row);\n } else {\n const endWordsLength = MagikUtils.END_WORDS.length;\n for (let i = 0; i < endWordsLength; i++) {\n if (testString.endsWith(MagikUtils.END_WORDS[i])) {\n indent++;\n tempIndent = true;\n break;\n }\n }\n }\n\n // Remove strings before counting brackets\n const noStrings = MagikUtils.removeStrings(testString);\n\n matches = noStrings.match(MagikUtils.INC_BRACKETS);\n if (matches) {\n indent += matches.length;\n }\n matches = noStrings.match(MagikUtils.DEC_BRACKETS);\n if (matches) {\n indent -= matches.length;\n }\n }\n }\n\n if (edit.size > 0) {\n await vscode.workspace.applyEdit(edit);\n }\n\n this.magikVSCode.outdentWord = outdentWords[indent];\n\n return lineIndents;\n }", "function adjustMargins() {\n detectSpacesIn(body);\n} //Initiate recursion:", "_alignCell(cell, dimensions, number, offset = 0, lineWeight = 1) {\n\t\t\td3.select(cell)\n\t\t\t\t// + number: Space 1 px between cells\n\t\t\t\t.attr('transform', `translate(${ offset + number * dimensions + number * lineWeight },0)`);\n\t\t}", "_createLineNumbers(editor) {\n const {\n changes,\n newStart: initialOffset\n } = this.props.hunk;\n const changeCount = changes.length;\n const maxDisplayLineNumber = initialOffset + changeCount - 1; // The maximum required gutter width for this hunk, in characters:\n\n const gutterWidth = String(maxDisplayLineNumber).length;\n let deletedLinesInSection = 0;\n let deletedLines = 0; // use a generator to avoid having to precalculate and store an array of\n // line numbers\n\n function* lineNumberGenerator() {\n for (let line = 0; line < changeCount; line++) {\n if (changes[line].type === 'del') {\n deletedLinesInSection++;\n } else {\n deletedLines += deletedLinesInSection;\n deletedLinesInSection = 0;\n }\n\n yield line + initialOffset - deletedLines;\n }\n }\n\n const gutter = createCustomLineNumberGutter(editor, lineNumberGenerator(), gutterWidth, {\n onClick: this.props.onClickLine\n });\n\n this._disposables.add(() => {\n gutter.destroy();\n });\n }" ]
[ "0.6321616", "0.6283151", "0.6254765", "0.6179584", "0.6179584", "0.6179584", "0.61641204", "0.6133896", "0.6133896", "0.6133896", "0.6133896", "0.6133247", "0.6133247", "0.6133247", "0.6133247", "0.6133247", "0.6133247", "0.6124336", "0.6124336", "0.6117045", "0.61085737", "0.61085737", "0.61085737", "0.61085737", "0.61085737", "0.61085737", "0.61085737", "0.61085737", "0.61085737", "0.61085737", "0.61085737", "0.61085737", "0.61085737", "0.61018175", "0.60879827", "0.60852194", "0.6082592", "0.6082592", "0.6082592", "0.6082592", "0.6082592", "0.6082592", "0.6082592", "0.6081283", "0.6077692", "0.60772955", "0.60625935", "0.60625935", "0.60625935", "0.60625935", "0.60625935", "0.60625935", "0.60625935", "0.60625935", "0.60625935", "0.60625935", "0.60625935", "0.6045244", "0.6045244", "0.6042631", "0.6042631", "0.60384274", "0.60384274", "0.60384274", "0.60384274", "0.60384274", "0.60384274", "0.60384274", "0.60384274", "0.60384274", "0.60384274", "0.60384274", "0.6036477", "0.6024492", "0.60154253", "0.60026217", "0.60002005", "0.60002005", "0.59141254", "0.58850265", "0.57976127", "0.578381", "0.57742214", "0.5763816" ]
0.613407
19
Used to ensure that the line number gutter is still the right size for the current document size. Returns true when an update is needed.
function maybeUpdateLineNumberWidth(cm) { if (!cm.options.lineNumbers) { return false } var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display; if (last.length != display.lineNumChars) { var test = display.measure.appendChild(elt("div", [elt("div", last)], "CodeMirror-linenumber CodeMirror-gutter-elt")); var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW; display.lineGutter.style.width = ""; display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1; display.lineNumWidth = display.lineNumInnerWidth + padding; display.lineNumChars = display.lineNumInnerWidth ? last.length : -1; display.lineGutter.style.width = display.lineNumWidth + "px"; updateGutterSpace(cm.display); return true } return false }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) return false;\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding);\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true;\n }\n return false;\n }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) return false;\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding);\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true;\n }\n return false;\n }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) return false;\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding);\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true;\n }\n return false;\n }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) return false;\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding);\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true;\n }\n return false;\n }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) return false;\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding);\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true;\n }\n return false;\n }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) return false;\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding);\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true;\n }\n return false;\n }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) return false;\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true;\n }\n return false;\n }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) return false;\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true;\n }\n return false;\n }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true\n }\n return false\n }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true\n }\n return false\n }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true\n }\n return false\n }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true\n }\n return false\n }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"))\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW\n display.lineGutter.style.width = \"\"\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1\n display.lineNumWidth = display.lineNumInnerWidth + padding\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1\n display.lineGutter.style.width = display.lineNumWidth + \"px\"\n updateGutterSpace(cm)\n return true\n }\n return false\n}", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"))\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW\n display.lineGutter.style.width = \"\"\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1\n display.lineNumWidth = display.lineNumInnerWidth + padding\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1\n display.lineGutter.style.width = display.lineNumWidth + \"px\"\n updateGutterSpace(cm)\n return true\n }\n return false\n}", "function maybeUpdateLineNumberWidth(cm) {\n\t if (!cm.options.lineNumbers) return false;\n\t var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n\t if (last.length != display.lineNumChars) {\n\t var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n\t \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n\t var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n\t display.lineGutter.style.width = \"\";\n\t display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n\t display.lineNumWidth = display.lineNumInnerWidth + padding;\n\t display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n\t display.lineGutter.style.width = display.lineNumWidth + \"px\";\n\t updateGutterSpace(cm);\n\t return true;\n\t }\n\t return false;\n\t }", "function maybeUpdateLineNumberWidth(cm) {\n\t if (!cm.options.lineNumbers) return false;\n\t var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n\t if (last.length != display.lineNumChars) {\n\t var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n\t \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n\t var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n\t display.lineGutter.style.width = \"\";\n\t display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n\t display.lineNumWidth = display.lineNumInnerWidth + padding;\n\t display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n\t display.lineGutter.style.width = display.lineNumWidth + \"px\";\n\t updateGutterSpace(cm);\n\t return true;\n\t }\n\t return false;\n\t }", "function maybeUpdateLineNumberWidth(cm) {\n\t if (!cm.options.lineNumbers) return false;\n\t var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n\t if (last.length != display.lineNumChars) {\n\t var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n\t \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n\t var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n\t display.lineGutter.style.width = \"\";\n\t display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n\t display.lineNumWidth = display.lineNumInnerWidth + padding;\n\t display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n\t display.lineGutter.style.width = display.lineNumWidth + \"px\";\n\t updateGutterSpace(cm);\n\t return true;\n\t }\n\t return false;\n\t }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) {\n return false;\n }\n\n var doc = cm.doc,\n last = lineNumberFor(cm.options, doc.first + doc.size - 1),\n display = cm.display;\n\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)], \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth,\n padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm.display);\n return true;\n }\n\n return false;\n }", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true\n }\n return false\n}", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true\n }\n return false\n}", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true\n }\n return false\n}", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true\n }\n return false\n}", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true\n }\n return false\n}", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true\n }\n return false\n}", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true\n }\n return false\n}", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true\n }\n return false\n}", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true\n }\n return false\n}", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true\n }\n return false\n}", "function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true\n }\n return false\n}", "function maybeUpdateLineNumberWidth(cm) {\r\n if (!cm.options.lineNumbers) return false;\r\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\r\n if (last.length != display.lineNumChars) {\r\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\r\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\r\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\r\n display.lineGutter.style.width = \"\";\r\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding);\r\n display.lineNumWidth = display.lineNumInnerWidth + padding;\r\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\r\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\r\n updateGutterSpace(cm);\r\n return true;\r\n }\r\n return false;\r\n }", "function maybeUpdateLineNumberWidth(cm) {\r\n if (!cm.options.lineNumbers) { return false }\r\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\r\n if (last.length != display.lineNumChars) {\r\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\r\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\r\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\r\n display.lineGutter.style.width = \"\";\r\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\r\n display.lineNumWidth = display.lineNumInnerWidth + padding;\r\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\r\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\r\n updateGutterSpace(cm);\r\n return true\r\n }\r\n return false\r\n}", "function maybeUpdateLineNumberWidth(cm) {\n\t\t if (!cm.options.lineNumbers) return false;\n\t\t var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n\t\t if (last.length != display.lineNumChars) {\n\t\t var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n\t\t \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n\t\t var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n\t\t display.lineGutter.style.width = \"\";\n\t\t display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n\t\t display.lineNumWidth = display.lineNumInnerWidth + padding;\n\t\t display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n\t\t display.lineGutter.style.width = display.lineNumWidth + \"px\";\n\t\t updateGutterSpace(cm);\n\t\t return true;\n\t\t }\n\t\t return false;\n\t\t }", "function maybeUpdateLineNumberWidth(cm) {\n\t\t if (!cm.options.lineNumbers) { return false }\n\t\t var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n\t\t if (last.length != display.lineNumChars) {\n\t\t var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n\t\t \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n\t\t var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n\t\t display.lineGutter.style.width = \"\";\n\t\t display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n\t\t display.lineNumWidth = display.lineNumInnerWidth + padding;\n\t\t display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n\t\t display.lineGutter.style.width = display.lineNumWidth + \"px\";\n\t\t updateGutterSpace(cm.display);\n\t\t return true\n\t\t }\n\t\t return false\n\t\t }", "_shouldUpdateWidth() {\n const domWidth = this._getDOMDimensions().width;\n return this.state.width !== domWidth;\n }", "function isChanged() {\n var x = currentCircle.attr(\"cx\");\n var xBackup = currentCircle.attr(\"cx-backup\");\n return Math.round(parseFloat(x) / minSpace) != Math.round(parseFloat(xBackup) / minSpace);\n}", "function checkSize() {\n var truncate = function truncate() {\n if (line < 1) lineData = [that._ellipsis(\"\", line)];else lineData[line - 1] = that._ellipsis(lineData[line - 1], line);\n }; // Constraint the font size\n\n\n fS = max([fS, fMin]);\n fS = min([fS, fMax]);\n\n if (resize) {\n lH = fS * lHRatio;\n wrapper.fontSize(fS).lineHeight(lH);\n style[\"font-size\"] = fS;\n style[\"line-height\"] = lH;\n }\n\n wrapResults = wrapper(t);\n lineData = wrapResults.lines.filter(function (l) {\n return l !== \"\";\n });\n line = lineData.length;\n\n if (wrapResults.truncated) {\n if (resize) {\n fS--;\n\n if (fS < fMin) {\n fS = fMin;\n truncate();\n return;\n } else checkSize();\n } else truncate();\n }\n }", "updatePanelSize ()\n {\n this.viewerState.viewport.invalidate();\n\n // FIXME(wabain): This should really only be called after initial load\n if (this.viewerState.renderer)\n {\n this.updateOffsets();\n this.viewerState.renderer.goto(this.settings.currentPageIndex, this.viewerState.verticalOffset, this.viewerState.horizontalOffset);\n }\n\n return true;\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc\n\n if (update.editorIsHidden) {\n resetView(cm)\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm)\n update.dims = getDimensions(cm)\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first)\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin)\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom) }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo) }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from)\n to = visualLineEndNo(cm.doc, to)\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth\n adjustView(cm, from, to)\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom))\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\"\n\n var toUpdate = countDirtyView(cm)\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var focused = activeElt()\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\" }\n patchDisplay(cm, display.updateLineNumbers, update.dims)\n if (toUpdate > 4) { display.lineDiv.style.display = \"\" }\n display.renderedView = display.view\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n if (focused && activeElt() != focused && focused.offsetHeight) { focused.focus() }\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv)\n removeChildren(display.selectionDiv)\n display.gutters.style.height = display.sizer.style.minHeight = 0\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight\n display.lastWrapWidth = update.wrapperWidth\n startWorker(cm, 400)\n }\n\n display.updateLineNumbers = null\n\n return true\n}", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc\n\n if (update.editorIsHidden) {\n resetView(cm)\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm)\n update.dims = getDimensions(cm)\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first)\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin)\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom) }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo) }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from)\n to = visualLineEndNo(cm.doc, to)\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth\n adjustView(cm, from, to)\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom))\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\"\n\n var toUpdate = countDirtyView(cm)\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var focused = activeElt()\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\" }\n patchDisplay(cm, display.updateLineNumbers, update.dims)\n if (toUpdate > 4) { display.lineDiv.style.display = \"\" }\n display.renderedView = display.view\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n if (focused && activeElt() != focused && focused.offsetHeight) { focused.focus() }\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv)\n removeChildren(display.selectionDiv)\n display.gutters.style.height = display.sizer.style.minHeight = 0\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight\n display.lastWrapWidth = update.wrapperWidth\n startWorker(cm, 400)\n }\n\n display.updateLineNumbers = null\n\n return true\n}", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n if (update.editorIsHidden) {\n resetView(cm);\n return false;\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n countDirtyView(cm) == 0)\n return false;\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\n if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n return false;\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var focused = activeElt();\n if (toUpdate > 4) display.lineDiv.style.display = \"none\";\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) display.lineDiv.style.display = \"\";\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\n\n // Prevent selection and cursors from interfering with the scroll\n // width.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true;\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false;\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n return false;\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\n if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n return false;\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var focused = activeElt();\n if (toUpdate > 4) display.lineDiv.style.display = \"none\";\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) display.lineDiv.style.display = \"\";\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true;\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false;\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n return false;\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\n if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n return false;\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var focused = activeElt();\n if (toUpdate > 4) display.lineDiv.style.display = \"none\";\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) display.lineDiv.style.display = \"\";\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true;\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false;\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n return false;\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\n if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n return false;\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var focused = activeElt();\n if (toUpdate > 4) display.lineDiv.style.display = \"none\";\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) display.lineDiv.style.display = \"\";\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true;\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false;\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n return false;\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\n if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n return false;\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var focused = activeElt();\n if (toUpdate > 4) display.lineDiv.style.display = \"none\";\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) display.lineDiv.style.display = \"\";\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true;\n }", "function updateDisplayIfNeeded(cm, update) {\r\n var display = cm.display, doc = cm.doc;\r\n if (update.editorIsHidden) {\r\n resetView(cm);\r\n return false;\r\n }\r\n\r\n // Bail out if the visible area is already rendered and nothing changed.\r\n if (!update.force &&\r\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\r\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\r\n countDirtyView(cm) == 0)\r\n return false;\r\n\r\n if (maybeUpdateLineNumberWidth(cm)) {\r\n resetView(cm);\r\n update.dims = getDimensions(cm);\r\n }\r\n\r\n // Compute a suitable new viewport (from & to)\r\n var end = doc.first + doc.size;\r\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\r\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\r\n if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\r\n if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\r\n if (sawCollapsedSpans) {\r\n from = visualLineNo(cm.doc, from);\r\n to = visualLineEndNo(cm.doc, to);\r\n }\r\n\r\n var different = from != display.viewFrom || to != display.viewTo ||\r\n display.lastSizeC != update.wrapperHeight;\r\n adjustView(cm, from, to);\r\n\r\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\r\n // Position the mover div to align with the current scroll position\r\n cm.display.mover.style.top = display.viewOffset + \"px\";\r\n\r\n var toUpdate = countDirtyView(cm);\r\n if (!different && toUpdate == 0 && !update.force &&\r\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\r\n return false;\r\n\r\n // For big changes, we hide the enclosing element during the\r\n // update, since that speeds up the operations on most browsers.\r\n var focused = activeElt();\r\n if (toUpdate > 4) display.lineDiv.style.display = \"none\";\r\n patchDisplay(cm, display.updateLineNumbers, update.dims);\r\n if (toUpdate > 4) display.lineDiv.style.display = \"\";\r\n // There might have been a widget with a focused element that got\r\n // hidden or updated, if so re-focus it.\r\n if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\r\n\r\n // Prevent selection and cursors from interfering with the scroll\r\n // width.\r\n removeChildren(display.cursorDiv);\r\n removeChildren(display.selectionDiv);\r\n\r\n if (different) {\r\n display.lastSizeC = update.wrapperHeight;\r\n startWorker(cm, 400);\r\n }\r\n\r\n display.updateLineNumbers = null;\r\n\r\n return true;\r\n }", "function updateDisplayIfNeeded(cm, update) {\r\n var display = cm.display, doc = cm.doc;\r\n\r\n if (update.editorIsHidden) {\r\n resetView(cm);\r\n return false\r\n }\r\n\r\n // Bail out if the visible area is already rendered and nothing changed.\r\n if (!update.force &&\r\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\r\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\r\n display.renderedView == display.view && countDirtyView(cm) == 0)\r\n { return false }\r\n\r\n if (maybeUpdateLineNumberWidth(cm)) {\r\n resetView(cm);\r\n update.dims = getDimensions(cm);\r\n }\r\n\r\n // Compute a suitable new viewport (from & to)\r\n var end = doc.first + doc.size;\r\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\r\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\r\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\r\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\r\n if (sawCollapsedSpans) {\r\n from = visualLineNo(cm.doc, from);\r\n to = visualLineEndNo(cm.doc, to);\r\n }\r\n\r\n var different = from != display.viewFrom || to != display.viewTo ||\r\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\r\n adjustView(cm, from, to);\r\n\r\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\r\n // Position the mover div to align with the current scroll position\r\n cm.display.mover.style.top = display.viewOffset + \"px\";\r\n\r\n var toUpdate = countDirtyView(cm);\r\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\r\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\r\n { return false }\r\n\r\n // For big changes, we hide the enclosing element during the\r\n // update, since that speeds up the operations on most browsers.\r\n var selSnapshot = selectionSnapshot(cm);\r\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\r\n patchDisplay(cm, display.updateLineNumbers, update.dims);\r\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\r\n display.renderedView = display.view;\r\n // There might have been a widget with a focused element that got\r\n // hidden or updated, if so re-focus it.\r\n restoreSelection(selSnapshot);\r\n\r\n // Prevent selection and cursors from interfering with the scroll\r\n // width and height.\r\n removeChildren(display.cursorDiv);\r\n removeChildren(display.selectionDiv);\r\n display.gutters.style.height = display.sizer.style.minHeight = 0;\r\n\r\n if (different) {\r\n display.lastWrapHeight = update.wrapperHeight;\r\n display.lastWrapWidth = update.wrapperWidth;\r\n startWorker(cm, 400);\r\n }\r\n\r\n display.updateLineNumbers = null;\r\n\r\n return true\r\n}", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n if (update.editorIsHidden) {\n resetView(cm);\n return false;\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n countDirtyView(cm) == 0)\n return false;\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\n if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastSizeC != update.wrapperHeight;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n return false;\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var focused = activeElt();\n if (toUpdate > 4) display.lineDiv.style.display = \"none\";\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) display.lineDiv.style.display = \"\";\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\n\n // Prevent selection and cursors from interfering with the scroll\n // width.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n\n if (different) {\n display.lastSizeC = update.wrapperHeight;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true;\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n if (update.editorIsHidden) {\n resetView(cm);\n return false;\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n countDirtyView(cm) == 0)\n return false;\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\n if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastSizeC != update.wrapperHeight;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n return false;\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var focused = activeElt();\n if (toUpdate > 4) display.lineDiv.style.display = \"none\";\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) display.lineDiv.style.display = \"\";\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\n\n // Prevent selection and cursors from interfering with the scroll\n // width.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n\n if (different) {\n display.lastSizeC = update.wrapperHeight;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true;\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n}", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n}", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n}", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n}", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n}", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n}", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n}", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n}", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n}", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n}", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n}", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }", "get geometryChanged() {\n return this.docChanged || (this.flags & (8 /* Geometry */ | 2 /* Height */)) > 0;\n }", "function updateDisplayIfNeeded(cm, update) {\n var display = cm.display,\n doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false;\n } // Bail out if the visible area is already rendered and nothing changed.\n\n\n if (!update.force && update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo && (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) && display.renderedView == display.view && countDirtyView(cm) == 0) {\n return false;\n }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n } // Compute a suitable new viewport (from & to)\n\n\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n\n if (display.viewFrom < from && from - display.viewFrom < 20) {\n from = Math.max(doc.first, display.viewFrom);\n }\n\n if (display.viewTo > to && display.viewTo - to < 20) {\n to = Math.min(end, display.viewTo);\n }\n\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo || display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n display.viewOffset = _heightAtLine(getLine(cm.doc, display.viewFrom)); // Position the mover div to align with the current scroll position\n\n cm.display.mover.style.top = display.viewOffset + \"px\";\n var toUpdate = countDirtyView(cm);\n\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view && (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo)) {\n return false;\n } // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n\n\n var selSnapshot = selectionSnapshot(cm);\n\n if (toUpdate > 4) {\n display.lineDiv.style.display = \"none\";\n }\n\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n\n if (toUpdate > 4) {\n display.lineDiv.style.display = \"\";\n }\n\n display.renderedView = display.view; // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n\n restoreSelection(selSnapshot); // Prevent selection and cursors from interfering with the scroll\n // width and height.\n\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n return true;\n }", "function updateSize() {\n var mb_in_bytes = 1024 * 1024;\n var file = document.getElementById(\"data-file\").files[0],\n type_file = file.name.split('.').pop();\n if (file.size < mb_in_bytes * 5 && type_file === \"docx\") {\n return true;\n }\n return false;\n}", "function updateDisplayIfNeeded(cm, update) {\n\t var display = cm.display, doc = cm.doc;\n\n\t if (update.editorIsHidden) {\n\t resetView(cm);\n\t return false;\n\t }\n\n\t // Bail out if the visible area is already rendered and nothing changed.\n\t if (!update.force &&\n\t update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n\t (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n\t display.renderedView == display.view && countDirtyView(cm) == 0)\n\t return false;\n\n\t if (maybeUpdateLineNumberWidth(cm)) {\n\t resetView(cm);\n\t update.dims = getDimensions(cm);\n\t }\n\n\t // Compute a suitable new viewport (from & to)\n\t var end = doc.first + doc.size;\n\t var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n\t var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n\t if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\n\t if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\n\t if (sawCollapsedSpans) {\n\t from = visualLineNo(cm.doc, from);\n\t to = visualLineEndNo(cm.doc, to);\n\t }\n\n\t var different = from != display.viewFrom || to != display.viewTo ||\n\t display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n\t adjustView(cm, from, to);\n\n\t display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n\t // Position the mover div to align with the current scroll position\n\t cm.display.mover.style.top = display.viewOffset + \"px\";\n\n\t var toUpdate = countDirtyView(cm);\n\t if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n\t (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n\t return false;\n\n\t // For big changes, we hide the enclosing element during the\n\t // update, since that speeds up the operations on most browsers.\n\t var focused = activeElt();\n\t if (toUpdate > 4) display.lineDiv.style.display = \"none\";\n\t patchDisplay(cm, display.updateLineNumbers, update.dims);\n\t if (toUpdate > 4) display.lineDiv.style.display = \"\";\n\t display.renderedView = display.view;\n\t // There might have been a widget with a focused element that got\n\t // hidden or updated, if so re-focus it.\n\t if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\n\n\t // Prevent selection and cursors from interfering with the scroll\n\t // width and height.\n\t removeChildren(display.cursorDiv);\n\t removeChildren(display.selectionDiv);\n\t display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n\t if (different) {\n\t display.lastWrapHeight = update.wrapperHeight;\n\t display.lastWrapWidth = update.wrapperWidth;\n\t startWorker(cm, 400);\n\t }\n\n\t display.updateLineNumbers = null;\n\n\t return true;\n\t }", "function updateDisplayIfNeeded(cm, update) {\n\t var display = cm.display, doc = cm.doc;\n\n\t if (update.editorIsHidden) {\n\t resetView(cm);\n\t return false;\n\t }\n\n\t // Bail out if the visible area is already rendered and nothing changed.\n\t if (!update.force &&\n\t update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n\t (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n\t display.renderedView == display.view && countDirtyView(cm) == 0)\n\t return false;\n\n\t if (maybeUpdateLineNumberWidth(cm)) {\n\t resetView(cm);\n\t update.dims = getDimensions(cm);\n\t }\n\n\t // Compute a suitable new viewport (from & to)\n\t var end = doc.first + doc.size;\n\t var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n\t var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n\t if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\n\t if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\n\t if (sawCollapsedSpans) {\n\t from = visualLineNo(cm.doc, from);\n\t to = visualLineEndNo(cm.doc, to);\n\t }\n\n\t var different = from != display.viewFrom || to != display.viewTo ||\n\t display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n\t adjustView(cm, from, to);\n\n\t display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n\t // Position the mover div to align with the current scroll position\n\t cm.display.mover.style.top = display.viewOffset + \"px\";\n\n\t var toUpdate = countDirtyView(cm);\n\t if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n\t (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n\t return false;\n\n\t // For big changes, we hide the enclosing element during the\n\t // update, since that speeds up the operations on most browsers.\n\t var focused = activeElt();\n\t if (toUpdate > 4) display.lineDiv.style.display = \"none\";\n\t patchDisplay(cm, display.updateLineNumbers, update.dims);\n\t if (toUpdate > 4) display.lineDiv.style.display = \"\";\n\t display.renderedView = display.view;\n\t // There might have been a widget with a focused element that got\n\t // hidden or updated, if so re-focus it.\n\t if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\n\n\t // Prevent selection and cursors from interfering with the scroll\n\t // width and height.\n\t removeChildren(display.cursorDiv);\n\t removeChildren(display.selectionDiv);\n\t display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n\t if (different) {\n\t display.lastWrapHeight = update.wrapperHeight;\n\t display.lastWrapWidth = update.wrapperWidth;\n\t startWorker(cm, 400);\n\t }\n\n\t display.updateLineNumbers = null;\n\n\t return true;\n\t }", "function checkDrawSize(){\n\t\tvar current = svgCanvas.getSvgString();\n\t\tvar compressed = lz77.compress(current);\n\t\t//alert(current.length*2 + ' ' + compressed.length * 2);\n\t\t// if compressed svg string is larger than 20k (or 10k if maxSnaps > 10), alert user and undo latest change\n\t\tif(compressed.length * 2 > svgEditor.maxDrawSize){\n\t\t\t$('#tool_undo').click();\n\t\t\t$('#drawlimit_dialog').dialog('open');\n\t\t}\n\t}", "get _isResized() {\n // Compare ratios. Very different includes IHM space.\n var heightRatio = _Global.document.documentElement.clientHeight / _Global.innerHeight,\n widthRatio = _Global.document.documentElement.clientWidth / _Global.innerWidth;\n\n // If they're nearly identical, then the view hasn't been resized for the IHM\n // Only check one bound because we know the IHM will make it shorter, not skinnier.\n return (widthRatio / heightRatio < 0.99);\n\n }", "function updateDisplayIfNeeded(cm, update) {\n\t\t var display = cm.display, doc = cm.doc;\n\n\t\t if (update.editorIsHidden) {\n\t\t resetView(cm);\n\t\t return false\n\t\t }\n\n\t\t // Bail out if the visible area is already rendered and nothing changed.\n\t\t if (!update.force &&\n\t\t update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n\t\t (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n\t\t display.renderedView == display.view && countDirtyView(cm) == 0)\n\t\t { return false }\n\n\t\t if (maybeUpdateLineNumberWidth(cm)) {\n\t\t resetView(cm);\n\t\t update.dims = getDimensions(cm);\n\t\t }\n\n\t\t // Compute a suitable new viewport (from & to)\n\t\t var end = doc.first + doc.size;\n\t\t var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n\t\t var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n\t\t if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n\t\t if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n\t\t if (sawCollapsedSpans) {\n\t\t from = visualLineNo(cm.doc, from);\n\t\t to = visualLineEndNo(cm.doc, to);\n\t\t }\n\n\t\t var different = from != display.viewFrom || to != display.viewTo ||\n\t\t display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n\t\t adjustView(cm, from, to);\n\n\t\t display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n\t\t // Position the mover div to align with the current scroll position\n\t\t cm.display.mover.style.top = display.viewOffset + \"px\";\n\n\t\t var toUpdate = countDirtyView(cm);\n\t\t if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n\t\t (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n\t\t { return false }\n\n\t\t // For big changes, we hide the enclosing element during the\n\t\t // update, since that speeds up the operations on most browsers.\n\t\t var selSnapshot = selectionSnapshot(cm);\n\t\t if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n\t\t patchDisplay(cm, display.updateLineNumbers, update.dims);\n\t\t if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n\t\t display.renderedView = display.view;\n\t\t // There might have been a widget with a focused element that got\n\t\t // hidden or updated, if so re-focus it.\n\t\t restoreSelection(selSnapshot);\n\n\t\t // Prevent selection and cursors from interfering with the scroll\n\t\t // width and height.\n\t\t removeChildren(display.cursorDiv);\n\t\t removeChildren(display.selectionDiv);\n\t\t display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n\t\t if (different) {\n\t\t display.lastWrapHeight = update.wrapperHeight;\n\t\t display.lastWrapWidth = update.wrapperWidth;\n\t\t startWorker(cm, 400);\n\t\t }\n\n\t\t display.updateLineNumbers = null;\n\n\t\t return true\n\t\t }", "function updateDisplayIfNeeded(cm, update) {\n\t\t var display = cm.display, doc = cm.doc;\n\t\t\n\t\t if (update.editorIsHidden) {\n\t\t resetView(cm);\n\t\t return false;\n\t\t }\n\t\t\n\t\t // Bail out if the visible area is already rendered and nothing changed.\n\t\t if (!update.force &&\n\t\t update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n\t\t (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n\t\t display.renderedView == display.view && countDirtyView(cm) == 0)\n\t\t return false;\n\t\t\n\t\t if (maybeUpdateLineNumberWidth(cm)) {\n\t\t resetView(cm);\n\t\t update.dims = getDimensions(cm);\n\t\t }\n\t\t\n\t\t // Compute a suitable new viewport (from & to)\n\t\t var end = doc.first + doc.size;\n\t\t var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n\t\t var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n\t\t if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\n\t\t if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\n\t\t if (sawCollapsedSpans) {\n\t\t from = visualLineNo(cm.doc, from);\n\t\t to = visualLineEndNo(cm.doc, to);\n\t\t }\n\t\t\n\t\t var different = from != display.viewFrom || to != display.viewTo ||\n\t\t display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n\t\t adjustView(cm, from, to);\n\t\t\n\t\t display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n\t\t // Position the mover div to align with the current scroll position\n\t\t cm.display.mover.style.top = display.viewOffset + \"px\";\n\t\t\n\t\t var toUpdate = countDirtyView(cm);\n\t\t if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n\t\t (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n\t\t return false;\n\t\t\n\t\t // For big changes, we hide the enclosing element during the\n\t\t // update, since that speeds up the operations on most browsers.\n\t\t var focused = activeElt();\n\t\t if (toUpdate > 4) display.lineDiv.style.display = \"none\";\n\t\t patchDisplay(cm, display.updateLineNumbers, update.dims);\n\t\t if (toUpdate > 4) display.lineDiv.style.display = \"\";\n\t\t display.renderedView = display.view;\n\t\t // There might have been a widget with a focused element that got\n\t\t // hidden or updated, if so re-focus it.\n\t\t if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\n\t\t\n\t\t // Prevent selection and cursors from interfering with the scroll\n\t\t // width and height.\n\t\t removeChildren(display.cursorDiv);\n\t\t removeChildren(display.selectionDiv);\n\t\t display.gutters.style.height = display.sizer.style.minHeight = 0;\n\t\t\n\t\t if (different) {\n\t\t display.lastWrapHeight = update.wrapperHeight;\n\t\t display.lastWrapWidth = update.wrapperWidth;\n\t\t startWorker(cm, 400);\n\t\t }\n\t\t\n\t\t display.updateLineNumbers = null;\n\t\t\n\t\t return true;\n\t\t }", "function fastCheck() {\n for (var i = watchArray.length - 1; i >= 0; i--) {\n if (!watchArray[i].inited) continue;\n\n var deltaTop = Math.abs(getDocOffsetTop(watchArray[i].clone) - watchArray[i].docOffsetTop),\n deltaHeight = Math.abs(watchArray[i].parent.node.offsetHeight - watchArray[i].parent.height);\n\n if (deltaTop >= 2 || deltaHeight >= 2) return false;\n }\n return true;\n }", "function fastCheck() {\n for (var i = watchArray.length - 1; i >= 0; i--) {\n if (!watchArray[i].inited) continue;\n\n var deltaTop = Math.abs(getDocOffsetTop(watchArray[i].clone) - watchArray[i].docOffsetTop),\n deltaHeight = Math.abs(watchArray[i].parent.node.offsetHeight - watchArray[i].parent.height);\n\n if (deltaTop >= 2 || deltaHeight >= 2) return false;\n }\n return true;\n }", "function updateDisplayIfNeeded(cm, update) {\n\t var display = cm.display, doc = cm.doc;\n\t\n\t if (update.editorIsHidden) {\n\t resetView(cm);\n\t return false;\n\t }\n\t\n\t // Bail out if the visible area is already rendered and nothing changed.\n\t if (!update.force &&\n\t update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n\t (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n\t display.renderedView == display.view && countDirtyView(cm) == 0)\n\t return false;\n\t\n\t if (maybeUpdateLineNumberWidth(cm)) {\n\t resetView(cm);\n\t update.dims = getDimensions(cm);\n\t }\n\t\n\t // Compute a suitable new viewport (from & to)\n\t var end = doc.first + doc.size;\n\t var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n\t var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n\t if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\n\t if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\n\t if (sawCollapsedSpans) {\n\t from = visualLineNo(cm.doc, from);\n\t to = visualLineEndNo(cm.doc, to);\n\t }\n\t\n\t var different = from != display.viewFrom || to != display.viewTo ||\n\t display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n\t adjustView(cm, from, to);\n\t\n\t display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n\t // Position the mover div to align with the current scroll position\n\t cm.display.mover.style.top = display.viewOffset + \"px\";\n\t\n\t var toUpdate = countDirtyView(cm);\n\t if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n\t (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n\t return false;\n\t\n\t // For big changes, we hide the enclosing element during the\n\t // update, since that speeds up the operations on most browsers.\n\t var focused = activeElt();\n\t if (toUpdate > 4) display.lineDiv.style.display = \"none\";\n\t patchDisplay(cm, display.updateLineNumbers, update.dims);\n\t if (toUpdate > 4) display.lineDiv.style.display = \"\";\n\t display.renderedView = display.view;\n\t // There might have been a widget with a focused element that got\n\t // hidden or updated, if so re-focus it.\n\t if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\n\t\n\t // Prevent selection and cursors from interfering with the scroll\n\t // width and height.\n\t removeChildren(display.cursorDiv);\n\t removeChildren(display.selectionDiv);\n\t display.gutters.style.height = display.sizer.style.minHeight = 0;\n\t\n\t if (different) {\n\t display.lastWrapHeight = update.wrapperHeight;\n\t display.lastWrapWidth = update.wrapperWidth;\n\t startWorker(cm, 400);\n\t }\n\t\n\t display.updateLineNumbers = null;\n\t\n\t return true;\n\t }" ]
[ "0.6707741", "0.6707741", "0.6707741", "0.6707741", "0.6707741", "0.6707741", "0.6697914", "0.6697914", "0.66803974", "0.66803974", "0.66803974", "0.66803974", "0.66591954", "0.66591954", "0.6634631", "0.6634631", "0.6634631", "0.66250575", "0.66222084", "0.66222084", "0.66222084", "0.66222084", "0.66222084", "0.66222084", "0.66222084", "0.66222084", "0.66222084", "0.66222084", "0.66222084", "0.66155183", "0.6576493", "0.65679914", "0.6490876", "0.6250962", "0.6031086", "0.5917924", "0.58375233", "0.5826403", "0.5826403", "0.58142734", "0.5803012", "0.5803012", "0.5803012", "0.5803012", "0.57988733", "0.57877934", "0.57874525", "0.57874525", "0.5779379", "0.5779379", "0.5779379", "0.5779379", "0.5779379", "0.5779379", "0.5779379", "0.5779379", "0.5779379", "0.5779379", "0.5779379", "0.57693684", "0.57693684", "0.57693684", "0.57693684", "0.57693684", "0.57693684", "0.57693684", "0.57693684", "0.57693684", "0.57693684", "0.57693684", "0.57693684", "0.57693684", "0.57693684", "0.57693684", "0.57693684", "0.57693684", "0.5740857", "0.5724004", "0.5714489", "0.5701295", "0.5701295", "0.5691265", "0.56783193", "0.5674676", "0.5665977", "0.5656166", "0.5656166", "0.5573045" ]
0.6648584
26
Rebuild the gutter elements, ensure the margin to the left of the code matches their width.
function renderGutters(display) { var gutters = display.gutters, specs = display.gutterSpecs; removeChildren(gutters); display.lineGutter = null; for (var i = 0; i < specs.length; ++i) { var ref = specs[i]; var className = ref.className; var style = ref.style; var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + className)); if (style) { gElt.style.cssText = style; } if (className == "CodeMirror-linenumbers") { display.lineGutter = gElt; gElt.style.width = (display.lineNumWidth || 1) + "px"; } } gutters.style.display = specs.length ? "" : "none"; updateGutterSpace(display); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function wa(e){for(var t=e.display,a={},n={},r=t.gutters.clientLeft,f=t.gutters.firstChild,o=0;f;f=f.nextSibling,++o)a[e.options.gutters[o]]=f.offsetLeft+f.clientLeft+r,n[e.options.gutters[o]]=f.clientWidth;return{fixedPos:xa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:a,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}", "function adjustMargins() {\n detectSpacesIn(body);\n} //Initiate recursion:", "function marginsDefine() {\n for (let i = -17; i < 0; i++) {\n t0p = i;\n marginsTopNBot.push(t0p);\n }\n for (let i = 305; i > 288; i--) {\n bottom = i;\n marginsTopNBot.push(bottom);\n }\n for (let i = 0; i < 18; i++) {\n left = i * 17;\n right = i * 17 - 1;\n marginLeft.push(left);\n marginRight.push(right);\n }\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n }", "function Ga(e){var t=e.display,a=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=xa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,r=t.gutters.offsetWidth,f=n+\"px\",o=0;o<a.length;o++)if(!a[o].hidden){e.options.fixedGutter&&(a[o].gutter&&(a[o].gutter.style.left=f),a[o].gutterBackground&&(a[o].gutterBackground.style.left=f));var i=a[o].alignable;if(i)for(var s=0;s<i.length;s++)i[s].style.left=f}e.options.fixedGutter&&(t.gutters.style.left=n+r+\"px\")}}", "function fullWidthLeftRightSpacing() { \n // Padding for full width blocks\n \n if(vW > 991) {\n var widthDifference = (vW - $('.dummy div').outerWidth()) / 2;\n } else {\n var widthDifference = (vW - $('.dummy div').width()) / 2;\n }\n $('.container-fluid-container-pad-right').css('padding-right', widthDifference);\n $('.container-fluid-container-pad-left').css('padding-left', widthDifference);\n }", "function alignHorizontally(cm) {\r\n var display = cm.display, view = display.view;\r\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\r\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\r\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\r\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\r\n if (cm.options.fixedGutter) {\r\n if (view[i].gutter)\r\n { view[i].gutter.style.left = left; }\r\n if (view[i].gutterBackground)\r\n { view[i].gutterBackground.style.left = left; }\r\n }\r\n var align = view[i].alignable;\r\n if (align) { for (var j = 0; j < align.length; j++)\r\n { align[j].style.left = left; } }\r\n } }\r\n if (cm.options.fixedGutter)\r\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\r\n}", "function get_left_margin(){\n\tvar wrapper=lhs=fave_buttons=upload=log=greet=0;\n\t//get the width of all elements on the right side and remove the px suffix\n\twrapper = $(\"#wrapper\").css(\"width\").replace(/[^0-9]/g, '');\n\tupload = $(\"#select_upload\").css(\"width\").replace(/[^0-9]/g, '');\n\tfave_buttons = $(\"#fave_buttons\").css(\"width\").replace(/[^0-9]/g, '');\n\tif(document.getElementById(\"select_logout\"))\n\t\tlog = $(\"#select_logout\").css(\"width\").replace(/[^0-9]/g, '');\n\telse\n\t\tlog = $(\"#select_login\").css(\"width\").replace(/[^0-9]/g, '');\n\tif(document.getElementById(\"functions_greeting\"))\n\t\tgreet =$(\".functions_greeting\").css(\"width\").replace(/[^0-9]/g,'');\n\tlhs = $(\"#left_hand\").css(\"width\").replace(/[^0-9]/g, '');\n\treturn wrapper - lhs - fave_buttons - upload - log - greet-30;\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n}", "function toRowGuttersCss(gutter) {\n return 'margin-left: -' + gutter / 2 + 'px; margin-right: -' + gutter / 2 + 'px;';\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n view[i].gutter.style.left = left;\n if (view[i].gutterBackground)\n view[i].gutterBackground.style.left = left;\n }\n var align = view[i].alignable;\n if (align) for (var j = 0; j < align.length; j++)\n align[j].style.left = left;\n }\n if (cm.options.fixedGutter)\n display.gutters.style.left = (comp + gutterW) + \"px\";\n }", "function alignHorizontally(cm) {\n\t\t var display = cm.display, view = display.view;\n\t\t if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n\t\t var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n\t\t var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n\t\t for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n\t\t if (cm.options.fixedGutter) {\n\t\t if (view[i].gutter)\n\t\t { view[i].gutter.style.left = left; }\n\t\t if (view[i].gutterBackground)\n\t\t { view[i].gutterBackground.style.left = left; }\n\t\t }\n\t\t var align = view[i].alignable;\n\t\t if (align) { for (var j = 0; j < align.length; j++)\n\t\t { align[j].style.left = left; } }\n\t\t } }\n\t\t if (cm.options.fixedGutter)\n\t\t { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n\t\t }", "updateContentMargins() {\n // 1. For drawers in `over` mode, they don't affect the content.\n // 2. For drawers in `side` mode they should shrink the content. We do this by adding to the\n // left margin (for left drawer) or right margin (for right the drawer).\n // 3. For drawers in `push` mode the should shift the content without resizing it. We do this by\n // adding to the left or right margin and simultaneously subtracting the same amount of\n // margin from the other side.\n let left = 0;\n let right = 0;\n if (this._left && this._left.opened) {\n if (this._left.mode == 'side') {\n left += this._left._getWidth();\n }\n else if (this._left.mode == 'push') {\n const width = this._left._getWidth();\n left += width;\n right -= width;\n }\n }\n if (this._right && this._right.opened) {\n if (this._right.mode == 'side') {\n right += this._right._getWidth();\n }\n else if (this._right.mode == 'push') {\n const width = this._right._getWidth();\n right += width;\n left -= width;\n }\n }\n // If either `right` or `left` is zero, don't set a style to the element. This\n // allows users to specify a custom size via CSS class in SSR scenarios where the\n // measured widths will always be zero. Note that we reset to `null` here, rather\n // than below, in order to ensure that the types in the `if` below are consistent.\n left = left || null;\n right = right || null;\n if (left !== this._contentMargins.left || right !== this._contentMargins.right) {\n this._contentMargins = { left, right };\n // Pull back into the NgZone since in some cases we could be outside. We need to be careful\n // to do it only when something changed, otherwise we can end up hitting the zone too often.\n this._ngZone.run(() => this._contentMarginChanges.next(this._contentMargins));\n }\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\"\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left }\n }\n var align = view[i].alignable\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\" }\n}", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\"\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left }\n }\n var align = view[i].alignable\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\" }\n}", "updateContentMargins() {\n // 1. For drawers in `over` mode, they don't affect the content.\n // 2. For drawers in `side` mode they should shrink the content. We do this by adding to the\n // left margin (for left drawer) or right margin (for right the drawer).\n // 3. For drawers in `push` mode the should shift the content without resizing it. We do this by\n // adding to the left or right margin and simultaneously subtracting the same amount of\n // margin from the other side.\n let left = 0;\n let right = 0;\n if (this._left && this._left.opened) {\n if (this._left.mode === 'side') {\n left += this._left._getWidth();\n }\n else if (this._left.mode === 'push') {\n const width = this._left._getWidth();\n left += width;\n right -= width;\n }\n }\n if (this._right && this._right.opened) {\n if (this._right.mode === 'side') {\n right += this._right._getWidth();\n }\n else if (this._right.mode === 'push') {\n const width = this._right._getWidth();\n right += width;\n left -= width;\n }\n }\n // If either `right` or `left` is zero, don't set a style to the element. This\n // allows users to specify a custom size via CSS class in SSR scenarios where the\n // measured widths will always be zero. Note that we reset to `null` here, rather\n // than below, in order to ensure that the types in the `if` below are consistent.\n left = left || null;\n right = right || null;\n if (left !== this._contentMargins.left || right !== this._contentMargins.right) {\n this._contentMargins = { left, right };\n // Pull back into the NgZone since in some cases we could be outside. We need to be careful\n // to do it only when something changed, otherwise we can end up hitting the zone too often.\n this._ngZone.run(() => this._contentMarginChanges.next(this._contentMargins));\n }\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\n if (cm.options.fixedGutter && view[i].gutter)\n view[i].gutter.style.left = left;\n var align = view[i].alignable;\n if (align) for (var j = 0; j < align.length; j++)\n align[j].style.left = left;\n }\n if (cm.options.fixedGutter)\n display.gutters.style.left = (comp + gutterW) + \"px\";\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\n if (cm.options.fixedGutter && view[i].gutter)\n view[i].gutter.style.left = left;\n var align = view[i].alignable;\n if (align) for (var j = 0; j < align.length; j++)\n align[j].style.left = left;\n }\n if (cm.options.fixedGutter)\n display.gutters.style.left = (comp + gutterW) + \"px\";\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\n if (cm.options.fixedGutter && view[i].gutter)\n view[i].gutter.style.left = left;\n var align = view[i].alignable;\n if (align) for (var j = 0; j < align.length; j++)\n align[j].style.left = left;\n }\n if (cm.options.fixedGutter)\n display.gutters.style.left = (comp + gutterW) + \"px\";\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\n if (cm.options.fixedGutter && view[i].gutter)\n view[i].gutter.style.left = left;\n var align = view[i].alignable;\n if (align) for (var j = 0; j < align.length; j++)\n align[j].style.left = left;\n }\n if (cm.options.fixedGutter)\n display.gutters.style.left = (comp + gutterW) + \"px\";\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\n if (cm.options.fixedGutter && view[i].gutter)\n view[i].gutter.style.left = left;\n var align = view[i].alignable;\n if (align) for (var j = 0; j < align.length; j++)\n align[j].style.left = left;\n }\n if (cm.options.fixedGutter)\n display.gutters.style.left = (comp + gutterW) + \"px\";\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\n if (cm.options.fixedGutter && view[i].gutter)\n view[i].gutter.style.left = left;\n var align = view[i].alignable;\n if (align) for (var j = 0; j < align.length; j++)\n align[j].style.left = left;\n }\n if (cm.options.fixedGutter)\n display.gutters.style.left = (comp + gutterW) + \"px\";\n }", "function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\n if (cm.options.fixedGutter && view[i].gutter)\n view[i].gutter.style.left = left;\n var align = view[i].alignable;\n if (align) for (var j = 0; j < align.length; j++)\n align[j].style.left = left;\n }\n if (cm.options.fixedGutter)\n display.gutters.style.left = (comp + gutterW) + \"px\";\n }", "function marginPushersAgain() {\n if(JSON.stringify(fullLayout._size) === oldmargins) return;\n\n return Lib.syncOrAsync([\n marginPushers,\n subroutines.layoutStyles\n ], gd);\n }", "function marginPushersAgain() {\n if(JSON.stringify(fullLayout._size) === oldmargins) return;\n\n return Lib.syncOrAsync([\n marginPushers,\n subroutines.layoutStyles\n ], gd);\n }", "function Rn(e){var a=e.display.gutters,r=e.options.gutters;t(a);for(var f=0;f<r.length;++f){var o=r[f],i=a.appendChild(n(\"div\",null,\"CodeMirror-gutter \"+o));\"CodeMirror-linenumbers\"==o&&(e.display.lineGutter=i,i.style.width=(e.display.lineNumWidth||1)+\"px\")}a.style.display=f?\"\":\"none\",In(e)}", "function alignHorizontally(cm) {\n\t\t var display = cm.display, view = display.view;\n\t\t if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\n\t\t var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n\t\t var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n\t\t for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\n\t\t if (cm.options.fixedGutter) {\n\t\t if (view[i].gutter)\n\t\t view[i].gutter.style.left = left;\n\t\t if (view[i].gutterBackground)\n\t\t view[i].gutterBackground.style.left = left;\n\t\t }\n\t\t var align = view[i].alignable;\n\t\t if (align) for (var j = 0; j < align.length; j++)\n\t\t align[j].style.left = left;\n\t\t }\n\t\t if (cm.options.fixedGutter)\n\t\t display.gutters.style.left = (comp + gutterW) + \"px\";\n\t\t }", "function alignHorizontally(cm) {\r\n var display = cm.display, view = display.view;\r\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\r\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\r\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\r\n for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\r\n if (cm.options.fixedGutter && view[i].gutter)\r\n view[i].gutter.style.left = left;\r\n var align = view[i].alignable;\r\n if (align) for (var j = 0; j < align.length; j++)\r\n align[j].style.left = left;\r\n }\r\n if (cm.options.fixedGutter)\r\n display.gutters.style.left = (comp + gutterW) + \"px\";\r\n }", "function alignHorizontally(cm) {\n\t var display = cm.display, view = display.view;\n\t if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\n\t var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n\t var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n\t for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\n\t if (cm.options.fixedGutter) {\n\t if (view[i].gutter)\n\t view[i].gutter.style.left = left;\n\t if (view[i].gutterBackground)\n\t view[i].gutterBackground.style.left = left;\n\t }\n\t var align = view[i].alignable;\n\t if (align) for (var j = 0; j < align.length; j++)\n\t align[j].style.left = left;\n\t }\n\t if (cm.options.fixedGutter)\n\t display.gutters.style.left = (comp + gutterW) + \"px\";\n\t }", "function royalGalleryGutter() {\n\n\t\troyalGallery.css({\n\t\t\t'margin-right' \t: gallery_default_gutter_horz +'px',\n\t\t\t'margin-bottom' : gallery_default_gutter_vert +'px'\n\t\t});\n\n\t\t$('.gallery-columns-2 .gallery-item').css({\n\t\t\t'width' : '-webkit-calc((100% - ('+ gallery_default_gutter_horz +'px * 1)) / 2)',\n\t\t\t'width' : 'calc((100% - ('+ gallery_default_gutter_horz +'px * 1)) / 2)'\n\t\t});\n\t\t$('.gallery-columns-3 .gallery-item').css({\n\t\t\t'width' : '-webkit-calc((100% - ('+ gallery_default_gutter_horz +'px * 2)) / 3)',\n\t\t\t'width' : 'calc((100% - ('+ gallery_default_gutter_horz +'px * 2)) / 3)'\n\t\t});\n\t\t$('.gallery-columns-4 .gallery-item').css({\n\t\t\t'width' : '-webkit-calc((100% - ('+ gallery_default_gutter_horz +'px * 3)) / 4)',\n\t\t\t'width' : 'calc((100% - ('+ gallery_default_gutter_horz +'px * 3)) / 4)'\n\t\t});\n\t\t$('.gallery-columns-5 .gallery-item').css({\n\t\t\t'width' : '-webkit-calc((100% - ('+ gallery_default_gutter_horz +'px * 4)) / 5)',\n\t\t\t'width' : 'calc((100% - ('+ gallery_default_gutter_horz +'px * 4)) / 5)'\n\t\t});\n\t\t$('.gallery-columns-6 .gallery-item').css({\n\t\t\t'width' : '-webkit-calc((100% - ('+ gallery_default_gutter_horz +'px * 5)) / 6)',\n\t\t\t'width' : 'calc((100% - ('+ gallery_default_gutter_horz +'px * 5)) / 6)'\n\t\t});\n\t\t$('.gallery-columns-7 .gallery-item').css({\n\t\t\t'width' : '-webkit-calc((100% - ('+ gallery_default_gutter_horz +'px * 6)) / 7)',\n\t\t\t'width' : 'calc((100% - ('+ gallery_default_gutter_horz +'px * 6)) / 7)'\n\t\t});\n\t\t$('.gallery-columns-8 .gallery-item').css({\n\t\t\t'width' : '-webkit-calc((100% - ('+ gallery_default_gutter_horz +'px * 7)) / 8)',\n\t\t\t'width' : 'calc((100% - ('+ gallery_default_gutter_horz +'px * 7)) / 8)'\n\t\t});\n\t\t$('.gallery-columns-9 .gallery-item').css({\n\t\t\t'width' : '-webkit-calc((100% - ('+ gallery_default_gutter_horz +'px * 8)) / 9)',\n\t\t\t'width' : 'calc((100% - ('+ gallery_default_gutter_horz +'px * 8)) / 9)'\n\t\t});\n\n\t}", "function changePadding(){\n //get margin size and check for need here\n //var pl = document.getElementById('grid-container').style.paddingLeft;\n //document.getElementById(\"display\").innerHTML = pl;\n \n var pads = 0;\n var id3 = setInterval(frame, 30);\n function frame() {\n if (pads == 30){ clearInterval(id3); }\n else {\n pads++;\n document.getElementById(\"grid-container\").style.paddingLeft = 30-pads + \"vw\";\n document.getElementById(\"grid-container\").style.paddingRight = 30-pads + \"vw\";\n }\n }\n}", "_justify() {\n let hIx = 0;\n let left = 0;\n let minx = 0;\n let maxx = 0;\n let lvl = 0;\n let maxwidth = 0;\n let runningWidth = 0;\n let runningHeight = 0;\n if (!this.inlineBlocks.length) {\n return;\n }\n minx = this.inlineBlocks[0].text.startX;\n // We justify relative to first block x/y.\n const initialX = this.inlineBlocks[0].text.startX;\n const initialY = this.inlineBlocks[0].text.startY;\n const vert = {};\n this.inlineBlocks.forEach((inlineBlock) => {\n const block = inlineBlock.text;\n const blockBox = block.getLogicalBox();\n // If this is a horizontal positioning, reset to first blokc position\n //\n if (hIx > 0) {\n block.startX = initialX;\n block.startY = initialY;\n }\n minx = block.startX < minx ? block.startX : minx;\n maxx = (block.startX + blockBox.width) > maxx ? block.startX + blockBox.width : maxx;\n\n lvl = inlineBlock.position === SmoTextGroup.relativePositions.ABOVE ? lvl + 1 : lvl;\n lvl = inlineBlock.position === SmoTextGroup.relativePositions.BELOW ? lvl - 1 : lvl;\n if (inlineBlock.position === SmoTextGroup.relativePositions.RIGHT) {\n block.startX += runningWidth;\n if (hIx > 0) {\n block.startX += this.spacing;\n }\n }\n if (inlineBlock.position === SmoTextGroup.relativePositions.LEFT) {\n if (hIx > 0) {\n block.startX = minx - blockBox.width;\n minx = block.startX;\n block.startX -= this.spacing;\n }\n }\n if (inlineBlock.position === SmoTextGroup.relativePositions.BELOW) {\n block.startY += runningHeight;\n if (hIx > 0) {\n block.startY += this.spacing;\n }\n }\n if (inlineBlock.position === SmoTextGroup.relativePositions.ABOVE) {\n block.startY -= runningHeight;\n if (hIx > 0) {\n block.startY -= this.spacing;\n }\n }\n if (!vert[lvl]) {\n vert[lvl] = {};\n vert[lvl].blocks = [block];\n vert[lvl].minx = block.startX;\n vert[lvl].maxx = block.startX + blockBox.width;\n maxwidth = vert[lvl].width = blockBox.width;\n } else {\n vert[lvl].blocks.push(block);\n vert[lvl].minx = vert[lvl].minx < block.startX ? vert[lvl].minx : block.startX;\n vert[lvl].maxx = vert[lvl].maxx > (block.startX + blockBox.width) ?\n vert[lvl].maxx : (block.startX + blockBox.width);\n vert[lvl].width += blockBox.width;\n maxwidth = maxwidth > vert[lvl].width ? maxwidth : vert[lvl].width;\n }\n runningWidth += blockBox.width;\n runningHeight += blockBox.height;\n hIx += 1;\n block.updatedMetrics = false;\n });\n\n const levels = Object.keys(vert);\n\n // Horizontal justify the vertical blocks\n levels.forEach((level) => {\n const vobj = vert[level];\n if (this.justification === SmoTextGroup.justifications.LEFT) {\n left = minx - vobj.minx;\n } else if (this.justification === SmoTextGroup.justifications.RIGHT) {\n left = maxx - vobj.maxx;\n } else {\n left = (maxwidth / 2) - (vobj.width / 2);\n left += minx - vobj.minx;\n }\n vobj.blocks.forEach((block) => {\n block.offsetStartX(left);\n });\n });\n }", "updateChildWidgetLeft(left) {\n // TODO: Cell spacing calculation.\n let spacing = 0;\n if (this.ownerTable.tableFormat.cellSpacing > 0) {\n spacing = this.ownerTable.tableFormat.cellSpacing;\n }\n for (let i = 0; i < this.childWidgets.length; i++) {\n let cellWidget = this.childWidgets[i];\n left += spacing + cellWidget.margin.left;\n cellWidget.x = left;\n cellWidget.updateChildWidgetLeft(cellWidget.x);\n left += cellWidget.width + cellWidget.margin.right;\n }\n }", "function alignHorizontally(cm) {\n\t var display = cm.display, view = display.view;\n\t if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\n\t var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n\t var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n\t for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\n\t if (cm.options.fixedGutter && view[i].gutter)\n\t view[i].gutter.style.left = left;\n\t var align = view[i].alignable;\n\t if (align) for (var j = 0; j < align.length; j++)\n\t align[j].style.left = left;\n\t }\n\t if (cm.options.fixedGutter)\n\t display.gutters.style.left = (comp + gutterW) + \"px\";\n\t }", "function alignHorizontally(cm) {\n\t var display = cm.display, view = display.view;\n\t if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\n\t var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n\t var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n\t for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\n\t if (cm.options.fixedGutter && view[i].gutter)\n\t view[i].gutter.style.left = left;\n\t var align = view[i].alignable;\n\t if (align) for (var j = 0; j < align.length; j++)\n\t align[j].style.left = left;\n\t }\n\t if (cm.options.fixedGutter)\n\t display.gutters.style.left = (comp + gutterW) + \"px\";\n\t }", "function marginPushers() {\n // First reset the list of things that are allowed to change the margins\n // So any deleted traces or components will be wiped out of the\n // automargin calculation.\n // This means *every* margin pusher must be listed here, even if it\n // doesn't actually try to push the margins until later.\n Plots.clearAutoMarginIds(gd);\n subroutines.drawMarginPushers(gd);\n Axes.allowAutoMargin(gd);\n if (gd._fullLayout.title.text && gd._fullLayout.title.automargin) Plots.allowAutoMargin(gd, 'title.automargin');\n\n // TODO can this be moved elsewhere?\n if (fullLayout._has('pie')) {\n var fullData = gd._fullData;\n for (var i = 0; i < fullData.length; i++) {\n var trace = fullData[i];\n if (trace.type === 'pie' && trace.automargin) {\n Plots.allowAutoMargin(gd, 'pie.' + trace.uid + '.automargin');\n }\n }\n }\n Plots.doAutoMargin(gd);\n return Plots.previousPromises(gd);\n }", "function computeHolderMargin(width) {\n var margin = 3;\n var imgWidth = width + (2 * margin);\n\n var totalWidth = $(\"#partial\").width();\n\n var numberOfPhotosAcross = Math.floor(totalWidth / imgWidth);\n\n // corrects for when there are less photos than can fit on screen\n var usedWidth = Math.min(numberOfPhotosAcross, totalPhotoCount) * imgWidth;\n var remainder = totalWidth - usedWidth;\n\n $(\"#ul-holder\").css(\"margin-left\", (remainder / 2) + \"px\");\n}", "checkSpaceLeft() {\n const { theme } = this.props;\n const middleContainer = document.getElementById('middle_container');\n if (middleContainer) {\n const middleWidth = middleContainer.offsetWidth;\n const nextColumnWidth = parseInt(theme.column.width, 10);\n return Math.floor(middleWidth / nextColumnWidth);\n }\n return 1;\n }", "function outputPaddingAdjuster() {\n if (!tutorialSettings.libraries.turtle && !tutorialSettings.libraries.DOM && !tutorialSettings.libraries.csv && !tutorialSettings.libraries.csvAndTurtle) {\n outputBlock.style.paddingLeft = \"40px\";\n } \n else {\n if($(window).width() < 1183){\n outputBlock.style.paddingLeft = \"40px\";\n }\n }\n}", "function setOuterWidth() {\n outerWidth = wrap.offsetWidth;\n dragBarPos = calcDragBarPosFromCss() || Math.floor(outerWidth / 2) - 5;\n }", "function widen() {\n var minWidth = 685;\n\n //prepare array of magics\n var std_buttons = document.getElementById(\"std_buttons\");\n var magic = document.getElementById(\"magic\");\n var magic2 = document.getElementById(\"magic2\");\n var magic3 = document.getElementById(\"magic3\");\n var magic4 = document.getElementById(\"magic4\");\n var magic5 = document.getElementById(\"magic5\");\n var magic_array = [];\n\n if (magic) magic_array.push(magic);\n if (magic2) magic_array.push(magic2);\n if (magic3) magic_array.push(magic3);\n if (magic4) magic_array.push(magic4);\n if (magic5) magic_array.push(magic5);\n\n //sort by length desc\n magic_array.sort(function (a, b) {\n return b.offsetWidth - a.offsetWidth;\n });\n\n var defWidth = std_buttons.offsetWidth;\n var fixedWidth = 100;\n\n var stdWidth = fixedWidth + std_buttons.offsetWidth;\n console.log(\"standard width=\" + stdWidth);\n\n var newWidth =\n fixedWidth +\n std_buttons.offsetWidth +\n (magic ? magic.offsetWidth : 0) +\n (magic2 ? magic2.offsetWidth : 0) +\n (magic3 ? magic3.offsetWidth : 0) +\n (magic4 ? magic4.offsetWidth : 0) +\n (magic5 ? magic5.offsetWidth : 0);\n\n if (newWidth > 795) {\n //console.log(\"width calculated to\"+newWidth+\". shortening labels\");\n document.getElementById(\"query\").innerText = \"Que\";\n document.getElementById(\"project_list\").innerText = \"Lst\";\n newWidth =\n fixedWidth +\n std_buttons.offsetWidth +\n (magic ? magic.offsetWidth : 0) +\n (magic2 ? magic2.offsetWidth : 0) +\n (magic3 ? magic3.offsetWidth : 0) +\n (magic4 ? magic4.offsetWidth : 0) +\n (magic5 ? magic5.offsetWidth : 0);\n }\n if (newWidth > 795) {\n //console.log(\"width calculated to\"+newWidth+\". shortening labels\");\n document.getElementById(\"validate\").innerText = \"Val\";\n document.getElementById(\"project\").innerText = \"Prj\";\n newWidth =\n fixedWidth +\n std_buttons.offsetWidth +\n (magic ? magic.offsetWidth : 0) +\n (magic2 ? magic2.offsetWidth : 0) +\n (magic3 ? magic3.offsetWidth : 0) +\n (magic4 ? magic4.offsetWidth : 0) +\n (magic5 ? magic5.offsetWidth : 0);\n }\n if (newWidth > 795) {\n //console.log(\"width calculated to\"+newWidth+\". shortening labels\");\n document.getElementById(\"model\").innerText = \"LD\";\n document.getElementById(\"model2\").innerText = \"LB\";\n document.getElementById(\"model3\").innerText = \"WB\";\n newWidth =\n fixedWidth +\n std_buttons.offsetWidth +\n (magic ? magic.offsetWidth : 0) +\n (magic2 ? magic2.offsetWidth : 0) +\n (magic3 ? magic3.offsetWidth : 0) +\n (magic4 ? magic4.offsetWidth : 0) +\n (magic5 ? magic5.offsetWidth : 0);\n }\n if (newWidth > 795) {\n //console.log(\"width calculated to\"+newWidth+\". shortening labels\");\n document.getElementById(\"explain\").innerText = \"E\";\n document.getElementById(\"schedules_gp\").innerText = \"G\";\n newWidth =\n fixedWidth +\n std_buttons.offsetWidth +\n (magic ? magic.offsetWidth : 0) +\n (magic2 ? magic2.offsetWidth : 0) +\n (magic3 ? magic3.offsetWidth : 0) +\n (magic4 ? magic4.offsetWidth : 0) +\n (magic5 ? magic5.offsetWidth : 0);\n }\n if (newWidth > 795) {\n //console.log(\"width calculated to\"+newWidth+\". shortening labels\");\n document.getElementById(\"md_export\").innerText = \"M\";\n document.getElementById(\"md_import\").innerText = \"M\";\n newWidth =\n fixedWidth +\n std_buttons.offsetWidth +\n (magic ? magic.offsetWidth : 0) +\n (magic2 ? magic2.offsetWidth : 0) +\n (magic3 ? magic3.offsetWidth : 0) +\n (magic4 ? magic4.offsetWidth : 0) +\n (magic5 ? magic5.offsetWidth : 0);\n }\n\n var x = 0; //to avoid infinite cycle\n for (\n var i = 0;\n i < magic_array.length && newWidth > 795 && x < 20;\n magic_array.sort(function (a, b) {\n return b.offsetWidth - a.offsetWidth;\n })\n ) {\n //console.log(\"width calculated to\"+newWidth+\". shortening longest magic label \"+magic_array[i].innerText );\n magic_array[i].innerText = magic_array[i].innerText.substring(\n 0,\n magic_array[i].innerText.length - 1\n );\n newWidth =\n fixedWidth +\n std_buttons.offsetWidth +\n (magic ? magic.offsetWidth : 0) +\n (magic2 ? magic2.offsetWidth : 0) +\n (magic3 ? magic3.offsetWidth : 0) +\n (magic4 ? magic4.offsetWidth : 0) +\n (magic5 ? magic5.offsetWidth : 0);\n x++;\n }\n\n var newWidthCss = newWidth + \"px\";\n\n var body = document.getElementsByTagName(\"body\")[0];\n var html = document.getElementsByTagName(\"html\")[0];\n body.setAttribute(\"width\", newWidth);\n body.style.setProperty(\"width\", newWidthCss, \"\");\n html.setAttribute(\"width\", newWidth);\n html.style.setProperty(\"width\", newWidthCss, \"\");\n}", "function setWidth(){\n var width = 500/(columnCounter + 1);\n\n for(var i=0; i<=columnCounter; i++){\n for(var j=0; j<columns[i].length; j++) {\n columns[i][j].style.width = (width - 3) + 'px';\n columns[i][j].style.marginLeft = width * i + 'px';\n }\n }\n }", "calcMarginLeft() {\n const { width } = this.getWindowDimensions();\n const dotPatternSize = this.getDotPatternSize();\n // const marginLeft = ((dotPatternSize - ((width % dotPatternSize) / 2)) - dotPatternSize) * -1\n let marginLeft = (width % dotPatternSize) / 2;\n const indicator = (width / dotPatternSize) % 2;\n if (indicator < 1) {\n marginLeft = marginLeft - dotPatternSize / 2;\n }\n this.setState({ marginLeft });\n return marginLeft;\n }", "function fixLeftMargin(){\r\n\tvar marginLeft = Math.ceil(parseFloat($(\"#div-body-first\").css(\"margin-left\"))/2);\r\n\t$(\"#div-body-first\").css(\"margin-left\", marginLeft);\r\n}", "_precalculateContentWidths() {\n let cellPadding = 0;\n\n if (!this.$el.hasClass('diff-error') && this._$revisionRow.length > 0) {\n const containerExtents = this.$el.getExtents('p', 'lr');\n\n /* Calculate the widths and state of the diff columns. */\n let $cells = $(this._$revisionRow[0].cells);\n cellPadding = $(this.el.querySelector('pre'))\n .parent().addBack()\n .getExtents('p', 'lr');\n\n this._colReservedWidths = $cells.eq(0).outerWidth() + cellPadding +\n containerExtents;\n this._numColumns = $cells.length;\n\n if (this._numColumns === 4) {\n /* There's a left-hand side and a right-hand side. */\n this._colReservedWidths += $cells.eq(2).outerWidth() +\n cellPadding;\n }\n\n /* Calculate the widths and state of the filename columns. */\n $cells = $(this._$filenameRow[0].cells);\n this._numFilenameColumns = $cells.length;\n this._filenameReservedWidths = containerExtents +\n 2 * this._numFilenameColumns;\n } else {\n this._colReservedWidths = 0;\n this._filenameReservedWidths = 0;\n this._numColumns = 0;\n this._numFilenameColumns = 0;\n }\n }", "_addItemsSpacing() {\n // Not last child.\n for (let item = 0; item < this._items.length - 1; item++) {\n const sliderItemWrap = this._items[item].parentElement;\n sliderItemWrap.style.marginRight = this._settings.slidesSpacing + 'px';\n }\n }", "function generateStylePush(nGridUnit, nColumnWidth, nColumnGutter, nColumns)\n{\n\t//Declare return string.\n\tvar sStylePush = '';\n\n\tfor (i = 0, j = Math.round(nColumns / 2); i < j; i++)\n\t{\n\t\tvar nDistance = i * nGridUnit * (nColumnWidth + nColumnGutter);\n\t\tsStylePush += '\\n.push-' + i + '{margin-left:' + nDistance + 'px;}';\n\t}\n\t\n\treturn sStylePush;\n}", "function stretchCheckerboard() {\n\t\ty = $('.main-section .wrapper').outerWidth();\t\t\n\t\t$('.main-section header h3').each(function() {\n\t\t\tw = $(this).outerWidth();\n\t\t\t$(this).css({ marginRight: (y-w)%40 });\n\t\t});\n\t\t\n\t}", "function reflowContent() {\n var showing = $scrollContent.width() + parseInt($scrollContent.css(\"margin-left\"), 10);\n var gap = $scrollPane.width() - showing;\n if (gap > 0) {\n $scrollContent.css(\"margin-left\", parseInt($scrollContent.css(\"margin-left\"), 10) + gap);\n }\n }", "function reflowContent(){\n\t\tvar showing = scrollContent.width() + parseInt( scrollContent.css('margin-left') );\n\t\tvar gap = scrollPane.width() - showing;\n\t\tif(gap > 0){\n\t\t\tscrollContent.css('margin-left', parseInt( scrollContent.css('margin-left') ) + gap);\n\t\t}\n}", "function marginPushersAgain() {\n\t var seq = JSON.stringify(fullLayout._size) === oldmargins ?\n\t [] :\n\t [marginPushers, subroutines.layoutStyles];\n\t\n\t // re-initialize cartesian interaction,\n\t // which are sometimes cleared during marginPushers\n\t seq = seq.concat(Fx.init);\n\t\n\t return Lib.syncOrAsync(seq, gd);\n\t }", "function gutter(config) {\n return [gutters(), activeGutters.of(Object.assign(Object.assign({}, defaults), config))];\n}", "function marginPushers() {\n\t var calcdata = gd.calcdata;\n\t var i, cd, trace;\n\t\n\t Registry.getComponentMethod('legend', 'draw')(gd);\n\t Registry.getComponentMethod('rangeselector', 'draw')(gd);\n\t Registry.getComponentMethod('sliders', 'draw')(gd);\n\t Registry.getComponentMethod('updatemenus', 'draw')(gd);\n\t\n\t for(i = 0; i < calcdata.length; i++) {\n\t cd = calcdata[i];\n\t trace = cd[0].trace;\n\t if(trace.visible !== true || !trace._module.colorbar) {\n\t Plots.autoMargin(gd, 'cb' + trace.uid);\n\t }\n\t else trace._module.colorbar(gd, cd);\n\t }\n\t\n\t Plots.doAutoMargin(gd);\n\t return Plots.previousPromises(gd);\n\t }", "function removeFixedWidths() {\n $(\".footer--content\").css({ 'margin' : '0', 'padding-left': '60px' });\n }", "function FixGridWidth()\n{\n\tlet q = document.querySelectorAll(\".grid\");\n\tq.forEach(e => {\n\t\te.style.width = `${e.clientHeight}px`;\n\t});\n}", "function pack() {\n var boxes = config.boardView.querySelectorAll(\".box\"),\n boxesPerRow = calculateBoxesPerRow(boxes.length),\n margin = parseInt(window.getComputedStyle(boxes[0]).marginTop.replace(\"px\", \"\")),\n boardWidth = boxesPerRow * (boxes[0].offsetWidth + 2 * margin);\n\n if (boxesPerRow === 1) {\n boxesPerRow = boxes.length;\n }\n\n config.boardView.style.width = boardWidth + \"px\";\n }", "function refreshWidths() {\n slideWidth = $slideshow.width();\n\n // ...pulling currSlide from global :/\n var left = slideLeftPos( currSlide );\n $slideReel.css(\"left\", left);\n }", "function marginPushers() {\n var calcdata = gd.calcdata;\n var i, cd, trace;\n\n Registry.getComponentMethod('legend', 'draw')(gd);\n Registry.getComponentMethod('rangeselector', 'draw')(gd);\n Registry.getComponentMethod('sliders', 'draw')(gd);\n Registry.getComponentMethod('updatemenus', 'draw')(gd);\n\n for(i = 0; i < calcdata.length; i++) {\n cd = calcdata[i];\n trace = cd[0].trace;\n if(trace.visible !== true || !trace._module.colorbar) {\n Plots.autoMargin(gd, 'cb' + trace.uid);\n }\n else trace._module.colorbar(gd, cd);\n }\n\n Plots.doAutoMargin(gd);\n return Plots.previousPromises(gd);\n }", "function marginPushers() {\n var calcdata = gd.calcdata;\n var i, cd, trace;\n\n Registry.getComponentMethod('legend', 'draw')(gd);\n Registry.getComponentMethod('rangeselector', 'draw')(gd);\n Registry.getComponentMethod('sliders', 'draw')(gd);\n Registry.getComponentMethod('updatemenus', 'draw')(gd);\n\n for(i = 0; i < calcdata.length; i++) {\n cd = calcdata[i];\n trace = cd[0].trace;\n if(trace.visible !== true || !trace._module.colorbar) {\n Plots.autoMargin(gd, 'cb' + trace.uid);\n }\n else trace._module.colorbar(gd, cd);\n }\n\n Plots.doAutoMargin(gd);\n return Plots.previousPromises(gd);\n }", "function makeLeftTemplate() {\n var startX = width;\n var jogLeft = startX - parenWidth;\n var nearLeft = -(width * nearFactor);\n var farLeft = -(width * farFactor);\n\n return makeSVGTemplate(width, height,\n [['M', [startX, top]],\n ['L', [jogLeft, top]],\n // Draw the far edge.\n ['Q', [farLeft, midY, jogLeft, bottom]],\n ['M', [jogLeft, bottom]],\n ['L', [startX, bottom]],\n // Draw the near edge.\n ['Q', [nearLeft, midY, startX, top]]]);\n }", "function setBoxWidths() {\n var leftWidth = dragBarPos - 2,\n rightWidth = outerWidth - dragBarPos - 12;\n\n left.css('width', '' + toPercent(leftWidth) + '%');\n right.css('width', '' + toPercent(rightWidth) + '%');\n }", "function goLeft() {\n leftMargin = $(\".inner-liner\").css(\"margin-left\").replace(\"px\", \"\") * 1;\n newLeftMargin = (leftMargin + 650);\n $(\".inner-liner\").animate({ marginLeft: newLeftMargin }, 500);\n }", "enterParagraphLeftMarginValue(ctx) {\n\t}", "function b(){h.style.cssText=\"-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%\",h.innerHTML=\"\",$a.appendChild(g);var b=a.getComputedStyle(h);c=\"1%\"!==b.top,f=\"2px\"===b.marginLeft,d=\"4px\"===b.width,h.style.marginRight=\"50%\",e=\"4px\"===b.marginRight,$a.removeChild(g)}", "function marginPushersAgain() {\n if (!Plots.didMarginChange(oldMargins, fullLayout._size)) return;\n return Lib.syncOrAsync([marginPushers, subroutines.layoutStyles], gd);\n }", "function tw_stretch() {\n var i = $(window).width();\n $(\".row .tw-stretch-element-inside-column\").each(function () {\n var $this = $(this),\n row = $this.closest(\".row\"),\n cols = $this.closest('[class^=\"col-\"]'),\n colsheight = $this.closest('[class^=\"col-\"]').height(),\n rect = this.getBoundingClientRect(),\n l = row[0].getBoundingClientRect(),\n s = cols[0].getBoundingClientRect(),\n r = rect.left,\n d = i - rect.right,\n c = l.left + (parseFloat(row.css(\"padding-left\")) || 0),\n u = i - l.right + (parseFloat(row.css(\"padding-right\")) || 0),\n p = s.left,\n f = i - s.right,\n styles = {\n \"margin-left\": 0,\n \"margin-right\": 0\n };\n if (Math.round(c) === Math.round(p)) {\n var h = parseFloat($this.css(\"margin-left\") || 0);\n styles[\"margin-left\"] = h - r;\n }\n if (Math.round(u) === Math.round(f)) {\n var w = parseFloat($this.css(\"margin-right\") || 0);\n styles[\"margin-right\"] = w - d;\n }\n $this.css(styles);\n });\n }", "function ajustarAPantalla(){\n let containerWidth = $itemsContainer.clientWidth-1;\n\n for (let n=0; n < divItemsArray.length; n++){\n if (divItemsArray[n].clientWidth === 0){\n LastItemVisible=n;\n break;\n }\n }\n\n const widthImg = 100;\n let spareWidth = containerWidth-LastItemVisible*widthImg;\n let marginInitial = spareWidth/(LastItemVisible*2);\n let marginAcumulado=marginInitial;\n //let movimiento= marginInitial*2 + widthImg;\n \n for (let n=0; n < LastItemVisible; n++){\n arrayPositionValues[n]=marginAcumulado;\n $divItems[n].style.left = marginAcumulado + 'px';\n marginAcumulado=marginAcumulado+marginInitial*2+widthImg;\n }\n \n}", "function leftAlign(){\n\tvar baseX = 999999;\n\tfor(var i=0; i<currentShapes.length; i++){\n\t\tif(baseX>currentShapes[i].getX()){\n\t\t\tbaseX = currentShapes[i].getX();\n\t\t}\n\t}\n\tfor(var k=0; k<currentShapes.length; k++){\n\t\tcurrentShapes[k].setX(baseX);\n\t}\n\tlayer.draw();\n\thatioGroupRevised();\n}", "function offsetSpaces (offset) {\n var res = '' , i;\n for (i = 0; i < offset; i += 1) { res += spacer; }\n return res;\n}", "function calcWrapperParts() {\n\tif ($('.page-description-block').width() == 256 && (windowObj.width() > 768))\n\t{\n\t\t$aboutCompanySH.css({ left: '512px' }).width(windowObj.width() - 512);\n\t\t$('.about-page-description-block').css({ left: '256px' });\n\t\t$('.can-fade').css({ left: '256px' });\t\t\n\t\tif( $('.can-fade').is(':visible')){\n\t\t\t$simplePageSlideshow.width(windowObj.width() - 512).css({ left: '512px' });\n\t\t}\n\t\t$('.contacts-map').width(windowObj.width() - 512);\n\t}\n\telse if( $pageDescriptionBlock.width() == 340 && ($(window).width() > 768)) \n\t{\n\t\t$aboutCompanySH.css({ left: '680px' }).width(windowObj.width() - 680);\n\t\t$('.about-page-description-block').css({ left: '340px' });\n\t\t$('.can-fade').css({ left: '340px' });\t\t\t\n\t\tif( $('.can-fade').is(':visible')){\n\t\t\t$simplePageSlideshow.width(windowObj.width() - 680).css({ left: '680px' });\n\t\t}\n\t\t$('.contacts-map').width(windowObj.width() - 679);\n\t}\t\n\telse if ($(window).width() > 768)\n\t{\n\t\t$aboutCompanySH.css({ left: '40%' }).width(windowObj.width() * 0.6);\n\t\t$('.about-page-description-block').css({ left: '20%' });\n\t\t$('.can-fade').css({ left: '20%' });\n\t\tif( $('.can-fade').is(':visible')){\n\t\t\t$simplePageSlideshow.width(windowObj.width() * 0.6).css({ left: '40%' });\n\t\t}\n\t\t$('.contacts-map').width(windowObj.width() * 0.6);\n\t};\n}", "function getContentMargin() {\n var margin = options.jq.contentWell.css('margin-left');\n contentMargin = (margin === options.params.closedNavMargin) ? contentMargin : margin;\n }", "relayoutEditorsCore() {\n this.debug(\"relayoutEditorsCore()\");\n const editors = VSCodeDom.getEditorSplitViews();\n const rightMostEditors = {};\n // Determine the right-most editors for each editor row. Rows are\n // determined by editors having a common `top` value.\n // The right most editor on a per row basis needs its width reduced\n // by 300px.\n for (let editor of editors) {\n const top = editor.style.top;\n const left = editor.style.left\n ? parseInt(editor.style.left, 10)\n : 0;\n const existing = rightMostEditors[top];\n if (existing && left < existing.left)\n continue;\n rightMostEditors[top] = {\n el: editor,\n left: left\n };\n }\n for (let key in rightMostEditors) {\n const rightMost = rightMostEditors[key];\n // Panels that do not explicity set a width use an inherited\n // width of 100%.\n if (!rightMost.el.style.width) {\n rightMost.el.style.width = `calc(100% - ${this.sideTabSize})`;\n }\n else {\n Dom.updateStyle(rightMost.el, \"width\", -this.sideTabSizePx);\n }\n // Some of the children elements also must be dynamically\n // resized.\n // .overlayWidgets is the container that holds the quick search.\n // .zone-widge belongs to the code peek view. Even though it's a\n // child of overlayWidgets it has its own width calculated.\n const children = rightMost.el.querySelectorAll(\".overlayWidgets, .zone-widget\");\n for (let i = 0; i < children.length; ++i) {\n const el = children[i];\n Dom.updateStyle(el, \"width\", -this.sideTabSizePx);\n }\n const scrollables = rightMost.el.querySelectorAll(\".editor-scrollable, .overflow-guard\");\n for (let i = 0; i < scrollables.length; ++i) {\n const el = scrollables[i];\n // If the element is inline, then its sizing is based\n // relative to its parent already. The `peek` preview\n // behaves this way.\n if (Dom.hasParent(el, \"inline\"))\n continue;\n Dom.updateStyle(el, \"width\", -this.sideTabSizePx);\n }\n const needParentChanges = document.querySelectorAll(\".welcomePageContainer\");\n for (let i = 0; i < needParentChanges.length; ++i) {\n Dom.updateStyle(needParentChanges[i].parentElement, \"width\", -this.sideTabSizePx);\n }\n }\n // If this is ever needed to work with variable side docking,\n // the placement of the dock can be determined by a class on the\n // id'd child.\n const sidebar = VSCodeDom.getSideBarSplitView();\n Dom.updateStyle(sidebar.activitybar, \"left\", -this.sideTabSizePx);\n Dom.updateStyle(sidebar.sidebar, \"left\", -this.sideTabSizePx);\n // The sashes for non-subcontainered elements must also be adjusted for.\n const sashContainer = Dom.getChild(this.newContainerDest, \"sash-container\");\n Dom.visitChildren(sashContainer, el => {\n if (Dom.hasClass(el, \"monaco-sash\")) {\n Dom.updateStyle(el, \"left\", -this.sideTabSizePx);\n }\n });\n }", "function marginPushers() {\n\t var calcdata = gd.calcdata;\n\t var i, cd, trace;\n\t\n\t Legend.draw(gd);\n\t RangeSelector.draw(gd);\n\t\n\t for(i = 0; i < calcdata.length; i++) {\n\t cd = calcdata[i];\n\t trace = cd[0].trace;\n\t if(trace.visible !== true || !trace._module.colorbar) {\n\t Plots.autoMargin(gd, 'cb' + trace.uid);\n\t }\n\t else trace._module.colorbar(gd, cd);\n\t }\n\t\n\t Plots.doAutoMargin(gd);\n\t return Plots.previousPromises(gd);\n\t }", "function rebuild() {\n\t\tcalcWidth();\n\t\tcheck();\n\t}", "clearOldTintsAndMargins(){\n\n let gridsContainer = document.querySelector('.container');\n let gridsConChildren = Array.from(gridsContainer.children);\n\n this.clearOldTints(gridsConChildren);\n\n this.clearOldMargins(gridsConChildren);\n\n //update state\n this.currentThreadId = this.props.commentThreadDoc._id;\n this.hasNewComment = false;\n }" ]
[ "0.6624648", "0.6136517", "0.5908344", "0.5870894", "0.5870894", "0.5870894", "0.5870894", "0.5870894", "0.5870894", "0.5870894", "0.5870894", "0.5870894", "0.5870894", "0.5870894", "0.5870894", "0.5870894", "0.5870894", "0.5870894", "0.5870894", "0.5870894", "0.58042896", "0.5791231", "0.5781181", "0.57520133", "0.5747001", "0.5747001", "0.5747001", "0.5747001", "0.5747001", "0.5747001", "0.5747001", "0.5747001", "0.5747001", "0.5747001", "0.5747001", "0.57434344", "0.572755", "0.57129914", "0.57084656", "0.56919986", "0.56919986", "0.5687746", "0.5617136", "0.5617136", "0.5617136", "0.5617136", "0.5617136", "0.5617136", "0.5617136", "0.5616746", "0.5616746", "0.5615963", "0.5599114", "0.55934757", "0.5571572", "0.55426997", "0.55356055", "0.5511409", "0.54712945", "0.5470523", "0.5470523", "0.54657096", "0.54515815", "0.5449119", "0.54170656", "0.5408883", "0.5378304", "0.53687674", "0.53665066", "0.53442615", "0.53120136", "0.5308941", "0.524081", "0.524034", "0.5236206", "0.52349484", "0.52328855", "0.5220326", "0.5215822", "0.52097225", "0.51984525", "0.51955783", "0.5177028", "0.5167321", "0.5167321", "0.5161623", "0.51584053", "0.51571053", "0.5153796", "0.5152744", "0.5134864", "0.5124593", "0.51213866", "0.5108396", "0.5093502", "0.5086737", "0.5085541", "0.50845516", "0.507617", "0.506904", "0.5065897" ]
0.0
-1
The display handles the DOM integration, both for input reading and content drawing. It holds references to DOM nodes and displayrelated state.
function Display(place, doc, input, options) { var d = this; this.input = input; // Covers bottom-right square when both scrollbars are present. d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler"); d.scrollbarFiller.setAttribute("cm-not-content", "true"); // Covers bottom of gutter when coverGutterNextToScrollbar is on // and h scrollbar is present. d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler"); d.gutterFiller.setAttribute("cm-not-content", "true"); // Will contain the actual code, positioned to cover the viewport. d.lineDiv = eltP("div", null, "CodeMirror-code"); // Elements are added to these to represent selection and cursors. d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1"); d.cursorDiv = elt("div", null, "CodeMirror-cursors"); // A visibility: hidden element used to find the size of things. d.measure = elt("div", null, "CodeMirror-measure"); // When lines outside of the viewport are measured, they are drawn in this. d.lineMeasure = elt("div", null, "CodeMirror-measure"); // Wraps everything that needs to exist inside the vertically-padded coordinate system d.lineSpace = eltP("div", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv], null, "position: relative; outline: none"); var lines = eltP("div", [d.lineSpace], "CodeMirror-lines"); // Moved around its parent to cover visible view. d.mover = elt("div", [lines], null, "position: relative"); // Set to the height of the document, allowing scrolling. d.sizer = elt("div", [d.mover], "CodeMirror-sizer"); d.sizerWidth = null; // Behavior of elts with overflow: auto and padding is // inconsistent across browsers. This is used to ensure the // scrollable area is big enough. d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerGap + "px; width: 1px;"); // Will contain the gutters, if any. d.gutters = elt("div", null, "CodeMirror-gutters"); d.lineGutter = null; // Actual scrollable element. d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll"); d.scroller.setAttribute("tabIndex", "-1"); // The element in which the editor lives. d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror"); // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported) if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; } if (!webkit && !(gecko && mobile)) { d.scroller.draggable = true; } if (place) { if (place.appendChild) { place.appendChild(d.wrapper); } else { place(d.wrapper); } } // Current rendered range (may be bigger than the view window). d.viewFrom = d.viewTo = doc.first; d.reportedViewFrom = d.reportedViewTo = doc.first; // Information about the rendered lines. d.view = []; d.renderedView = null; // Holds info about a single rendered line when it was rendered // for measurement, while not in view. d.externalMeasured = null; // Empty space (in pixels) above the view d.viewOffset = 0; d.lastWrapHeight = d.lastWrapWidth = 0; d.updateLineNumbers = null; d.nativeBarWidth = d.barHeight = d.barWidth = 0; d.scrollbarsClipped = false; // Used to only resize the line number gutter when necessary (when // the amount of lines crosses a boundary that makes its width change) d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null; // Set to true when a non-horizontal-scrolling line widget is // added. As an optimization, line widget aligning is skipped when // this is false. d.alignWidgets = false; d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null; // Tracks the maximum line length so that the horizontal scrollbar // can be kept static when scrolling. d.maxLine = null; d.maxLineLength = 0; d.maxLineChanged = false; // Used for measuring wheel scrolling granularity d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null; // True when shift is held down. d.shift = false; // Used to track whether anything happened since the context menu // was opened. d.selForContextMenu = null; d.activeTouch = null; d.gutterSpecs = getGutters(options.gutters, options.lineNumbers); renderGutters(d); input.init(d); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayDOM(){\r\n\t\tvar str = '';\r\n\t\tcontainer.getChildren().each(function(item){\r\n\t\t\tstr += '<div style=\"' + item.style.cssText + '\">' + item.get('text') + '</div>\\n';\r\n\t\t});\r\n\t\tdocument.id('output').set('text', str);\r\n\t}", "displayScene() {\n\n //Process all component nodes\n this.processNode(this.idRoot, null, null, 1, 1);\n }", "display(ele) {\n // make sure ele is a DOM element\n if (this.isDOM(ele)) {\n ele.style.display = 'block';\n } else {\n console.error('Error while trying to display a non DOM object');\n }\n }", "$render(displayRef) {\n if(this.$alive)\n this.render.apply(this, [this, displayRef]);\n }", "displayScene() {\n // entry point for graph rendering\n //TODO: Render loop starting at root of graph\n //console.log(this.nodes)\n this.components[this.idRoot].display();\n }", "display() {\n this._flushSomeDiv(this._threadHost)\n this._threadHost.appendChild(this._identifiedThread)\n this._scrollBottom()\n }", "createDOM() {\n // outer element hosts the node itself, css background colors,\n // border etc. will be applied here.\n this.domElement = document.createElement('div');\n this.domElement.node = this;\n this.domElement.classList.add('node');\n this.graph.domElement.appendChild(this.domElement);\n\n // content element has the title for the node and maybe some more UI\n // it is centered in the node in css.\n this.content = document.createElement('div');\n this.content.classList.add('node_content');\n this.domElement.appendChild(this.content);\n this.addDragAndDrop();\n }", "function Interpreter_CreateDisplayPanel()\n{\n\t//create a div\n\tvar theDisplayPanel = document.body.appendChild(document.createElement(\"DIV\"));\n\t//set its values\n\ttheDisplayPanel.style.cssText = \"position:absolute;width:100%;height:100%;overflow:auto;left:0px;top:0px;-moz-transform-origin:0 0;\" + (__DESIGNER_CONTROLLER ? \"\" : \"-webkit-transform: translate3d(0, 0, 0);\");\n\t//make it unselectable\n\tBrowser_SetSelectable(theDisplayPanel, false);\n\t//finally add the size change listener\n\tBrowser_AddEvent(window, __BROWSER_EVENT_RESIZE, Interpreter_OnResizeEvent);\n\tBrowser_AddEvent(theDisplayPanel, __BROWSER_EVENT_SCROLL, Interpreter_OnDisplayScroll);\n\t//return it\n\treturn theDisplayPanel;\n}", "_buildDisplayView() {\n this.element.innerHTML = this.value;\n }", "_buildDisplayView() {\n this.element.innerHTML = this.value;\n }", "function Interpreter_UpdateDisplay()\n{\n\t//helpers\n\tvar uidObject, theObject;\n\t//loop through all of our iframes\n\tfor (uidObject in this.LoadedIFrames)\n\t{\n\t\t//get the object\n\t\ttheObject = this.LoadedIFrames[uidObject];\n\t\t//valid?\n\t\tif (theObject && theObject.HTML)\n\t\t{\n\t\t\t//purge all css data\n\t\t\tBrowser_RemoveCSSData_Purge(theObject.HTML.contentDocument);\n\t\t}\n\t}\n\t//purge all css data from main doc too\n\tBrowser_RemoveCSSData_Purge(document);\n\t//loop through all toplevel objects\n\tfor (uidObject in this.TopLevelObjects)\n\t{\n\t\t//get the object\n\t\ttheObject = this.TopLevelObjects[uidObject];\n\t\t//valid?\n\t\tif (theObject)\n\t\t{\n\t\t\t//update it with full recursion\n\t\t\ttheObject.UpdateDisplay(true);\n\t\t}\n\t}\n\t//rearrange the forms\n\tForm_RearrangeForms(this.FocusedFormId);\n\t//and reset this\n\tthis.FocusedFormId = [];\n\t//have we got a focused object id? (AND NOT IN DESIGNER)\n\tif (this.State && this.State.FocusedObjectId > 0)\n\t{\n\t\t//memorise it\n\t\tthis.FocusedObjectId = this.State.FocusedObjectId;\n\t}\n\t//we need to handle the tabs here\n\tthis.PreUpdatePostDisplay();\n}", "display() {\n this.editorNode.style.visibility = \"visible\";\n this.focusInput();\n }", "function DOMRenderer() {}", "render_display() {\n this.element.fadeIn();\n this.visible = true;\n }", "function parseNodes()\r\n{\r\n\tvar browser = gBrowser.mCurrentBrowser;\t\r\n\tdisplayNodes(browser.contentDocument);\r\n\tcreateWindow();\r\n}", "display()\n {\n $(this.element).html(`\n <link rel=\"stylesheet\" href=\"views/tab-view/tab-view.css\">\n <link rel=\"stylesheet\" href=\"views/tab-content/tab-content.css\">\n <link rel=\"stylesheet\" href=\"views/list-tasks/list-tasks.css\">\n <link rel=\"stylesheet\" href=\"views/diagram-view/diagram-view.css\">\n\n <ul id=\"tabs\">\n </ul>\n <div id=\"tab-content\"></div>\n `);\n\n this.ulTabs = document.getElementById('tabs');\n this.divsContent = document.getElementById('tab-content');\n\n //adapt the height of the div to the full width\n $(window).resize(function()\n {\n $('#tab-content').height($('#tab-content').parent().height() - $('#tabs').height());\n });\n\n $(document).ready(function()\n {\n $(window).trigger('resize');\n });\n }", "renderIncDom() {\n\t\tif (this.component_.render) {\n\t\t\tthis.component_.render();\n\t\t} else {\n\t\t\tIncrementalDOM.elementVoid('div');\n\t\t}\n\t}", "get display() {\n return this._display.innerHTML;\n }", "render() {\n console.debug(`Rendering DOM of ${this.constructor.name}`);\n this.shadowRoot.innerHTML = this.html;\n if (this.script != null) {\n console.debug(`Running script of ${this.constructor.name}`);\n this.script();\n console.debug(`Finished running script of ${this.constructor.name}`);\n }\n console.debug(`Finished rendering DOM of ${this.constructor.name}`);\n }", "_render() {\n\n this._el.innerHTML = `\n <div class='itk-slider'>\n <button class='show-prev-btn'> left </button>\n <img class='slide-img' src=''>\n <button class='show-next-btn'> right </button>\n </div>`;\n\n this.showPrevBtn = this._el.querySelector('.show-prev-btn');\n this.showNextBtn = this._el.querySelector('.show-next-btn');\n this.slideImage = this._el.querySelector('.slide-img');\n }", "_render() {\n this._reactComponent = this._getReactComponent();\n if (!this._root) this._root = createRoot(this._container.getElement()[0]);\n this._root.render(this._reactComponent);\n }", "function displayContentUpdate() {\n display.textContent = displayContent.join('');\n}", "function update_display(){\n // canvas\n draw();\n // DOM displaying results\n display_questions_list();\n}", "_registerDisplayListeners () {\n this.display = caller('display', {postMessage: window.parent.postMessage.bind(window.parent)})\n this.hide = caller('hide', {postMessage: window.parent.postMessage.bind(window.parent)})\n }", "render(){\n //createDom (tag, type, name, value, domClass, id, parent)\n this.containerDom = this.htmlHelper.createDom('div', this.parentDom,this.domClass + '_conatiner')\n this.dom = this.htmlHelper.createDom('canvas', this.containerDom);\n this.dom.style.touchAction=\"none\"; // prevent default browser actions\n\n this.setContextData(this.defaultLineWidth, '#000000')\n }", "function display(node){\n if(node.visible){\n if (hasBorder() == true)\n p.stroke(getBorderColor());\n else\n p.noStroke();\n\n if(beingDragged != null && node == beingDragged){\n p.fill(getActiveColor());\n } else if(p.mouseX >= node.x-node.width/2 && p.mouseX <= node.x+node.width/2 \n && p.mouseY >= node.y-node.height/2 && p.mouseY <= node.y+node.height/2){\n if (currentClickedNode == node)\n p.fill(getSelectedColor());\n else\n p.fill(getHoverColor());\n\n document.getElementById('show_label').innerHTML = node.label;\n document.getElementById('show_url').innerHTML = node.url;\n document.getElementById('show_url').href = node.url;\n } else if (currentClickedNode == node){\n p.fill(getSelectedColor()); \n } else {\n p.fill(getNodeColor());\n } \n p.rect(node.x, node.y, node.width, node.height);\n\n //Handle node expander graphic\n if (node.children.length != 0) {\n p.noStroke();\n p.fill(getActiveColor());\n p.rect(node.x+node.width/2, node.y, 3, 3);\n } \n\n //Handle text \n p.fill(getFontColor());\n // calculate text size based on the current size of the node\n p.textSize(getTextSize(node));\n p.text(node.label, node.x - node.width/2 + 5, node.y + 5);\n //p.text(node.label, node.x-35, node.y+5);\n\n //Used for drag/drop\n var x_origin = node.x + node.width/2;\n var y_origin = node.y;\n\n //Recurse on children and draw connecting lines\n for(var i=0; i<node.children.length; i++){\n if(node.children[i].visible && node.children[i].x - node.children[i].width/2 > 0 && node.children[i].y > 0){\n display(node.children[i]);\n p.stroke(getLineColor());\n p.line(x_origin, y_origin, node.children[i].x - node.children[i].width/2, node.children[i].y);\n }\n }\n }\n}", "function Display_showGameElements() {\n\tvar displayContent = document.getElementById(\"displayContent\");\n\n\tvar inputToCrib = document.createElementNS(this.xhtmlns, \"input\");\n\tinputToCrib.setAttribute(\"id\", \"inputToCrib\");\n\tinputToCrib.setAttribute(\"type\", \"button\");\n\tinputToCrib.setAttribute(\"value\", \"To Crib\");\n\tinputToCrib.setAttribute(\"onclick\", \"toCrib();\");\n\n\tvar inputPlay = document.createElementNS(this.xhtmlns, \"input\");\n\tinputPlay.setAttribute(\"id\", \"inputPlay\");\n\tinputPlay.setAttribute(\"type\", \"button\");\n\tinputPlay.setAttribute(\"value\", \"Play card\");\n\n\tdisplayContent.appendChild(inputToCrib);\n\tdisplayContent.appendChild(inputPlay);\n\n\t// Show deck and stack\n\tthis.createCard(null, 490, 10, 120, false);\n\tthis.createCard(null, 620, 10, 120, false);\n\n\t// Display count\n\tvar spanCountHeader = document.createElementNS(this.xhtmlns, \"span\");\n\tspanCountHeader.setAttribute(\"id\", \"spanCountHeader\");\n\tspanCountHeader.appendChild(document.createTextNode(\"Curent Play Count:\"));\n\n\tvar spanCount = document.createElementNS(this.xhtmlns, \"span\");\n\tspanCount.setAttribute(\"id\", \"spanCount\");\n\tspanCount.appendChild(document.createTextNode(\"0\"));\n\n\tvar whosCrib = document.createElementNS(this.xhtmlns, \"img\");\n\twhosCrib.setAttribute(\"id\", \"whosCrib\");\n\twhosCrib.setAttribute(\"src\", \"img/crib.png\");\n\n\tdisplayContent.appendChild(whosCrib);\n\tdisplayContent.appendChild(spanCountHeader);\n\tdisplayContent.appendChild(spanCount);\n}", "render(innerHTML = \"\")\n {\n this.DOMContainer.innerHTML = innerHTML;\n if (this.handleDOMContainer) \n {\n this.DOMContainer.insertAdjacentElement(\"afterbegin\", this.handleDOMContainer);\n } \n }", "render() {\n const { rootNode, sizeSet } = this;\n let visualIndex = this.visualIndex;\n\n if (this.isSharedViewSet() && sizeSet.isPlaceOn(WORKING_SPACE_BOTTOM)) {\n visualIndex += sizeSet.sharedSize.nextSize;\n }\n\n let node = rootNode.childNodes[visualIndex];\n\n if (node.tagName !== this.childNodeType) {\n const newNode = this.nodesPool();\n\n rootNode.replaceChild(newNode, node);\n node = newNode;\n }\n\n this.collectedNodes.push(node);\n this.visualIndex += 1;\n }", "display() {\n\t\tsuper.display();\n\n\t\t/* Display the boxes on the right panel. */\n\t\tthis.scoreBox.display();\n\t\tthis.levelLinesBox.display();\n\t\tthis.nextPieceBox.display();\n\t\tthis.statBox.display();\n\n\t\t/* Display the falling piece. */\n\t\tif (this.piece != undefined) {\n\t\t\tthis.piece.display(this.grid.initialx, this.grid.initialy, this.grid.squareSize);\n\t\t}\n\n\t\t/* Display the grid. */\n\t\tthis.grid.display();\n\n\t\tif (this.state == STATE_SELECT_LEVEL) {\n\t\t\tthis.blurBackground();\n\t\t\tthis.levelSelectorBox.display();\n\t\t}\n\t\telse if (this.state == STATE_WAIT_ADVERSARY_SELECTION) {\n\t\t\tthis.blurBackground();\n\t\t\tthis.waitAdversarySelectionBox.display();\n\t\t}\n\t\telse if (this.state == STATE_GAME_OVER) {\n\t\t\tthis.blurBackground();\n\t\t\tthis.gameOverSelectorBox.display();\n\t\t}\n\t\telse if (this.state == STATE_SUBMIT) {\n\t\t\tthis.blurBackground();\n\t\t\tthis.submitBox.display();\n\t\t}\n\t}", "function renderDom() {\n stackList.innerHTML = \"\";\n myStack.stackControl.forEach(el => {\n stackList.innerHTML += `<li>${el}</li>`;\n })\n }", "function show() {\n const toShow = document.querySelector(\".show\");\n const showBlock = document.querySelector(\".currentDisplay\");\n showBlock.innerHTML = (toShow.innerHTML)\n}", "connectedCallback() {\n this.renderAndUpdateDom();\n }", "function initializeDisplay() {\n // set the data and properties of link lines\n link = svg.append(\"g\")\n .attr(\"class\", \"links\")\n .selectAll(\"line\")\n .data(graph.links)\n .enter().append(\"line\");\n\n // set the data and properties of node circles\n node = svg.append(\"g\")\n .attr(\"class\", \"nodes\")\n .selectAll(\"circle\")\n .data(graph.nodes)\n .enter()\n .append(\"circle\")\n .call(d3.drag()\n .on(\"start\", dragstarted)\n .on(\"drag\", dragged)\n .on(\"end\", dragended));\n\n node.append(\"title\")\n .text(function (d) {\n return d.id;\n });\n\n link.append(\"title\")\n .text(function (d) {\n return d.value;\n });\n \n // visualize the graph\n updateDisplay();\n}", "function displayContent(div){\n\tscrollContentPadding()\n\tprebuildSlideMenu()\n\teditPagerLink()\n\tShadowbox.clearCache()//Re-initialize Shadowbox to include any newly loaded images\n\tShadowbox.setup()\n\n\t\tvar imgLoaded = 0\n\t\tvar contentBox = $(activeContainer).find('.'+div)\n\t\tvar imgCount = $('img',contentBox).size()\t\t\n\t\t\n\t\t\n\t\t$('img',contentBox).each(function(index,element){\n\n\t\t\tif(element.complete){\n\n\t\t\t\timgLoaded ++\n\n\t\t\t} else {\n\n\t\t\t\t$(element).bind('load',function(){\n\t\t\t\t\timgLoaded ++\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t})\t\t\t\t\n\n\t\t\t}\n\t\n\t\t})\t\t\n\n\t\tvar scrollBuilder = setInterval(function(){\t\t\t\n\t\t\tif(imgLoaded == imgCount){\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t$(activePanel).mCustomScrollbar(\"vertical\",400,\"easeOutCirc\",1.05,\"fixed\",\"yes\",\"yes\",20)\t\n\t\t\t\t\n\t\t\t\t//readOut(\"Building slidemenu\" + smId)\n\t\t\t\t//readOut($(activeContainer).css('width'))\t\t\n\t\t\t\tclearInterval(scrollBuilder)\n\t\t\t}\n\t\t},250)\n\n\n\t\t\n\t$(activeContainer).fadeTo(1000,1)\t \n}", "displayScene() {\n if(this.nodeInfo)\n this.displayNode(this.nodeInfo[this.idRoot],this.defaultMaterialID,\"null\",{s:1,t:1},false);\n }", "function displayHTML()\n{\n document.getElementById( \"outputDiv\" ).innerHTML = outputHTML;\n} // end function displayDoc", "displayScene()\r\n {\r\n this.traverseGraph(this.components[this.idRoot], this.components[this.idRoot].materials, this.components[this.idRoot].texture);\r\n }", "function css_defaultDisplay(nodeName) {\n var doc = document,\n display = elemdisplay[nodeName];\n\n if (!display) {\n display = actualDisplay(nodeName, doc);\n\n // If the simple way fails, read from inside an iframe\n if (display === \"none\" || !display) {\n // Use the already-created iframe if possible\n iframe = (iframe || jQuery(\"<iframe frameborder='0' width='0' height='0'/>\")\n .css(\"cssText\", \"display:block !important\")).appendTo(doc.documentElement);\n\n // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse\n doc = (iframe[0].contentWindow || iframe[0].contentDocument).document;\n doc.write(\"<!doctype html><html><body>\");\n doc.close();\n\n display = actualDisplay(nodeName, doc);\n iframe.detach();\n }\n\n // Store the correct default display\n elemdisplay[nodeName] = display;\n }\n\n return display;\n }", "display () {\r\n this.timeout = null;\r\n if (this.pending) return;\r\n let content = this.input.textContent;\r\n if (content === this.oldContent) return;\r\n\r\n if (this.running) {\r\n this.pending = true;\r\n MathJax.Hub.Queue([\"display\", this]);\r\n } else {\r\n this.buffer.innerHTML = this.oldContent = (content.length > 0 ) ? '$' + content + '$' : '';\r\n this.running = true;\r\n MathJax.Hub.Queue([\"Typeset\", MathJax.Hub, this.buffer ], [\"finish\", this] );\r\n }\r\n }", "function display() {\n\n doSanityCheck();\n initButtons();\n}", "function TrackingDisplay($display) {\n\t\t//Store the canvas element for this display\n\t\tthis.$display = $display;\n\n\t\t//Retrieve and store the 2d drawing context for this canvas\n\t\tthis.drawContext = $display[0].getContext('2d');\n\n\t\t//Store the dimensions of the current display element.\n\t\tthis.width = $display.width();\n\t\tthis.height = $display.height();\n\n\t\t//Determine which axis is the constraining axis for this canvas so we can ensure our displays are squares.\n\t\tif (this.width < this.height) {\n\t\t\tthis.height = this.width;\n\t\t} else {\n\t\t\tthis.width = this.height;\n\t\t}\n\n\t\t//Apply the new dimensions\n\t\t$display.height(this.height).width(this.width).attr(\"width\", this.width).attr(\"height\", this.height);\n\n\t\t//Multidimensional array of values from the CELL_STATE variable representing the state of each cell.\n\t\tthis.gridState = [];\n\n\t\t//Multidimensional array of any values. Used just to contain data related to each cell. At the moment, this only used\n\t\t//to specify the type of ship in a \"SHIP\" cell.\n\t\tthis.gridData = [];\n\n\t\t//Declare the hasInit flag, for controlling when the initialization logic fires\n\t\tthis.hasInit = false;\n\t}", "function renderContent() {\n var content = document.getElementById('content_' + selected);\n // Initialize the pane.\n if (content.id == 'content_blocks') {\n // If the workspace was changed by the XML tab, Firefox will have performed\n // an incomplete rendering due to Blockly being invisible. Rerender.\n Blockly.mainWorkspace.render();\n } else if (content.id == 'content_xml') {\n var xmlTextarea = document.getElementById('textarea_xml');\n var xmlDom = Blockly.Xml.workspaceToDom(Blockly.mainWorkspace);\n var xmlText = Blockly.Xml.domToPrettyText(xmlDom);\n xmlTextarea.value = xmlText;\n xmlTextarea.focus();\n } else if (content.id == 'content_javascript') {\n content.innerHTML = Blockly.Generator.workspaceToCode('JavaScript');\n } else if (content.id == 'content_python') {\n content.innerHTML = Blockly.Generator.workspaceToCode('Python');\n }\n}", "createDisplay() {\n const { text, fontSize = 36, color = '#000000' } = this.conf;\n this.display = new ProxyObj();\n // this.setAnchor(0.5);\n this.display.text = text;\n this.display.updateStyle({ fontSize, fill: color });\n }", "function clearDisplay() {\n // Removing all children from an element\n var element = document.getElementById(\"rightSideBar\");\n document.getElementById(\"docDisplay\").innerHTML = \"\";\n while (element.firstChild) {\n element.removeChild(element.firstChild);\n }\n}", "display() {\n this.scene.pushMatrix();\n this.scene.multMatrix(this.transfMatrix); /*Add the new transformation matrix to this node \n and all its descendants*/\n\n /*if this node is keyframe animated and the animation has not started yet, node cannot be displayed*/\n if((this.animation != null && (this.animation.checkVisibility() == true)) || this.animation == null) {\n if(this.animation != null) {\n this.animation.apply(this.scene);\n }\n \n if(this.material != \"null\") { //Adicionar o material se não for \"null\"\n materialStack.push(this.material);\n }\n\n if(this.scene.materials[materialStack[materialStack.length - 1]] != null)\n this.scene.materials[materialStack[materialStack.length - 1]].apply();\n\n if(this.texture == \"clear\") {\n if(this.scene.textures[textureStack[textureStack.length - 1]] != null) \n this.scene.textures[textureStack[textureStack.length - 1]].unbind(); \n textureStack.push(0);\n } else if(this.texture == \"null\") {\n if(this.scene.textures[textureStack[textureStack.length - 1]] != null) {\n if(this.scene.textures[textureStack[textureStack.length - 1]] != 0)\n this.scene.textures[textureStack[textureStack.length - 1]].bind();\n }\n } else {\n if(this.scene.textures[this.texture] != 0 && this.scene.textures[this.texture] != null) {\n textureStack.push(this.texture);\n this.scene.textures[textureStack[textureStack.length - 1]].bind();\n }\n }\n\n //Display leaves if they exist\n for(var i = 0; i < this.leaves.length; i++) {\n if(this.leaves[i] != null)\n this.leaves[i].display();\n }\n\n //Recursively run this code for all the children nodes\n for(var j = 0; j < this.descendants.length; j++) {\n this.descendants[j].display();\n }\n\n if(this.texture != \"null\"){\n textureStack.pop();\n }\n\n if(this.material != \"null\")\n materialStack.pop();\n }\n\n this.scene.popMatrix();\n\n }", "async connectedCallback() {\n const ctor = this.constructor;\n this.setAttribute(`_ui5rt${(0, _Runtimes.getCurrentRuntimeIndex)()}`, \"\");\n this.setAttribute(\"_ui5host\", \"\");\n this.setAttribute(ctor.getMetadata().getPureTag(), \"\");\n if (ctor.getMetadata().supportsF6FastNavigation()) {\n this.setAttribute(\"data-sap-ui-fastnavgroup\", \"true\");\n }\n const slotsAreManaged = ctor.getMetadata().slotsAreManaged();\n this._inDOM = true;\n if (slotsAreManaged) {\n // always register the observer before yielding control to the main thread (await)\n this._startObservingDOMChildren();\n await this._processChildren();\n }\n if (!this._inDOM) {\n // Component removed from DOM while _processChildren was running\n return;\n }\n (0, _Render.renderImmediately)(this);\n this._domRefReadyPromise._deferredResolve();\n this._fullyConnected = true;\n this.onEnterDOM();\n }", "display() {\n this.object.display();\n }", "show ()\n\t{\n\t\t//if the view hasn't been initialised, call setup (of the concrete view e.g. LOView)\n\t\tif(!this.initialised)\n\t\t{\n\t\t\tthis.setup();\n\t\t}\n\t\telse\n\t\t{\n\t\t\t//unhide the elements of the scene\n\t\t\tthis.root.style.display = 'block';\n\t\t}\n\t}", "render() {\n\t\tif (!this.component_.element) {\n\t\t\tthis.component_.element = document.createElement('div');\n\t\t}\n\t\tthis.emit('rendered', !this.isRendered_);\n\t}", "function __zoot_c3d__process_DOM() {\n let containers = document.body.getElementsByTagName('zoot-c3d-root-container');\n for (let i = 0; i < containers.length; i++) {\n __zoot_c3d__process_Component(undefined, containers[i]);\n __zoot_c3d__g_root_containers.push(containers[i]);\n containers[i].zoot_c3d_sync();\n }\n}", "display() {\n this.scene.pushMatrix();\n this.scene.multMatrix(this.transformationMatrix);\n if ((typeof this.cgfTexture != 'undefined') && this.cgfMaterial != null)\n this.cgfMaterial.setTexture(this.cgfTexture);\n if (this.cgfMaterial != null)\n this.cgfMaterial.apply();\n\n if (typeof this.animations[this.atualAnimationId] != 'undefined')\n this.animations[this.atualAnimationId].display();\n\n for (let children of this.childrens) {\n if (children.cgfTextureId == \"inherit\") {\n children.cgfTexture = this.cgfTexture;\n children.length_sTexture = this.length_sTexture;\n children.length_tTexture = this.length_tTexture;\n }\n if (children.cgfMaterialId == \"inherit\") {\n children.cgfMaterial = this.cgfMaterial;\n }\n if (!(children instanceof Component)) {\n if (!(isNaN(this.length_sTexture) || isNaN(this.length_tTexture)))\n children.updateTexCoords(this.length_sTexture, this.length_tTexture);\n }\n children.display();\n }\n\n this.scene.popMatrix();\n }", "show() {\n for (let node of this.nodes) {\n node.show();\n node.showLinks();\n }\n }", "_renderScreen() {\n\t\tif (this._el && this._component) {\n\t\t\tthis._component.render(this._el);\n\t\t}\n\t}", "connectedCallback() {\n this.innerHTML = this.render();\n\n }", "function renderContent() {\n var content = document.getElementById('content_' + selected);\n // Initialize the pane.\n if (content.id == 'content_blocks') {\n // If the workspace was changed by the XML tab, Firefox will have performed\n // an incomplete rendering due to Blockly being invisible. Rerender.\n Blockly.mainWorkspace.render();\n } else if (content.id == 'content_xml') {\n var xmlTextarea = document.getElementById('textarea_xml');\n var xmlDom = Blockly.Xml.workspaceToDom(Blockly.mainWorkspace);\n var xmlText = Blockly.Xml.domToPrettyText(xmlDom);\n xmlTextarea.value = xmlText;\n xmlTextarea.focus();\n } else if (content.id == 'content_javascript') {\n content.innerHTML = Blockly.Generator.workspaceToCode('JavaScript');\n } else if (content.id == 'content_python') {\n content.innerHTML = Blockly.Generator.workspaceToCode('Python');\n } else if (content.id == 'content_whalesong') {\n content.innerHTML = Blockly.Generator.workspaceToCode('Whalesong');\n } else if (content.id == 'content_ray') {\n content.innerHTML = Blockly.Generator.workspaceToCode('Ray');\n }\n}", "displayScene() {\n var root = this.components[this.root];\n if (root == null)\n return \"[displayScene]: root node does not exist!\";\n\n // display scene graph starting at the root component\n root.display(root.materials[root.currentMaterialIndex][1], root.texture);\n }", "render() {\n this._addChooserHandler();\n this._addLoggerListeners();\n this._addButtonHandler();\n }", "function showElement () {\n if(this instanceof HTMLCollection || this instanceof NodeList) {\n for(var i = 0; i < this.length; i++) {\n this[i].style.display = null;\n }\n }\n else if(this instanceof HTMLElement) {\n this.style.display = null;\n }\n\n return this;\n }", "onEnterDOM() {}", "function displayContents() {\n\tif (contentsRequest.readyState === XMLHttpRequest.DONE) {\n\t\tif (contentsRequest.status === 200) {\n\t\t\tdocument.getElementById('tree').textContent = properties.showtree();\n\t\t\tdocument.getElementById('display').innerHTML = formatDirContents(contentsRequest.responseText);\n\t\t} else {\n\t\t\talert('There was a problem with the request.');\n\t\t}\n\t}\n}", "function updateDisplay () {\n const display = document.querySelector('.calculatorDisplay');\n // update value of screen element with content of `displayValue`\n display.value = calcDisplay.displayValue;\n}", "render() {\n this.fetch(() => {\n /**\n * Notice that the order here doesn't matter, if we want it to work like React,\n * we have to set up a virtual DOM and then have another object which it's purpose\n * will be to get the virtual DOM and then put that into the DOM (ReactDOM job is actually just that).\n * Virtual DOM is just any representation of the DOM elements, for that we can use JSX to\n * make our job easier and actually doing that is way easier than what you might think!\n */\n new Articles(this.articles).render();\n });\n }", "function actualDisplay( name, doc ) {\n\tvar elem = DM( doc.createElement( name ) ).appendTo( doc.body ),\n\t\tdisplay = DM.css( elem[0], \"display\" );\n\telem.remove();\n\treturn display;\n}", "show() {\n this.el.appendChild(this.canvas);\n this.update();\n }", "function changeTheDOM()\n{\n\tconsole.log('DOM change call');\n\tdocument.getElementById('passage').setAttribute('style','display: block');\n\tdocument.getElementById('playagain').setAttribute('style','display: block');\n\tdocument.getElementById('madlibs-entry').setAttribute('style','display: none');\n\n\tdocument.getElementById('classics').innerHTML = selectedPassageTitle;\n}", "attachToDOM_() {\n document.body.appendChild(this);\n }", "function defaultDisplay(nodeName){if(!elemdisplay[nodeName]){var body=document.body,elem=jQuery(\"<\"+nodeName+\">\").appendTo(body),display=elem.css(\"display\");elem.remove(); // If the simple way fails,\n\t// get element's real default display by attaching it to a temp iframe\n\tif(display===\"none\"||display===\"\"){ // No iframe to use yet, so create it\n\tif(!iframe){iframe=document.createElement(\"iframe\");iframe.frameBorder=iframe.width=iframe.height=0;}body.appendChild(iframe); // Create a cacheable copy of the iframe document on first call.\n\t// IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML\n\t// document to it; WebKit & Firefox won't allow reusing the iframe document.\n\tif(!iframeDoc||!iframe.createElement){iframeDoc=(iframe.contentWindow||iframe.contentDocument).document;iframeDoc.write((jQuery.support.boxModel?\"<!doctype html>\":\"\")+\"<html><body>\");iframeDoc.close();}elem=iframeDoc.createElement(nodeName);iframeDoc.body.appendChild(elem);display=jQuery.css(elem,\"display\");body.removeChild(iframe);} // Store the correct default display\n\telemdisplay[nodeName]=display;}return elemdisplay[nodeName];}", "function renderContent() {\n var content = document.getElementById('content_' + selected);\n // Initialize the pane.\n if (content.id == 'content_blocks') {\n // If the workspace was changed by the XML tab, Firefox will have performed\n // an incomplete rendering due to Blockly being invisible. Rerender.\n Blockly.mainWorkspace.render();\n //Check if the arduino code peek is showing\n if(document.getElementById('arduino_code_peek').style.display != 'none' ) {\n renderArduinoCode(null);\n }\n } else if (content.id == 'content_xml') {\n // Initialize the pane.\n var xmlTextarea = document.getElementById('textarea_xml');\n var xmlDom = Blockly.Xml.workspaceToDom(Blockly.mainWorkspace);\n var xmlText = Blockly.Xml.domToPrettyText(xmlDom);\n xmlTextarea.value = xmlText;\n xmlTextarea.focus();\n } else if (content.id == 'content_arduino') {\n var code = Blockly.Generator.workspaceToCode('Arduino');\n var arduinoTextarea = document.getElementById('textarea_arduino');\n arduinoTextarea.value = code\n arduinoTextarea.focus();\n }\n}", "function _display(){\n\t\t\t$(levelID).html(level);\n\t\t\t$(pointsID).html(points);\n\t\t\t$(linesID).html(lines);\n\t\t}", "setDisplayNodeParent(element) {\n this.display_node.remove();\n element.appendChild(this.display_node);\n }", "get display () {\n\t\treturn this._display;\n\t}", "get display () {\n\t\treturn this._display;\n\t}", "get display () {\n\t\treturn this._display;\n\t}", "function updateDisplay(){\n const display = document.querySelector('.calculator-screen');\n // update the value of screen from displayValue in calculator object\n display.value = calculator.displayValue;\n}", "render() {\n this.innerHTML = this.htmlElementsString;\n this.rootElement.appendChild(this);\n this.createScript();\n }", "function css_defaultDisplay( nodeName ) {\n var doc = document,\n display = elemdisplay[ nodeName ];\n\n if ( !display ) {\n display = actualDisplay( nodeName, doc );\n\n // If the simple way fails, read from inside an iframe\n if ( display === \"none\" || !display ) {\n // Use the already-created iframe if possible\n iframe = ( iframe ||\n jQuery(\"<iframe frameborder='0' width='0' height='0'/>\")\n .css( \"cssText\", \"display:block !important\" )\n ).appendTo( doc.documentElement );\n\n // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse\n doc = ( iframe[0].contentWindow || iframe[0].contentDocument ).document;\n doc.write(\"<!doctype html><html><body>\");\n doc.close();\n\n display = actualDisplay( nodeName, doc );\n iframe.detach();\n }\n\n // Store the correct default display\n elemdisplay[ nodeName ] = display;\n }\n\n return display;\n}", "function css_defaultDisplay( nodeName ) {\n var doc = document,\n display = elemdisplay[ nodeName ];\n\n if ( !display ) {\n display = actualDisplay( nodeName, doc );\n\n // If the simple way fails, read from inside an iframe\n if ( display === \"none\" || !display ) {\n // Use the already-created iframe if possible\n iframe = ( iframe ||\n jQuery(\"<iframe frameborder='0' width='0' height='0'/>\")\n .css( \"cssText\", \"display:block !important\" )\n ).appendTo( doc.documentElement );\n\n // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse\n doc = ( iframe[0].contentWindow || iframe[0].contentDocument ).document;\n doc.write(\"<!doctype html><html><body>\");\n doc.close();\n\n display = actualDisplay( nodeName, doc );\n iframe.detach();\n }\n\n // Store the correct default display\n elemdisplay[ nodeName ] = display;\n }\n\n return display;\n}", "createDisplay() {\n const { text, fontSize = 36 } = this.conf;\n this.display = Pool.get(this.type, () => new Label());\n this.display.attr({ text, fontSize });\n }", "_onUpdateDisplay() {}", "function render()\n {\n if (me.triggerEvent('renderBefore', data) === false)\n return;\n\n // remove all child nodes\n container.html('');\n\n // render child nodes\n for (var i=0; i < data.length; i++) {\n data[i].level = 0;\n render_node(data[i], container);\n }\n\n me.triggerEvent('renderAfter', container);\n }", "_initDisplay(value) {}", "_render(html){this.$.container.innerHTML=html}", "render() {\n this.notify('initial-load', {});\n /**\n * Used to load context menu\n */\n this.trigger('load');\n this.notify('initial-end', {});\n this.renderElements();\n this.renderComplete();\n }", "render() {\n this.notify('initial-load', {});\n /**\n * Used to load context menu\n */\n this.trigger('load');\n this.notify('initial-end', {});\n this.renderElements();\n this.renderComplete();\n }", "render() {\n this.notify('initial-load', {});\n /**\n * Used to load context menu\n */\n this.trigger('load');\n this.notify('initial-end', {});\n this.renderElements();\n this.renderComplete();\n }", "function displayContent(tag) {\n\t\n\tvar pagedisplay = document.getElementsByClassName(\"pagedisplay\")[0];\n\t\n\tswitch(tag) {\n\t\tcase \"projects\":\n\t\t\tvar projects = getProjects();\n\t\t\temptyDiv(\"pagedisplay\");\n\t\t\tpagedisplay.appendChild(projects);\n\t\t\tbreak;\n\t\tcase \"aboutus\":\n\t\t\tvar aboutus = getAboutUs();\n\t\t\temptyDiv(\"pagedisplay\");\n\t\t\tpagedisplay.appendChild(aboutus);\n\t\t\tbreak;\n\t\tcase \"becomemember\":\n\t\t\tvar becomemember = getBecomeMember();\n\t\t\temptyDiv(\"pagedisplay\");\n\t\t\tpagedisplay.appendChild(becomemember);\n\t\t\tbreak;\n\t\tcase \"members\":\n\t\t\tvar membersarea = getMembers();\n\t\t\temptyDiv(\"pagedisplay\");\n\t\t\tpagedisplay.appendChild(membersarea);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tbreak;\n\t}\n}", "function DisplayObject()\n{\n this.last = this;\n this.first = this;\n /**\n * The coordinate of the object relative to the local coordinates of the parent.\n *\n * @property position\n * @type Point\n */\n this.position = new Point();\n\n /**\n * The scale factor of the object.\n *\n * @property scale\n * @type Point\n */\n this.scale = new Point(1,1);//{x:1, y:1};\n\n /**\n * The pivot point of the displayObject that it rotates around\n *\n * @property pivot\n * @type Point\n */\n this.pivot = new Point(0,0);\n\n /**\n * The rotation of the object in radians.\n *\n * @property rotation\n * @type Number\n */\n this.rotation = 0;\n\n /**\n * The opacity of the object.\n *\n * @property alpha\n * @type Number\n */\n this.alpha = 1;\n\n /**\n * The visibility of the object.\n *\n * @property visible\n * @type Boolean\n */\n this.visible = true;\n\n /**\n * This is the defined area that will pick up mouse / touch events. It is null by default.\n * Setting it is a neat way of optimising the hitTest function that the interactionManager will use (as it will not need to hit test all the children)\n *\n * @property hitArea\n * @type Rectangle|Circle|Ellipse|Polygon\n */\n this.hitArea = null;\n\n /**\n * This is used to indicate if the displayObject should display a mouse hand cursor on rollover\n *\n * @property buttonMode\n * @type Boolean\n */\n this.buttonMode = false;\n\n /**\n * Can this object be rendered\n *\n * @property renderable\n * @type Boolean\n */\n this.renderable = false;\n\n /**\n * [read-only] The display object container that contains this display object.\n *\n * @property parent\n * @type DisplayObjectContainer\n * @readOnly\n */\n this.parent = null;\n\n /**\n * [read-only] The stage the display object is connected to, or undefined if it is not connected to the stage.\n *\n * @property stage\n * @type Stage\n * @readOnly\n */\n this.stage = null;\n\n /**\n * [read-only] The multiplied alpha of the displayobject\n *\n * @property worldAlpha\n * @type Number\n * @readOnly\n */\n this.worldAlpha = 1;\n\n /**\n * [read-only] Whether or not the object is interactive, do not toggle directly! use the `interactive` property\n *\n * @property _interactive\n * @type Boolean\n * @readOnly\n * @private\n */\n this._interactive = false;\n\n this.defaultCursor = 'pointer';\n\n /**\n * [read-only] Current transform of the object based on world (parent) factors\n *\n * @property worldTransform\n * @type Mat3\n * @readOnly\n * @private\n */\n this.worldTransform = mat3.create();//mat3.identity();\n\n /**\n * [read-only] Current transform of the object locally\n *\n * @property localTransform\n * @type Mat3\n * @readOnly\n * @private\n */\n this.localTransform = mat3.create();//mat3.identity();\n\n /**\n * [NYI] Unkown\n *\n * @property color\n * @type Array<>\n * @private\n */\n this.color = [];\n\n /**\n * [NYI] Holds whether or not this object is dynamic, for rendering optimization\n *\n * @property dynamic\n * @type Boolean\n * @private\n */\n this.dynamic = true;\n\n // chach that puppy!\n this._sr = 0;\n this._cr = 1;\n\n\n this.filterArea = new Rectangle(0,0,1,1);\n\n /*\n * MOUSE Callbacks\n */\n\n /**\n * A callback that is used when the users clicks on the displayObject with their mouse\n * @method click\n * @param interactionData {InteractionData}\n */\n\n /**\n * A callback that is used when the user clicks the mouse down over the sprite\n * @method mousedown\n * @param interactionData {InteractionData}\n */\n\n /**\n * A callback that is used when the user releases the mouse that was over the displayObject\n * for this callback to be fired the mouse must have been pressed down over the displayObject\n * @method mouseup\n * @param interactionData {InteractionData}\n */\n\n /**\n * A callback that is used when the user releases the mouse that was over the displayObject but is no longer over the displayObject\n * for this callback to be fired, The touch must have started over the displayObject\n * @method mouseupoutside\n * @param interactionData {InteractionData}\n */\n\n /**\n * A callback that is used when the users mouse rolls over the displayObject\n * @method mouseover\n * @param interactionData {InteractionData}\n */\n\n /**\n * A callback that is used when the users mouse leaves the displayObject\n * @method mouseout\n * @param interactionData {InteractionData}\n */\n\n\n /*\n * TOUCH Callbacks\n */\n\n /**\n * A callback that is used when the users taps on the sprite with their finger\n * basically a touch version of click\n * @method tap\n * @param interactionData {InteractionData}\n */\n\n /**\n * A callback that is used when the user touch's over the displayObject\n * @method touchstart\n * @param interactionData {InteractionData}\n */\n\n /**\n * A callback that is used when the user releases a touch over the displayObject\n * @method touchend\n * @param interactionData {InteractionData}\n */\n\n /**\n * A callback that is used when the user releases the touch that was over the displayObject\n * for this callback to be fired, The touch must have started over the sprite\n * @method touchendoutside\n * @param interactionData {InteractionData}\n */\n}", "function actualDisplay( name, doc ) {\r\n\tvar elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),\r\n\t\tdisplay = jQuery.css( elem[0], \"display\" );\r\n\telem.remove();\r\n\treturn display;\r\n}", "function displayCanvas() {\n\ttheCanvas.style.display = 'block';\n}", "contentDidUpdate() {\n const html = this.getPaneHtml();\n this.props.onPreviewUpdate(html);\n if (this.previewWindow) {\n this.previewWindow.document.write(html);\n }\n }", "function TreeViewItem_Show()\n{\n\t//need to update?\n\tif (this.Update)\n\t{\n\t\t//call update\n\t\tthis.UpdateLine();\n\t}\n\t//have we got html?\n\tif (this.HTML)\n\t{\n\t\t//show it\n\t\tthis.HTML.style.display = \"block\";\n\t\t//correct top\n\t\tthis.HTML.style.top = this.Top + \"px\";\n\t}\n}", "render() {\n this._userEvent('beforeRender');\n const html = this.template.render({data: this.viewData}, (data) => {\n return this.wrapTemplate(data);\n });\n if (!this.wrapper) {\n this.wrapper = this._createWrapper();\n }\n this.updateNode(this.wrapper, html);\n this.resize();\n this._userEvent('afterRender');\n }", "render() {\n super.render();\n this._outputView = new OutputArea({\n rendermime: renderMime,\n contentFactory: OutputArea.defaultContentFactory,\n model: this.model.outputs\n });\n this.pWidget.insertWidget(0, this._outputView);\n\n this.pWidget.addClass('jupyter-widgets');\n this.pWidget.addClass('widget-output');\n this.update(); // Set defaults.\n }", "function displayHTML() {\n \tvar preview_div = document.getElementById(\"preview_div\");\n \tpreview_div.style.display = \"none\";\n \tvar htmlcode_div = document.getElementById(\"htmlcode_div\");\n \thtmlcode_div.style.display = \"block\";\n }", "get domContent() {\n return this._domContent;\n }", "function RenderableDOMElement() {\n }", "function css_defaultDisplay( nodeName ) {\n\tvar doc = document,\n\t\tdisplay = elemdisplay[ nodeName ];\n\n\tif ( !display ) {\n\t\tdisplay = actualDisplay( nodeName, doc );\n\n\t\t// If the simple way fails, read from inside an iframe\n\t\tif ( display === \"none\" || !display ) {\n\t\t\t// Use the already-created iframe if possible\n\t\t\tiframe = ( iframe ||\n\t\t\t\tDM(\"<iframe frameborder='0' width='0' height='0'/>\")\n\t\t\t\t.css( \"cssText\", \"display:block !important\" )\n\t\t\t).appendTo( doc.documentElement );\n\n\t\t\t// Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse\n\t\t\tdoc = ( iframe[0].contentWindow || iframe[0].contentDocument ).document;\n\t\t\tdoc.write(\"<!doctype html><html><body>\");\n\t\t\tdoc.close();\n\n\t\t\tdisplay = actualDisplay( nodeName, doc );\n\t\t\tiframe.detach();\n\t\t}\n\n\t\t// Store the correct default display\n\t\telemdisplay[ nodeName ] = display;\n\t}\n\n\treturn display;\n}", "function updateDisplay(elem){\n \n activeContent = elem.innerHTML.replace(/<.+?>/g,\"\");\n if(activeContent == \"profiles\"){\n activeContent = \"SearchSpan\"\n toggle_visibility(\"SearchSpan\", \"SEARCHdiv\");\n } else if (activeContent == \"barplot\"){\n toggle_visibility(\"barplot\", \"VISUALIZEdiv\")\n } \n }", "function defaultDisplay(nodeName) {\n\n if (!elemdisplay[nodeName]) {\n\n var body = document.body,\n\t\t\telem = jQuery(\"<\" + nodeName + \">\").appendTo(body),\n\t\t\tdisplay = elem.css(\"display\");\n\n elem.remove();\n\n // If the simple way fails,\n // get element's real default display by attaching it to a temp iframe\n if (display === \"none\" || display === \"\") {\n // No iframe to use yet, so create it\n if (!iframe) {\n iframe = document.createElement(\"iframe\");\n iframe.frameBorder = iframe.width = iframe.height = 0;\n }\n\n body.appendChild(iframe);\n\n // Create a cacheable copy of the iframe document on first call.\n // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML\n // document to it; WebKit & Firefox won't allow reusing the iframe document.\n if (!iframeDoc || !iframe.createElement) {\n iframeDoc = (iframe.contentWindow || iframe.contentDocument).document;\n iframeDoc.write((document.compatMode === \"CSS1Compat\" ? \"<!doctype html>\" : \"\") + \"<html><body>\");\n iframeDoc.close();\n }\n\n elem = iframeDoc.createElement(nodeName);\n\n iframeDoc.body.appendChild(elem);\n\n display = jQuery.css(elem, \"display\");\n\n body.removeChild(iframe);\n }\n\n // Store the correct default display\n elemdisplay[nodeName] = display;\n }\n\n return elemdisplay[nodeName];\n }", "function render() {\n\tcontainer.innerHTML = htmlStr;\n}" ]
[ "0.71113545", "0.66074544", "0.6554401", "0.62461466", "0.62349385", "0.62249076", "0.6143888", "0.6131278", "0.6119149", "0.6119149", "0.61026573", "0.6072142", "0.60649383", "0.6028712", "0.6020695", "0.6014327", "0.60055435", "0.5979706", "0.58654046", "0.58615804", "0.5796999", "0.5771374", "0.57480675", "0.57476103", "0.5720757", "0.5714685", "0.56988", "0.56918293", "0.5676022", "0.5671711", "0.56644815", "0.5662718", "0.5660905", "0.56576407", "0.56420195", "0.5638442", "0.5636853", "0.5634022", "0.5623005", "0.562213", "0.56060904", "0.5603213", "0.5587118", "0.5577066", "0.5564908", "0.55393773", "0.5534586", "0.5529371", "0.5515305", "0.55132693", "0.5496609", "0.54934853", "0.54827005", "0.546748", "0.5455101", "0.54530823", "0.54498726", "0.5438931", "0.5431291", "0.5428792", "0.54277307", "0.54235774", "0.5419443", "0.541906", "0.5402838", "0.5399706", "0.5398186", "0.5395538", "0.53909016", "0.5388539", "0.5388071", "0.5382883", "0.5382883", "0.5382883", "0.5377509", "0.5373793", "0.53728104", "0.53728104", "0.53646415", "0.5364589", "0.5361708", "0.5360363", "0.53572327", "0.5349944", "0.5349944", "0.5349944", "0.5346328", "0.53304553", "0.5326101", "0.532277", "0.53203523", "0.5314479", "0.5309801", "0.5300622", "0.52999955", "0.5299865", "0.52990013", "0.5298821", "0.52979344", "0.52961546", "0.5294411" ]
0.0
-1
Take an unsorted, potentially overlapping set of ranges, and build a selection out of it. 'Consumes' ranges array (modifying it).
function normalizeSelection(cm, ranges, primIndex) { var mayTouch = cm && cm.options.selectionsMayTouch; var prim = ranges[primIndex]; ranges.sort(function (a, b) { return cmp(a.from(), b.from()); }); primIndex = indexOf(ranges, prim); for (var i = 1; i < ranges.length; i++) { var cur = ranges[i], prev = ranges[i - 1]; var diff = cmp(prev.to(), cur.from()); if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) { var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to()); var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head; if (i <= primIndex) { --primIndex; } ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to)); } } return new Selection(ranges, primIndex) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static _mergeRanges(ranges, newRange) {\n let inRange = false;\n for (let i = 0; i < ranges.length; i++) {\n const range = ranges[i];\n if (!inRange) {\n if (newRange[1] <= range[0]) {\n // Case 1: New range is before the search range\n ranges.splice(i, 0, newRange);\n return ranges;\n }\n if (newRange[1] <= range[1]) {\n // Case 2: New range is either wholly contained within the\n // search range or overlaps with the front of it\n range[0] = Math.min(newRange[0], range[0]);\n return ranges;\n }\n if (newRange[0] < range[1]) {\n // Case 3: New range either wholly contains the search range\n // or overlaps with the end of it\n range[0] = Math.min(newRange[0], range[0]);\n inRange = true;\n }\n // Case 4: New range starts after the search range\n continue;\n }\n else {\n if (newRange[1] <= range[0]) {\n // Case 5: New range extends from previous range but doesn't\n // reach the current one\n ranges[i - 1][1] = newRange[1];\n return ranges;\n }\n if (newRange[1] <= range[1]) {\n // Case 6: New range extends from prvious range into the\n // current range\n ranges[i - 1][1] = Math.max(newRange[1], range[1]);\n ranges.splice(i, 1);\n return ranges;\n }\n // Case 7: New range extends from previous range past the\n // end of the current range\n ranges.splice(i, 1);\n i--;\n }\n }\n if (inRange) {\n // Case 8: New range extends past the last existing range\n ranges[ranges.length - 1][1] = newRange[1];\n }\n else {\n // Case 9: New range starts after the last existing range\n ranges.push(newRange);\n }\n return ranges;\n }", "function Selection (ranges) {\n this.ranges = ranges || [];\n }", "function mergeRange(ranges, newRangeStart, newRangeEnd) {\n let inRange = false;\n for (let i = 0; i < ranges.length; i++) {\n const range = ranges[i];\n if (!inRange) {\n if (newRangeEnd <= range[0]) {\n // Case 1: New range is before the search range\n ranges.splice(i, 0, [newRangeStart, newRangeEnd]);\n return ranges;\n }\n else if (newRangeEnd <= range[1]) {\n // Case 2: New range is either wholly contained within the\n // search range or overlaps with the front of it\n range[0] = Math.min(newRangeStart, range[0]);\n return ranges;\n }\n else if (newRangeStart < range[1]) {\n // Case 3: New range either wholly contains the search range\n // or overlaps with the end of it\n range[0] = Math.min(newRangeStart, range[0]);\n inRange = true;\n }\n else {\n // Case 4: New range starts after the search range\n continue;\n }\n }\n else {\n if (newRangeEnd <= range[0]) {\n // Case 5: New range extends from previous range but doesn't\n // reach the current one\n ranges[i - 1][1] = newRangeEnd;\n return ranges;\n }\n else if (newRangeEnd <= range[1]) {\n // Case 6: New range extends from prvious range into the\n // current range\n ranges[i - 1][1] = Math.max(newRangeEnd, range[1]);\n ranges.splice(i, 1);\n inRange = false;\n return ranges;\n }\n else {\n // Case 7: New range extends from previous range past the\n // end of the current range\n ranges.splice(i, 1);\n i--;\n }\n }\n }\n if (inRange) {\n // Case 8: New range extends past the last existing range\n ranges[ranges.length - 1][1] = newRangeEnd;\n }\n else {\n // Case 9: New range starts after the last existing range\n ranges.push([newRangeStart, newRangeEnd]);\n }\n return ranges;\n}", "static of(ranges, sort = false) {\n let build = new RangeSetBuilder();\n for (let range of ranges instanceof Range ? [ranges] : sort ? lazySort(ranges) : ranges)\n build.add(range.from, range.to, range.value);\n return build.finish();\n }", "function normalizeSelection(ranges, primIndex) {\r\n var prim = ranges[primIndex];\r\n ranges.sort(function(a, b) { return cmp(a.from(), b.from()); });\r\n primIndex = indexOf(ranges, prim);\r\n for (var i = 1; i < ranges.length; i++) {\r\n var cur = ranges[i], prev = ranges[i - 1];\r\n if (cmp(prev.to(), cur.from()) >= 0) {\r\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\r\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\r\n if (i <= primIndex) --primIndex;\r\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\r\n }\r\n }\r\n return new Selection(ranges, primIndex);\r\n }", "function normalizeSelection(ranges, primIndex) {\n\t\t var prim = ranges[primIndex];\n\t\t ranges.sort(function(a, b) { return cmp(a.from(), b.from()); });\n\t\t primIndex = indexOf(ranges, prim);\n\t\t for (var i = 1; i < ranges.length; i++) {\n\t\t var cur = ranges[i], prev = ranges[i - 1];\n\t\t if (cmp(prev.to(), cur.from()) >= 0) {\n\t\t var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n\t\t var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n\t\t if (i <= primIndex) --primIndex;\n\t\t ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n\t\t }\n\t\t }\n\t\t return new Selection(ranges, primIndex);\n\t\t }", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function(a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) --primIndex;\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex);\n }", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function(a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) --primIndex;\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex);\n }", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function(a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) --primIndex;\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex);\n }", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function(a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) --primIndex;\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex);\n }", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function(a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) --primIndex;\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex);\n }", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function(a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) --primIndex;\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex);\n }", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function(a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) --primIndex;\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex);\n }", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function(a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) --primIndex;\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex);\n }", "function normalizeSelection(ranges, primIndex) {\r\n var prim = ranges[primIndex];\r\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\r\n primIndex = indexOf(ranges, prim);\r\n for (var i = 1; i < ranges.length; i++) {\r\n var cur = ranges[i], prev = ranges[i - 1];\r\n if (cmp(prev.to(), cur.from()) >= 0) {\r\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\r\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\r\n if (i <= primIndex) { --primIndex; }\r\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\r\n }\r\n }\r\n return new Selection(ranges, primIndex)\r\n}", "function addArray(ranges) {\n var origRanges = ranges;\n var newRanges = [];\n var overlap = false;\n for (var i = 0; i < origRanges.length; i += 1) {\n for (var j = i + 1; j < origRanges.length; j++) {\n if (origRanges[i].overlaps(origRanges[j], {adjacent:true})) {\n overlap = true;\n newRanges.push(addTwo(origRanges[i], origRanges[j]));\n origRanges.splice(j, 1);\n origRanges.splice(i, 1);\n if (i!=0) { i--; j-=2;}\n else {j--;}\n }\n }\n }\n if (overlap) {\n return addArray(newRanges.concat(origRanges));\n } else {\n return origRanges;\n }\n}", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n}", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n}", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n}", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n}", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n}", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n}", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n}", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n}", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n}", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n}", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n}", "function normalizeSelection(ranges, primIndex) {\n\t var prim = ranges[primIndex];\n\t ranges.sort(function(a, b) { return cmp(a.from(), b.from()); });\n\t primIndex = indexOf(ranges, prim);\n\t for (var i = 1; i < ranges.length; i++) {\n\t var cur = ranges[i], prev = ranges[i - 1];\n\t if (cmp(prev.to(), cur.from()) >= 0) {\n\t var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n\t var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n\t if (i <= primIndex) --primIndex;\n\t ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n\t }\n\t }\n\t return new Selection(ranges, primIndex);\n\t }", "function normalizeSelection(ranges, primIndex) {\n\t var prim = ranges[primIndex];\n\t ranges.sort(function(a, b) { return cmp(a.from(), b.from()); });\n\t primIndex = indexOf(ranges, prim);\n\t for (var i = 1; i < ranges.length; i++) {\n\t var cur = ranges[i], prev = ranges[i - 1];\n\t if (cmp(prev.to(), cur.from()) >= 0) {\n\t var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n\t var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n\t if (i <= primIndex) --primIndex;\n\t ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n\t }\n\t }\n\t return new Selection(ranges, primIndex);\n\t }", "function normalizeSelection(ranges, primIndex) {\n\t var prim = ranges[primIndex];\n\t ranges.sort(function(a, b) { return cmp(a.from(), b.from()); });\n\t primIndex = indexOf(ranges, prim);\n\t for (var i = 1; i < ranges.length; i++) {\n\t var cur = ranges[i], prev = ranges[i - 1];\n\t if (cmp(prev.to(), cur.from()) >= 0) {\n\t var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n\t var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n\t if (i <= primIndex) --primIndex;\n\t ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n\t }\n\t }\n\t return new Selection(ranges, primIndex);\n\t }", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex]\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); })\n primIndex = indexOf(ranges, prim)\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1]\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to())\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head\n if (i <= primIndex) { --primIndex }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to))\n }\n }\n return new Selection(ranges, primIndex)\n}", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex]\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); })\n primIndex = indexOf(ranges, prim)\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1]\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to())\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head\n if (i <= primIndex) { --primIndex }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to))\n }\n }\n return new Selection(ranges, primIndex)\n}", "function combineRanges(ranges){var ordered=ranges.map(mapWithIndex).sort(sortByRangeStart);for(var j=0,i=1;i<ordered.length;i++){var range=ordered[i];var current=ordered[j];if(range.start>current.end+1){// next range\nordered[++j]=range;}else if(range.end>current.end){// extend range\ncurrent.end=range.end;current.index=Math.min(current.index,range.index);}}// trim ordered array\nordered.length=j+1;// generate combined range\nvar combined=ordered.sort(sortByRangeIndex).map(mapWithoutIndex);// copy ranges type\ncombined.type=ranges.type;return combined;}", "function ranges(array){\n const ranges = [];\n let rangeIndex = 0;\n ranges.push(new Range(array[0]));\n for(let i = 1; i < array.length; i++){\n const current = array[i];\n const currentRange = ranges[rangeIndex];\n const wasPushed = currentRange.tryPush(current);\n if(!wasPushed){\n rangeIndex++;\n ranges.push(new Range(current));\n }\n }\n return ranges;\n}", "function normalizeRanges(ranges) {\n var sortedRanges = ranges.slice(0);\n sortedRanges.sort(compareRanges);\n var newRanges = [];\n\n // Check for overlaps and merge where they exist\n for (var i = 1, len = ranges.length, range, mergedRange = ranges[0]; i < len; ++i) {\n range = ranges[i];\n if (range.intersectsOrTouchesRange(mergedRange)) {\n mergedRange = mergedRange.union(range);\n } else {\n newRanges.push(mergedRange);\n mergedRange = range;\n }\n\n }\n newRanges.push(mergedRange);\n return newRanges;\n }", "static create(ranges, mainIndex = 0) {\n if (ranges.length == 0)\n throw new RangeError(\"A selection needs at least one range\");\n for (let pos = 0, i = 0; i < ranges.length; i++) {\n let range = ranges[i];\n if (range.empty ? range.from <= pos : range.from < pos)\n return EditorSelection.normalized(ranges.slice(), mainIndex);\n pos = range.to;\n }\n return new EditorSelection(ranges, mainIndex);\n }", "function rangeset(array, callback, halfopen = false) {\n if (!callback) {\n callback = (start, end) =>\n start === end ? `${start}` : `${start}-${end}`;\n }\n const sequence = array.sort().map((v) => Number.parseInt(v));\n const ranges = [];\n for (let i = 0; i < sequence.length; i += 1) {\n const rstart = sequence[i];\n let rend = rstart;\n while (sequence[i + 1] - sequence[i] === 1) {\n rend = sequence[i + 1]; // sequential...\n i += 1;\n }\n ranges.push(callback(rstart, halfopen ? rend + 1 : rend));\n }\n\n return ranges;\n}", "function normalizeSelection(cm, ranges, primIndex) {\n var mayTouch = cm && cm.options.selectionsMayTouch;\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) {\n return cmp(a.from(), b.from());\n });\n primIndex = indexOf(ranges, prim);\n\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i],\n prev = ranges[i - 1];\n var diff = cmp(prev.to(), cur.from());\n\n if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {\n var from = minPos(prev.from(), cur.from()),\n to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n\n if (i <= primIndex) {\n --primIndex;\n }\n\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n\n return new Selection(ranges, primIndex);\n }", "intersect(range) {\n if (this.set.length === 0) { return []; }\n\n let intersects = [];\n this.set.forEach( (setRange) => {\n let intersect = [];\n const list = this._setToArray([setRange]);\n for (let i = range.range[0]; i < range.range[1]; i++) {\n if (list[i]) {\n intersect[i] = range.value || true;\n }\n }\n const set = this._arrayToSet(intersect)[0];\n if (set) { intersects.push(set); }\n });\n\n return intersects;\n }", "function combineRanges(ranges) {\n var ordered = ranges.map(mapWithIndex).sort(sortByRangeStart);\n\n for (var j = 0, i = 1; i < ordered.length; i++) {\n var range = ordered[i];\n var current = ordered[j];\n\n if (range.start > current.end + 1) {\n // next range\n ordered[++j] = range;\n } else if (range.end > current.end) {\n // extend range\n current.end = range.end;\n current.index = Math.min(current.index, range.index);\n }\n } // trim ordered array\n\n\n ordered.length = j + 1; // generate combined range\n\n var combined = ordered.sort(sortByRangeIndex).map(mapWithoutIndex); // copy ranges type\n\n combined.type = ranges.type;\n return combined;\n}", "getSelectedRowsByRanges(ranges) {\r\n if (!this.slickGrid) return [];\r\n\r\n return _.map(_.range(ranges.fromRow, ranges.toRow + 1), v => {\r\n return this.slickGrid.getDataItem(v);\r\n });\r\n }", "function $qQQH$var$combineRanges(ranges) {\n var ordered = ranges.map($qQQH$var$mapWithIndex).sort($qQQH$var$sortByRangeStart);\n\n for (var j = 0, i = 1; i < ordered.length; i++) {\n var range = ordered[i];\n var current = ordered[j];\n\n if (range.start > current.end + 1) {\n // next range\n ordered[++j] = range;\n } else if (range.end > current.end) {\n current.end = range.end;\n current.index = Math.min(current.index, range.index);\n }\n } // trim ordered array\n\n\n ordered.length = j + 1; // generate combined range\n\n var combined = ordered.sort($qQQH$var$sortByRangeIndex).map($qQQH$var$mapWithoutIndex); // copy ranges type\n\n combined.type = ranges.type;\n return combined;\n}", "function combineRanges (ranges) {\n var ordered = ranges.map(mapWithIndex).sort(sortByRangeStart)\n\n for (var j = 0, i = 1; i < ordered.length; i++) {\n var range = ordered[i]\n var current = ordered[j]\n\n if (range.start > current.end + 1) {\n // next range\n ordered[++j] = range\n } else if (range.end > current.end) {\n // extend range\n current.end = range.end\n current.index = Math.min(current.index, range.index)\n }\n }\n\n // trim ordered array\n ordered.length = j + 1\n\n // generate combined range\n var combined = ordered.sort(sortByRangeIndex).map(mapWithoutIndex)\n\n // copy ranges type\n combined.type = ranges.type\n\n return combined\n}", "function combineRanges (ranges) {\n var ordered = ranges.map(mapWithIndex).sort(sortByRangeStart)\n\n for (var j = 0, i = 1; i < ordered.length; i++) {\n var range = ordered[i]\n var current = ordered[j]\n\n if (range.start > current.end + 1) {\n // next range\n ordered[++j] = range\n } else if (range.end > current.end) {\n // extend range\n current.end = range.end\n current.index = Math.min(current.index, range.index)\n }\n }\n\n // trim ordered array\n ordered.length = j + 1\n\n // generate combined range\n var combined = ordered.sort(sortByRangeIndex).map(mapWithoutIndex)\n\n // copy ranges type\n combined.type = ranges.type\n\n return combined\n}", "function combineRanges (ranges) {\n var ordered = ranges.map(mapWithIndex).sort(sortByRangeStart)\n\n for (var j = 0, i = 1; i < ordered.length; i++) {\n var range = ordered[i]\n var current = ordered[j]\n\n if (range.start > current.end + 1) {\n // next range\n ordered[++j] = range\n } else if (range.end > current.end) {\n // extend range\n current.end = range.end\n current.index = Math.min(current.index, range.index)\n }\n }\n\n // trim ordered array\n ordered.length = j + 1\n\n // generate combined range\n var combined = ordered.sort(sortByRangeIndex).map(mapWithoutIndex)\n\n // copy ranges type\n combined.type = ranges.type\n\n return combined\n}", "function combineRanges (ranges) {\n var ordered = ranges.map(mapWithIndex).sort(sortByRangeStart)\n\n for (var j = 0, i = 1; i < ordered.length; i++) {\n var range = ordered[i]\n var current = ordered[j]\n\n if (range.start > current.end + 1) {\n // next range\n ordered[++j] = range\n } else if (range.end > current.end) {\n // extend range\n current.end = range.end\n current.index = Math.min(current.index, range.index)\n }\n }\n\n // trim ordered array\n ordered.length = j + 1\n\n // generate combined range\n var combined = ordered.sort(sortByRangeIndex).map(mapWithoutIndex)\n\n // copy ranges type\n combined.type = ranges.type\n\n return combined\n}", "function combineRanges (ranges) {\n var ordered = ranges.map(mapWithIndex).sort(sortByRangeStart)\n\n for (var j = 0, i = 1; i < ordered.length; i++) {\n var range = ordered[i]\n var current = ordered[j]\n\n if (range.start > current.end + 1) {\n // next range\n ordered[++j] = range\n } else if (range.end > current.end) {\n // extend range\n current.end = range.end\n current.index = Math.min(current.index, range.index)\n }\n }\n\n // trim ordered array\n ordered.length = j + 1\n\n // generate combined range\n var combined = ordered.sort(sortByRangeIndex).map(mapWithoutIndex)\n\n // copy ranges type\n combined.type = ranges.type\n\n return combined\n}", "function combineRanges (ranges) {\n var ordered = ranges.map(mapWithIndex).sort(sortByRangeStart)\n\n for (var j = 0, i = 1; i < ordered.length; i++) {\n var range = ordered[i]\n var current = ordered[j]\n\n if (range.start > current.end + 1) {\n // next range\n ordered[++j] = range\n } else if (range.end > current.end) {\n // extend range\n current.end = range.end\n current.index = Math.min(current.index, range.index)\n }\n }\n\n // trim ordered array\n ordered.length = j + 1\n\n // generate combined range\n var combined = ordered.sort(sortByRangeIndex).map(mapWithoutIndex)\n\n // copy ranges type\n combined.type = ranges.type\n\n return combined\n}", "function combineRanges (ranges) {\n var ordered = ranges.map(mapWithIndex).sort(sortByRangeStart)\n\n for (var j = 0, i = 1; i < ordered.length; i++) {\n var range = ordered[i]\n var current = ordered[j]\n\n if (range.start > current.end + 1) {\n // next range\n ordered[++j] = range\n } else if (range.end > current.end) {\n // extend range\n current.end = range.end\n current.index = Math.min(current.index, range.index)\n }\n }\n\n // trim ordered array\n ordered.length = j + 1\n\n // generate combined range\n var combined = ordered.sort(sortByRangeIndex).map(mapWithoutIndex)\n\n // copy ranges type\n combined.type = ranges.type\n\n return combined\n}", "function combineRanges (ranges) {\n var ordered = ranges.map(mapWithIndex).sort(sortByRangeStart)\n\n for (var j = 0, i = 1; i < ordered.length; i++) {\n var range = ordered[i]\n var current = ordered[j]\n\n if (range.start > current.end + 1) {\n // next range\n ordered[++j] = range\n } else if (range.end > current.end) {\n // extend range\n current.end = range.end\n current.index = Math.min(current.index, range.index)\n }\n }\n\n // trim ordered array\n ordered.length = j + 1\n\n // generate combined range\n var combined = ordered.sort(sortByRangeIndex).map(mapWithoutIndex)\n\n // copy ranges type\n combined.type = ranges.type\n\n return combined\n}", "function combineRanges (ranges) {\n var ordered = ranges.map(mapWithIndex).sort(sortByRangeStart)\n\n for (var j = 0, i = 1; i < ordered.length; i++) {\n var range = ordered[i]\n var current = ordered[j]\n\n if (range.start > current.end + 1) {\n // next range\n ordered[++j] = range\n } else if (range.end > current.end) {\n // extend range\n current.end = range.end\n current.index = Math.min(current.index, range.index)\n }\n }\n\n // trim ordered array\n ordered.length = j + 1\n\n // generate combined range\n var combined = ordered.sort(sortByRangeIndex).map(mapWithoutIndex)\n\n // copy ranges type\n combined.type = ranges.type\n\n return combined\n}", "function combineRanges (ranges) {\n var ordered = ranges.map(mapWithIndex).sort(sortByRangeStart)\n\n for (var j = 0, i = 1; i < ordered.length; i++) {\n var range = ordered[i]\n var current = ordered[j]\n\n if (range.start > current.end + 1) {\n // next range\n ordered[++j] = range\n } else if (range.end > current.end) {\n // extend range\n current.end = range.end\n current.index = Math.min(current.index, range.index)\n }\n }\n\n // trim ordered array\n ordered.length = j + 1\n\n // generate combined range\n var combined = ordered.sort(sortByRangeIndex).map(mapWithoutIndex)\n\n // copy ranges type\n combined.type = ranges.type\n\n return combined\n}", "function combineRanges (ranges) {\n var ordered = ranges.map(mapWithIndex).sort(sortByRangeStart)\n\n for (var j = 0, i = 1; i < ordered.length; i++) {\n var range = ordered[i]\n var current = ordered[j]\n\n if (range.start > current.end + 1) {\n // next range\n ordered[++j] = range\n } else if (range.end > current.end) {\n // extend range\n current.end = range.end\n current.index = Math.min(current.index, range.index)\n }\n }\n\n // trim ordered array\n ordered.length = j + 1\n\n // generate combined range\n var combined = ordered.sort(sortByRangeIndex).map(mapWithoutIndex)\n\n // copy ranges type\n combined.type = ranges.type\n\n return combined\n}", "function combineRanges (ranges) {\n var ordered = ranges.map(mapWithIndex).sort(sortByRangeStart)\n\n for (var j = 0, i = 1; i < ordered.length; i++) {\n var range = ordered[i]\n var current = ordered[j]\n\n if (range.start > current.end + 1) {\n // next range\n ordered[++j] = range\n } else if (range.end > current.end) {\n // extend range\n current.end = range.end\n current.index = Math.min(current.index, range.index)\n }\n }\n\n // trim ordered array\n ordered.length = j + 1\n\n // generate combined range\n var combined = ordered.sort(sortByRangeIndex).map(mapWithoutIndex)\n\n // copy ranges type\n combined.type = ranges.type\n\n return combined\n}", "function combineRanges (ranges) {\n var ordered = ranges.map(mapWithIndex).sort(sortByRangeStart)\n\n for (var j = 0, i = 1; i < ordered.length; i++) {\n var range = ordered[i]\n var current = ordered[j]\n\n if (range.start > current.end + 1) {\n // next range\n ordered[++j] = range\n } else if (range.end > current.end) {\n // extend range\n current.end = range.end\n current.index = Math.min(current.index, range.index)\n }\n }\n\n // trim ordered array\n ordered.length = j + 1\n\n // generate combined range\n var combined = ordered.sort(sortByRangeIndex).map(mapWithoutIndex)\n\n // copy ranges type\n combined.type = ranges.type\n\n return combined\n}", "function combineRanges (ranges) {\n var ordered = ranges.map(mapWithIndex).sort(sortByRangeStart)\n\n for (var j = 0, i = 1; i < ordered.length; i++) {\n var range = ordered[i]\n var current = ordered[j]\n\n if (range.start > current.end + 1) {\n // next range\n ordered[++j] = range\n } else if (range.end > current.end) {\n // extend range\n current.end = range.end\n current.index = Math.min(current.index, range.index)\n }\n }\n\n // trim ordered array\n ordered.length = j + 1\n\n // generate combined range\n var combined = ordered.sort(sortByRangeIndex).map(mapWithoutIndex)\n\n // copy ranges type\n combined.type = ranges.type\n\n return combined\n}", "function combineRanges (ranges) {\n var ordered = ranges.map(mapWithIndex).sort(sortByRangeStart)\n\n for (var j = 0, i = 1; i < ordered.length; i++) {\n var range = ordered[i]\n var current = ordered[j]\n\n if (range.start > current.end + 1) {\n // next range\n ordered[++j] = range\n } else if (range.end > current.end) {\n // extend range\n current.end = range.end\n current.index = Math.min(current.index, range.index)\n }\n }\n\n // trim ordered array\n ordered.length = j + 1\n\n // generate combined range\n var combined = ordered.sort(sortByRangeIndex).map(mapWithoutIndex)\n\n // copy ranges type\n combined.type = ranges.type\n\n return combined\n}", "function removeRange(ranges, range) {\n const newRange = ranges.filter(r => !_.isEqual(r, range));\n if (newRange.length === 0) {\n return [{\n from: null,\n to: null,\n }];\n }\n return newRange;\n }", "function normalizeSelection(cm, ranges, primIndex) {\n\t\t var mayTouch = cm && cm.options.selectionsMayTouch;\n\t\t var prim = ranges[primIndex];\n\t\t ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n\t\t primIndex = indexOf(ranges, prim);\n\t\t for (var i = 1; i < ranges.length; i++) {\n\t\t var cur = ranges[i], prev = ranges[i - 1];\n\t\t var diff = cmp(prev.to(), cur.from());\n\t\t if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {\n\t\t var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n\t\t var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n\t\t if (i <= primIndex) { --primIndex; }\n\t\t ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n\t\t }\n\t\t }\n\t\t return new Selection(ranges, primIndex)\n\t\t }", "function unionRanges(range1, range2) {\n let i = 0;\n let j = 0;\n const union = [];\n while (i < range1.length && j < range2.length) {\n if (segmentsOverlap(range1[i], range2[j])) {\n let overlap = unionSegments(range1[i], range2[j]);\n i += 1;\n j += 1;\n while (i < range1.length && segmentsOverlap(overlap, range1[i])) {\n overlap = unionSegments(overlap, range1[i]);\n i += 1;\n }\n while (j < range2.length && segmentsOverlap(overlap, range2[j])) {\n overlap = unionSegments(overlap, range2[j]);\n j += 1;\n }\n union.push(overlap);\n } else if (range1[i][0] <= range2[j][0]) {\n union.push(range1[i].slice(0));\n i += 1;\n } else {\n union.push(range2[j].slice(0));\n j += 1;\n }\n }\n while (i < range1.length) {\n union.push(range1[i].slice(0));\n i += 1;\n }\n while (j < range2.length) {\n union.push(range2[j].slice(0));\n j += 1;\n }\n return union;\n}", "function decomposeRanges(ranges) {\n let results = [];\n let endpoints = [];\n\n // Extract range starts/ends\n // and sort in ascending order\n ranges.forEach((r) => {\n endpoints.push(r[0]);\n endpoints.push(r[1]);\n });\n endpoints = [...new Set(endpoints)];\n endpoints.sort((a, b) => a - b);\n\n // Keep track of hashes for each endpoint\n let start = {}, end = {};\n endpoints.forEach((e) => {\n start[e] = new Set();\n end[e] = new Set();\n });\n ranges.forEach((r) => {\n start[r[0]].add(r[2]);\n end[r[1]].add(r[2]);\n });\n\n // Split ranges into non-overlapping parts\n let current = new Set();\n pairwise(endpoints, (e1, e2) => {\n // Keep track of current hashes\n end[e1].forEach((t) => {\n current.delete(t);\n });\n start[e1].forEach((t) => {\n current.add(t);\n });\n if (current.size > 0) {\n results.push([e1, e2, [...current]]);\n }\n });\n return results;\n}", "function getValuesSetForRanges(ranges) {\n let valuesSets = []\n\n for (let rangeIndex = 0; rangeIndex < ranges.length; rangeIndex++) {\n const values = ranges[rangeIndex]\n\n if (valuesSets.length === 0) {\n valuesSets.push(...values.map((value) => [value]))\n } else {\n const newValuesSets = []\n\n for (let setIndex = 0; setIndex < valuesSets.length; setIndex++) {\n const valuesSet = valuesSets[setIndex]\n\n for (let valueIndex = 0; valueIndex < values.length; valueIndex++) {\n const value = values[valueIndex]\n const newValuesSet = valuesSet.concat([value])\n\n newValuesSets.push(newValuesSet)\n }\n }\n\n valuesSets = newValuesSets\n }\n }\n\n return valuesSets\n}", "inRanges(results, ranges) {\n var i, j, k, len, min, pass, ref, result;\n pass = true;\n switch (false) {\n case !(this.isArray(results) && this.isArray(ranges)):\n min = Math.min(results.length, ranges.length); // Ony apply the ranges we ga\n for (i = j = 0, ref = min; (0 <= ref ? j < ref : j > ref); i = 0 <= ref ? ++j : --j) {\n pass = pass && this.inRange(results[i], ranges[i]);\n }\n break;\n case !this.isArray(results):\n for (k = 0, len = results.length; k < len; k++) {\n result = results[k];\n pass = pass && this.inRange(results, ranges);\n }\n break;\n default:\n pass = false;\n }\n return pass;\n }", "function OverlappingRanges(arr) { \n\t\n\tvar array1 = createSequence(arr[0], arr[1]);\n\tvar array2 = createSequence(arr[2], arr[3]);\n\tvar counterAnswer = compareArrays(array1, array2); \n\t\n\t\n\tfunction createSequence(x,y) {\n\t\tvar newArray = [];\n\t\tfor (var i = x; i <= y; i++) {\n\t\t\tnewArray.push(i);\n\t\t}\n\t\treturn newArray;\n\t}\n\n\tfunction compareArrays(arr1, arr2) {\n\t\tvar counter = 0;\n\t\tfor (var i = 0; i < arr1.length; i++) {\n\t\t\tif (arr2.indexOf(arr1[i]) > -1) {\n\t\t\t\tcounter++;\n\t\t\t}\n\t\t}\n\t\treturn counter\n\t}\n\t\n\treturn (counterAnswer >= arr[4]); \n\n}", "_dumpRanges() {\n var text = \"Ranges:\";\n\n for (var i = 0; i < this.__selectedRangeArr.length; i++) {\n var range = this.__selectedRangeArr[i];\n text += \" [\" + range.minIndex + \"..\" + range.maxIndex + \"]\";\n }\n\n this.debug(text);\n }", "function selectRange() {\n var frstSelect = selectedEles[0];\n var lstSelect = selectedEles[selectedEles.length - 1];\n if (cols) {\n var flipStart = flipFlipIdx(Math.min(flipIdx(selectionMinPivot), flipIdx(selectionMaxPivot),\n flipIdx(frstSelect), flipIdx(lstSelect)));\n var flipEnd = flipFlipIdx(Math.max(flipIdx(selectionMinPivot), flipIdx(selectionMaxPivot),\n flipIdx(frstSelect), flipIdx(lstSelect)));\n selectElemsDownRows(Math.min(flipStart, flipEnd), Math.max(flipStart, flipEnd));\n } else {\n var start = Math.min(selectionMinPivot, frstSelect);\n var end = Math.max(selectionMaxPivot, lstSelect);\n selectElemRange(start, end);\n }\n }", "function composeRanges(nums) {\n let ranges = [];\n let i = 0;\n let j = 0;\n while (i < nums.length && j < nums.length) {\n if (nums[j + 1] - nums[j] === 1) j++;\n else {\n if (nums[j] !== nums[i]) ranges.push(`${nums[i]}->${nums[j]}`);\n else ranges.push(`${nums[i]}`);\n j++;\n i = j;\n }\n }\n return ranges;\n}", "function addRanges(range1, range2) {\n const segments = [];\n // consider all possible segment combinations\n range1.forEach((segment1) => {\n range2.forEach((segment2) => {\n segments.push([segment1[0] + segment2[0], segment1[1] + segment2[1]]);\n });\n });\n // join segments that overlap using the classic algorithm\n segments.sort((segmentA, segmentB) => segmentA[0] - segmentB[0]);\n const newRange = [];\n let joinedSegment = segments[0].slice(0);\n segments.slice(1).forEach((segment) => {\n if (joinedSegment[1] >= segment[0]) {\n joinedSegment[1] = Math.max(joinedSegment[1], segment[1]);\n } else {\n newRange.push(joinedSegment);\n joinedSegment = segment.slice(0);\n }\n });\n newRange.push(joinedSegment);\n return newRange;\n}", "function rangeArr(start, end) {\n if (start === end) return [];\n\n return ([start].concat(rangeArr(start + 1, end)));\n\n}", "function RangeSet(lower, upper){\n\tthis.lower = lower;\n\tthis.upper = upper;\n\tthis.getRange = function(){\n\t\treturn upper- lower;\n\t};\n}", "function updateRange(lo, hi, values, add) {\n let ranges = settings.process.ranges;\n let slices = {};\n let min = lo;\n let max = hi;\n\n // special case for belt loops which should not be flattened\n if (values.outputLoops) {\n ranges.push({\n lo, hi, fields: values\n });\n api.conf.update_fields(settings.process);\n api.show.alert(\"update ranges\", 2);\n api.event.emit(\"range.updates\", ranges);\n return;\n }\n\n // just remove values from matching ranges\n if (!add) {\n for (let range of getOverlappingRanges(lo, hi)) {\n for (let key of Object.keys(values)) {\n delete range.fields[key];\n }\n if (Object.keys(range.fields).length === 0) {\n let pos = ranges.indexOf(range);\n if (pos >= 0) {\n ranges.splice(pos,1);\n }\n }\n }\n api.event.emit(\"range.updates\", ranges);\n return;\n }\n\n // set aside belt loops and re-append later\n // since we do not want to collapse/merge loops\n let exclude = ranges.filter(r => r.fields.outputLoops);\n ranges = ranges.filter(r => !r.fields.outputLoops);\n\n // flatten ranges\n ranges.push({lo, hi, fields: values});\n for (let range of ranges) {\n min = Math.min(range.lo, min);\n max = Math.max(range.hi, max);\n for (let i=range.lo; i<=range.hi; i++) {\n let slice = slices[i];\n if (!slice) {\n slice = slices[i] = {};\n }\n for (let [key,val] of Object.entries(range.fields)) {\n slice[key] = val;\n }\n }\n }\n\n // merge contiguous matching ranges\n ranges = settings.process.ranges = [];\n let range;\n for (let i=min; i<=max; i++) {\n let slice = slices[i];\n if (slice && !range) {\n range = {lo: i, hi: i, fields: slice};\n } else if (slice && range && areEqual(range.fields, slice)) {\n range.hi = i;\n } else if (range) {\n ranges.push(range);\n if (slice) {\n range = {lo: i, hi: i, fields: slice};\n } else {\n range = undefined;\n }\n }\n }\n\n ranges.push(range);\n ranges.appendAll(exclude);\n\n api.conf.update_fields(settings.process);\n api.show.alert(\"update ranges\", 2);\n api.event.emit(\"range.updates\", ranges);\n}", "function Selection(ranges, primIndex) {\n this.ranges = ranges\n this.primIndex = primIndex\n}", "function onSelection(ranges, event) {\n selections.push({\n ranges: ranges,\n event: event\n });\n }", "function clearSelectionEvents(array) {\r\n while (array.length) {\r\n var last = lst(array);\r\n if (last.ranges) array.pop();\r\n else break;\r\n }\r\n }", "function clearSelectionEvents(array) {\r\n while (array.length) {\r\n var last = lst(array);\r\n if (last.ranges) { array.pop(); }\r\n else { break }\r\n }\r\n}", "function getRange(array, start, end) {\n const ret = [];\n if (start <= array.length && start <= end) {\n for (let i = start - 1; i < end; i++) {\n ret.push(array[i]);\n }\n }\n return ret;\n}", "function clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array)\n if (last.ranges) { array.pop() }\n else { break }\n }\n}", "function clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array)\n if (last.ranges) { array.pop() }\n else { break }\n }\n}", "function range (startNumber, endNumber) {\n const range2 = [];\n if (startNumber < endNumber) {\n for (let i = startNumber; i <= endNumber; i++) {\n range2.push(i);\n }\n } else {\n for (let i = startNumber; i >= endNumber; i--) {\n range2.push(i);\n }\n }\n return range2;\n}", "function clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array);\n if (last.ranges) array.pop();\n else break;\n }\n }", "function clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array);\n if (last.ranges) array.pop();\n else break;\n }\n }", "function clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array);\n if (last.ranges) array.pop();\n else break;\n }\n }", "function clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array);\n if (last.ranges) array.pop();\n else break;\n }\n }", "function clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array);\n if (last.ranges) array.pop();\n else break;\n }\n }" ]
[ "0.70186657", "0.6829976", "0.6789967", "0.6774615", "0.6716162", "0.66930807", "0.6687457", "0.6687457", "0.6687457", "0.6687457", "0.6687457", "0.6687457", "0.6687457", "0.6687457", "0.66794205", "0.66419154", "0.6637528", "0.6637528", "0.6637528", "0.6637528", "0.6637528", "0.6637528", "0.6637528", "0.6637528", "0.6637528", "0.6637528", "0.6637528", "0.66340977", "0.66340977", "0.66340977", "0.6631735", "0.6631735", "0.656769", "0.64204264", "0.64030075", "0.61972123", "0.61322016", "0.60964525", "0.6088779", "0.6070573", "0.6058748", "0.60507274", "0.60326993", "0.60326993", "0.60326993", "0.60326993", "0.60326993", "0.60326993", "0.60326993", "0.60326993", "0.60326993", "0.60326993", "0.60326993", "0.60326993", "0.60326993", "0.60326993", "0.60326993", "0.59860986", "0.59478676", "0.5906727", "0.59054846", "0.5894801", "0.5855462", "0.5844844", "0.5808162", "0.5799374", "0.5769368", "0.57591736", "0.5757983", "0.5749646", "0.57170814", "0.5702157", "0.56954706", "0.568457", "0.5678477", "0.56767493", "0.5670173", "0.5670173", "0.5664712", "0.5664604", "0.5664604", "0.5664604", "0.5664604", "0.5664604" ]
0.6089187
49
Compute the position of the end of a change (its 'to' property refers to the prechange end).
function changeEnd(change) { if (!change.text) { return change.to } return Pos(change.from.line + change.text.length - 1, lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function changeEnd(change) {\n if (!change.text) {\n return change.to;\n }\n\n return Pos(change.from.line + change.text.length - 1, lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0));\n } // Adjust a position to refer to the post-change position of the", "function changeEnd(change) {\n\t\t if (!change.text) { return change.to }\n\t\t return Pos(change.from.line + change.text.length - 1,\n\t\t lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n\t\t }", "function changeEnd(change) {\r\n if (!change.text) { return change.to }\r\n return Pos(change.from.line + change.text.length - 1,\r\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\r\n}", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n}", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n}", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n}", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n}", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n}", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n}", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n}", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n}", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n}", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n}", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n}", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n}", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n}", "getLastEndPosition() {\n\t\t\tconst {overrides} = this.impl;\n\t\t\tif (overrides !== undefined) {\n\t\t\t\treturn overrides.getLastEndPosition(this);\n\t\t\t}\n\n\t\t\treturn this.getPositionFromIndex(this.prevToken.end);\n\t\t}", "function adjustForChange(pos, change) {\n\t\t if (cmp(pos, change.from) < 0) { return pos }\n\t\t if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n\t\t var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n\t\t if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n\t\t return Pos(line, ch)\n\t\t }", "get end() {\n if (this._positions.anchor < this._positions.focus) {\n return this._positions.focus\n }\n\n return this._positions.anchor\n }", "function adjustForChange(pos, change) {\n\t\t if (cmp(pos, change.from) < 0) return pos;\n\t\t if (cmp(pos, change.to) <= 0) return changeEnd(change);\n\t\t\n\t\t var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n\t\t if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch;\n\t\t return Pos(line, ch);\n\t\t }", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n }", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n }", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n }", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n }", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n }", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n }", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n }", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n }", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n }", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n }", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n }", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n }", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n }", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n }", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n }", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n }", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n }", "function adjustForChange(pos, change) {\n\t if (cmp(pos, change.from) < 0) return pos;\n\t if (cmp(pos, change.to) <= 0) return changeEnd(change);\n\t\n\t var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n\t if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch;\n\t return Pos(line, ch);\n\t }", "function adjustForChange(pos, change) {\n\t if (cmp(pos, change.from) < 0) return pos;\n\t if (cmp(pos, change.to) <= 0) return changeEnd(change);\n\n\t var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n\t if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch;\n\t return Pos(line, ch);\n\t }", "function adjustForChange(pos, change) {\n\t if (cmp(pos, change.from) < 0) return pos;\n\t if (cmp(pos, change.to) <= 0) return changeEnd(change);\n\n\t var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n\t if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch;\n\t return Pos(line, ch);\n\t }", "get endPosition() { return this.endPositionIn; }", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) {\n return pos;\n }\n\n if (cmp(pos, change.to) <= 0) {\n return changeEnd(change);\n }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1,\n ch = pos.ch;\n\n if (pos.line == change.to.line) {\n ch += changeEnd(change).ch - change.to.ch;\n }\n\n return Pos(line, ch);\n }", "function adjustForChange(pos, change) {\r\n if (cmp(pos, change.from) < 0) { return pos }\r\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\r\n\r\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\r\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\r\n return Pos(line, ch)\r\n}", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch }\n return Pos(line, ch)\n}", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch }\n return Pos(line, ch)\n}", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n}", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n}", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n}", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n}", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n}", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n}", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n}", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n}", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n}", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n}", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n}", "function adjustForChange(pos, change) {\r\n if (cmp(pos, change.from) < 0) return pos;\r\n if (cmp(pos, change.to) <= 0) return changeEnd(change);\r\n\r\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\r\n if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch;\r\n return Pos(line, ch);\r\n }", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) return pos;\n if (cmp(pos, change.to) <= 0) return changeEnd(change);\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch;\n return Pos(line, ch);\n }", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) return pos;\n if (cmp(pos, change.to) <= 0) return changeEnd(change);\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch;\n return Pos(line, ch);\n }", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) return pos;\n if (cmp(pos, change.to) <= 0) return changeEnd(change);\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch;\n return Pos(line, ch);\n }", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) return pos;\n if (cmp(pos, change.to) <= 0) return changeEnd(change);\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch;\n return Pos(line, ch);\n }", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) return pos;\n if (cmp(pos, change.to) <= 0) return changeEnd(change);\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch;\n return Pos(line, ch);\n }", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) return pos;\n if (cmp(pos, change.to) <= 0) return changeEnd(change);\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch;\n return Pos(line, ch);\n }", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) return pos;\n if (cmp(pos, change.to) <= 0) return changeEnd(change);\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch;\n return Pos(line, ch);\n }", "get end() {\n return this.$to.after(this.depth + 1);\n }", "get endOffset() {\n return this.getHierarchicalIndexByPosition(this.end);\n }", "function editEnd(from, to) {\n if (!to) return 0;\n if (!from) return to.length;\n for (var i = from.length, j = to.length; i >= 0 && j >= 0; --i, --j)\n if (from.charAt(i) != to.charAt(j)) break;\n return j + 1;\n }", "function editEnd(from, to) {\n if (!to) return 0;\n if (!from) return to.length;\n for (var i = from.length, j = to.length; i >= 0 && j >= 0; --i, --j)\n if (from.charAt(i) != to.charAt(j)) break;\n return j + 1;\n }", "function editEnd(from, to) {\n if (!to) return 0;\n if (!from) return to.length;\n for (var i = from.length, j = to.length; i >= 0 && j >= 0; --i, --j)\n if (from.charAt(i) != to.charAt(j)) break;\n return j + 1;\n }", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) return pos;\n if (cmp(pos, change.to) <= 0) return changeEnd(change);\n\n let line = pos.line + change.text.length - (change.to.line - change.from.line) - 1,\n ch = pos.ch;\n if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch;\n return Pos(line, ch);\n}", "get endIndex() {\n return this.$to.indexAfter(this.depth);\n }", "function editEnd(from, to) {\n if (!to) return from ? from.length : 0;\n if (!from) return to.length;\n for (var i = from.length, j = to.length; i >= 0 && j >= 0; --i, --j)\n if (from.charAt(i) != to.charAt(j)) break;\n return j + 1;\n }", "function editEnd(from, to) {\n if (!to) return from ? from.length : 0;\n if (!from) return to.length;\n for (var i = from.length, j = to.length; i >= 0 && j >= 0; --i, --j)\n if (from.charAt(i) != to.charAt(j)) break;\n return j + 1;\n }", "function editEnd(from, to) {\n if (!to) return from ? from.length : 0;\n if (!from) return to.length;\n for (var i = from.length, j = to.length; i >= 0 && j >= 0; --i, --j)\n if (from.charAt(i) != to.charAt(j)) break;\n return j + 1;\n }", "get endB() { return Math.max(this.fromB, this.toB - 1); }", "end(editor, at) {\n return Editor.point(editor, at, {\n edge: 'end'\n });\n }", "end(editor, at) {\n return Editor.point(editor, at, {\n edge: 'end'\n });\n }", "get end() {\n return this.span.end;\n }", "_getEndPositionOfNode(node) {\n const nodeEndPos = node.getEnd();\n const commentRanges = ts.getTrailingCommentRanges(node.getSourceFile().text, nodeEndPos);\n if (!commentRanges || !commentRanges.length) {\n return nodeEndPos;\n }\n return commentRanges[commentRanges.length - 1].end;\n }", "get end() {\n return this.selector('TextPositionSelector').end;\n }", "get end() {\n return this.selector('TextPositionSelector').end;\n }", "getAsyncEndPos(){\n\t\tvar sz = this.async_stop_pos.count();\n\t\tif (sz == 0){\n\t\t\treturn \"\";\n\t\t}\n\t\tvar obj = this.async_stop_pos.item(sz - 1);\n\t\treturn obj.get(\"end\", \"\", \"string\");\n\t}", "get endA() { return Math.max(this.fromA, this.toA - 1); }", "after(depth) {\n depth = this.resolveDepth(depth);\n if (!depth)\n throw new RangeError(\"There is no position after the top-level node\");\n return depth == this.depth + 1 ? this.pos : this.path[depth * 3 - 1] + this.path[depth * 3].nodeSize;\n }" ]
[ "0.81361943", "0.7953961", "0.78976995", "0.7896871", "0.7896871", "0.7896871", "0.7896871", "0.7896871", "0.7896871", "0.7896871", "0.7896871", "0.7896871", "0.7896871", "0.7896871", "0.7896871", "0.7896871", "0.6733018", "0.67322105", "0.6654323", "0.6598373", "0.6589914", "0.6589914", "0.6589914", "0.6589914", "0.6589914", "0.6589914", "0.6589914", "0.6589914", "0.6589914", "0.6589914", "0.6589914", "0.6589914", "0.6589914", "0.6589914", "0.6589914", "0.6589914", "0.6589914", "0.6580855", "0.657243", "0.657243", "0.6572422", "0.6549717", "0.65293264", "0.6511921", "0.6511921", "0.64980936", "0.64980936", "0.64980936", "0.64980936", "0.64980936", "0.64980936", "0.64980936", "0.64980936", "0.64980936", "0.64980936", "0.64980936", "0.6493417", "0.6483556", "0.6483556", "0.6483556", "0.6483556", "0.6483556", "0.6483556", "0.6483556", "0.63960415", "0.6378075", "0.63581276", "0.63581276", "0.63581276", "0.6325849", "0.6314919", "0.6237071", "0.6237071", "0.6237071", "0.6175605", "0.6077933", "0.6077933", "0.60139537", "0.5942425", "0.5923637", "0.5923637", "0.59167826", "0.59098834", "0.58934677" ]
0.7954137
17
Adjust a position to refer to the postchange position of the same text, or the end of the change if the change covers it.
function adjustForChange(pos, change) { if (cmp(pos, change.from) < 0) { return pos } if (cmp(pos, change.to) <= 0) { return changeEnd(change) } var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch; if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; } return Pos(line, ch) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function adjustForChange(pos, change) {\n\t\t if (cmp(pos, change.from) < 0) return pos;\n\t\t if (cmp(pos, change.to) <= 0) return changeEnd(change);\n\t\t\n\t\t var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n\t\t if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch;\n\t\t return Pos(line, ch);\n\t\t }", "function adjustForChange(pos, change) {\n\t\t if (cmp(pos, change.from) < 0) { return pos }\n\t\t if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n\t\t var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n\t\t if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n\t\t return Pos(line, ch)\n\t\t }", "function adjustForChange(pos, change) {\r\n if (cmp(pos, change.from) < 0) return pos;\r\n if (cmp(pos, change.to) <= 0) return changeEnd(change);\r\n\r\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\r\n if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch;\r\n return Pos(line, ch);\r\n }", "function adjustForChange(pos, change) {\n\t if (cmp(pos, change.from) < 0) return pos;\n\t if (cmp(pos, change.to) <= 0) return changeEnd(change);\n\n\t var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n\t if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch;\n\t return Pos(line, ch);\n\t }", "function adjustForChange(pos, change) {\n\t if (cmp(pos, change.from) < 0) return pos;\n\t if (cmp(pos, change.to) <= 0) return changeEnd(change);\n\n\t var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n\t if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch;\n\t return Pos(line, ch);\n\t }", "function adjustForChange(pos, change) {\r\n if (cmp(pos, change.from) < 0) { return pos }\r\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\r\n\r\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\r\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\r\n return Pos(line, ch)\r\n}", "function adjustForChange(pos, change) {\n\t if (cmp(pos, change.from) < 0) return pos;\n\t if (cmp(pos, change.to) <= 0) return changeEnd(change);\n\t\n\t var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n\t if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch;\n\t return Pos(line, ch);\n\t }", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) return pos;\n if (cmp(pos, change.to) <= 0) return changeEnd(change);\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch;\n return Pos(line, ch);\n }", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) return pos;\n if (cmp(pos, change.to) <= 0) return changeEnd(change);\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch;\n return Pos(line, ch);\n }", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) return pos;\n if (cmp(pos, change.to) <= 0) return changeEnd(change);\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch;\n return Pos(line, ch);\n }", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) return pos;\n if (cmp(pos, change.to) <= 0) return changeEnd(change);\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch;\n return Pos(line, ch);\n }", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) return pos;\n if (cmp(pos, change.to) <= 0) return changeEnd(change);\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch;\n return Pos(line, ch);\n }", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) return pos;\n if (cmp(pos, change.to) <= 0) return changeEnd(change);\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch;\n return Pos(line, ch);\n }", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) return pos;\n if (cmp(pos, change.to) <= 0) return changeEnd(change);\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch;\n return Pos(line, ch);\n }", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) {\n return pos;\n }\n\n if (cmp(pos, change.to) <= 0) {\n return changeEnd(change);\n }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1,\n ch = pos.ch;\n\n if (pos.line == change.to.line) {\n ch += changeEnd(change).ch - change.to.ch;\n }\n\n return Pos(line, ch);\n }", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch }\n return Pos(line, ch)\n}", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch }\n return Pos(line, ch)\n}", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n}", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n}", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n}", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n}", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n}", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n}", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n}", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n}", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n}", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n}", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n}", "function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) return pos;\n if (cmp(pos, change.to) <= 0) return changeEnd(change);\n\n let line = pos.line + change.text.length - (change.to.line - change.from.line) - 1,\n ch = pos.ch;\n if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch;\n return Pos(line, ch);\n}", "function clipPostChange(doc, change, pos) {\n if (!posLess(change.from, pos)) return clipPos(doc, pos);\n var diff = (change.text.length - 1) - (change.to.line - change.from.line);\n if (pos.line > change.to.line + diff) {\n var preLine = pos.line - diff, lastLine = doc.first + doc.size - 1;\n if (preLine > lastLine) return Pos(lastLine, getLine(doc, lastLine).text.length);\n return clipToLen(pos, getLine(doc, preLine).text.length);\n }\n if (pos.line == change.to.line + diff)\n return clipToLen(pos, lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0) +\n getLine(doc, change.to.line).text.length - change.to.ch);\n var inside = pos.line - change.from.line;\n return clipToLen(pos, change.text[inside].length + (inside ? 0 : change.from.ch));\n }", "function clipPostChange(doc, change, pos) {\n if (!posLess(change.from, pos)) return clipPos(doc, pos);\n var diff = (change.text.length - 1) - (change.to.line - change.from.line);\n if (pos.line > change.to.line + diff) {\n var preLine = pos.line - diff, lastLine = doc.first + doc.size - 1;\n if (preLine > lastLine) return Pos(lastLine, getLine(doc, lastLine).text.length);\n return clipToLen(pos, getLine(doc, preLine).text.length);\n }\n if (pos.line == change.to.line + diff)\n return clipToLen(pos, lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0) +\n getLine(doc, change.to.line).text.length - change.to.ch);\n var inside = pos.line - change.from.line;\n return clipToLen(pos, change.text[inside].length + (inside ? 0 : change.from.ch));\n }", "function clipPostChange(doc, change, pos) {\n if (!posLess(change.from, pos)) return clipPos(doc, pos);\n var diff = (change.text.length - 1) - (change.to.line - change.from.line);\n if (pos.line > change.to.line + diff) {\n var preLine = pos.line - diff, lastLine = doc.first + doc.size - 1;\n if (preLine > lastLine) return Pos(lastLine, getLine(doc, lastLine).text.length);\n return clipToLen(pos, getLine(doc, preLine).text.length);\n }\n if (pos.line == change.to.line + diff)\n return clipToLen(pos, lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0) +\n getLine(doc, change.to.line).text.length - change.to.ch);\n var inside = pos.line - change.from.line;\n return clipToLen(pos, change.text[inside].length + (inside ? 0 : change.from.ch));\n }", "function clipPostChange(doc, change, pos) {\n if (!posLess(change.from, pos)) return clipPos(doc, pos);\n var diff = (change.text.length - 1) - (change.to.line - change.from.line);\n if (pos.line > change.to.line + diff) {\n var preLine = pos.line - diff, lastLine = doc.first + doc.size - 1;\n if (preLine > lastLine) return Pos(lastLine, getLine(doc, lastLine).text.length);\n return clipToLen(pos, getLine(doc, preLine).text.length);\n }\n if (pos.line == change.to.line + diff)\n return clipToLen(pos, lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0) +\n getLine(doc, change.to.line).text.length - change.to.ch);\n var inside = pos.line - change.from.line;\n return clipToLen(pos, change.text[inside].length + (inside ? 0 : change.from.ch));\n }", "function changeEnd(change) {\n if (!change.text) {\n return change.to;\n }\n\n return Pos(change.from.line + change.text.length - 1, lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0));\n } // Adjust a position to refer to the post-change position of the", "function changeEnd(change) {\n\t\t if (!change.text) { return change.to }\n\t\t return Pos(change.from.line + change.text.length - 1,\n\t\t lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n\t\t }", "function changeEnd(change) {\r\n if (!change.text) { return change.to }\r\n return Pos(change.from.line + change.text.length - 1,\r\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\r\n}", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n }", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n }", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n }", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n }", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n }", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n }", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n }", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n }", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n }", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n }", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n }", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n }", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n }", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n }", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n }", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n }", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n }", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n}", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n}", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n}", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n}", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n}", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n}", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n}", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n}", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n}", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n}", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n}", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n}", "function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n}", "function setpostion(newPostion) {\n setPosition(newPostion);\n }", "function saveAfter(pos) {\n if (self.history.textAfter(pos.node).length > pos.offset) {\n self.line = pos.node;\n self.offset = pos.offset + 1;\n }\n else {\n self.line = self.history.nodeAfter(pos.node);\n self.offset = 0;\n }\n }", "function stretchSpansOverChange(doc, change) {\n\t\t if (change.full) { return null }\n\t\t var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;\n\t\t var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;\n\t\t if (!oldFirst && !oldLast) { return null }\n\n\t\t var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;\n\t\t // Get the spans that 'stick out' on both sides\n\t\t var first = markedSpansBefore(oldFirst, startCh, isInsert);\n\t\t var last = markedSpansAfter(oldLast, endCh, isInsert);\n\n\t\t // Next, merge those two ends\n\t\t var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);\n\t\t if (first) {\n\t\t // Fix up .to properties of first\n\t\t for (var i = 0; i < first.length; ++i) {\n\t\t var span = first[i];\n\t\t if (span.to == null) {\n\t\t var found = getMarkedSpanFor(last, span.marker);\n\t\t if (!found) { span.to = startCh; }\n\t\t else if (sameLine) { span.to = found.to == null ? null : found.to + offset; }\n\t\t }\n\t\t }\n\t\t }\n\t\t if (last) {\n\t\t // Fix up .from in last (or move them into first in case of sameLine)\n\t\t for (var i$1 = 0; i$1 < last.length; ++i$1) {\n\t\t var span$1 = last[i$1];\n\t\t if (span$1.to != null) { span$1.to += offset; }\n\t\t if (span$1.from == null) {\n\t\t var found$1 = getMarkedSpanFor(first, span$1.marker);\n\t\t if (!found$1) {\n\t\t span$1.from = offset;\n\t\t if (sameLine) { (first || (first = [])).push(span$1); }\n\t\t }\n\t\t } else {\n\t\t span$1.from += offset;\n\t\t if (sameLine) { (first || (first = [])).push(span$1); }\n\t\t }\n\t\t }\n\t\t }\n\t\t // Make sure we didn't create any zero-length spans\n\t\t if (first) { first = clearEmptySpans(first); }\n\t\t if (last && last != first) { last = clearEmptySpans(last); }\n\n\t\t var newMarkers = [first];\n\t\t if (!sameLine) {\n\t\t // Fill gap with whole-line-spans\n\t\t var gap = change.text.length - 2, gapMarkers;\n\t\t if (gap > 0 && first)\n\t\t { for (var i$2 = 0; i$2 < first.length; ++i$2)\n\t\t { if (first[i$2].to == null)\n\t\t { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)); } } }\n\t\t for (var i$3 = 0; i$3 < gap; ++i$3)\n\t\t { newMarkers.push(gapMarkers); }\n\t\t newMarkers.push(last);\n\t\t }\n\t\t return newMarkers\n\t\t }", "function stretchSpansOverChange(doc, change) {\n if (change.full) {\n return null;\n }\n\n var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;\n var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;\n\n if (!oldFirst && !oldLast) {\n return null;\n }\n\n var startCh = change.from.ch,\n endCh = change.to.ch,\n isInsert = cmp(change.from, change.to) == 0; // Get the spans that 'stick out' on both sides\n\n var first = markedSpansBefore(oldFirst, startCh, isInsert);\n var last = markedSpansAfter(oldLast, endCh, isInsert); // Next, merge those two ends\n\n var sameLine = change.text.length == 1,\n offset = lst(change.text).length + (sameLine ? startCh : 0);\n\n if (first) {\n // Fix up .to properties of first\n for (var i = 0; i < first.length; ++i) {\n var span = first[i];\n\n if (span.to == null) {\n var found = getMarkedSpanFor(last, span.marker);\n\n if (!found) {\n span.to = startCh;\n } else if (sameLine) {\n span.to = found.to == null ? null : found.to + offset;\n }\n }\n }\n }\n\n if (last) {\n // Fix up .from in last (or move them into first in case of sameLine)\n for (var i$1 = 0; i$1 < last.length; ++i$1) {\n var span$1 = last[i$1];\n\n if (span$1.to != null) {\n span$1.to += offset;\n }\n\n if (span$1.from == null) {\n var found$1 = getMarkedSpanFor(first, span$1.marker);\n\n if (!found$1) {\n span$1.from = offset;\n\n if (sameLine) {\n (first || (first = [])).push(span$1);\n }\n }\n } else {\n span$1.from += offset;\n\n if (sameLine) {\n (first || (first = [])).push(span$1);\n }\n }\n }\n } // Make sure we didn't create any zero-length spans\n\n\n if (first) {\n first = clearEmptySpans(first);\n }\n\n if (last && last != first) {\n last = clearEmptySpans(last);\n }\n\n var newMarkers = [first];\n\n if (!sameLine) {\n // Fill gap with whole-line-spans\n var gap = change.text.length - 2,\n gapMarkers;\n\n if (gap > 0 && first) {\n for (var i$2 = 0; i$2 < first.length; ++i$2) {\n if (first[i$2].to == null) {\n (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null));\n }\n }\n }\n\n for (var i$3 = 0; i$3 < gap; ++i$3) {\n newMarkers.push(gapMarkers);\n }\n\n newMarkers.push(last);\n }\n\n return newMarkers;\n } // Remove spans that are empty and don't have a clearWhenEmpty", "function stretchSpansOverChange(doc, change) {\n if (change.full) { return null }\n var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;\n var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;\n if (!oldFirst && !oldLast) { return null }\n\n var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;\n // Get the spans that 'stick out' on both sides\n var first = markedSpansBefore(oldFirst, startCh, isInsert);\n var last = markedSpansAfter(oldLast, endCh, isInsert);\n\n // Next, merge those two ends\n var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);\n if (first) {\n // Fix up .to properties of first\n for (var i = 0; i < first.length; ++i) {\n var span = first[i];\n if (span.to == null) {\n var found = getMarkedSpanFor(last, span.marker);\n if (!found) { span.to = startCh; }\n else if (sameLine) { span.to = found.to == null ? null : found.to + offset; }\n }\n }\n }\n if (last) {\n // Fix up .from in last (or move them into first in case of sameLine)\n for (var i$1 = 0; i$1 < last.length; ++i$1) {\n var span$1 = last[i$1];\n if (span$1.to != null) { span$1.to += offset; }\n if (span$1.from == null) {\n var found$1 = getMarkedSpanFor(first, span$1.marker);\n if (!found$1) {\n span$1.from = offset;\n if (sameLine) { (first || (first = [])).push(span$1); }\n }\n } else {\n span$1.from += offset;\n if (sameLine) { (first || (first = [])).push(span$1); }\n }\n }\n }\n // Make sure we didn't create any zero-length spans\n if (first) { first = clearEmptySpans(first); }\n if (last && last != first) { last = clearEmptySpans(last); }\n\n var newMarkers = [first];\n if (!sameLine) {\n // Fill gap with whole-line-spans\n var gap = change.text.length - 2, gapMarkers;\n if (gap > 0 && first)\n { for (var i$2 = 0; i$2 < first.length; ++i$2)\n { if (first[i$2].to == null)\n { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)); } } }\n for (var i$3 = 0; i$3 < gap; ++i$3)\n { newMarkers.push(gapMarkers); }\n newMarkers.push(last);\n }\n return newMarkers\n }", "function stretchSpansOverChange(doc, change) {\n if (change.full) { return null }\n var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;\n var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;\n if (!oldFirst && !oldLast) { return null }\n\n var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;\n // Get the spans that 'stick out' on both sides\n var first = markedSpansBefore(oldFirst, startCh, isInsert);\n var last = markedSpansAfter(oldLast, endCh, isInsert);\n\n // Next, merge those two ends\n var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);\n if (first) {\n // Fix up .to properties of first\n for (var i = 0; i < first.length; ++i) {\n var span = first[i];\n if (span.to == null) {\n var found = getMarkedSpanFor(last, span.marker);\n if (!found) { span.to = startCh; }\n else if (sameLine) { span.to = found.to == null ? null : found.to + offset; }\n }\n }\n }\n if (last) {\n // Fix up .from in last (or move them into first in case of sameLine)\n for (var i$1 = 0; i$1 < last.length; ++i$1) {\n var span$1 = last[i$1];\n if (span$1.to != null) { span$1.to += offset; }\n if (span$1.from == null) {\n var found$1 = getMarkedSpanFor(first, span$1.marker);\n if (!found$1) {\n span$1.from = offset;\n if (sameLine) { (first || (first = [])).push(span$1); }\n }\n } else {\n span$1.from += offset;\n if (sameLine) { (first || (first = [])).push(span$1); }\n }\n }\n }\n // Make sure we didn't create any zero-length spans\n if (first) { first = clearEmptySpans(first); }\n if (last && last != first) { last = clearEmptySpans(last); }\n\n var newMarkers = [first];\n if (!sameLine) {\n // Fill gap with whole-line-spans\n var gap = change.text.length - 2, gapMarkers;\n if (gap > 0 && first)\n { for (var i$2 = 0; i$2 < first.length; ++i$2)\n { if (first[i$2].to == null)\n { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)); } } }\n for (var i$3 = 0; i$3 < gap; ++i$3)\n { newMarkers.push(gapMarkers); }\n newMarkers.push(last);\n }\n return newMarkers\n }", "function stretchSpansOverChange(doc, change) {\n if (change.full) { return null }\n var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;\n var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;\n if (!oldFirst && !oldLast) { return null }\n\n var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;\n // Get the spans that 'stick out' on both sides\n var first = markedSpansBefore(oldFirst, startCh, isInsert);\n var last = markedSpansAfter(oldLast, endCh, isInsert);\n\n // Next, merge those two ends\n var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);\n if (first) {\n // Fix up .to properties of first\n for (var i = 0; i < first.length; ++i) {\n var span = first[i];\n if (span.to == null) {\n var found = getMarkedSpanFor(last, span.marker);\n if (!found) { span.to = startCh; }\n else if (sameLine) { span.to = found.to == null ? null : found.to + offset; }\n }\n }\n }\n if (last) {\n // Fix up .from in last (or move them into first in case of sameLine)\n for (var i$1 = 0; i$1 < last.length; ++i$1) {\n var span$1 = last[i$1];\n if (span$1.to != null) { span$1.to += offset; }\n if (span$1.from == null) {\n var found$1 = getMarkedSpanFor(first, span$1.marker);\n if (!found$1) {\n span$1.from = offset;\n if (sameLine) { (first || (first = [])).push(span$1); }\n }\n } else {\n span$1.from += offset;\n if (sameLine) { (first || (first = [])).push(span$1); }\n }\n }\n }\n // Make sure we didn't create any zero-length spans\n if (first) { first = clearEmptySpans(first); }\n if (last && last != first) { last = clearEmptySpans(last); }\n\n var newMarkers = [first];\n if (!sameLine) {\n // Fill gap with whole-line-spans\n var gap = change.text.length - 2, gapMarkers;\n if (gap > 0 && first)\n { for (var i$2 = 0; i$2 < first.length; ++i$2)\n { if (first[i$2].to == null)\n { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)); } } }\n for (var i$3 = 0; i$3 < gap; ++i$3)\n { newMarkers.push(gapMarkers); }\n newMarkers.push(last);\n }\n return newMarkers\n }", "function stretchSpansOverChange(doc, change) {\n if (change.full) { return null }\n var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;\n var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;\n if (!oldFirst && !oldLast) { return null }\n\n var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;\n // Get the spans that 'stick out' on both sides\n var first = markedSpansBefore(oldFirst, startCh, isInsert);\n var last = markedSpansAfter(oldLast, endCh, isInsert);\n\n // Next, merge those two ends\n var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);\n if (first) {\n // Fix up .to properties of first\n for (var i = 0; i < first.length; ++i) {\n var span = first[i];\n if (span.to == null) {\n var found = getMarkedSpanFor(last, span.marker);\n if (!found) { span.to = startCh; }\n else if (sameLine) { span.to = found.to == null ? null : found.to + offset; }\n }\n }\n }\n if (last) {\n // Fix up .from in last (or move them into first in case of sameLine)\n for (var i$1 = 0; i$1 < last.length; ++i$1) {\n var span$1 = last[i$1];\n if (span$1.to != null) { span$1.to += offset; }\n if (span$1.from == null) {\n var found$1 = getMarkedSpanFor(first, span$1.marker);\n if (!found$1) {\n span$1.from = offset;\n if (sameLine) { (first || (first = [])).push(span$1); }\n }\n } else {\n span$1.from += offset;\n if (sameLine) { (first || (first = [])).push(span$1); }\n }\n }\n }\n // Make sure we didn't create any zero-length spans\n if (first) { first = clearEmptySpans(first); }\n if (last && last != first) { last = clearEmptySpans(last); }\n\n var newMarkers = [first];\n if (!sameLine) {\n // Fill gap with whole-line-spans\n var gap = change.text.length - 2, gapMarkers;\n if (gap > 0 && first)\n { for (var i$2 = 0; i$2 < first.length; ++i$2)\n { if (first[i$2].to == null)\n { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)); } } }\n for (var i$3 = 0; i$3 < gap; ++i$3)\n { newMarkers.push(gapMarkers); }\n newMarkers.push(last);\n }\n return newMarkers\n }", "function stretchSpansOverChange(doc, change) {\n if (change.full) { return null }\n var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;\n var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;\n if (!oldFirst && !oldLast) { return null }\n\n var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;\n // Get the spans that 'stick out' on both sides\n var first = markedSpansBefore(oldFirst, startCh, isInsert);\n var last = markedSpansAfter(oldLast, endCh, isInsert);\n\n // Next, merge those two ends\n var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);\n if (first) {\n // Fix up .to properties of first\n for (var i = 0; i < first.length; ++i) {\n var span = first[i];\n if (span.to == null) {\n var found = getMarkedSpanFor(last, span.marker);\n if (!found) { span.to = startCh; }\n else if (sameLine) { span.to = found.to == null ? null : found.to + offset; }\n }\n }\n }\n if (last) {\n // Fix up .from in last (or move them into first in case of sameLine)\n for (var i$1 = 0; i$1 < last.length; ++i$1) {\n var span$1 = last[i$1];\n if (span$1.to != null) { span$1.to += offset; }\n if (span$1.from == null) {\n var found$1 = getMarkedSpanFor(first, span$1.marker);\n if (!found$1) {\n span$1.from = offset;\n if (sameLine) { (first || (first = [])).push(span$1); }\n }\n } else {\n span$1.from += offset;\n if (sameLine) { (first || (first = [])).push(span$1); }\n }\n }\n }\n // Make sure we didn't create any zero-length spans\n if (first) { first = clearEmptySpans(first); }\n if (last && last != first) { last = clearEmptySpans(last); }\n\n var newMarkers = [first];\n if (!sameLine) {\n // Fill gap with whole-line-spans\n var gap = change.text.length - 2, gapMarkers;\n if (gap > 0 && first)\n { for (var i$2 = 0; i$2 < first.length; ++i$2)\n { if (first[i$2].to == null)\n { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)); } } }\n for (var i$3 = 0; i$3 < gap; ++i$3)\n { newMarkers.push(gapMarkers); }\n newMarkers.push(last);\n }\n return newMarkers\n }", "function stretchSpansOverChange(doc, change) {\n if (change.full) { return null }\n var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;\n var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;\n if (!oldFirst && !oldLast) { return null }\n\n var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;\n // Get the spans that 'stick out' on both sides\n var first = markedSpansBefore(oldFirst, startCh, isInsert);\n var last = markedSpansAfter(oldLast, endCh, isInsert);\n\n // Next, merge those two ends\n var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);\n if (first) {\n // Fix up .to properties of first\n for (var i = 0; i < first.length; ++i) {\n var span = first[i];\n if (span.to == null) {\n var found = getMarkedSpanFor(last, span.marker);\n if (!found) { span.to = startCh; }\n else if (sameLine) { span.to = found.to == null ? null : found.to + offset; }\n }\n }\n }\n if (last) {\n // Fix up .from in last (or move them into first in case of sameLine)\n for (var i$1 = 0; i$1 < last.length; ++i$1) {\n var span$1 = last[i$1];\n if (span$1.to != null) { span$1.to += offset; }\n if (span$1.from == null) {\n var found$1 = getMarkedSpanFor(first, span$1.marker);\n if (!found$1) {\n span$1.from = offset;\n if (sameLine) { (first || (first = [])).push(span$1); }\n }\n } else {\n span$1.from += offset;\n if (sameLine) { (first || (first = [])).push(span$1); }\n }\n }\n }\n // Make sure we didn't create any zero-length spans\n if (first) { first = clearEmptySpans(first); }\n if (last && last != first) { last = clearEmptySpans(last); }\n\n var newMarkers = [first];\n if (!sameLine) {\n // Fill gap with whole-line-spans\n var gap = change.text.length - 2, gapMarkers;\n if (gap > 0 && first)\n { for (var i$2 = 0; i$2 < first.length; ++i$2)\n { if (first[i$2].to == null)\n { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)); } } }\n for (var i$3 = 0; i$3 < gap; ++i$3)\n { newMarkers.push(gapMarkers); }\n newMarkers.push(last);\n }\n return newMarkers\n }", "function stretchSpansOverChange(doc, change) {\n if (change.full) { return null }\n var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;\n var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;\n if (!oldFirst && !oldLast) { return null }\n\n var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;\n // Get the spans that 'stick out' on both sides\n var first = markedSpansBefore(oldFirst, startCh, isInsert);\n var last = markedSpansAfter(oldLast, endCh, isInsert);\n\n // Next, merge those two ends\n var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);\n if (first) {\n // Fix up .to properties of first\n for (var i = 0; i < first.length; ++i) {\n var span = first[i];\n if (span.to == null) {\n var found = getMarkedSpanFor(last, span.marker);\n if (!found) { span.to = startCh; }\n else if (sameLine) { span.to = found.to == null ? null : found.to + offset; }\n }\n }\n }\n if (last) {\n // Fix up .from in last (or move them into first in case of sameLine)\n for (var i$1 = 0; i$1 < last.length; ++i$1) {\n var span$1 = last[i$1];\n if (span$1.to != null) { span$1.to += offset; }\n if (span$1.from == null) {\n var found$1 = getMarkedSpanFor(first, span$1.marker);\n if (!found$1) {\n span$1.from = offset;\n if (sameLine) { (first || (first = [])).push(span$1); }\n }\n } else {\n span$1.from += offset;\n if (sameLine) { (first || (first = [])).push(span$1); }\n }\n }\n }\n // Make sure we didn't create any zero-length spans\n if (first) { first = clearEmptySpans(first); }\n if (last && last != first) { last = clearEmptySpans(last); }\n\n var newMarkers = [first];\n if (!sameLine) {\n // Fill gap with whole-line-spans\n var gap = change.text.length - 2, gapMarkers;\n if (gap > 0 && first)\n { for (var i$2 = 0; i$2 < first.length; ++i$2)\n { if (first[i$2].to == null)\n { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)); } } }\n for (var i$3 = 0; i$3 < gap; ++i$3)\n { newMarkers.push(gapMarkers); }\n newMarkers.push(last);\n }\n return newMarkers\n }", "function stretchSpansOverChange(doc, change) {\n if (change.full) { return null }\n var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;\n var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;\n if (!oldFirst && !oldLast) { return null }\n\n var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;\n // Get the spans that 'stick out' on both sides\n var first = markedSpansBefore(oldFirst, startCh, isInsert);\n var last = markedSpansAfter(oldLast, endCh, isInsert);\n\n // Next, merge those two ends\n var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);\n if (first) {\n // Fix up .to properties of first\n for (var i = 0; i < first.length; ++i) {\n var span = first[i];\n if (span.to == null) {\n var found = getMarkedSpanFor(last, span.marker);\n if (!found) { span.to = startCh; }\n else if (sameLine) { span.to = found.to == null ? null : found.to + offset; }\n }\n }\n }\n if (last) {\n // Fix up .from in last (or move them into first in case of sameLine)\n for (var i$1 = 0; i$1 < last.length; ++i$1) {\n var span$1 = last[i$1];\n if (span$1.to != null) { span$1.to += offset; }\n if (span$1.from == null) {\n var found$1 = getMarkedSpanFor(first, span$1.marker);\n if (!found$1) {\n span$1.from = offset;\n if (sameLine) { (first || (first = [])).push(span$1); }\n }\n } else {\n span$1.from += offset;\n if (sameLine) { (first || (first = [])).push(span$1); }\n }\n }\n }\n // Make sure we didn't create any zero-length spans\n if (first) { first = clearEmptySpans(first); }\n if (last && last != first) { last = clearEmptySpans(last); }\n\n var newMarkers = [first];\n if (!sameLine) {\n // Fill gap with whole-line-spans\n var gap = change.text.length - 2, gapMarkers;\n if (gap > 0 && first)\n { for (var i$2 = 0; i$2 < first.length; ++i$2)\n { if (first[i$2].to == null)\n { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)); } } }\n for (var i$3 = 0; i$3 < gap; ++i$3)\n { newMarkers.push(gapMarkers); }\n newMarkers.push(last);\n }\n return newMarkers\n }", "function stretchSpansOverChange(doc, change) {\n if (change.full) { return null }\n var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;\n var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;\n if (!oldFirst && !oldLast) { return null }\n\n var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;\n // Get the spans that 'stick out' on both sides\n var first = markedSpansBefore(oldFirst, startCh, isInsert);\n var last = markedSpansAfter(oldLast, endCh, isInsert);\n\n // Next, merge those two ends\n var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);\n if (first) {\n // Fix up .to properties of first\n for (var i = 0; i < first.length; ++i) {\n var span = first[i];\n if (span.to == null) {\n var found = getMarkedSpanFor(last, span.marker);\n if (!found) { span.to = startCh; }\n else if (sameLine) { span.to = found.to == null ? null : found.to + offset; }\n }\n }\n }\n if (last) {\n // Fix up .from in last (or move them into first in case of sameLine)\n for (var i$1 = 0; i$1 < last.length; ++i$1) {\n var span$1 = last[i$1];\n if (span$1.to != null) { span$1.to += offset; }\n if (span$1.from == null) {\n var found$1 = getMarkedSpanFor(first, span$1.marker);\n if (!found$1) {\n span$1.from = offset;\n if (sameLine) { (first || (first = [])).push(span$1); }\n }\n } else {\n span$1.from += offset;\n if (sameLine) { (first || (first = [])).push(span$1); }\n }\n }\n }\n // Make sure we didn't create any zero-length spans\n if (first) { first = clearEmptySpans(first); }\n if (last && last != first) { last = clearEmptySpans(last); }\n\n var newMarkers = [first];\n if (!sameLine) {\n // Fill gap with whole-line-spans\n var gap = change.text.length - 2, gapMarkers;\n if (gap > 0 && first)\n { for (var i$2 = 0; i$2 < first.length; ++i$2)\n { if (first[i$2].to == null)\n { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)); } } }\n for (var i$3 = 0; i$3 < gap; ++i$3)\n { newMarkers.push(gapMarkers); }\n newMarkers.push(last);\n }\n return newMarkers\n }", "function stretchSpansOverChange(doc, change) {\n if (change.full) { return null }\n var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;\n var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;\n if (!oldFirst && !oldLast) { return null }\n\n var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;\n // Get the spans that 'stick out' on both sides\n var first = markedSpansBefore(oldFirst, startCh, isInsert);\n var last = markedSpansAfter(oldLast, endCh, isInsert);\n\n // Next, merge those two ends\n var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);\n if (first) {\n // Fix up .to properties of first\n for (var i = 0; i < first.length; ++i) {\n var span = first[i];\n if (span.to == null) {\n var found = getMarkedSpanFor(last, span.marker);\n if (!found) { span.to = startCh; }\n else if (sameLine) { span.to = found.to == null ? null : found.to + offset; }\n }\n }\n }\n if (last) {\n // Fix up .from in last (or move them into first in case of sameLine)\n for (var i$1 = 0; i$1 < last.length; ++i$1) {\n var span$1 = last[i$1];\n if (span$1.to != null) { span$1.to += offset; }\n if (span$1.from == null) {\n var found$1 = getMarkedSpanFor(first, span$1.marker);\n if (!found$1) {\n span$1.from = offset;\n if (sameLine) { (first || (first = [])).push(span$1); }\n }\n } else {\n span$1.from += offset;\n if (sameLine) { (first || (first = [])).push(span$1); }\n }\n }\n }\n // Make sure we didn't create any zero-length spans\n if (first) { first = clearEmptySpans(first); }\n if (last && last != first) { last = clearEmptySpans(last); }\n\n var newMarkers = [first];\n if (!sameLine) {\n // Fill gap with whole-line-spans\n var gap = change.text.length - 2, gapMarkers;\n if (gap > 0 && first)\n { for (var i$2 = 0; i$2 < first.length; ++i$2)\n { if (first[i$2].to == null)\n { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)); } } }\n for (var i$3 = 0; i$3 < gap; ++i$3)\n { newMarkers.push(gapMarkers); }\n newMarkers.push(last);\n }\n return newMarkers\n }", "function stretchSpansOverChange(doc, change) {\n if (change.full) { return null }\n var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;\n var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;\n if (!oldFirst && !oldLast) { return null }\n\n var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;\n // Get the spans that 'stick out' on both sides\n var first = markedSpansBefore(oldFirst, startCh, isInsert);\n var last = markedSpansAfter(oldLast, endCh, isInsert);\n\n // Next, merge those two ends\n var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);\n if (first) {\n // Fix up .to properties of first\n for (var i = 0; i < first.length; ++i) {\n var span = first[i];\n if (span.to == null) {\n var found = getMarkedSpanFor(last, span.marker);\n if (!found) { span.to = startCh; }\n else if (sameLine) { span.to = found.to == null ? null : found.to + offset; }\n }\n }\n }\n if (last) {\n // Fix up .from in last (or move them into first in case of sameLine)\n for (var i$1 = 0; i$1 < last.length; ++i$1) {\n var span$1 = last[i$1];\n if (span$1.to != null) { span$1.to += offset; }\n if (span$1.from == null) {\n var found$1 = getMarkedSpanFor(first, span$1.marker);\n if (!found$1) {\n span$1.from = offset;\n if (sameLine) { (first || (first = [])).push(span$1); }\n }\n } else {\n span$1.from += offset;\n if (sameLine) { (first || (first = [])).push(span$1); }\n }\n }\n }\n // Make sure we didn't create any zero-length spans\n if (first) { first = clearEmptySpans(first); }\n if (last && last != first) { last = clearEmptySpans(last); }\n\n var newMarkers = [first];\n if (!sameLine) {\n // Fill gap with whole-line-spans\n var gap = change.text.length - 2, gapMarkers;\n if (gap > 0 && first)\n { for (var i$2 = 0; i$2 < first.length; ++i$2)\n { if (first[i$2].to == null)\n { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)); } } }\n for (var i$3 = 0; i$3 < gap; ++i$3)\n { newMarkers.push(gapMarkers); }\n newMarkers.push(last);\n }\n return newMarkers\n }", "function stretchSpansOverChange(doc, change) {\n if (change.full) { return null }\n var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;\n var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;\n if (!oldFirst && !oldLast) { return null }\n\n var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;\n // Get the spans that 'stick out' on both sides\n var first = markedSpansBefore(oldFirst, startCh, isInsert);\n var last = markedSpansAfter(oldLast, endCh, isInsert);\n\n // Next, merge those two ends\n var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);\n if (first) {\n // Fix up .to properties of first\n for (var i = 0; i < first.length; ++i) {\n var span = first[i];\n if (span.to == null) {\n var found = getMarkedSpanFor(last, span.marker);\n if (!found) { span.to = startCh; }\n else if (sameLine) { span.to = found.to == null ? null : found.to + offset; }\n }\n }\n }\n if (last) {\n // Fix up .from in last (or move them into first in case of sameLine)\n for (var i$1 = 0; i$1 < last.length; ++i$1) {\n var span$1 = last[i$1];\n if (span$1.to != null) { span$1.to += offset; }\n if (span$1.from == null) {\n var found$1 = getMarkedSpanFor(first, span$1.marker);\n if (!found$1) {\n span$1.from = offset;\n if (sameLine) { (first || (first = [])).push(span$1); }\n }\n } else {\n span$1.from += offset;\n if (sameLine) { (first || (first = [])).push(span$1); }\n }\n }\n }\n // Make sure we didn't create any zero-length spans\n if (first) { first = clearEmptySpans(first); }\n if (last && last != first) { last = clearEmptySpans(last); }\n\n var newMarkers = [first];\n if (!sameLine) {\n // Fill gap with whole-line-spans\n var gap = change.text.length - 2, gapMarkers;\n if (gap > 0 && first)\n { for (var i$2 = 0; i$2 < first.length; ++i$2)\n { if (first[i$2].to == null)\n { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)); } } }\n for (var i$3 = 0; i$3 < gap; ++i$3)\n { newMarkers.push(gapMarkers); }\n newMarkers.push(last);\n }\n return newMarkers\n }", "function stretchSpansOverChange(doc, change) {\n if (change.full) { return null }\n var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;\n var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;\n if (!oldFirst && !oldLast) { return null }\n\n var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;\n // Get the spans that 'stick out' on both sides\n var first = markedSpansBefore(oldFirst, startCh, isInsert);\n var last = markedSpansAfter(oldLast, endCh, isInsert);\n\n // Next, merge those two ends\n var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);\n if (first) {\n // Fix up .to properties of first\n for (var i = 0; i < first.length; ++i) {\n var span = first[i];\n if (span.to == null) {\n var found = getMarkedSpanFor(last, span.marker);\n if (!found) { span.to = startCh; }\n else if (sameLine) { span.to = found.to == null ? null : found.to + offset; }\n }\n }\n }\n if (last) {\n // Fix up .from in last (or move them into first in case of sameLine)\n for (var i$1 = 0; i$1 < last.length; ++i$1) {\n var span$1 = last[i$1];\n if (span$1.to != null) { span$1.to += offset; }\n if (span$1.from == null) {\n var found$1 = getMarkedSpanFor(first, span$1.marker);\n if (!found$1) {\n span$1.from = offset;\n if (sameLine) { (first || (first = [])).push(span$1); }\n }\n } else {\n span$1.from += offset;\n if (sameLine) { (first || (first = [])).push(span$1); }\n }\n }\n }\n // Make sure we didn't create any zero-length spans\n if (first) { first = clearEmptySpans(first); }\n if (last && last != first) { last = clearEmptySpans(last); }\n\n var newMarkers = [first];\n if (!sameLine) {\n // Fill gap with whole-line-spans\n var gap = change.text.length - 2, gapMarkers;\n if (gap > 0 && first)\n { for (var i$2 = 0; i$2 < first.length; ++i$2)\n { if (first[i$2].to == null)\n { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)); } } }\n for (var i$3 = 0; i$3 < gap; ++i$3)\n { newMarkers.push(gapMarkers); }\n newMarkers.push(last);\n }\n return newMarkers\n }", "function stretchSpansOverChange(doc, change) {\n if (change.full) { return null }\n var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;\n var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;\n if (!oldFirst && !oldLast) { return null }\n\n var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;\n // Get the spans that 'stick out' on both sides\n var first = markedSpansBefore(oldFirst, startCh, isInsert);\n var last = markedSpansAfter(oldLast, endCh, isInsert);\n\n // Next, merge those two ends\n var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);\n if (first) {\n // Fix up .to properties of first\n for (var i = 0; i < first.length; ++i) {\n var span = first[i];\n if (span.to == null) {\n var found = getMarkedSpanFor(last, span.marker);\n if (!found) { span.to = startCh; }\n else if (sameLine) { span.to = found.to == null ? null : found.to + offset; }\n }\n }\n }\n if (last) {\n // Fix up .from in last (or move them into first in case of sameLine)\n for (var i$1 = 0; i$1 < last.length; ++i$1) {\n var span$1 = last[i$1];\n if (span$1.to != null) { span$1.to += offset; }\n if (span$1.from == null) {\n var found$1 = getMarkedSpanFor(first, span$1.marker);\n if (!found$1) {\n span$1.from = offset;\n if (sameLine) { (first || (first = [])).push(span$1); }\n }\n } else {\n span$1.from += offset;\n if (sameLine) { (first || (first = [])).push(span$1); }\n }\n }\n }\n // Make sure we didn't create any zero-length spans\n if (first) { first = clearEmptySpans(first); }\n if (last && last != first) { last = clearEmptySpans(last); }\n\n var newMarkers = [first];\n if (!sameLine) {\n // Fill gap with whole-line-spans\n var gap = change.text.length - 2, gapMarkers;\n if (gap > 0 && first)\n { for (var i$2 = 0; i$2 < first.length; ++i$2)\n { if (first[i$2].to == null)\n { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)); } } }\n for (var i$3 = 0; i$3 < gap; ++i$3)\n { newMarkers.push(gapMarkers); }\n newMarkers.push(last);\n }\n return newMarkers\n }" ]
[ "0.7517424", "0.75166106", "0.7476101", "0.7449859", "0.7449859", "0.7445846", "0.7444705", "0.7421281", "0.7421281", "0.7421281", "0.7421281", "0.7421281", "0.7421281", "0.7421281", "0.7408827", "0.7380149", "0.7380149", "0.7374359", "0.7374359", "0.7374359", "0.7374359", "0.7374359", "0.7374359", "0.7374359", "0.7374359", "0.7374359", "0.7374359", "0.7374359", "0.733338", "0.6776084", "0.6776084", "0.6776084", "0.6776084", "0.6666464", "0.598164", "0.5928826", "0.5900188", "0.5900188", "0.5900188", "0.5900188", "0.5900188", "0.5900188", "0.5900188", "0.5900188", "0.5900188", "0.5900188", "0.5900188", "0.5900188", "0.5900188", "0.5900188", "0.5900188", "0.5900188", "0.5900188", "0.58584416", "0.58584416", "0.58584416", "0.58584416", "0.58584416", "0.58584416", "0.58584416", "0.58584416", "0.58584416", "0.58584416", "0.58584416", "0.58584416", "0.58584416", "0.5834559", "0.5818789", "0.56701314", "0.5658825", "0.565299", "0.565299", "0.565299", "0.565299", "0.565299", "0.565299", "0.565299", "0.565299", "0.565299", "0.565299", "0.565299", "0.565299", "0.565299", "0.565299" ]
0.741919
27
Used by replaceSelections to allow moving the selection to the start or around the replaced test. Hint may be "start" or "around".
function computeReplacedSel(doc, changes, hint) { var out = []; var oldPrev = Pos(doc.first, 0), newPrev = oldPrev; for (var i = 0; i < changes.length; i++) { var change = changes[i]; var from = offsetPos(change.from, oldPrev, newPrev); var to = offsetPos(changeEnd(change), oldPrev, newPrev); oldPrev = change.to; newPrev = to; if (hint == "around") { var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0; out[i] = new Range(inv ? to : from, inv ? from : to); } else { out[i] = new Range(from, from); } } return new Selection(out, doc.sel.primIndex) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "replaceBeforeCursor(start, text) {\n this.insertBetween(start, this.el.selectionStart, text);\n }", "function moveSelection(event) {\n event.preventDefault();\n event.stopPropagation();\n console.log('Calling moveSelection');\n \n optimalApp.selectionPosition[0] = event.pageX - optimalApp.selectionOffset[0];\n optimalApp.selectionPosition[1] = event.pageY - optimalApp.selectionOffset[1];\n \n updateSelection();\n}", "moveNextPosition() {\n if (isNullOrUndefined(this.start)) {\n return;\n }\n if (this.isEmpty) {\n this.start.moveNextPosition();\n this.end.setPositionInternal(this.start);\n }\n this.updateForwardSelection();\n this.upDownSelectionLength = this.start.location.x;\n this.fireSelectionChanged(true);\n }", "function wrapRange(editor, wsEdit, shifts, newSelections, i, shift, cursor, range, isSelected, startPtn, endPtn) {\n if (endPtn == undefined) {\n endPtn = startPtn;\n }\n let text = editor.document.getText(range);\n const prevSelection = newSelections[i];\n const ptnLength = (startPtn + endPtn).length;\n let newCursorPos = cursor.with({ character: cursor.character + shift });\n let newSelection;\n if (isWrapped(text, startPtn)) {\n // remove start/end patterns from range\n wsEdit.replace(editor.document.uri, range, text.substr(startPtn.length, text.length - ptnLength));\n shifts.push([range.end, -ptnLength]);\n // Fix cursor position\n if (!isSelected) {\n if (!range.isEmpty) { // means quick styling\n if (cursor.character == range.end.character) {\n newCursorPos = cursor.with({ character: cursor.character + shift - ptnLength });\n }\n else {\n newCursorPos = cursor.with({ character: cursor.character + shift - startPtn.length });\n }\n }\n else { // means `**|**` -> `|`\n newCursorPos = cursor.with({ character: cursor.character + shift + startPtn.length });\n }\n newSelection = new vscode_1.Selection(newCursorPos, newCursorPos);\n }\n else {\n newSelection = new vscode_1.Selection(prevSelection.start.with({ character: prevSelection.start.character + shift }), prevSelection.end.with({ character: prevSelection.end.character + shift - ptnLength }));\n }\n }\n else {\n // add start/end patterns around range\n wsEdit.replace(editor.document.uri, range, startPtn + text + endPtn);\n shifts.push([range.end, ptnLength]);\n // Fix cursor position\n if (!isSelected) {\n if (!range.isEmpty) { // means quick styling\n if (cursor.character == range.end.character) {\n newCursorPos = cursor.with({ character: cursor.character + shift + ptnLength });\n }\n else {\n newCursorPos = cursor.with({ character: cursor.character + shift + startPtn.length });\n }\n }\n else { // means `|` -> `**|**`\n newCursorPos = cursor.with({ character: cursor.character + shift + startPtn.length });\n }\n newSelection = new vscode_1.Selection(newCursorPos, newCursorPos);\n }\n else {\n newSelection = new vscode_1.Selection(prevSelection.start.with({ character: prevSelection.start.character + shift }), prevSelection.end.with({ character: prevSelection.end.character + shift + ptnLength }));\n }\n }\n newSelections[i] = newSelection;\n}", "moveToParagraphStart() {\n if (this.isForward) {\n this.start.paragraphStartInternal(this, false);\n this.end.setPositionInternal(this.start);\n this.upDownSelectionLength = this.end.location.x;\n }\n else {\n this.end.paragraphStartInternal(this, false);\n this.start.setPositionInternal(this.end);\n this.upDownSelectionLength = this.start.location.x;\n }\n this.fireSelectionChanged(true);\n }", "moveForward() {\n let indexInInline = 0;\n let inlineObj = this.currentWidget.getInline(this.offset, indexInInline);\n let inline = inlineObj.element;\n indexInInline = inlineObj.index;\n if (!isNullOrUndefined(inline)) {\n if (!this.owner.selection.isEmpty && indexInInline === inline.length && inline instanceof FieldElementBox\n && inline.fieldType === 1) {\n let hierarchicalIndex = this.owner.selection.start.getHierarchicalIndexInternal();\n // tslint:disable-next-line:max-line-length\n let fieldBeginOffset = inline.fieldBegin.line.getOffset(inline.fieldBegin, 0);\n // tslint:disable-next-line:max-line-length\n let fieldBeginIndex = this.getHierarchicalIndex(inline.fieldBegin.line, fieldBeginOffset.toString());\n if (!TextPosition.isForwardSelection(hierarchicalIndex, fieldBeginIndex)) {\n //If field begin is before selection start, move selection start to field begin.\n // tslint:disable-next-line:max-line-length\n this.owner.selection.start.setPositionParagraph(inline.fieldBegin.line, fieldBeginOffset);\n return;\n }\n }\n inline = this.selection.getNextRenderedElementBox(inline, indexInInline);\n }\n if (inline instanceof FieldElementBox && !isNullOrUndefined(inline.fieldEnd)) {\n let selectionStartParagraph = this.owner.selection.start.paragraph;\n let selectionStartIndex = 0;\n // tslint:disable-next-line:max-line-length\n let selectionStartInlineObj = selectionStartParagraph.getInline(this.owner.selection.start.offset, selectionStartIndex);\n let selectionStartInline = selectionStartInlineObj.element;\n selectionStartIndex = selectionStartInlineObj.index;\n let nextRenderInline = this.selection.getNextRenderedElementBox(selectionStartInline, selectionStartIndex);\n if (nextRenderInline === inline) {\n this.moveNextPositionInternal(inline);\n }\n else {\n //If selection start is before field begin, extend selection end to field end.\n inline = inline.fieldEnd;\n this.currentWidget = inline.line;\n this.offset = this.currentWidget.getOffset(inline, 1);\n //Updates physical position in current page.\n this.updatePhysicalPosition(true);\n return;\n }\n }\n else if ((inline instanceof FieldElementBox)\n && (inline.fieldType === 0 || inline.fieldType === 1)) {\n this.currentWidget = inline.line;\n this.offset = this.currentWidget.getOffset(inline, 1);\n }\n indexInInline = 0;\n let nextOffset = this.selection.getNextValidOffset(this.currentWidget, this.offset);\n let length = this.selection.getLineLength(this.currentWidget);\n let isParagraphEnd = this.selection.isParagraphLastLine(this.currentWidget);\n if (this.offset < nextOffset) {\n this.offset = nextOffset;\n let inlineObj = this.currentWidget.getInline(this.offset, indexInInline);\n inline = inlineObj.element;\n indexInInline = inlineObj.index;\n if (!isNullOrUndefined(inline) && indexInInline === inline.length && inline.nextNode instanceof FieldElementBox) {\n let nextValidInline = this.selection.getNextValidElement(inline.nextNode);\n //Moves to field end mark.\n if (nextValidInline instanceof FieldElementBox && nextValidInline.fieldType === 1) {\n inline = nextValidInline;\n this.offset = this.currentWidget.getOffset(inline, 1);\n }\n }\n }\n else if (this.offset === nextOffset && this.offset < length + 1 && isParagraphEnd) {\n this.offset = length + 1;\n }\n else {\n this.updateOffsetToNextParagraph(indexInInline, true);\n }\n //Gets physical position in current page.\n this.updatePhysicalPosition(true);\n }", "movePreviousPosition() {\n if (isNullOrUndefined(this.start)) {\n return;\n }\n if (this.isEmpty) {\n this.start.movePreviousPosition();\n this.end.setPositionInternal(this.start);\n }\n this.updateBackwardSelection();\n this.upDownSelectionLength = this.start.location.x;\n this.fireSelectionChanged(true);\n }", "function keyCommandMoveSelectionToStartOfBlock(editorState){var selection=editorState.getSelection();var startKey=selection.getStartKey();return EditorState.set(editorState,{selection:selection.merge({anchorKey:startKey,anchorOffset:0,focusKey:startKey,focusOffset:0,isBackward:false}),forceSelection:true});}", "setSelectionRange(start, end, direction) {\n this.getInput().setSelectionRange(start, end, direction);\n }", "function moveStart(rng) {\n\t\t\tvar container = rng.startContainer,\n\t\t\t\t\toffset = rng.startOffset, isAtEndOfText,\n\t\t\t\t\twalker, node, nodes, tmpNode;\n\n\t\t\tif (rng.startContainer == rng.endContainer) {\n\t\t\t\tif (isInlineBlock(rng.startContainer.childNodes[rng.startOffset])) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Convert text node into index if possible\n\t\t\tif (container.nodeType == 3 && offset >= container.nodeValue.length) {\n\t\t\t\t// Get the parent container location and walk from there\n\t\t\t\toffset = nodeIndex(container);\n\t\t\t\tcontainer = container.parentNode;\n\t\t\t\tisAtEndOfText = true;\n\t\t\t}\n\n\t\t\t// Move startContainer/startOffset in to a suitable node\n\t\t\tif (container.nodeType == 1) {\n\t\t\t\tnodes = container.childNodes;\n\t\t\t\tcontainer = nodes[Math.min(offset, nodes.length - 1)];\n\t\t\t\twalker = new TreeWalker(container, dom.getParent(container, dom.isBlock));\n\n\t\t\t\t// If offset is at end of the parent node walk to the next one\n\t\t\t\tif (offset > nodes.length - 1 || isAtEndOfText) {\n\t\t\t\t\twalker.next();\n\t\t\t\t}\n\n\t\t\t\tfor (node = walker.current(); node; node = walker.next()) {\n\t\t\t\t\tif (node.nodeType == 3 && !isWhiteSpaceNode(node)) {\n\t\t\t\t\t\t// IE has a \"neat\" feature where it moves the start node into the closest element\n\t\t\t\t\t\t// we can avoid this by inserting an element before it and then remove it after we set the selection\n\t\t\t\t\t\ttmpNode = dom.create('a', {'data-mce-bogus': 'all'}, INVISIBLE_CHAR);\n\t\t\t\t\t\tnode.parentNode.insertBefore(tmpNode, node);\n\n\t\t\t\t\t\t// Set selection and remove tmpNode\n\t\t\t\t\t\trng.setStart(node, 0);\n\t\t\t\t\t\tselection.setRng(rng);\n\t\t\t\t\t\tdom.remove(tmpNode);\n\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}", "function moveStart(rng) {\n\t\t\tvar container = rng.startContainer,\n\t\t\t\t\toffset = rng.startOffset, isAtEndOfText,\n\t\t\t\t\twalker, node, nodes, tmpNode;\n\n\t\t\tif (rng.startContainer == rng.endContainer) {\n\t\t\t\tif (isInlineBlock(rng.startContainer.childNodes[rng.startOffset])) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Convert text node into index if possible\n\t\t\tif (container.nodeType == 3 && offset >= container.nodeValue.length) {\n\t\t\t\t// Get the parent container location and walk from there\n\t\t\t\toffset = nodeIndex(container);\n\t\t\t\tcontainer = container.parentNode;\n\t\t\t\tisAtEndOfText = true;\n\t\t\t}\n\n\t\t\t// Move startContainer/startOffset in to a suitable node\n\t\t\tif (container.nodeType == 1) {\n\t\t\t\tnodes = container.childNodes;\n\t\t\t\tcontainer = nodes[Math.min(offset, nodes.length - 1)];\n\t\t\t\twalker = new TreeWalker(container, dom.getParent(container, dom.isBlock));\n\n\t\t\t\t// If offset is at end of the parent node walk to the next one\n\t\t\t\tif (offset > nodes.length - 1 || isAtEndOfText) {\n\t\t\t\t\twalker.next();\n\t\t\t\t}\n\n\t\t\t\tfor (node = walker.current(); node; node = walker.next()) {\n\t\t\t\t\tif (node.nodeType == 3 && !isWhiteSpaceNode(node)) {\n\t\t\t\t\t\t// IE has a \"neat\" feature where it moves the start node into the closest element\n\t\t\t\t\t\t// we can avoid this by inserting an element before it and then remove it after we set the selection\n\t\t\t\t\t\ttmpNode = dom.create('a', {'data-mce-bogus': 'all'}, INVISIBLE_CHAR);\n\t\t\t\t\t\tnode.parentNode.insertBefore(tmpNode, node);\n\n\t\t\t\t\t\t// Set selection and remove tmpNode\n\t\t\t\t\t\trng.setStart(node, 0);\n\t\t\t\t\t\tselection.setRng(rng);\n\t\t\t\t\t\tdom.remove(tmpNode);\n\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}", "function moveStart(rng) {\n\t\t\tvar container = rng.startContainer,\n\t\t\t\t\toffset = rng.startOffset, isAtEndOfText,\n\t\t\t\t\twalker, node, nodes, tmpNode;\n\n\t\t\tif (rng.startContainer == rng.endContainer) {\n\t\t\t\tif (isInlineBlock(rng.startContainer.childNodes[rng.startOffset])) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Convert text node into index if possible\n\t\t\tif (container.nodeType == 3 && offset >= container.nodeValue.length) {\n\t\t\t\t// Get the parent container location and walk from there\n\t\t\t\toffset = nodeIndex(container);\n\t\t\t\tcontainer = container.parentNode;\n\t\t\t\tisAtEndOfText = true;\n\t\t\t}\n\n\t\t\t// Move startContainer/startOffset in to a suitable node\n\t\t\tif (container.nodeType == 1) {\n\t\t\t\tnodes = container.childNodes;\n\t\t\t\tcontainer = nodes[Math.min(offset, nodes.length - 1)];\n\t\t\t\twalker = new TreeWalker(container, dom.getParent(container, dom.isBlock));\n\n\t\t\t\t// If offset is at end of the parent node walk to the next one\n\t\t\t\tif (offset > nodes.length - 1 || isAtEndOfText) {\n\t\t\t\t\twalker.next();\n\t\t\t\t}\n\n\t\t\t\tfor (node = walker.current(); node; node = walker.next()) {\n\t\t\t\t\tif (node.nodeType == 3 && !isWhiteSpaceNode(node)) {\n\t\t\t\t\t\t// IE has a \"neat\" feature where it moves the start node into the closest element\n\t\t\t\t\t\t// we can avoid this by inserting an element before it and then remove it after we set the selection\n\t\t\t\t\t\ttmpNode = dom.create('a', {'data-mce-bogus': 'all'}, INVISIBLE_CHAR);\n\t\t\t\t\t\tnode.parentNode.insertBefore(tmpNode, node);\n\n\t\t\t\t\t\t// Set selection and remove tmpNode\n\t\t\t\t\t\trng.setStart(node, 0);\n\t\t\t\t\t\tselection.setRng(rng);\n\t\t\t\t\t\tdom.remove(tmpNode);\n\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}", "function moveSelected(delta) {\n setSelectedIndex(selectedIndex + delta);\n }", "replaceSelection(text) {\n if (typeof text == \"string\")\n text = this.toText(text);\n return this.changeByRange(range => ({ changes: { from: range.from, to: range.to, insert: text },\n range: EditorSelection.cursor(range.from + text.length) }));\n }", "function setElementSelection(that, start, end) {\n if (that.selectionStart === undefined) {\n that.focus();\n var r = that.createTextRange();\n r.collapse(true);\n r.moveEnd('character', end);\n r.moveStart('character', start);\n r.select();\n } else {\n that.selectionStart = start;\n that.selectionEnd = end;\n }\n }", "function setElementSelection(that, start, end) {\n if (that.selectionStart === undefined) {\n that.focus();\n var r = that.createTextRange();\n r.collapse(true);\n r.moveEnd('character', end);\n r.moveStart('character', start);\n r.select();\n } else {\n that.selectionStart = start;\n that.selectionEnd = end;\n }\n }", "function setElementSelection(that, start, end) {\n if (that.selectionStart === undefined) {\n that.focus();\n var r = that.createTextRange();\n r.collapse(true);\n r.moveEnd('character', end);\n r.moveStart('character', start);\n r.select();\n } else {\n that.selectionStart = start;\n that.selectionEnd = end;\n }\n }", "extendToLineStart() {\n if (isNullOrUndefined(this.start)) {\n return;\n }\n this.end.moveToLineStartInternal(this, true);\n this.upDownSelectionLength = this.end.location.x;\n this.fireSelectionChanged(true);\n }", "function moveSelected(delta) {\n var idx = selectedIndex + delta;\n idx = Math.max(idx, 0);\n idx = Math.min(idx, filteredDeclarations.length - 1);\n\n // select\n setSelectedIndex(idx)\n refreshSelected();\n }", "navigateLineStart() {\n this.selection.moveCursorLineStart();\n this.clearSelection();\n }", "move(editor) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var {\n selection\n } = editor;\n var {\n distance = 1,\n unit = 'character',\n reverse = false\n } = options;\n var {\n edge = null\n } = options;\n\n if (!selection) {\n return;\n }\n\n if (edge === 'start') {\n edge = Range.isBackward(selection) ? 'focus' : 'anchor';\n }\n\n if (edge === 'end') {\n edge = Range.isBackward(selection) ? 'anchor' : 'focus';\n }\n\n var {\n anchor,\n focus\n } = selection;\n var opts = {\n distance,\n unit\n };\n var props = {};\n\n if (edge == null || edge === 'anchor') {\n var point = reverse ? Editor.before(editor, anchor, opts) : Editor.after(editor, anchor, opts);\n\n if (point) {\n props.anchor = point;\n }\n }\n\n if (edge == null || edge === 'focus') {\n var _point = reverse ? Editor.before(editor, focus, opts) : Editor.after(editor, focus, opts);\n\n if (_point) {\n props.focus = _point;\n }\n }\n\n Transforms.setSelection(editor, props);\n }", "move(editor) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var {\n selection\n } = editor;\n var {\n distance = 1,\n unit = 'character',\n reverse = false\n } = options;\n var {\n edge = null\n } = options;\n\n if (!selection) {\n return;\n }\n\n if (edge === 'start') {\n edge = Range.isBackward(selection) ? 'focus' : 'anchor';\n }\n\n if (edge === 'end') {\n edge = Range.isBackward(selection) ? 'anchor' : 'focus';\n }\n\n var {\n anchor,\n focus\n } = selection;\n var opts = {\n distance,\n unit\n };\n var props = {};\n\n if (edge == null || edge === 'anchor') {\n var point = reverse ? Editor.before(editor, anchor, opts) : Editor.after(editor, anchor, opts);\n\n if (point) {\n props.anchor = point;\n }\n }\n\n if (edge == null || edge === 'focus') {\n var _point = reverse ? Editor.before(editor, focus, opts) : Editor.after(editor, focus, opts);\n\n if (_point) {\n props.focus = _point;\n }\n }\n\n Transforms.setSelection(editor, props);\n }", "function leftButtonSelect(cm, e, start, type, addNew) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(e);\n\n var ourRange, ourIndex, startSel = doc.sel;\n if (addNew && !e.shiftKey) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n ourRange = doc.sel.ranges[ourIndex];\n else\n ourRange = new Range(start, start);\n } else {\n ourRange = doc.sel.primary();\n }\n\n if (e.altKey) {\n type = \"rect\";\n if (!addNew) ourRange = new Range(start, start);\n start = posFromMouse(cm, e, true, true);\n ourIndex = -1;\n } else if (type == \"double\") {\n var word = cm.findWordAt(start);\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, word.anchor, word.head);\n else\n ourRange = word;\n } else if (type == \"triple\") {\n var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, line.anchor, line.head);\n else\n ourRange = line;\n } else {\n ourRange = extendRange(doc, ourRange, start);\n }\n\n if (!addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex > -1) {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n } else {\n ourIndex = doc.sel.ranges.length;\n setSelection(doc, normalizeSelection(doc.sel.ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) return;\n lastPos = pos;\n\n if (type == \"rect\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\n else if (text.length > leftPos)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\n }\n if (!ranges.length) ranges.push(new Range(start, start));\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var anchor = oldRange.anchor, head = pos;\n if (type != \"single\") {\n if (type == \"double\")\n var range = cm.findWordAt(pos);\n else\n var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));\n if (cmp(range.anchor, anchor) > 0) {\n head = range.head;\n anchor = minPos(oldRange.from(), range.anchor);\n } else {\n head = range.anchor;\n anchor = maxPos(oldRange.to(), range.head);\n }\n }\n var ranges = startSel.ranges.slice(0);\n ranges[ourIndex] = new Range(clipPos(doc, anchor), head);\n setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, type == \"rect\");\n if (!cur) return;\n if (cmp(cur, lastPos) != 0) {\n ensureFocus(cm);\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) setTimeout(operation(cm, function() {\n if (counter != curCount) return;\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50);\n }\n }\n\n function done(e) {\n counter = Infinity;\n e_preventDefault(e);\n focusInput(cm);\n off(document, \"mousemove\", move);\n off(document, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function(e) {\n if (!e_button(e)) done(e);\n else extend(e);\n });\n var up = operation(cm, done);\n on(document, \"mousemove\", move);\n on(document, \"mouseup\", up);\n }", "extendToWordStartInternal(isNavigation) {\n if (isNullOrUndefined(this.start)) {\n return;\n }\n let isCellSelected = this.extendToWordStartEnd();\n if (isCellSelected) {\n this.end.moveToPreviousParagraphInTable(this);\n }\n else {\n if (isNavigation && this.end.isCurrentParaBidi) {\n this.end.moveToWordEndInternal(isNavigation ? 0 : 1, false);\n }\n else {\n this.end.moveToWordStartInternal(isNavigation ? 0 : 1);\n }\n }\n if (isNavigation) {\n this.start.setPositionInternal(this.end);\n }\n this.upDownSelectionLength = this.end.location.x;\n this.fireSelectionChanged(true);\n }", "replace(tr, content = Slice.empty) {\n let lastNode = content.content.lastChild, lastParent = null;\n for (let i = 0; i < content.openEnd; i++) {\n lastParent = lastNode;\n lastNode = lastNode.lastChild;\n }\n let mapFrom = tr.steps.length, ranges = this.ranges;\n for (let i = 0; i < ranges.length; i++) {\n let { $from, $to } = ranges[i], mapping = tr.mapping.slice(mapFrom);\n tr.replaceRange(mapping.map($from.pos), mapping.map($to.pos), i ? Slice.empty : content);\n if (i == 0)\n selectionToInsertionEnd$1(tr, mapFrom, (lastNode ? lastNode.isInline : lastParent && lastParent.isTextblock) ? -1 : 1);\n }\n }", "extendToPreviousLine() {\n if (isNullOrUndefined(this.start)) {\n return;\n }\n this.end.moveToPreviousLine(this, this.upDownSelectionLength);\n this.fireSelectionChanged(true);\n }", "function leftButtonSelect(cm, e, start, type, addNew) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(e);\n\n var ourRange, ourIndex, startSel = doc.sel;\n if (addNew && !e.shiftKey) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n ourRange = doc.sel.ranges[ourIndex];\n else\n ourRange = new Range(start, start);\n } else {\n ourRange = doc.sel.primary();\n }\n\n if (e.altKey) {\n type = \"rect\";\n if (!addNew) ourRange = new Range(start, start);\n start = posFromMouse(cm, e, true, true);\n ourIndex = -1;\n } else if (type == \"double\") {\n var word = findWordAt(cm, start);\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, word.anchor, word.head);\n else\n ourRange = word;\n } else if (type == \"triple\") {\n var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, line.anchor, line.head);\n else\n ourRange = line;\n } else {\n ourRange = extendRange(doc, ourRange, start);\n }\n\n if (!addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex > -1) {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n } else {\n ourIndex = doc.sel.ranges.length;\n setSelection(doc, normalizeSelection(doc.sel.ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) return;\n lastPos = pos;\n\n if (type == \"rect\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\n else if (text.length > leftPos)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\n }\n if (!ranges.length) ranges.push(new Range(start, start));\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var anchor = oldRange.anchor, head = pos;\n if (type != \"single\") {\n if (type == \"double\")\n var range = findWordAt(cm, pos);\n else\n var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));\n if (cmp(range.anchor, anchor) > 0) {\n head = range.head;\n anchor = minPos(oldRange.from(), range.anchor);\n } else {\n head = range.anchor;\n anchor = maxPos(oldRange.to(), range.head);\n }\n }\n var ranges = startSel.ranges.slice(0);\n ranges[ourIndex] = new Range(clipPos(doc, anchor), head);\n setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, type == \"rect\");\n if (!cur) return;\n if (cmp(cur, lastPos) != 0) {\n ensureFocus(cm);\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) setTimeout(operation(cm, function() {\n if (counter != curCount) return;\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50);\n }\n }\n\n function done(e) {\n counter = Infinity;\n e_preventDefault(e);\n focusInput(cm);\n off(document, \"mousemove\", move);\n off(document, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function(e) {\n if (!e_button(e)) done(e);\n else extend(e);\n });\n var up = operation(cm, done);\n on(document, \"mousemove\", move);\n on(document, \"mouseup\", up);\n }", "function leftButtonSelect(cm, e, start, type, addNew) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(e);\n\n var ourRange, ourIndex, startSel = doc.sel;\n if (addNew && !e.shiftKey) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n ourRange = doc.sel.ranges[ourIndex];\n else\n ourRange = new Range(start, start);\n } else {\n ourRange = doc.sel.primary();\n }\n\n if (e.altKey) {\n type = \"rect\";\n if (!addNew) ourRange = new Range(start, start);\n start = posFromMouse(cm, e, true, true);\n ourIndex = -1;\n } else if (type == \"double\") {\n var word = findWordAt(cm, start);\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, word.anchor, word.head);\n else\n ourRange = word;\n } else if (type == \"triple\") {\n var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, line.anchor, line.head);\n else\n ourRange = line;\n } else {\n ourRange = extendRange(doc, ourRange, start);\n }\n\n if (!addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex > -1) {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n } else {\n ourIndex = doc.sel.ranges.length;\n setSelection(doc, normalizeSelection(doc.sel.ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) return;\n lastPos = pos;\n\n if (type == \"rect\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\n else if (text.length > leftPos)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\n }\n if (!ranges.length) ranges.push(new Range(start, start));\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var anchor = oldRange.anchor, head = pos;\n if (type != \"single\") {\n if (type == \"double\")\n var range = findWordAt(cm, pos);\n else\n var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));\n if (cmp(range.anchor, anchor) > 0) {\n head = range.head;\n anchor = minPos(oldRange.from(), range.anchor);\n } else {\n head = range.anchor;\n anchor = maxPos(oldRange.to(), range.head);\n }\n }\n var ranges = startSel.ranges.slice(0);\n ranges[ourIndex] = new Range(clipPos(doc, anchor), head);\n setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, type == \"rect\");\n if (!cur) return;\n if (cmp(cur, lastPos) != 0) {\n ensureFocus(cm);\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) setTimeout(operation(cm, function() {\n if (counter != curCount) return;\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50);\n }\n }\n\n function done(e) {\n counter = Infinity;\n e_preventDefault(e);\n focusInput(cm);\n off(document, \"mousemove\", move);\n off(document, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function(e) {\n if (!e_button(e)) done(e);\n else extend(e);\n });\n var up = operation(cm, done);\n on(document, \"mousemove\", move);\n on(document, \"mouseup\", up);\n }", "function leftButtonSelect(cm, e, start, type, addNew) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(e);\n\n var ourRange, ourIndex, startSel = doc.sel;\n if (addNew && !e.shiftKey) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n ourRange = doc.sel.ranges[ourIndex];\n else\n ourRange = new Range(start, start);\n } else {\n ourRange = doc.sel.primary();\n }\n\n if (e.altKey) {\n type = \"rect\";\n if (!addNew) ourRange = new Range(start, start);\n start = posFromMouse(cm, e, true, true);\n ourIndex = -1;\n } else if (type == \"double\") {\n var word = findWordAt(cm, start);\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, word.anchor, word.head);\n else\n ourRange = word;\n } else if (type == \"triple\") {\n var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, line.anchor, line.head);\n else\n ourRange = line;\n } else {\n ourRange = extendRange(doc, ourRange, start);\n }\n\n if (!addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex > -1) {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n } else {\n ourIndex = doc.sel.ranges.length;\n setSelection(doc, normalizeSelection(doc.sel.ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) return;\n lastPos = pos;\n\n if (type == \"rect\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\n else if (text.length > leftPos)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\n }\n if (!ranges.length) ranges.push(new Range(start, start));\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var anchor = oldRange.anchor, head = pos;\n if (type != \"single\") {\n if (type == \"double\")\n var range = findWordAt(cm, pos);\n else\n var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));\n if (cmp(range.anchor, anchor) > 0) {\n head = range.head;\n anchor = minPos(oldRange.from(), range.anchor);\n } else {\n head = range.anchor;\n anchor = maxPos(oldRange.to(), range.head);\n }\n }\n var ranges = startSel.ranges.slice(0);\n ranges[ourIndex] = new Range(clipPos(doc, anchor), head);\n setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, type == \"rect\");\n if (!cur) return;\n if (cmp(cur, lastPos) != 0) {\n ensureFocus(cm);\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) setTimeout(operation(cm, function() {\n if (counter != curCount) return;\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50);\n }\n }\n\n function done(e) {\n counter = Infinity;\n e_preventDefault(e);\n focusInput(cm);\n off(document, \"mousemove\", move);\n off(document, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function(e) {\n if (!e_button(e)) done(e);\n else extend(e);\n });\n var up = operation(cm, done);\n on(document, \"mousemove\", move);\n on(document, \"mouseup\", up);\n }", "moveToWordEndInternal(type, excludeSpace) {\n // type === 0 -------->CTRL+ARROW Navigation\n // type === 1 -------->CTRL+SHIFT+ARROW Selection\n // type === 2 -------->Double-tap Word Selection\n let incrementValue = 0;\n let endOffset = this.currentWidget.getEndOffset();\n if (this.selection.isParagraphFirstLine(this.currentWidget)) {\n if (this.currentWidget.children[0] instanceof ListTextElementBox) {\n incrementValue = 1;\n }\n if (this.currentWidget.children[1] instanceof ListTextElementBox) {\n incrementValue = 2;\n }\n }\n if (this.offset + incrementValue === endOffset || this.offset === endOffset + 1) {\n if (this.offset === endOffset && type !== 0) {\n this.setPositionParagraph(this.currentWidget, endOffset + 1);\n }\n else {\n let nextParagraph = this.selection.getNextParagraphBlock(this.currentWidget.paragraph);\n if (isNullOrUndefined(nextParagraph)) {\n return;\n }\n this.currentWidget = nextParagraph.childWidgets[0];\n this.offset = this.selection.getStartLineOffset(this.currentWidget);\n if (type === 1) {\n // tslint:disable-next-line:max-line-length\n let nextWord = this.moveToNextParagraphInTableCheck();\n if (nextWord) {\n this.moveToNextParagraphInTable();\n }\n else {\n this.moveToWordEndInternal(type, excludeSpace);\n }\n }\n }\n }\n else {\n let indexInInline = 0;\n let endSelection = false;\n let inlineObj = this.currentWidget.getInline(this.offset, indexInInline);\n let inline = inlineObj.element;\n indexInInline = inlineObj.index;\n this.getNextWordOffset(inline, indexInInline, type, false, endSelection, this, excludeSpace);\n }\n if (type !== 0) {\n let selectionStartIndex = this.owner.selection.start.getHierarchicalIndexInternal();\n let selectionEndIndex = this.getHierarchicalIndexInternal();\n if (selectionStartIndex !== selectionEndIndex) {\n this.validateForwardFieldSelection(selectionStartIndex, selectionEndIndex);\n }\n }\n this.updatePhysicalPosition(true);\n }", "moveToWordStartInternal(type) {\n let endOffset = this.currentWidget.getEndOffset();\n let currentPara = this.currentWidget.paragraph;\n let selection = this.selection;\n if (type === 2 && (this.offset === endOffset || this.offset === endOffset + 1)) {\n return;\n }\n if (this.offset === endOffset + 1) {\n this.offset = endOffset;\n }\n else if (this.offset === selection.getStartOffset(currentPara) && this.currentWidget === currentPara.childWidgets[0]) {\n let previousParagraph = selection.getPreviousParagraphBlock(currentPara);\n if (isNullOrUndefined(previousParagraph)) {\n return;\n }\n this.currentWidget = previousParagraph.childWidgets[previousParagraph.childWidgets.length - 1];\n this.offset = this.currentWidget.getEndOffset();\n }\n else {\n if (this.offset === selection.getStartLineOffset(this.currentWidget)) {\n let lineIndex = currentPara.childWidgets.indexOf(this.currentWidget);\n if (lineIndex - 1 >= 0) {\n this.currentWidget = currentPara.childWidgets[lineIndex - 1];\n this.offset = this.currentWidget.getEndOffset();\n }\n }\n let isStarted = false;\n let endSelection = false;\n let indexInInline = 0;\n let inlineObj = this.currentWidget.getInline(this.offset, indexInInline);\n let inline = inlineObj.element;\n indexInInline = inlineObj.index;\n // tslint:disable-next-line:max-line-length \n this.getPreviousWordOffset(inline, selection, indexInInline, type, (inline instanceof FieldElementBox && inline.fieldType === 1), isStarted, endSelection, this);\n }\n if (type === 1) {\n this.calculateOffset();\n }\n this.updatePhysicalPosition(true);\n }", "function leftButtonSelect(cm, e, start, type, addNew) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(e);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (addNew && !e.shiftKey) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n ourRange = ranges[ourIndex];\n else\n ourRange = new Range(start, start);\n } else {\n ourRange = doc.sel.primary();\n }\n\n if (e.altKey) {\n type = \"rect\";\n if (!addNew) ourRange = new Range(start, start);\n start = posFromMouse(cm, e, true, true);\n ourIndex = -1;\n } else if (type == \"double\") {\n var word = cm.findWordAt(start);\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, word.anchor, word.head);\n else\n ourRange = word;\n } else if (type == \"triple\") {\n var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, line.anchor, line.head);\n else\n ourRange = line;\n } else {\n ourRange = extendRange(doc, ourRange, start);\n }\n\n if (!addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == \"single\") {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0));\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) return;\n lastPos = pos;\n\n if (type == \"rect\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\n else if (text.length > leftPos)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\n }\n if (!ranges.length) ranges.push(new Range(start, start));\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var anchor = oldRange.anchor, head = pos;\n if (type != \"single\") {\n if (type == \"double\")\n var range = cm.findWordAt(pos);\n else\n var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));\n if (cmp(range.anchor, anchor) > 0) {\n head = range.head;\n anchor = minPos(oldRange.from(), range.anchor);\n } else {\n head = range.anchor;\n anchor = maxPos(oldRange.to(), range.head);\n }\n }\n var ranges = startSel.ranges.slice(0);\n ranges[ourIndex] = new Range(clipPos(doc, anchor), head);\n setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, type == \"rect\");\n if (!cur) return;\n if (cmp(cur, lastPos) != 0) {\n ensureFocus(cm);\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) setTimeout(operation(cm, function() {\n if (counter != curCount) return;\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50);\n }\n }\n\n function done(e) {\n counter = Infinity;\n e_preventDefault(e);\n focusInput(cm);\n off(document, \"mousemove\", move);\n off(document, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function(e) {\n if (!e_button(e)) done(e);\n else extend(e);\n });\n var up = operation(cm, done);\n on(document, \"mousemove\", move);\n on(document, \"mouseup\", up);\n }", "function leftButtonSelect(cm, e, start, type, addNew) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(e);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (addNew && !e.shiftKey) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n ourRange = ranges[ourIndex];\n else\n ourRange = new Range(start, start);\n } else {\n ourRange = doc.sel.primary();\n }\n\n if (e.altKey) {\n type = \"rect\";\n if (!addNew) ourRange = new Range(start, start);\n start = posFromMouse(cm, e, true, true);\n ourIndex = -1;\n } else if (type == \"double\") {\n var word = cm.findWordAt(start);\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, word.anchor, word.head);\n else\n ourRange = word;\n } else if (type == \"triple\") {\n var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, line.anchor, line.head);\n else\n ourRange = line;\n } else {\n ourRange = extendRange(doc, ourRange, start);\n }\n\n if (!addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == \"single\") {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0));\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) return;\n lastPos = pos;\n\n if (type == \"rect\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\n else if (text.length > leftPos)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\n }\n if (!ranges.length) ranges.push(new Range(start, start));\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var anchor = oldRange.anchor, head = pos;\n if (type != \"single\") {\n if (type == \"double\")\n var range = cm.findWordAt(pos);\n else\n var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));\n if (cmp(range.anchor, anchor) > 0) {\n head = range.head;\n anchor = minPos(oldRange.from(), range.anchor);\n } else {\n head = range.anchor;\n anchor = maxPos(oldRange.to(), range.head);\n }\n }\n var ranges = startSel.ranges.slice(0);\n ranges[ourIndex] = new Range(clipPos(doc, anchor), head);\n setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, type == \"rect\");\n if (!cur) return;\n if (cmp(cur, lastPos) != 0) {\n ensureFocus(cm);\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) setTimeout(operation(cm, function() {\n if (counter != curCount) return;\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50);\n }\n }\n\n function done(e) {\n counter = Infinity;\n e_preventDefault(e);\n focusInput(cm);\n off(document, \"mousemove\", move);\n off(document, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function(e) {\n if (!e_button(e)) done(e);\n else extend(e);\n });\n var up = operation(cm, done);\n on(document, \"mousemove\", move);\n on(document, \"mouseup\", up);\n }", "extendToParagraphStart() {\n if (isNullOrUndefined(this.start)) {\n return;\n }\n this.end.paragraphStartInternal(this, true);\n this.upDownSelectionLength = this.end.location.x;\n this.fireSelectionChanged(true);\n }", "function computeReplacedSel(doc, changes, hint) {\n\t\t var out = [];\n\t\t var oldPrev = Pos(doc.first, 0), newPrev = oldPrev;\n\t\t for (var i = 0; i < changes.length; i++) {\n\t\t var change = changes[i];\n\t\t var from = offsetPos(change.from, oldPrev, newPrev);\n\t\t var to = offsetPos(changeEnd(change), oldPrev, newPrev);\n\t\t oldPrev = change.to;\n\t\t newPrev = to;\n\t\t if (hint == \"around\") {\n\t\t var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0;\n\t\t out[i] = new Range(inv ? to : from, inv ? from : to);\n\t\t } else {\n\t\t out[i] = new Range(from, from);\n\t\t }\n\t\t }\n\t\t return new Selection(out, doc.sel.primIndex)\n\t\t }", "function computeReplacedSel(doc, changes, hint) {\n\t\t var out = [];\n\t\t var oldPrev = Pos(doc.first, 0), newPrev = oldPrev;\n\t\t for (var i = 0; i < changes.length; i++) {\n\t\t var change = changes[i];\n\t\t var from = offsetPos(change.from, oldPrev, newPrev);\n\t\t var to = offsetPos(changeEnd(change), oldPrev, newPrev);\n\t\t oldPrev = change.to;\n\t\t newPrev = to;\n\t\t if (hint == \"around\") {\n\t\t var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0;\n\t\t out[i] = new Range(inv ? to : from, inv ? from : to);\n\t\t } else {\n\t\t out[i] = new Range(from, from);\n\t\t }\n\t\t }\n\t\t return new Selection(out, doc.sel.primIndex);\n\t\t }", "function leftButtonSelect(cm, e, start, type, addNew) {\r\n var display = cm.display, doc = cm.doc;\r\n e_preventDefault(e);\r\n\r\n var ourRange, ourIndex, startSel = doc.sel;\r\n if (addNew && !e.shiftKey) {\r\n ourIndex = doc.sel.contains(start);\r\n if (ourIndex > -1)\r\n ourRange = doc.sel.ranges[ourIndex];\r\n else\r\n ourRange = new Range(start, start);\r\n } else {\r\n ourRange = doc.sel.primary();\r\n }\r\n\r\n if (e.altKey) {\r\n type = \"rect\";\r\n if (!addNew) ourRange = new Range(start, start);\r\n start = posFromMouse(cm, e, true, true);\r\n ourIndex = -1;\r\n } else if (type == \"double\") {\r\n var word = findWordAt(cm, start);\r\n if (cm.display.shift || doc.extend)\r\n ourRange = extendRange(doc, ourRange, word.anchor, word.head);\r\n else\r\n ourRange = word;\r\n } else if (type == \"triple\") {\r\n var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));\r\n if (cm.display.shift || doc.extend)\r\n ourRange = extendRange(doc, ourRange, line.anchor, line.head);\r\n else\r\n ourRange = line;\r\n } else {\r\n ourRange = extendRange(doc, ourRange, start);\r\n }\r\n\r\n if (!addNew) {\r\n ourIndex = 0;\r\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\r\n startSel = doc.sel;\r\n } else if (ourIndex > -1) {\r\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\r\n } else {\r\n ourIndex = doc.sel.ranges.length;\r\n setSelection(doc, normalizeSelection(doc.sel.ranges.concat([ourRange]), ourIndex),\r\n {scroll: false, origin: \"*mouse\"});\r\n }\r\n\r\n var lastPos = start;\r\n function extendTo(pos) {\r\n if (cmp(lastPos, pos) == 0) return;\r\n lastPos = pos;\r\n\r\n if (type == \"rect\") {\r\n var ranges = [], tabSize = cm.options.tabSize;\r\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\r\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\r\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\r\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\r\n line <= end; line++) {\r\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\r\n if (left == right)\r\n ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\r\n else if (text.length > leftPos)\r\n ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\r\n }\r\n if (!ranges.length) ranges.push(new Range(start, start));\r\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\r\n {origin: \"*mouse\", scroll: false});\r\n cm.scrollIntoView(pos);\r\n } else {\r\n var oldRange = ourRange;\r\n var anchor = oldRange.anchor, head = pos;\r\n if (type != \"single\") {\r\n if (type == \"double\")\r\n var range = findWordAt(cm, pos);\r\n else\r\n var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));\r\n if (cmp(range.anchor, anchor) > 0) {\r\n head = range.head;\r\n anchor = minPos(oldRange.from(), range.anchor);\r\n } else {\r\n head = range.anchor;\r\n anchor = maxPos(oldRange.to(), range.head);\r\n }\r\n }\r\n var ranges = startSel.ranges.slice(0);\r\n ranges[ourIndex] = new Range(clipPos(doc, anchor), head);\r\n setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);\r\n }\r\n }\r\n\r\n var editorSize = display.wrapper.getBoundingClientRect();\r\n // Used to ensure timeout re-tries don't fire when another extend\r\n // happened in the meantime (clearTimeout isn't reliable -- at\r\n // least on Chrome, the timeouts still happen even when cleared,\r\n // if the clear happens after their scheduled firing time).\r\n var counter = 0;\r\n\r\n function extend(e) {\r\n var curCount = ++counter;\r\n var cur = posFromMouse(cm, e, true, type == \"rect\");\r\n if (!cur) return;\r\n if (cmp(cur, lastPos) != 0) {\r\n ensureFocus(cm);\r\n extendTo(cur);\r\n var visible = visibleLines(display, doc);\r\n if (cur.line >= visible.to || cur.line < visible.from)\r\n setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);\r\n } else {\r\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\r\n if (outside) setTimeout(operation(cm, function() {\r\n if (counter != curCount) return;\r\n display.scroller.scrollTop += outside;\r\n extend(e);\r\n }), 50);\r\n }\r\n }\r\n\r\n function done(e) {\r\n counter = Infinity;\r\n e_preventDefault(e);\r\n focusInput(cm);\r\n off(document, \"mousemove\", move);\r\n off(document, \"mouseup\", up);\r\n doc.history.lastSelOrigin = null;\r\n }\r\n\r\n var move = operation(cm, function(e) {\r\n if (!e_button(e)) done(e);\r\n else extend(e);\r\n });\r\n var up = operation(cm, done);\r\n on(document, \"mousemove\", move);\r\n on(document, \"mouseup\", up);\r\n }", "function leftButtonSelect(cm, e, start, type, addNew) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(e);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (addNew && !e.shiftKey) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n ourRange = ranges[ourIndex];\n else\n ourRange = new Range(start, start);\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (e.altKey) {\n type = \"rect\";\n if (!addNew) ourRange = new Range(start, start);\n start = posFromMouse(cm, e, true, true);\n ourIndex = -1;\n } else if (type == \"double\") {\n var word = cm.findWordAt(start);\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, word.anchor, word.head);\n else\n ourRange = word;\n } else if (type == \"triple\") {\n var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, line.anchor, line.head);\n else\n ourRange = line;\n } else {\n ourRange = extendRange(doc, ourRange, start);\n }\n\n if (!addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == \"single\" && !e.shiftKey) {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0));\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) return;\n lastPos = pos;\n\n if (type == \"rect\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\n else if (text.length > leftPos)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\n }\n if (!ranges.length) ranges.push(new Range(start, start));\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var anchor = oldRange.anchor, head = pos;\n if (type != \"single\") {\n if (type == \"double\")\n var range = cm.findWordAt(pos);\n else\n var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));\n if (cmp(range.anchor, anchor) > 0) {\n head = range.head;\n anchor = minPos(oldRange.from(), range.anchor);\n } else {\n head = range.anchor;\n anchor = maxPos(oldRange.to(), range.head);\n }\n }\n var ranges = startSel.ranges.slice(0);\n ranges[ourIndex] = new Range(clipPos(doc, anchor), head);\n setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, type == \"rect\");\n if (!cur) return;\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) setTimeout(operation(cm, function() {\n if (counter != curCount) return;\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50);\n }\n }\n\n function done(e) {\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(document, \"mousemove\", move);\n off(document, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function(e) {\n if (!e_button(e)) done(e);\n else extend(e);\n });\n var up = operation(cm, done);\n on(document, \"mousemove\", move);\n on(document, \"mouseup\", up);\n }", "function makeSelectionRestoreFn (activeEl, start, end) {\n return function () {\n activeEl.selectionStart = start;\n activeEl.selectionEnd = end;\n };\n }", "function computeReplacedSel(doc, changes, hint) {\n var out = [];\n var oldPrev = Pos(doc.first, 0),\n newPrev = oldPrev;\n\n for (var i = 0; i < changes.length; i++) {\n var change = changes[i];\n var from = offsetPos(change.from, oldPrev, newPrev);\n var to = offsetPos(changeEnd(change), oldPrev, newPrev);\n oldPrev = change.to;\n newPrev = to;\n\n if (hint == \"around\") {\n var range = doc.sel.ranges[i],\n inv = cmp(range.head, range.anchor) < 0;\n out[i] = new Range(inv ? to : from, inv ? from : to);\n } else {\n out[i] = new Range(from, from);\n }\n }\n\n return new Selection(out, doc.sel.primIndex);\n } // Used to get the editor into a consistent state again when options change.", "function keyCommandMoveSelectionToStartOfBlock(editorState) {\n\t var selection = editorState.getSelection();\n\t var startKey = selection.getStartKey();\n\t return EditorState.set(editorState, {\n\t selection: selection.merge({\n\t anchorKey: startKey,\n\t anchorOffset: 0,\n\t focusKey: startKey,\n\t focusOffset: 0,\n\t isBackward: false\n\t }),\n\t forceSelection: true\n\t });\n\t}", "wrapText (start, end, prefix, suffix) {\n let replace = this.text.slice(start, end);\n let edit = {\n start,\n end,\n insert: prefix + replace + suffix,\n replace,\n preSelection: this.selection,\n postSelection: {\n start: start + prefix.length,\n end: end + prefix.length,\n isCollapsed: start === end,\n backwards: this.selection.backwards\n }\n };\n this.edit(edit);\n this.editHistory.push(edit);\n this.redoStack = [];\n }", "function computeReplacedSel(doc, changes, hint) {\n var out = [];\n var oldPrev = Pos(doc.first, 0), newPrev = oldPrev;\n for (var i = 0; i < changes.length; i++) {\n var change = changes[i];\n var from = offsetPos(change.from, oldPrev, newPrev);\n var to = offsetPos(changeEnd(change), oldPrev, newPrev);\n oldPrev = change.to;\n newPrev = to;\n if (hint == \"around\") {\n var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0;\n out[i] = new Range(inv ? to : from, inv ? from : to);\n } else {\n out[i] = new Range(from, from);\n }\n }\n return new Selection(out, doc.sel.primIndex);\n }", "function computeReplacedSel(doc, changes, hint) {\n var out = [];\n var oldPrev = Pos(doc.first, 0), newPrev = oldPrev;\n for (var i = 0; i < changes.length; i++) {\n var change = changes[i];\n var from = offsetPos(change.from, oldPrev, newPrev);\n var to = offsetPos(changeEnd(change), oldPrev, newPrev);\n oldPrev = change.to;\n newPrev = to;\n if (hint == \"around\") {\n var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0;\n out[i] = new Range(inv ? to : from, inv ? from : to);\n } else {\n out[i] = new Range(from, from);\n }\n }\n return new Selection(out, doc.sel.primIndex);\n }", "function computeReplacedSel(doc, changes, hint) {\n var out = [];\n var oldPrev = Pos(doc.first, 0), newPrev = oldPrev;\n for (var i = 0; i < changes.length; i++) {\n var change = changes[i];\n var from = offsetPos(change.from, oldPrev, newPrev);\n var to = offsetPos(changeEnd(change), oldPrev, newPrev);\n oldPrev = change.to;\n newPrev = to;\n if (hint == \"around\") {\n var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0;\n out[i] = new Range(inv ? to : from, inv ? from : to);\n } else {\n out[i] = new Range(from, from);\n }\n }\n return new Selection(out, doc.sel.primIndex);\n }", "function computeReplacedSel(doc, changes, hint) {\n var out = [];\n var oldPrev = Pos(doc.first, 0), newPrev = oldPrev;\n for (var i = 0; i < changes.length; i++) {\n var change = changes[i];\n var from = offsetPos(change.from, oldPrev, newPrev);\n var to = offsetPos(changeEnd(change), oldPrev, newPrev);\n oldPrev = change.to;\n newPrev = to;\n if (hint == \"around\") {\n var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0;\n out[i] = new Range(inv ? to : from, inv ? from : to);\n } else {\n out[i] = new Range(from, from);\n }\n }\n return new Selection(out, doc.sel.primIndex);\n }", "function computeReplacedSel(doc, changes, hint) {\n var out = [];\n var oldPrev = Pos(doc.first, 0), newPrev = oldPrev;\n for (var i = 0; i < changes.length; i++) {\n var change = changes[i];\n var from = offsetPos(change.from, oldPrev, newPrev);\n var to = offsetPos(changeEnd(change), oldPrev, newPrev);\n oldPrev = change.to;\n newPrev = to;\n if (hint == \"around\") {\n var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0;\n out[i] = new Range(inv ? to : from, inv ? from : to);\n } else {\n out[i] = new Range(from, from);\n }\n }\n return new Selection(out, doc.sel.primIndex);\n }", "function computeReplacedSel(doc, changes, hint) {\n var out = [];\n var oldPrev = Pos(doc.first, 0), newPrev = oldPrev;\n for (var i = 0; i < changes.length; i++) {\n var change = changes[i];\n var from = offsetPos(change.from, oldPrev, newPrev);\n var to = offsetPos(changeEnd(change), oldPrev, newPrev);\n oldPrev = change.to;\n newPrev = to;\n if (hint == \"around\") {\n var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0;\n out[i] = new Range(inv ? to : from, inv ? from : to);\n } else {\n out[i] = new Range(from, from);\n }\n }\n return new Selection(out, doc.sel.primIndex);\n }", "function computeReplacedSel(doc, changes, hint) {\n var out = [];\n var oldPrev = Pos(doc.first, 0), newPrev = oldPrev;\n for (var i = 0; i < changes.length; i++) {\n var change = changes[i];\n var from = offsetPos(change.from, oldPrev, newPrev);\n var to = offsetPos(changeEnd(change), oldPrev, newPrev);\n oldPrev = change.to;\n newPrev = to;\n if (hint == \"around\") {\n var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0;\n out[i] = new Range(inv ? to : from, inv ? from : to);\n } else {\n out[i] = new Range(from, from);\n }\n }\n return new Selection(out, doc.sel.primIndex);\n }", "insertAfterPart(ref){ref.__insert(this.startNode=createMarker());this.endNode=ref.endNode;ref.endNode=this.startNode}", "insertAfterPart(ref){ref.__insert(this.startNode=createMarker());this.endNode=ref.endNode;ref.endNode=this.startNode;}", "moveToLineStart() {\n if (isNullOrUndefined(this.start)) {\n return;\n }\n this.updateBackwardSelection();\n this.start.moveToLineStartInternal(this, false);\n this.end.setPositionInternal(this.start);\n this.upDownSelectionLength = this.start.location.x;\n this.fireSelectionChanged(true);\n }", "function keyCommandMoveSelectionToStartOfBlock(\n editorState: EditorState,\n): EditorState {\n const selection = editorState.getSelection();\n const startKey = selection.getStartKey();\n return EditorState.set(editorState, {\n selection: selection.merge({\n anchorKey: startKey,\n anchorOffset: 0,\n focusKey: startKey,\n focusOffset: 0,\n isBackward: false,\n }),\n forceSelection: true,\n });\n}", "function computeReplacedSel(doc, changes, hint) {\r\n var out = [];\r\n var oldPrev = Pos(doc.first, 0), newPrev = oldPrev;\r\n for (var i = 0; i < changes.length; i++) {\r\n var change = changes[i];\r\n var from = offsetPos(change.from, oldPrev, newPrev);\r\n var to = offsetPos(changeEnd(change), oldPrev, newPrev);\r\n oldPrev = change.to;\r\n newPrev = to;\r\n if (hint == \"around\") {\r\n var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0;\r\n out[i] = new Range(inv ? to : from, inv ? from : to);\r\n } else {\r\n out[i] = new Range(from, from);\r\n }\r\n }\r\n return new Selection(out, doc.sel.primIndex);\r\n }", "function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range$$1 = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend); }\n else\n { ourRange = range$$1; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range$$1 = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range$$1.anchor, anchor) > 0) {\n head = range$$1.head;\n anchor = minPos(oldRange.from(), range$$1.anchor);\n } else {\n head = range$$1.anchor;\n anchor = maxPos(oldRange.to(), range$$1.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(display.wrapper.ownerDocument, \"mousemove\", move);\n off(display.wrapper.ownerDocument, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (e.buttons === 0 || !e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(display.wrapper.ownerDocument, \"mousemove\", move);\n on(display.wrapper.ownerDocument, \"mouseup\", up);\n}", "function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range$$1 = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend); }\n else\n { ourRange = range$$1; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range$$1 = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range$$1.anchor, anchor) > 0) {\n head = range$$1.head;\n anchor = minPos(oldRange.from(), range$$1.anchor);\n } else {\n head = range$$1.anchor;\n anchor = maxPos(oldRange.to(), range$$1.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(document, \"mousemove\", move);\n off(document, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (!e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(document, \"mousemove\", move);\n on(document, \"mouseup\", up);\n}", "function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range$$1 = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend); }\n else\n { ourRange = range$$1; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range$$1 = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range$$1.anchor, anchor) > 0) {\n head = range$$1.head;\n anchor = minPos(oldRange.from(), range$$1.anchor);\n } else {\n head = range$$1.anchor;\n anchor = maxPos(oldRange.to(), range$$1.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(display.wrapper.ownerDocument, \"mousemove\", move);\n off(display.wrapper.ownerDocument, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (e.buttons === 0 || !e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(display.wrapper.ownerDocument, \"mousemove\", move);\n on(display.wrapper.ownerDocument, \"mouseup\", up);\n}", "function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range$$1 = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend); }\n else\n { ourRange = range$$1; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range$$1 = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range$$1.anchor, anchor) > 0) {\n head = range$$1.head;\n anchor = minPos(oldRange.from(), range$$1.anchor);\n } else {\n head = range$$1.anchor;\n anchor = maxPos(oldRange.to(), range$$1.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(display.wrapper.ownerDocument, \"mousemove\", move);\n off(display.wrapper.ownerDocument, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (!e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(display.wrapper.ownerDocument, \"mousemove\", move);\n on(display.wrapper.ownerDocument, \"mouseup\", up);\n}", "function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range$$1 = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend); }\n else\n { ourRange = range$$1; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range$$1 = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range$$1.anchor, anchor) > 0) {\n head = range$$1.head;\n anchor = minPos(oldRange.from(), range$$1.anchor);\n } else {\n head = range$$1.anchor;\n anchor = maxPos(oldRange.to(), range$$1.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(document, \"mousemove\", move);\n off(document, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (!e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(document, \"mousemove\", move);\n on(document, \"mouseup\", up);\n}", "function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range$$1 = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend); }\n else\n { ourRange = range$$1; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range$$1 = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range$$1.anchor, anchor) > 0) {\n head = range$$1.head;\n anchor = minPos(oldRange.from(), range$$1.anchor);\n } else {\n head = range$$1.anchor;\n anchor = maxPos(oldRange.to(), range$$1.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(document, \"mousemove\", move);\n off(document, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (!e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(document, \"mousemove\", move);\n on(document, \"mouseup\", up);\n}", "function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range$$1 = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend); }\n else\n { ourRange = range$$1; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range$$1 = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range$$1.anchor, anchor) > 0) {\n head = range$$1.head;\n anchor = minPos(oldRange.from(), range$$1.anchor);\n } else {\n head = range$$1.anchor;\n anchor = maxPos(oldRange.to(), range$$1.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(display.wrapper.ownerDocument, \"mousemove\", move);\n off(display.wrapper.ownerDocument, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (e.buttons === 0 || !e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(display.wrapper.ownerDocument, \"mousemove\", move);\n on(display.wrapper.ownerDocument, \"mouseup\", up);\n}", "function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range$$1 = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend); }\n else\n { ourRange = range$$1; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range$$1 = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range$$1.anchor, anchor) > 0) {\n head = range$$1.head;\n anchor = minPos(oldRange.from(), range$$1.anchor);\n } else {\n head = range$$1.anchor;\n anchor = maxPos(oldRange.to(), range$$1.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(display.wrapper.ownerDocument, \"mousemove\", move);\n off(display.wrapper.ownerDocument, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (!e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(display.wrapper.ownerDocument, \"mousemove\", move);\n on(display.wrapper.ownerDocument, \"mouseup\", up);\n}", "function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range$$1 = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend); }\n else\n { ourRange = range$$1; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range$$1 = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range$$1.anchor, anchor) > 0) {\n head = range$$1.head;\n anchor = minPos(oldRange.from(), range$$1.anchor);\n } else {\n head = range$$1.anchor;\n anchor = maxPos(oldRange.to(), range$$1.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(display.wrapper.ownerDocument, \"mousemove\", move);\n off(display.wrapper.ownerDocument, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (!e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(display.wrapper.ownerDocument, \"mousemove\", move);\n on(display.wrapper.ownerDocument, \"mouseup\", up);\n}", "function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range$$1 = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend); }\n else\n { ourRange = range$$1; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range$$1 = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range$$1.anchor, anchor) > 0) {\n head = range$$1.head;\n anchor = minPos(oldRange.from(), range$$1.anchor);\n } else {\n head = range$$1.anchor;\n anchor = maxPos(oldRange.to(), range$$1.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(document, \"mousemove\", move);\n off(document, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (!e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(document, \"mousemove\", move);\n on(document, \"mouseup\", up);\n}", "function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range$$1 = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend); }\n else\n { ourRange = range$$1; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range$$1 = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range$$1.anchor, anchor) > 0) {\n head = range$$1.head;\n anchor = minPos(oldRange.from(), range$$1.anchor);\n } else {\n head = range$$1.anchor;\n anchor = maxPos(oldRange.to(), range$$1.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = new Range(clipPos(doc, anchor), head);\n setSelection(doc, normalizeSelection(ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(document, \"mousemove\", move);\n off(document, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (!e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(document, \"mousemove\", move);\n on(document, \"mouseup\", up);\n}", "insertAfterPart(e){e.__insert(this.startNode=createMarker()),this.endNode=e.endNode,e.endNode=this.startNode}", "function computeReplacedSel(doc, changes, hint) {\n var out = []\n var oldPrev = Pos(doc.first, 0), newPrev = oldPrev\n for (var i = 0; i < changes.length; i++) {\n var change = changes[i]\n var from = offsetPos(change.from, oldPrev, newPrev)\n var to = offsetPos(changeEnd(change), oldPrev, newPrev)\n oldPrev = change.to\n newPrev = to\n if (hint == \"around\") {\n var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0\n out[i] = new Range(inv ? to : from, inv ? from : to)\n } else {\n out[i] = new Range(from, from)\n }\n }\n return new Selection(out, doc.sel.primIndex)\n}", "function computeReplacedSel(doc, changes, hint) {\n var out = []\n var oldPrev = Pos(doc.first, 0), newPrev = oldPrev\n for (var i = 0; i < changes.length; i++) {\n var change = changes[i]\n var from = offsetPos(change.from, oldPrev, newPrev)\n var to = offsetPos(changeEnd(change), oldPrev, newPrev)\n oldPrev = change.to\n newPrev = to\n if (hint == \"around\") {\n var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0\n out[i] = new Range(inv ? to : from, inv ? from : to)\n } else {\n out[i] = new Range(from, from)\n }\n }\n return new Selection(out, doc.sel.primIndex)\n}", "function leftButtonSelect(cm, e, start, type, addNew) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(e);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (addNew && !e.shiftKey) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n ourRange = ranges[ourIndex];\n else\n ourRange = new Range(start, start);\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (chromeOS ? e.shiftKey && e.metaKey : e.altKey) {\n type = \"rect\";\n if (!addNew) ourRange = new Range(start, start);\n start = posFromMouse(cm, e, true, true);\n ourIndex = -1;\n } else if (type == \"double\") {\n var word = cm.findWordAt(start);\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, word.anchor, word.head);\n else\n ourRange = word;\n } else if (type == \"triple\") {\n var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, line.anchor, line.head);\n else\n ourRange = line;\n } else {\n ourRange = extendRange(doc, ourRange, start);\n }\n\n if (!addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == \"single\" && !e.shiftKey) {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) return;\n lastPos = pos;\n\n if (type == \"rect\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\n else if (text.length > leftPos)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\n }\n if (!ranges.length) ranges.push(new Range(start, start));\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var anchor = oldRange.anchor, head = pos;\n if (type != \"single\") {\n if (type == \"double\")\n var range = cm.findWordAt(pos);\n else\n var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));\n if (cmp(range.anchor, anchor) > 0) {\n head = range.head;\n anchor = minPos(oldRange.from(), range.anchor);\n } else {\n head = range.anchor;\n anchor = maxPos(oldRange.to(), range.head);\n }\n }\n var ranges = startSel.ranges.slice(0);\n ranges[ourIndex] = new Range(clipPos(doc, anchor), head);\n setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, type == \"rect\");\n if (!cur) return;\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) setTimeout(operation(cm, function() {\n if (counter != curCount) return;\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50);\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(document, \"mousemove\", move);\n off(document, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function(e) {\n if (!e_button(e)) done(e);\n else extend(e);\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(document, \"mousemove\", move);\n on(document, \"mouseup\", up);\n }", "function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range.anchor, range.head, behavior.extend); }\n else\n { ourRange = range; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range.anchor, anchor) > 0) {\n head = range.head;\n anchor = minPos(oldRange.from(), range.anchor);\n } else {\n head = range.anchor;\n anchor = maxPos(oldRange.to(), range.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n // If e is null or undefined we interpret this as someone trying\n // to explicitly cancel the selection rather than the user\n // letting go of the mouse button.\n if (e) {\n e_preventDefault(e);\n display.input.focus();\n }\n off(display.wrapper.ownerDocument, \"mousemove\", move);\n off(display.wrapper.ownerDocument, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (e.buttons === 0 || !e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(display.wrapper.ownerDocument, \"mousemove\", move);\n on(display.wrapper.ownerDocument, \"mouseup\", up);\n }", "function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range.anchor, range.head, behavior.extend); }\n else\n { ourRange = range; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range.anchor, anchor) > 0) {\n head = range.head;\n anchor = minPos(oldRange.from(), range.anchor);\n } else {\n head = range.anchor;\n anchor = maxPos(oldRange.to(), range.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n // If e is null or undefined we interpret this as someone trying\n // to explicitly cancel the selection rather than the user\n // letting go of the mouse button.\n if (e) {\n e_preventDefault(e);\n display.input.focus();\n }\n off(display.wrapper.ownerDocument, \"mousemove\", move);\n off(display.wrapper.ownerDocument, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (e.buttons === 0 || !e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(display.wrapper.ownerDocument, \"mousemove\", move);\n on(display.wrapper.ownerDocument, \"mouseup\", up);\n }", "function extendSelection(doc, pos, other, bias) {\n if (doc.sel.shift || doc.sel.extend) {\n var anchor = doc.sel.anchor;\n if (other) {\n var posBefore = posLess(pos, anchor);\n if (posBefore != posLess(other, anchor)) {\n anchor = pos;\n pos = other;\n } else if (posBefore != posLess(pos, other)) {\n pos = other;\n }\n }\n setSelection(doc, anchor, pos, bias);\n } else {\n setSelection(doc, pos, other || pos, bias);\n }\n if (doc.cm) doc.cm.curOp.userSelChange = true;\n }", "function extendSelection(doc, pos, other, bias) {\n if (doc.sel.shift || doc.sel.extend) {\n var anchor = doc.sel.anchor;\n if (other) {\n var posBefore = posLess(pos, anchor);\n if (posBefore != posLess(other, anchor)) {\n anchor = pos;\n pos = other;\n } else if (posBefore != posLess(pos, other)) {\n pos = other;\n }\n }\n setSelection(doc, anchor, pos, bias);\n } else {\n setSelection(doc, pos, other || pos, bias);\n }\n if (doc.cm) doc.cm.curOp.userSelChange = true;\n }", "function extendSelection(doc, pos, other, bias) {\n if (doc.sel.shift || doc.sel.extend) {\n var anchor = doc.sel.anchor;\n if (other) {\n var posBefore = posLess(pos, anchor);\n if (posBefore != posLess(other, anchor)) {\n anchor = pos;\n pos = other;\n } else if (posBefore != posLess(pos, other)) {\n pos = other;\n }\n }\n setSelection(doc, anchor, pos, bias);\n } else {\n setSelection(doc, pos, other || pos, bias);\n }\n if (doc.cm) doc.cm.curOp.userSelChange = true;\n }", "function extendSelection(doc, pos, other, bias) {\n if (doc.sel.shift || doc.sel.extend) {\n var anchor = doc.sel.anchor;\n if (other) {\n var posBefore = posLess(pos, anchor);\n if (posBefore != posLess(other, anchor)) {\n anchor = pos;\n pos = other;\n } else if (posBefore != posLess(pos, other)) {\n pos = other;\n }\n }\n setSelection(doc, anchor, pos, bias);\n } else {\n setSelection(doc, pos, other || pos, bias);\n }\n if (doc.cm) doc.cm.curOp.userSelChange = true;\n }", "moveUpInTable(selection) {\n let isPositionUpdated = false;\n let end = this.owner.selection.end;\n let isBackwardSelection = !this.owner.selection.isEmpty;\n isPositionUpdated = end.paragraph.isInsideTable;\n if (isPositionUpdated) {\n let startCell = this.currentWidget.paragraph.associatedCell;\n let endCell = end.paragraph.associatedCell;\n let containerCell = selection.getContainerCellOf(endCell, startCell);\n isPositionUpdated = containerCell.ownerTable.contains(startCell);\n if (isPositionUpdated) {\n endCell = selection.getSelectedCell(endCell, containerCell);\n startCell = selection.getSelectedCell(startCell, containerCell);\n // tslint:disable-next-line:max-line-length\n let isInContainerCell = selection.containsCell(containerCell, this.currentWidget.paragraph.associatedCell);\n let isContainerCellSelected = selection.isCellSelected(containerCell, this, end);\n if (!isContainerCellSelected) {\n // tslint:disable-next-line:max-line-length\n isContainerCellSelected = this.currentWidget.paragraph === selection.getFirstParagraph(containerCell) && this.isAtParagraphStart;\n }\n if ((isInContainerCell && isContainerCellSelected\n || !isInContainerCell) && !isNullOrUndefined(startCell.ownerRow.previousRenderedWidget)) {\n //Moves to cell in previous row.\n let row = startCell.ownerRow.previousRenderedWidget;\n // tslint:disable-next-line:max-line-length\n let cell = selection.getFirstCellInRegion(row, containerCell, this.owner.selection.upDownSelectionLength, true);\n let previousParagraph = selection.getLastParagraph(cell);\n this.setPosition(previousParagraph.childWidgets[0], true);\n return;\n }\n else if (isInContainerCell && isContainerCellSelected\n && isNullOrUndefined(startCell.ownerRow.previousRenderedWidget) || !isInContainerCell) {\n if (isBackwardSelection) {\n //Moves to first cell of row.\n startCell = startCell.ownerRow.childWidgets[0];\n let previousParagraph = selection.getFirstParagraph(startCell);\n this.setPosition(previousParagraph.childWidgets[0], true);\n }\n else {\n //Moves to last cell of row.\n startCell = startCell.ownerRow.childWidgets[startCell.ownerRow.childWidgets.length - 1];\n let previousParagraph = selection.getLastParagraph(startCell);\n this.setPosition(previousParagraph.childWidgets[0], false);\n }\n }\n }\n }\n if (!isPositionUpdated) {\n //Moves to previous row / previous block.\n let cell = selection.getContainerCell(this.currentWidget.paragraph.associatedCell);\n if (isBackwardSelection) {\n //Moves to first cell of row.\n cell = cell.ownerRow.childWidgets[0];\n let previousParagraph = selection.getFirstParagraph(cell);\n this.setPosition(previousParagraph.childWidgets[0], true);\n }\n else {\n //Moves to end of row.\n cell = cell.ownerRow.childWidgets[cell.ownerRow.childWidgets.length - 1];\n let previousParagraph = selection.getLastParagraph(cell);\n this.setPosition(previousParagraph.childWidgets[0], false);\n }\n }\n //Moves to previous row / previous block.\n this.moveBackward();\n }", "function expandSelectionToLine(_cm, curStart, curEnd) {\n curStart.ch = 0;\n curEnd.ch = 0;\n curEnd.line++;\n }", "function expandSelectionToLine(_cm, curStart, curEnd) {\n curStart.ch = 0;\n curEnd.ch = 0;\n curEnd.line++;\n }", "function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range$$1 = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend); }\n else\n { ourRange = range$$1; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range$$1 = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range$$1.anchor, anchor) > 0) {\n head = range$$1.head;\n anchor = minPos(oldRange.from(), range$$1.anchor);\n } else {\n head = range$$1.anchor;\n anchor = maxPos(oldRange.to(), range$$1.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n // If e is null or undefined we interpret this as someone trying\n // to explicitly cancel the selection rather than the user\n // letting go of the mouse button.\n if (e) {\n e_preventDefault(e);\n display.input.focus();\n }\n off(display.wrapper.ownerDocument, \"mousemove\", move);\n off(display.wrapper.ownerDocument, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (e.buttons === 0 || !e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(display.wrapper.ownerDocument, \"mousemove\", move);\n on(display.wrapper.ownerDocument, \"mouseup\", up);\n }", "function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range$$1 = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend); }\n else\n { ourRange = range$$1; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range$$1 = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range$$1.anchor, anchor) > 0) {\n head = range$$1.head;\n anchor = minPos(oldRange.from(), range$$1.anchor);\n } else {\n head = range$$1.anchor;\n anchor = maxPos(oldRange.to(), range$$1.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n // If e is null or undefined we interpret this as someone trying\n // to explicitly cancel the selection rather than the user\n // letting go of the mouse button.\n if (e) {\n e_preventDefault(e);\n display.input.focus();\n }\n off(display.wrapper.ownerDocument, \"mousemove\", move);\n off(display.wrapper.ownerDocument, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (e.buttons === 0 || !e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(display.wrapper.ownerDocument, \"mousemove\", move);\n on(display.wrapper.ownerDocument, \"mouseup\", up);\n }", "function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range$$1 = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend); }\n else\n { ourRange = range$$1; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range$$1 = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range$$1.anchor, anchor) > 0) {\n head = range$$1.head;\n anchor = minPos(oldRange.from(), range$$1.anchor);\n } else {\n head = range$$1.anchor;\n anchor = maxPos(oldRange.to(), range$$1.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n // If e is null or undefined we interpret this as someone trying\n // to explicitly cancel the selection rather than the user\n // letting go of the mouse button.\n if (e) {\n e_preventDefault(e);\n display.input.focus();\n }\n off(display.wrapper.ownerDocument, \"mousemove\", move);\n off(display.wrapper.ownerDocument, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (e.buttons === 0 || !e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(display.wrapper.ownerDocument, \"mousemove\", move);\n on(display.wrapper.ownerDocument, \"mouseup\", up);\n }", "function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range$$1 = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend); }\n else\n { ourRange = range$$1; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range$$1 = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range$$1.anchor, anchor) > 0) {\n head = range$$1.head;\n anchor = minPos(oldRange.from(), range$$1.anchor);\n } else {\n head = range$$1.anchor;\n anchor = maxPos(oldRange.to(), range$$1.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n // If e is null or undefined we interpret this as someone trying\n // to explicitly cancel the selection rather than the user\n // letting go of the mouse button.\n if (e) {\n e_preventDefault(e);\n display.input.focus();\n }\n off(display.wrapper.ownerDocument, \"mousemove\", move);\n off(display.wrapper.ownerDocument, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (e.buttons === 0 || !e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(display.wrapper.ownerDocument, \"mousemove\", move);\n on(display.wrapper.ownerDocument, \"mouseup\", up);\n }", "function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range$$1 = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend); }\n else\n { ourRange = range$$1; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range$$1 = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range$$1.anchor, anchor) > 0) {\n head = range$$1.head;\n anchor = minPos(oldRange.from(), range$$1.anchor);\n } else {\n head = range$$1.anchor;\n anchor = maxPos(oldRange.to(), range$$1.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(display.wrapper.ownerDocument, \"mousemove\", move);\n off(display.wrapper.ownerDocument, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (e.buttons === 0 || !e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(display.wrapper.ownerDocument, \"mousemove\", move);\n on(display.wrapper.ownerDocument, \"mouseup\", up);\n }", "function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range$$1 = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend); }\n else\n { ourRange = range$$1; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range$$1 = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range$$1.anchor, anchor) > 0) {\n head = range$$1.head;\n anchor = minPos(oldRange.from(), range$$1.anchor);\n } else {\n head = range$$1.anchor;\n anchor = maxPos(oldRange.to(), range$$1.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n // If e is null or undefined we interpret this as someone trying\n // to explicitly cancel the selection rather than the user\n // letting go of the mouse button.\n if (e) {\n e_preventDefault(e);\n display.input.focus();\n }\n off(display.wrapper.ownerDocument, \"mousemove\", move);\n off(display.wrapper.ownerDocument, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (e.buttons === 0 || !e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(display.wrapper.ownerDocument, \"mousemove\", move);\n on(display.wrapper.ownerDocument, \"mouseup\", up);\n }" ]
[ "0.6645743", "0.6270994", "0.61845195", "0.6150499", "0.6104101", "0.60757375", "0.60718614", "0.60028625", "0.6002224", "0.5982876", "0.5982876", "0.5982876", "0.597064", "0.59512234", "0.59484506", "0.59484506", "0.59484506", "0.59349036", "0.58870625", "0.5841855", "0.5833857", "0.5833857", "0.582603", "0.5813369", "0.5798405", "0.5793157", "0.5790812", "0.5790812", "0.5790812", "0.5763348", "0.57572883", "0.5756607", "0.5756607", "0.5738977", "0.57227755", "0.5722023", "0.57054305", "0.56995666", "0.56986046", "0.5693", "0.5676646", "0.56725025", "0.56711495", "0.56711495", "0.56711495", "0.56711495", "0.56711495", "0.56711495", "0.56711495", "0.5670188", "0.56656706", "0.56509054", "0.56465006", "0.5643777", "0.56379145", "0.56379145", "0.56379145", "0.56379145", "0.56379145", "0.56379145", "0.56379145", "0.56379145", "0.56379145", "0.56379145", "0.56379145", "0.5635395", "0.56306505", "0.56306505", "0.56271374", "0.56257886", "0.56257886", "0.56189215", "0.56189215", "0.56189215", "0.56189215", "0.5615205", "0.5611483", "0.5611483", "0.5607614", "0.5607614", "0.5607614", "0.5607614", "0.5607614", "0.5607614" ]
0.5666932
66
Used to get the editor into a consistent state again when options change.
function loadMode(cm) { cm.doc.mode = getMode(cm.options, cm.doc.modeOption); resetModeState(cm); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateEditor() {\n\t\ttextToEditor();\n\t\tpositionEditorCaret();\n\t}", "optionsUpdateHook() { }", "function _onEditorChanged() {\n\t\t_close();\n\t\tcurrentEditor = EditorManager.getCurrentFullEditor();\n\n\t\tcurrentEditor.$textNode = $(currentEditor.getRootElement()).find(\".CodeMirror-lines\");\n\t\tcurrentEditor.$textNode = $(currentEditor.$textNode.children()[0].children[3]);\n\t\tcurrentEditor.$numbersNode = $(currentEditor.getRootElement()).find(\".CodeMirror-gutter-text\");\n\n\t\t\n\t}", "function update() {\n if (isEditorEmpty()) {\n show();\n } else {\n hide();\n }\n }", "function changedOptions () {\n\t\t // If advanced click option changed, update rbkmitem_b class cursor\n\t\t if (advancedClick_option_old != options.advancedClick) {\n\t\t\tsetRBkmkItemBCursor(options.advancedClick);\n\t\t }\n\t\t // If a show path option changed, update any open search result \n\t\t if ((showPath_option_old != options.showPath)\n\t\t\t || (reversePath_option_old != options.reversePath)\n\t\t\t ) {\n\t\t\t// Trigger an update as results can change, if there is a search active\n\t\t\ttriggerUpdate();\n\t\t }\n\t\t if ((rememberSizes_option_old != options.rememberSizes)\n\t\t\t && (options.rememberSizes == false)) {\n\t\t\t// To reset the height to CSS default (\"20%\"), just set\n\t\t\tSearchResult.style.height = \"\";\n\t\t }\n\t\t if (searchHeight_option_old != options.searchHeight) {\n\t\t\tSearchResult.style.height = options.searchHeight; \n\t\t }\n\t\t // If match FF theme option changed\n\t\t if (matchTheme_option_old != options.matchTheme) {\n\t\t\tif (options.matchTheme) {\n\t\t\t // Align colors with window theme \n\t\t\t browser.theme.getCurrent(myWindowId)\n\t\t\t .then(setPanelColors);\n\n\t\t\t // Register listener\n\t\t\t browser.theme.onUpdated.addListener(themeRefreshedHandler);\n\t\t\t}\n\t\t\telse {\n\t\t\t resetPanelColors();\n\n\t\t\t // Remove listener\n\t\t\t browser.theme.onUpdated.removeListener(themeRefreshedHandler);\n\t\t\t}\n\t\t }\n\t\t // If set colors option changed, or if one of the colors changed while that option is set\n\t\t if (setColors_option_old != options.setColors\n\t\t\t || (options.setColors && ((textColor_option_old != options.textColor)\n\t\t\t\t\t\t\t\t\t || (bckgndColor_option_old != options.bckgndColor)\n\t\t\t\t \t\t\t\t\t )\n\t\t\t\t )\n\t\t\t ) {\n\t\t\tif (options.setColors) {\n\t\t\t // Align colors with chosen ones \n\t\t\t setPanelColorsTB(options.textColor, options.bckgndColor);\n\t\t\t}\n\t\t\telse { // Cannot change while machTheme option is set, so no theme to match, reset ..\n\t\t\t resetPanelColors();\n\t\t\t}\n\t\t }\n\t\t // If folder image options changed\n\t\t if ((options.useAltFldr && (altFldrImg_option_old != options.altFldrImg))\n\t\t\t || (useAltFldr_option_old != options.useAltFldr)\n\t\t\t ) {\n\t\t\tsetPanelFolderImg(options.useAltFldr, options.altFldrImg);\n\t\t }\n\t\t // If no-favicon image options changed\n\t\t if ((options.useAltNoFav && (altNoFavImg_option_old != options.altNoFavImg))\n\t\t\t || (useAltNoFav_option_old != options.useAltNoFav)\n\t\t\t ) {\n\t\t\tsetPanelNoFaviconImg(options.useAltNoFav, options.altNoFavImg);\n\t\t }\n\t\t // If BSP2 trash folder visibility changed\n\t\t if (trashVisible_option_old != options.trashVisible) {\n\t\t\tif (options.trashVisible) { // Insert BSP2 trash foder and all its children, with handling of parent twistie\n\t\t\t // Get parent of BSP2 Trash folder BN\n\t\t\t let BN = curBNList[bsp2TrashFldrBNId];\n\t\t\t let parentId = BN.parentId;\n\t\t\t let parentBN = curBNList[parentId];\n\t\t\t let parentRow = curRowList[parentId];\n\n\t\t\t // Retrieve row position where to insert.\n\t\t\t // Introduce robustness in case the BN tree is empty and index is not 0, as that seems to occur some times\n\t\t\t let children = parentBN.children;\n\t\t\t let index = BN_getIndex(BN, parentBN);\n \t\t\t if ((index == 0) || (children == undefined)) { // Insert just after parent row\n\t\t\t\t// Note that this also takes care of the case where parent had so far no child\n\t\t\t\tinsertRowIndex = parentRow.rowIndex + 1; // Can be at end of bookmarks table\n\t\t\t }\n\t\t\t else { // Insert just after previous row\n\t\t\t\tlet previousBN = BN_lastDescendant(children[index-1]);\n\t\t\t\tlet row = curRowList[previousBN.id];\n\t\t\t\tinsertRowIndex = row.rowIndex + 1; // Can be at end of bookmarks table\n\t\t\t }\n\n\t\t\t // We got the insertion point, proceed to insertion\n\t\t\t insertBkmks(BN, parentRow);\n\t\t\t}\n\t\t\telse { // Delete all BSP2 trash folder and its children, if any (with cleanup and handling od parent twistie)\n\t\t\t removeBkmks(curRowList[bsp2TrashFldrBNId], true);\n\t\t\t}\n\n\t\t\t// Trigger an update as results can change, if there is a search active\n\t\t\ttriggerUpdate();\n\t\t }\n\t\t // If trace option changed\n\t\t if (traceEnabled_option_old != options.traceEnabled) {\n\t\t\tTracePlace.hidden = !options.traceEnabled;\n\t\t }\n\t\t}", "_setToEditingMode() {\n this._hasBeenEdited = true\n this._setUiEditing()\n }", "sync_options_and_states(update_states) {\n var that = this;\n var current = that.current;\n var options = that.options;\n \n if (update_states) {\n current.pos = options.pos || current.pos;\n current.data_set = options.data_set || current.data_set;\n current.selection.low_pass_threshold = +options.low_pass || current.selection.low_pass_threshold;\n current.selection.threshold = +options.threshold || current.selection.threshold;\n current.source = options.source || current.source;\n\n var brush_string = options.brush;\n if (brush_string && brush_string.length > 0) {\n current.brush_extent = brush_string.split(',').map(d => +d);\n }\n\n var zero_padding = options.padding;\n if (zero_padding && zero_padding.length > 0) {\n var tmp = zero_padding.split(',').map(d => +d);\n current.zero_left = tmp[0];\n current.zero_right = tmp[1];\n }\n\n\n var cell_string = options.cells;\n if (cell_string && cell_string.length > 0) {\n current.selection.cells = cell_string.split(',').map(d => +d);\n\n }\n\n var ex_cell_string = options.ex_cell;\n if (ex_cell_string && ex_cell_string.length > 0) {\n that.current.selection.excluded_cells = ex_cell_string.split(',').map(d => +d)\n }\n\n\n } else {\n // TODO: maybe\n }\n\n }", "function optionChanged(){\n init();\n}", "_editorChange(e,deselect=!1){let root=this,editorChange=root.editor!==e.detail.editor,toolbarChange=root.toolbar!==e.detail.toolbar;if(deselect||editorChange||toolbarChange){let sel=window.getSelection();sel.removeAllRanges();root.editor=e.detail.editor;root.toolbar=e.detail.toolbar;if(root.observer)root.observer.disconnect();if(!deselect&&e.detail.editor){root.observer=new MutationObserver(evt=>{root.range=root.getRange()});root.observer.observe(e.detail.editor,{attributes:!1,childList:!0,subtree:!0,characterData:!1})}}}", "_resetOptions() {\n const changedOrDestroyed = Object(rxjs__WEBPACK_IMPORTED_MODULE_12__[\"merge\"])(this.options.changes, this._destroy);\n this.optionSelectionChanges.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_13__[\"takeUntil\"])(changedOrDestroyed)).subscribe(event => {\n this._onSelect(event.source, event.isUserInput);\n if (event.isUserInput && !this.multiple && this._panelOpen) {\n this.close();\n this.focus();\n }\n });\n // Listen to changes in the internal state of the options and react accordingly.\n // Handles cases like the labels of the selected options changing.\n Object(rxjs__WEBPACK_IMPORTED_MODULE_12__[\"merge\"])(...this.options.map(option => option._stateChanges))\n .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_13__[\"takeUntil\"])(changedOrDestroyed))\n .subscribe(() => {\n this._changeDetectorRef.markForCheck();\n this.stateChanges.next();\n });\n }", "function restore_options() {\r\n chrome.storage.sync.get('options', function(items) {\r\n $('#options').val(JSON.stringify(items.options || options_default, undefined, 4));\r\n });\r\n}", "resetEditor() {\n // best solution to clear all text/cursor position without issues\n // see https://github.com/facebook/draft-js/issues/410\n\n const editorState = this.state.editorState;\n\n const contentState = editorState.getCurrentContent();\n const selectionState = editorState.getSelection();\n\n const isBackward = selectionState.getIsBackward();\n\n const firstBlock = contentState.getFirstBlock();\n const lastBlock = contentState.getLastBlock();\n\n const leftmostBlock = !isBackward ? firstBlock : lastBlock;\n const rightmostBlock = !isBackward ? lastBlock : firstBlock;\n\n const rightmostBlockLength = rightmostBlock.getLength();\n\n const anchorKey = leftmostBlock.getKey();\n const anchorOffset = !isBackward ? 0 : rightmostBlockLength;\n\n const focusKey = rightmostBlock.getKey();\n const focusOffset = !isBackward ? rightmostBlockLength : 0;\n\n const newSelectionState = selectionState.merge({\n anchorKey,\n anchorOffset,\n focusKey,\n focusOffset,\n hasFocus: true\n });\n\n const newEditorState = EditorState.push(\n EditorState.moveFocusToEnd(editorState),\n Modifier.replaceText(contentState, newSelectionState, \"\")\n );\n this.setState({\n editorState: newEditorState\n });\n }", "initEditor() {\n let savedCode = this.service.getCode(this.currentExo.method);\n if (savedCode)\n this.editor.setValue(savedCode);\n\n byId('editor').style.height = this.editorHeight + 'px';\n this.editor.resize();\n }", "_editorChanged() {\n this.dispatchEvent(\n new CustomEvent(\"editor-change\", {\n bubbles: true,\n cancelable: true,\n composed: true,\n detail: this,\n })\n );\n }", "function resetEditor(element) {\r\n if (!element) {\r\n return;\r\n }\r\n\r\n let editor = element.querySelector(\".annotorious-editor-select\");\r\n let saveButton = element.querySelector(\".annotorious-editor-button-save\");\r\n\r\n //Check if dropdown menu was created\r\n if (!editor) {\r\n return;\r\n }\r\n\r\n // disable save button, because we reset to default (and invalid) option\r\n // just below\r\n saveButton.classList.add(\"annotorious-editor-save-disabled\");\r\n\r\n // Reset selection\r\n editor[0].selected = true;\r\n for (let option = 1; option < editor.childElementCount; option++) {\r\n editor[option].selected = false;\r\n }\r\n }", "async _codemirrorSetOptions() {\n const {\n mode: rawMode,\n autoCloseBrackets,\n dynamicHeight,\n getAutocompleteConstants,\n getRenderContext,\n hideGutters,\n hideLineNumbers,\n hideScrollbars,\n hintOptions,\n indentSize,\n indentWithTabs,\n infoOptions,\n jumpOptions,\n keyMap,\n lineWrapping,\n lintOptions,\n noDragDrop,\n noLint,\n noMatchBrackets,\n noStyleActiveLine,\n placeholder,\n readOnly,\n tabIndex,\n } = this.props;\n\n let mode;\n if (this.props.render) {\n mode = { name: 'nunjucks', baseMode: CodeEditor._normalizeMode(rawMode) };\n } else {\n // foo bar baz\n mode = CodeEditor._normalizeMode(rawMode);\n }\n\n // NOTE: YAML is not valid when indented with Tabs\n const isYaml = typeof rawMode === 'string' ? rawMode.includes('yaml') : false;\n const actuallyIndentWithTabs = indentWithTabs && !isYaml;\n\n const options = {\n readOnly: !!readOnly,\n placeholder: placeholder || '',\n mode: mode,\n tabIndex: typeof tabIndex === 'number' ? tabIndex : null,\n dragDrop: !noDragDrop,\n scrollbarStyle: hideScrollbars ? 'null' : 'native',\n styleActiveLine: !noStyleActiveLine,\n lineNumbers: !hideGutters && !hideLineNumbers,\n foldGutter: !hideGutters && !hideLineNumbers,\n lineWrapping: lineWrapping,\n indentWithTabs: actuallyIndentWithTabs,\n matchBrackets: !noMatchBrackets,\n lint: !noLint && !readOnly,\n gutters: [],\n };\n\n // Only set keyMap if we're not read-only. This is so things like\n // ctrl-a work on read-only mode.\n if (!readOnly && keyMap) {\n options.keyMap = keyMap;\n }\n\n if (indentSize) {\n options.tabSize = indentSize;\n options.indentUnit = indentSize;\n }\n\n if (!hideGutters && options.lint) {\n options.gutters.push('CodeMirror-lint-markers');\n }\n\n if (!hideGutters && options.lineNumbers) {\n options.gutters.push('CodeMirror-linenumbers');\n }\n\n if (!hideGutters && options.foldGutter) {\n options.gutters.push('CodeMirror-foldgutter');\n }\n\n if (hintOptions) {\n options.hintOptions = hintOptions;\n }\n\n if (infoOptions) {\n options.info = infoOptions;\n }\n\n if (jumpOptions) {\n options.jump = jumpOptions;\n }\n\n if (lintOptions) {\n options.lint = lintOptions;\n }\n\n if (typeof autoCloseBrackets === 'boolean') {\n options.autoCloseBrackets = autoCloseBrackets;\n }\n\n // Setup the hint options\n if (getRenderContext || getAutocompleteConstants) {\n let getVariables = null;\n let getTags = null;\n if (getRenderContext) {\n getVariables = async () => {\n const context = await getRenderContext();\n const variables = context ? context.keys : [];\n return variables || [];\n };\n\n // Only allow tags if we have variables too\n getTags = async () => {\n const expandedTags = [];\n for (const tagDef of await getTagDefinitions()) {\n const firstArg = tagDef.args[0];\n if (!firstArg || firstArg.type !== 'enum') {\n expandedTags.push(tagDef);\n continue;\n }\n\n for (const option of tagDef.args[0].options) {\n const optionName = misc.fnOrString(option.displayName, tagDef.args) || option.name;\n const newDef = clone(tagDef);\n newDef.displayName = `${tagDef.displayName} ⇒ ${optionName}`;\n newDef.args[0].defaultValue = option.value;\n expandedTags.push(newDef);\n }\n }\n\n return expandedTags;\n };\n }\n options.environmentAutocomplete = {\n getVariables,\n getTags,\n getConstants: getAutocompleteConstants,\n };\n }\n\n if (dynamicHeight) {\n options.viewportMargin = Infinity;\n }\n\n // Strip of charset if there is one\n const cm = this.codeMirror;\n Object.keys(options).map(key => {\n let shouldSetOption = false;\n\n if (key === 'jump' || key === 'info' || key === 'lint' || key === 'hintOptions') {\n // Use stringify here because these could be infinitely recursive due to GraphQL\n // schemas\n shouldSetOption = JSON.stringify(options[key]) !== JSON.stringify(cm.options[key]);\n } else if (!deepEqual(options[key], cm.options[key])) {\n // Don't set the option if it hasn't changed\n shouldSetOption = true;\n }\n\n if (shouldSetOption) {\n cm.setOption(key, options[key]);\n }\n });\n }", "function updateDropletMode(aceEditor) {\n }", "reload() {\n this.editor = atom.workspace.getActiveTextEditor();\n }", "componentDidUpdate({ editorState: prevPropsEditorState, isEditMode: prevIsEditMode }) {\n const { editorState: currentPropsEditorState, isEditMode } = this.props;\n const { editorState } = this.state;\n\n if (prevIsEditMode !== isEditMode) {\n // eslint-disable-next-line react/no-did-update-set-state\n this.setState(() => ({ readOnly: !isEditMode }));\n return;\n }\n\n if (\n currentPropsEditorState\n && prevPropsEditorState\n && prevPropsEditorState !== currentPropsEditorState\n ) {\n const newEditorState = pushEditorState(\n editorState,\n currentPropsEditorState.getCurrentContent(),\n );\n /**\n * Force editor to re-render when new editorState comes in via props. Required because the\n * error boundary can \"restore\" the editor after an error.\n */\n this.setState(() => ({ // eslint-disable-line react/no-did-update-set-state\n editorState: newEditorState.editorState,\n errors: newEditorState.errors,\n }));\n }\n }", "updateEditor() {\n if (typeof this.engine !== 'undefined') {\n this.engine.process(this.editor.toJSON());\n }\n }", "setEditorState (newEditorState) {\n this.newHistoryEvent (() => {\n let graph = this.graph;\n let selectedNode = graph.selectedNode(),\n selectedEdge = graph.selectedEdge();\n let newState = this.prependInputName (newEditorState, 'editor');\n if (newState.hasOwnProperty('editorContent')) {\n\tif (selectedEdge)\n this.graph.replaceEdgeText (selectedEdge, newState.editorContent);\n\telse if (selectedNode)\n this.graph.replaceNodeText (selectedNode, newState.editorContent);\n\telse\n console.error('oops: editor content with no selected node or edge');\n }\n return extend (newState, this.graphState());\n }, { source: 'editor',\n\t selected: this.graph.selected });\n }", "function engageEditMode() {\n\tMainwinObj.engageEditMode(exitEditMode, update);\n}", "_onActiveEditorUpdated(type, editor) {\n this._designView = editor;\n }", "_onActiveEditorUpdated(type, editor) {\n\t\tthis._onElementDeselected();\n\t\tthis._designView = editor;\n\t}", "refresh() {\n if (typeof this.$editorElm.multipleSelect === 'function') {\n this.$editorElm.multipleSelect('refresh');\n }\n }", "doEditMode() {\n\n }", "function resetToOptions(){\n\tconsole.log(\"Resetting to initial\", viewerParams.parts.options_initial);\n\tviewerParams.parts.options = JSON.parse(JSON.stringify(viewerParams.parts.options_initial));\n\tresetViewer();\n}", "edit() {\n this._enterEditMode();\n }", "function restoreOptions() {\r\n try {\r\n var api = chrome || browser;\r\n api.storage.sync.get(null, (res) => {\r\n document.querySelector(\"#voice\").value = res.voice || getFirstVoice();\r\n document.querySelector(\"#speed\").value = res.speed || 1;\r\n document.querySelector(\"#pitch\").value = res.pitch || 1;\r\n document.querySelector(\"#colorBackground\").value =\r\n res.colorBackground || \"light\";\r\n restoreColor();\r\n document.querySelector(\"#fontSize\").value = res.fontSize || \"medium\";\r\n\t restoreFontSize();\r\n if (\r\n res.experimentalMode &&\r\n res.definiteArticleCheck &&\r\n res.definiteArticleColor\r\n ) {\r\n colorDefiniteArticles(res.definiteArticleColor);\r\n }\r\n if (\r\n res.experimentalMode &&\r\n res.indefiniteArticleCheck &&\r\n res.indefiniteArticleColor\r\n ) {\r\n colorIndefiniteArticles(res.indefiniteArticleColor);\r\n }\r\n if (res.experimentalMode && res.eclipseMode) {\r\n eclipseMode();\r\n }\r\n });\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n}", "onToggleAdvancedEditor() {\n const toggleAdvancedEditor = () => {\n this.setState({\n advancedEditor: !this.state.advancedEditor,\n advancedEditorWarningAccepted: false\n });\n };\n\n if (this.state.advancedEditor) {\n return toggleAdvancedEditor();\n }\n\n return new Promise(resolve => this.setState({ advancedEditorLoading: true }, resolve))\n .then(() => this.getWidgetConfig())\n .then((res) => {\n const widgetConfig = Object.assign({}, res);\n delete widgetConfig.paramsConfig;\n delete widgetConfig.config;\n return new Promise(resolve => this.setState({\n widgetConfig,\n advancedEditorLoading: false\n }, resolve));\n })\n .catch(() => new Promise(resolve => this.setState({\n widgetConfig: {},\n advancedEditorLoading: false\n }, resolve)))\n .then(() => toggleAdvancedEditor());\n }", "function setEditorCommandState(cmd, state) {\n\t\t\ttry {\n\t\t\t\teditor.getDoc().execCommand(cmd, false, state);\n\t\t\t} catch (ex) {\n\t\t\t\t// Ignore\n\t\t\t}\n\t\t}", "function setEditorCommandState(cmd, state) {\n\t\t\ttry {\n\t\t\t\teditor.getDoc().execCommand(cmd, false, state);\n\t\t\t} catch (ex) {\n\t\t\t\t// Ignore\n\t\t\t}\n\t\t}", "function setEditorCommandState(cmd, state) {\n\t\t\ttry {\n\t\t\t\teditor.getDoc().execCommand(cmd, false, state);\n\t\t\t} catch (ex) {\n\t\t\t\t// Ignore\n\t\t\t}\n\t\t}", "function restoreDirty( editor )\r\n\t{\r\n\t\tif ( !editor.checkDirty() )\r\n\t\t\tsetTimeout( function(){ editor.resetDirty(); }, 0 );\r\n\t}", "lockEditor() {\n this.lock = true;\n }", "function restoreOptions() {\n // retrieves data saved, if not found then set these to default parameters\n chrome.storage.sync.get({\n color: \"FFEB3B\",\n opac: .5,\n rad: 50,\n trigger: \"F2\",\n\t\ttoggle: true,\n activePage: false\n }, function(items) {\n \t// sets value of the sliders and settings to saved settings\n document.getElementById('trigger').value = items.trigger;\n\n // draws the circle and text preview to loaded preferences\n\t\topacity = items.opac;\n\t\tradius = items.rad;\n\t\thighlight = items.color;\n\t\tcheck = items.toggle;\n\t\t$('#toggle').prop('checked', check);\n\t\tdrawCircle(opacity, radius, highlight);\n });\n}", "function restore_options() {\n if (typeof save === \"undefined\") {\n save = true;\n }\n\n if (typeof warn === \"undefined\") {\n warn = true;\n }\n\n if (typeof modify === \"undefined\") {\n modify = true;\n }\n\n if (typeof keyCommand === \"undefined\") {\n keyCommand = 69;\n }\n\n keyString.value = stringFromCharCode(keyCommand);\n keyValue.value = keyCommand;\n\n if (warn === \"true\") {\n warnYes.checked = true;\n } else {\n warnNo.checked = true;\n }\n\n if (save === \"true\") {\n saveYes.checked = true;\n } else {\n saveNo.checked = true;\n }\n\n if (modify === \"true\") {\n modifyYes.checked = true;\n } else {\n modifyNo.checked = true;\n }\n}", "clearActiveEditor() {\n this.activeEditor = void 0;\n }", "function restoreOptions() {\n chrome.storage.sync.get(['master', 'slave'], function(items) {\n document.getElementById('master').value = items.master || '';\n document.getElementById('slave').value = items.slave || '';\n });\n }", "_showEditor() {\n const EditorCls = this.richText ? CodeMirrorWrapper : TextAreaWrapper;\n\n if (this.richText) {\n RB.DnDUploader.instance.registerDropTarget(\n this.$el, gettext('Drop to add an image'),\n this._uploadImage.bind(this));\n }\n\n this._editor = new EditorCls({\n parentEl: this.el,\n autoSize: this.options.autoSize,\n minHeight: this.options.minHeight\n });\n\n this._editor.setText(this._value);\n this._value = '';\n this._richTextDirty = false;\n this._prevClientHeight = null;\n\n this._editor.$el.on(\n 'resize',\n _.throttle(() => this.$el.triggerHandler('resize'), 250));\n\n this.listenTo(this._editor, 'change', _.throttle(() => {\n /*\n * Make sure that the editor wasn't closed before the throttled\n * handler was reached.\n */\n if (this._editor === null) {\n return;\n }\n\n const clientHeight = this._editor.getClientHeight();\n\n if (clientHeight !== this._prevClientHeight) {\n this._prevClientHeight = clientHeight;\n this.$el.triggerHandler('resize');\n }\n\n this.trigger('change');\n }, 500));\n\n this.focus();\n }", "function restore_options() {\n // Use default value color = 'red' and likesColor = true.\n chrome.storage.sync.get({\n frequency: 'red',\n appearance: 'textImages',\n content: 'Informative Facts',\n category: 'Poaching',\n on: true,\n ads: 0\n }, function(items) {\n document.getElementById('myRange').value = items.frequency;\n setSelectedChbox( document.getElementById('view'),items.appearance);\n setSelectedChbox( document.getElementById('content'),items.content);\n setSelectedChbox( document.getElementById('category'),items.category);\n document.getElementById('earn').innerHTML = \"You have helped donate: \" +items.ads*5 + \" cents!\";\n\n if(items.on){\n document.getElementById(\"onoff\").value = \"Turn Off\";\n } else {\n document.getElementById(\"onoff\").value = \"Turn On\";\n }\n });\n}", "function setEditorSilent(){\n silcentEditorEvents = true;\n aceEditorHtml.setValue($renderedHtml.innerHTML.trim(), -1);\n setTimeout(function(){\n silcentEditorEvents = false;\n },100);\n }", "onEditorChange() {\n // If the handler is in standby mode, bail.\n if (this._standby) {\n return;\n }\n const editor = this.editor;\n if (!editor) {\n return;\n }\n const text = editor.model.value.text;\n const position = editor.getCursorPosition();\n const offset = Text.jsIndexToCharIndex(editor.getOffsetAt(position), text);\n const update = { content: null };\n const pending = ++this._pending;\n void this._connector\n .fetch({ offset, text })\n .then(reply => {\n // If handler has been disposed or a newer request is pending, bail.\n if (this.isDisposed || pending !== this._pending) {\n this._inspected.emit(update);\n return;\n }\n const { data } = reply;\n const mimeType = this._rendermime.preferredMimeType(data);\n if (mimeType) {\n const widget = this._rendermime.createRenderer(mimeType);\n const model = new MimeModel({ data });\n void widget.renderModel(model);\n update.content = widget;\n }\n this._inspected.emit(update);\n })\n .catch(reason => {\n // Since almost all failures are benign, fail silently.\n this._inspected.emit(update);\n });\n }", "function setGeckoEditingOptions() {\n\t\t\tfunction setOpts() {\n\t\t\t\trefreshContentEditable();\n\n\t\t\t\tsetEditorCommandState(\"StyleWithCSS\", false);\n\t\t\t\tsetEditorCommandState(\"enableInlineTableEditing\", false);\n\n\t\t\t\tif (!settings.object_resizing) {\n\t\t\t\t\tsetEditorCommandState(\"enableObjectResizing\", false);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!settings.readonly) {\n\t\t\t\teditor.on('BeforeExecCommand MouseDown', setOpts);\n\t\t\t}\n\t\t}", "function setGeckoEditingOptions() {\n\t\t\tfunction setOpts() {\n\t\t\t\trefreshContentEditable();\n\n\t\t\t\tsetEditorCommandState(\"StyleWithCSS\", false);\n\t\t\t\tsetEditorCommandState(\"enableInlineTableEditing\", false);\n\n\t\t\t\tif (!settings.object_resizing) {\n\t\t\t\t\tsetEditorCommandState(\"enableObjectResizing\", false);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!settings.readonly) {\n\t\t\t\teditor.on('BeforeExecCommand MouseDown', setOpts);\n\t\t\t}\n\t\t}", "function restore_options() {\n var badOptionsText = document.getElementById('badOptions');\n badOptionsText.style.visibility = \"hidden\";\n chrome.storage.sync.get({\n useURL: \"http://jiraland.issues.com\",\n useDefaultProject: \"STACK\",\n useLanguage: \"en\"\n }, function(items) {\n document.getElementById('inputURL').value = items.useURL;\n document.getElementById('inputDefaultProject').value = items.useDefaultProject;\n document.getElementById('inputLanguageOptions').value = items.useLanguage;\n setTicketPreview(items.useURL + \"/browse/\" + items.useDefaultProject, \"green\");\n });\n}", "async function onOptionsUpdated() {\n globalOptions = await getNewOptions(null);\n}", "function updateSelection(editorState,selection,forceSelection){return EditorState.set(editorState,{selection:selection,forceSelection:forceSelection,nativelyRenderedContent:null,inlineStyleOverride:null});}", "if (!game.inEditorMode) {\n // revert pos\n this.pos = lastPos;\n }", "function setGeckoEditingOptions() {\n\t\t\tfunction setOpts() {\n\t\t\t\teditor._refreshContentEditable();\n\n\t\t\t\tsetEditorCommandState(\"StyleWithCSS\", false);\n\t\t\t\tsetEditorCommandState(\"enableInlineTableEditing\", false);\n\n\t\t\t\tif (!settings.object_resizing) {\n\t\t\t\t\tsetEditorCommandState(\"enableObjectResizing\", false);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!settings.readonly) {\n\t\t\t\teditor.on('BeforeExecCommand MouseDown', setOpts);\n\t\t\t}\n\t\t}", "function onChangeWorkingLine(action) {\n changeWorkingLine(action);\n initEditor();\n}", "unlockEditor() {\n this.lock = false;\n }", "function restore_options() {\n // Use default value color = 'red' and likesColor = true.\n chrome.storage.sync.get({\n bugBugs: false,\n bugSpiders: true,\n bugMax: 3,\n bugMin: 1,\n bugDelay: 3.5,\n bugOdds: 70\n }, function(items) {\n document.getElementById('bugs').checked = items.bugBugs;\n document.getElementById('spiders').checked = items.bugSpiders;\n document.getElementById('maxnum').value = items.bugMax;\n document.getElementById('minnum').value = items.bugMin;\n document.getElementById('delay').value = items.bugDelay;\n document.getElementById('odds').value = items.bugOdds;\n });\n}", "manageOptions () {\n if (Utils.isFunction(this.data.options)) {\n if (!this.options) {\n this.options = new Map();\n }\n const newOptions = this.data.options(this);\n // Looks for options not available anymore\n this.options.forEach((option) => {\n if (!newOptions.includes(option.getId())) {\n option.lock();\n }\n });\n // Add new options\n for (let i = 0, l = newOptions.length; i < l; ++i) {\n const id = newOptions[i];\n if (!this.options.has(id)) {\n const option = new Action(id, this.owner, this);\n this.options.push(option);\n this.optionsWrapper.appendChild(option.html);\n }\n }\n }\n }", "function stateStartEditor(game) {\n\n // Ensure we don't have accidental clicks and start with plain mode\n edClickSafety = game.time.now;\n edState = EDITOR_STATE_EDIT;\n\n // Create the blueprint map if not present\n if (mapBlueprint == null) {\n mapBlueprint = mapCreateEmpty(3*16, 2*9);\n }\n\n // Create all phaser objects related to the map\n editorCreateAllFromMap(game, mapBlueprint);\n\n // Create grid and other UI phaser3 objects\n editorAddToolBox(game.add.rectangle(settingWidth / 2.0, settingHeight / 2.0, settingWidth - 160.0, settingHeight - 160.0, 0xffffff), 0.25);\n edLeftSelect = editorAddToolBox(game.add.rectangle(edLeftSelectPos.x * 80.0 + 40.0 + 80.0, edLeftSelectPos.y * 80.0 + 40.0 + 80.0, 60, 60, 0xff0000), 0.5);\n edRightSelect = editorAddToolBox(game.add.rectangle(edRightSelectPos.x * 80.0 + 40.0 + 80.0, edRightSelectPos.y * 80.0 + 40.0 + 80.0, 60, 60, 0x00ff00), 0.5);\n EDITOR_MENU.forEach(mo => editorAddMenuOption(game, mo) );\n edToolBoxObjects.forEach(o => o.setVisible(false) );\n}", "function editCodeEditor() {\n if (selectorTextEditor.style.display == 'none') {\n selectorTextEditor.innerHTML = seletorCode.value;\n selectorTextEditor.style.display = 'block';\n seletorCode.style.display = 'none';\n enabledIcons();\n } else {\n seletorCode.value = selectorTextEditor.innerHTML;\n selectorTextEditor.style.display = 'none';\n seletorCode.style.display = 'block';\n disabledIcons();\n }\n}", "function enableLiveEditor() {\n editorWrapper.classList.remove(\"hidden\");\n exampleChoiceList.classList.add(\"live\");\n output.classList.remove(\"hidden\");\n\n for (let i = 0, l = exampleChoices.length; i < l; i++) {\n const exampleChoice = exampleChoices[i];\n const choiceButton = document.createElement(\"button\");\n const choiceButtonText = document.createElement(\"span\");\n const choiceCode = exampleChoice.querySelector(\"code\");\n\n originalChoices.push(choiceCode.textContent);\n\n applyCodeMirror(\n exampleChoice.querySelector(\"pre\"),\n choiceCode.textContent,\n );\n\n choiceButton.setAttribute(\"type\", \"button\");\n choiceButton.classList.add(\"example-choice-button\");\n choiceButtonText.classList.add(\"visually-hidden\");\n choiceButtonText.textContent = \"Choose example \" + (i + 1);\n\n choiceButton.append(choiceButtonText);\n exampleChoice.append(choiceButton);\n\n if (exampleChoice.getAttribute(\"initial-choice\")) {\n initialChoice = indexOf(exampleChoices, exampleChoice);\n }\n\n choiceCode.remove();\n }\n\n mceEvents.register();\n mceEvents.addCSSEditorEventListeners(exampleChoiceList);\n handleResetEvents();\n handleChoiceHover();\n // Adding or removing class \"invalid\"\n cssEditorUtils.applyInitialSupportWarningState(exampleChoices);\n\n clippy.addClippy();\n }", "function save_options() {\n\tif (!woas.config.permit_edits) {\n\t\talert(woas.i18n.READ_ONLY);\n\t\treturn false;\n\t}\n\twoas.cfg_commit();\n\twoas.set_current(\"Special::Advanced\", true);\n}", "onResize() {\n this.editor.refresh();\n }", "save() {\n // // Update the global selection before saving anything.\n this.surface.editor.selection.update();\n Object.assign(this.saved, this.state);\n }", "function onOptionChanged() {\n var prom = pager.setState($scope.options);\n prom.then(ref, error, ref);\n ref();\n\n /** Refreshes the current data */\n function ref() {\n refresh(true);\n }\n }", "function Editor(options) {\n this.options = options;\n window.indentUnit = options.indentUnit;\n this.parent = parent;\n this.doc = document;\n var container = this.container = this.doc.body;\n this.win = window;\n this.history = new History(container, options.undoDepth, options.undoDelay, this);\n var self = this;\n\n if (!Editor.Parser)\n throw \"No parser loaded.\";\n if (options.parserConfig && Editor.Parser.configure)\n Editor.Parser.configure(options.parserConfig);\n\n if (!options.readOnly)\n select.setCursorPos(container, {node: null, offset: 0});\n\n this.dirty = [];\n this.importCode(options.content || \"\");\n this.history.onChange = options.onChange;\n\n if (!options.readOnly) {\n if (options.continuousScanning !== false) {\n this.scanner = this.documentScanner(options.passTime);\n this.delayScanning();\n }\n\n function setEditable() {\n // In IE, designMode frames can not run any scripts, so we use\n // contentEditable instead.\n if (document.body.contentEditable != undefined && internetExplorer)\n document.body.contentEditable = \"true\";\n else\n document.designMode = \"on\";\n\n document.documentElement.style.borderWidth = \"0\";\n if (!options.textWrapping)\n container.style.whiteSpace = \"nowrap\";\n }\n\n // If setting the frame editable fails, try again when the user\n // focus it (happens when the frame is not visible on\n // initialisation, in Firefox).\n try {\n setEditable();\n }\n catch(e) {\n var focusEvent = addEventHandler(document, \"focus\", function() {\n focusEvent();\n setEditable();\n }, true);\n }\n\n addEventHandler(document, \"keydown\", method(this, \"keyDown\"));\n addEventHandler(document, \"keypress\", method(this, \"keyPress\"));\n addEventHandler(document, \"keyup\", method(this, \"keyUp\"));\n\n function cursorActivity() {self.cursorActivity(false);}\n addEventHandler(document.body, \"mouseup\", cursorActivity);\n addEventHandler(document.body, \"cut\", cursorActivity);\n\n // workaround for a gecko bug [?] where going forward and then\n // back again breaks designmode (no more cursor)\n if (gecko)\n addEventHandler(this.win, \"pagehide\", function(){self.unloaded = true;});\n\n addEventHandler(document.body, \"paste\", function(event) {\n cursorActivity();\n var text = null;\n try {\n var clipboardData = event.clipboardData || window.clipboardData;\n if (clipboardData) text = clipboardData.getData('Text');\n }\n catch(e) {}\n if (text !== null) {\n event.stop();\n self.replaceSelection(text);\n select.scrollToCursor(self.container);\n }\n });\n\n if (this.options.autoMatchParens)\n addEventHandler(document.body, \"click\", method(this, \"scheduleParenHighlight\"));\n }\n else if (!options.textWrapping) {\n container.style.whiteSpace = \"nowrap\";\n }\n }", "function commitChanges() {\n if (editingSlide) {\n editingSlide.querySelector('.kreator-slide-content').innerHTML = editor.getHTML();\n }\n}", "function restore_options() {\n $(\"#theme\").val(\"blue\");\n $(\"#font_size\").val(\"0.9em\");\n $(\"#popup_width\").val(\"610\");\n $(\"#popup_height\").val(\"620\");\n $(\"#bookmark_url\").val(\"http://www.google.com/bookmarks/\");\n $(\"#sig_url\").val(\"http://www.google.com/bookmarks/find\");\n}", "function save_options_() {\r\n save_options();\r\n }", "function restore_options(){\n\trestore_sync_options();\n\trestore_local_options();\n}", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map));\n },\n removeKeyMap: function(map) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map || maps[i].name == map) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this.state.modeGen++;\n regChange(this);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n if (!range.empty()) {\n var from = range.from(), to = range.to();\n var start = Math.max(end, from.line);\n end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this, j, how); }\n var newRanges = this.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range.head.line > end) {\n indentLine(this, range.head.line, how, true);\n end = range.head.line;\n if (i == this.doc.sel.primIndex) { ensureCursorVisible(this); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range = this.doc.sel.primary();\n if (start == null) { pos = range.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range.from() : range.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range) {\n if (this$1.display.shift || this$1.doc.extend || range.empty())\n { return findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range.from() : range.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range) {\n var other = findPosH(doc, range.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range) {\n if (collapse)\n { return dir < 0 ? range.from() : range.to() }\n var headPos = cursorCoords(this$1, range.head, \"div\");\n if (range.goalColumn != null) { headPos.left = range.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt() },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range, margin) {\n if (range == null) {\n range = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range == \"number\") {\n range = {from: Pos(range, 0), to: null};\n } else if (range.from == null) {\n range = {from: range, to: null};\n }\n if (!range.to) { range.to = range.from; }\n range.margin = margin || 0;\n\n if (range.from.line != null) {\n scrollToRange(this, range);\n } else {\n scrollToCoordsRange(this, range.from, range.to, range.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo = this.display.viewFrom;\n this.doc.iter(lineNo, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo, \"widget\"); break } } }\n ++lineNo;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this.display);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5 || this.options.lineWrapping)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n // Cancel the current text selection if any (#5821)\n if (this.state.selectingText) { this.state.selectingText(); }\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map));\n },\n removeKeyMap: function(map) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map || maps[i].name == map) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this.state.modeGen++;\n regChange(this);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n if (!range.empty()) {\n var from = range.from(), to = range.to();\n var start = Math.max(end, from.line);\n end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this, j, how); }\n var newRanges = this.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range.head.line > end) {\n indentLine(this, range.head.line, how, true);\n end = range.head.line;\n if (i == this.doc.sel.primIndex) { ensureCursorVisible(this); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range = this.doc.sel.primary();\n if (start == null) { pos = range.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range.from() : range.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range) {\n if (this$1.display.shift || this$1.doc.extend || range.empty())\n { return findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range.from() : range.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range) {\n var other = findPosH(doc, range.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range) {\n if (collapse)\n { return dir < 0 ? range.from() : range.to() }\n var headPos = cursorCoords(this$1, range.head, \"div\");\n if (range.goalColumn != null) { headPos.left = range.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt() },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range, margin) {\n if (range == null) {\n range = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range == \"number\") {\n range = {from: Pos(range, 0), to: null};\n } else if (range.from == null) {\n range = {from: range, to: null};\n }\n if (!range.to) { range.to = range.from; }\n range.margin = margin || 0;\n\n if (range.from.line != null) {\n scrollToRange(this, range);\n } else {\n scrollToCoordsRange(this, range.from, range.to, range.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo = this.display.viewFrom;\n this.doc.iter(lineNo, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo, \"widget\"); break } } }\n ++lineNo;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this.display);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5 || this.options.lineWrapping)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n // Cancel the current text selection if any (#5821)\n if (this.state.selectingText) { this.state.selectingText(); }\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map));\n },\n removeKeyMap: function(map) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map || maps[i].name == map) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this.state.modeGen++;\n regChange(this);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n if (!range.empty()) {\n var from = range.from(), to = range.to();\n var start = Math.max(end, from.line);\n end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this, j, how); }\n var newRanges = this.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range.head.line > end) {\n indentLine(this, range.head.line, how, true);\n end = range.head.line;\n if (i == this.doc.sel.primIndex) { ensureCursorVisible(this); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range = this.doc.sel.primary();\n if (start == null) { pos = range.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range.from() : range.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range) {\n if (this$1.display.shift || this$1.doc.extend || range.empty())\n { return findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range.from() : range.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range) {\n var other = findPosH(doc, range.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range) {\n if (collapse)\n { return dir < 0 ? range.from() : range.to() }\n var headPos = cursorCoords(this$1, range.head, \"div\");\n if (range.goalColumn != null) { headPos.left = range.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt() },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range, margin) {\n if (range == null) {\n range = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range == \"number\") {\n range = {from: Pos(range, 0), to: null};\n } else if (range.from == null) {\n range = {from: range, to: null};\n }\n if (!range.to) { range.to = range.from; }\n range.margin = margin || 0;\n\n if (range.from.line != null) {\n scrollToRange(this, range);\n } else {\n scrollToCoordsRange(this, range.from, range.to, range.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo = this.display.viewFrom;\n this.doc.iter(lineNo, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo, \"widget\"); break } } }\n ++lineNo;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this.display);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n // Cancel the current text selection if any (#5821)\n if (this.state.selectingText) { this.state.selectingText(); }\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map));\n },\n removeKeyMap: function(map) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map || maps[i].name == map) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this.state.modeGen++;\n regChange(this);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n if (!range.empty()) {\n var from = range.from(), to = range.to();\n var start = Math.max(end, from.line);\n end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this, j, how); }\n var newRanges = this.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range.head.line > end) {\n indentLine(this, range.head.line, how, true);\n end = range.head.line;\n if (i == this.doc.sel.primIndex) { ensureCursorVisible(this); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range = this.doc.sel.primary();\n if (start == null) { pos = range.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range.from() : range.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range) {\n if (this$1.display.shift || this$1.doc.extend || range.empty())\n { return findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range.from() : range.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range) {\n var other = findPosH(doc, range.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range) {\n if (collapse)\n { return dir < 0 ? range.from() : range.to() }\n var headPos = cursorCoords(this$1, range.head, \"div\");\n if (range.goalColumn != null) { headPos.left = range.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt() },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range, margin) {\n if (range == null) {\n range = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range == \"number\") {\n range = {from: Pos(range, 0), to: null};\n } else if (range.from == null) {\n range = {from: range, to: null};\n }\n if (!range.to) { range.to = range.from; }\n range.margin = margin || 0;\n\n if (range.from.line != null) {\n scrollToRange(this, range);\n } else {\n scrollToCoordsRange(this, range.from, range.to, range.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo = this.display.viewFrom;\n this.doc.iter(lineNo, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo, \"widget\"); break } } }\n ++lineNo;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this.display);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5 || this.options.lineWrapping)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n // Cancel the current text selection if any (#5821)\n if (this.state.selectingText) { this.state.selectingText(); }\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map));\n },\n removeKeyMap: function(map) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map || maps[i].name == map) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this.state.modeGen++;\n regChange(this);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n if (!range.empty()) {\n var from = range.from(), to = range.to();\n var start = Math.max(end, from.line);\n end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this, j, how); }\n var newRanges = this.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range.head.line > end) {\n indentLine(this, range.head.line, how, true);\n end = range.head.line;\n if (i == this.doc.sel.primIndex) { ensureCursorVisible(this); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range = this.doc.sel.primary();\n if (start == null) { pos = range.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range.from() : range.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range) {\n if (this$1.display.shift || this$1.doc.extend || range.empty())\n { return findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range.from() : range.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range) {\n var other = findPosH(doc, range.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range) {\n if (collapse)\n { return dir < 0 ? range.from() : range.to() }\n var headPos = cursorCoords(this$1, range.head, \"div\");\n if (range.goalColumn != null) { headPos.left = range.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt() },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range, margin) {\n if (range == null) {\n range = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range == \"number\") {\n range = {from: Pos(range, 0), to: null};\n } else if (range.from == null) {\n range = {from: range, to: null};\n }\n if (!range.to) { range.to = range.from; }\n range.margin = margin || 0;\n\n if (range.from.line != null) {\n scrollToRange(this, range);\n } else {\n scrollToCoordsRange(this, range.from, range.to, range.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo = this.display.viewFrom;\n this.doc.iter(lineNo, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo, \"widget\"); break } } }\n ++lineNo;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this.display);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5 || this.options.lineWrapping)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n // Cancel the current text selection if any (#5821)\n if (this.state.selectingText) { this.state.selectingText(); }\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map));\n },\n removeKeyMap: function(map) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map || maps[i].name == map) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this.state.modeGen++;\n regChange(this);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n if (!range.empty()) {\n var from = range.from(), to = range.to();\n var start = Math.max(end, from.line);\n end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this, j, how); }\n var newRanges = this.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range.head.line > end) {\n indentLine(this, range.head.line, how, true);\n end = range.head.line;\n if (i == this.doc.sel.primIndex) { ensureCursorVisible(this); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range = this.doc.sel.primary();\n if (start == null) { pos = range.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range.from() : range.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range) {\n if (this$1.display.shift || this$1.doc.extend || range.empty())\n { return findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range.from() : range.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range) {\n var other = findPosH(doc, range.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range) {\n if (collapse)\n { return dir < 0 ? range.from() : range.to() }\n var headPos = cursorCoords(this$1, range.head, \"div\");\n if (range.goalColumn != null) { headPos.left = range.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt() },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range, margin) {\n if (range == null) {\n range = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range == \"number\") {\n range = {from: Pos(range, 0), to: null};\n } else if (range.from == null) {\n range = {from: range, to: null};\n }\n if (!range.to) { range.to = range.from; }\n range.margin = margin || 0;\n\n if (range.from.line != null) {\n scrollToRange(this, range);\n } else {\n scrollToCoordsRange(this, range.from, range.to, range.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo = this.display.viewFrom;\n this.doc.iter(lineNo, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo, \"widget\"); break } } }\n ++lineNo;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this.display);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5 || this.options.lineWrapping)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n // Cancel the current text selection if any (#5821)\n if (this.state.selectingText) { this.state.selectingText(); }\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }", "checkChange(){\n if(this.value != this.$editable.html()) {\n this.set('value', this.$editable.html());\n this.updateHeight();\n //this.$editable.scrollTop(0);\n }\n }", "selectionchange() {\n const editable = this.editor.getSelectedEditable();\n\n if (editable && !this.editor.window.getSelection().isCollapsed && this.editor.tags.allowed(editable, 'format', true)) {\n this.editor.formats.hidden = false;\n this.editor.formats.style.top = `${editable.offsetTop + editable.offsetParent.offsetTop - this.editor.formats.clientHeight}px`;\n } else {\n this.editor.formats.hidden = true;\n this.editor.formats.removeAttribute('style');\n }\n }", "function reset_options()\n{\n\tchrome.storage.local.set({\n\t\t'leap_motion_user_prefer_hand': 'right',\n\t\t'leap_motion_fingers': 'yes',\n\t\t'leap_motion_color': 'rainbow',\n\t\t'leap_motion_click': 'enabled',\n\t\t'leap_motion_scrolling': 'enabled',\n\t\t'leap_motion_history': 'enabled',\n\t\t'leap_motion_open_or_close_tab': 'enabled',\n\t\t'leap_motion_switch_tab': 'enabled',\t\t\n\t\t'leap_motion_zoom': 'disabled'\n\t});\n\n\tjQuery('#user_prefer_hand').val('right');\n\tjQuery('#fingers').val('yes');\n\tjQuery('#color').val('rainbow');\n\tjQuery('#click').val('enabled');\n\tjQuery('#scrolling').val('enabled');\n\tjQuery('#history').val('enabled');\n\tjQuery('#open_or_close_tab').val('enabled');\n\tjQuery('#switch_tab').val('enabled');\n\tjQuery('#zoom').val('disabled');\n\n\t// Update status to let user know options were saved.\n\t$('#status').html('Options Reset').fadeIn();\n\n\tsetTimeout(function(){ $('#status').fadeOut(); }, 3000);\n}", "registerChange() {\n if (this.editor && this.editor.save && this.shouldSaveHistory && !this.editor.configuration.readOnly) {\n this.editor.save().then((savedData) => {\n if (this.editorDidUpdate(savedData.blocks)) this.save(savedData.blocks);\n });\n }\n this.shouldSaveHistory = true;\n }", "function restore_options() {\n // Use default value color = 'red' and likesColor = true.\n chrome.storage.sync.get({\n panel: true,\n remove: true,\n notify: true,\n restyle: true,\n console: false,\n console_deep: false,\n }, (items) => {\n for (let item in items) {\n document.getElementById(item).checked = items[item];\n }\n });\n}", "function addEditorMethods(CodeMirror) {\n\t\t var optionHandlers = CodeMirror.optionHandlers;\n\n\t\t var helpers = CodeMirror.helpers = {};\n\n\t\t CodeMirror.prototype = {\n\t\t constructor: CodeMirror,\n\t\t focus: function(){win(this).focus(); this.display.input.focus();},\n\n\t\t setOption: function(option, value) {\n\t\t var options = this.options, old = options[option];\n\t\t if (options[option] == value && option != \"mode\") { return }\n\t\t options[option] = value;\n\t\t if (optionHandlers.hasOwnProperty(option))\n\t\t { operation(this, optionHandlers[option])(this, value, old); }\n\t\t signal(this, \"optionChange\", this, option);\n\t\t },\n\n\t\t getOption: function(option) {return this.options[option]},\n\t\t getDoc: function() {return this.doc},\n\n\t\t addKeyMap: function(map, bottom) {\n\t\t this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map));\n\t\t },\n\t\t removeKeyMap: function(map) {\n\t\t var maps = this.state.keyMaps;\n\t\t for (var i = 0; i < maps.length; ++i)\n\t\t { if (maps[i] == map || maps[i].name == map) {\n\t\t maps.splice(i, 1);\n\t\t return true\n\t\t } }\n\t\t },\n\n\t\t addOverlay: methodOp(function(spec, options) {\n\t\t var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n\t\t if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n\t\t insertSorted(this.state.overlays,\n\t\t {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n\t\t priority: (options && options.priority) || 0},\n\t\t function (overlay) { return overlay.priority; });\n\t\t this.state.modeGen++;\n\t\t regChange(this);\n\t\t }),\n\t\t removeOverlay: methodOp(function(spec) {\n\t\t var overlays = this.state.overlays;\n\t\t for (var i = 0; i < overlays.length; ++i) {\n\t\t var cur = overlays[i].modeSpec;\n\t\t if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n\t\t overlays.splice(i, 1);\n\t\t this.state.modeGen++;\n\t\t regChange(this);\n\t\t return\n\t\t }\n\t\t }\n\t\t }),\n\n\t\t indentLine: methodOp(function(n, dir, aggressive) {\n\t\t if (typeof dir != \"string\" && typeof dir != \"number\") {\n\t\t if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n\t\t else { dir = dir ? \"add\" : \"subtract\"; }\n\t\t }\n\t\t if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n\t\t }),\n\t\t indentSelection: methodOp(function(how) {\n\t\t var ranges = this.doc.sel.ranges, end = -1;\n\t\t for (var i = 0; i < ranges.length; i++) {\n\t\t var range = ranges[i];\n\t\t if (!range.empty()) {\n\t\t var from = range.from(), to = range.to();\n\t\t var start = Math.max(end, from.line);\n\t\t end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n\t\t for (var j = start; j < end; ++j)\n\t\t { indentLine(this, j, how); }\n\t\t var newRanges = this.doc.sel.ranges;\n\t\t if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n\t\t { replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n\t\t } else if (range.head.line > end) {\n\t\t indentLine(this, range.head.line, how, true);\n\t\t end = range.head.line;\n\t\t if (i == this.doc.sel.primIndex) { ensureCursorVisible(this); }\n\t\t }\n\t\t }\n\t\t }),\n\n\t\t // Fetch the parser token for a given character. Useful for hacks\n\t\t // that want to inspect the mode state (say, for completion).\n\t\t getTokenAt: function(pos, precise) {\n\t\t return takeToken(this, pos, precise)\n\t\t },\n\n\t\t getLineTokens: function(line, precise) {\n\t\t return takeToken(this, Pos(line), precise, true)\n\t\t },\n\n\t\t getTokenTypeAt: function(pos) {\n\t\t pos = clipPos(this.doc, pos);\n\t\t var styles = getLineStyles(this, getLine(this.doc, pos.line));\n\t\t var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n\t\t var type;\n\t\t if (ch == 0) { type = styles[2]; }\n\t\t else { for (;;) {\n\t\t var mid = (before + after) >> 1;\n\t\t if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n\t\t else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n\t\t else { type = styles[mid * 2 + 2]; break }\n\t\t } }\n\t\t var cut = type ? type.indexOf(\"overlay \") : -1;\n\t\t return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n\t\t },\n\n\t\t getModeAt: function(pos) {\n\t\t var mode = this.doc.mode;\n\t\t if (!mode.innerMode) { return mode }\n\t\t return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n\t\t },\n\n\t\t getHelper: function(pos, type) {\n\t\t return this.getHelpers(pos, type)[0]\n\t\t },\n\n\t\t getHelpers: function(pos, type) {\n\t\t var found = [];\n\t\t if (!helpers.hasOwnProperty(type)) { return found }\n\t\t var help = helpers[type], mode = this.getModeAt(pos);\n\t\t if (typeof mode[type] == \"string\") {\n\t\t if (help[mode[type]]) { found.push(help[mode[type]]); }\n\t\t } else if (mode[type]) {\n\t\t for (var i = 0; i < mode[type].length; i++) {\n\t\t var val = help[mode[type][i]];\n\t\t if (val) { found.push(val); }\n\t\t }\n\t\t } else if (mode.helperType && help[mode.helperType]) {\n\t\t found.push(help[mode.helperType]);\n\t\t } else if (help[mode.name]) {\n\t\t found.push(help[mode.name]);\n\t\t }\n\t\t for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n\t\t var cur = help._global[i$1];\n\t\t if (cur.pred(mode, this) && indexOf(found, cur.val) == -1)\n\t\t { found.push(cur.val); }\n\t\t }\n\t\t return found\n\t\t },\n\n\t\t getStateAfter: function(line, precise) {\n\t\t var doc = this.doc;\n\t\t line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n\t\t return getContextBefore(this, line + 1, precise).state\n\t\t },\n\n\t\t cursorCoords: function(start, mode) {\n\t\t var pos, range = this.doc.sel.primary();\n\t\t if (start == null) { pos = range.head; }\n\t\t else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n\t\t else { pos = start ? range.from() : range.to(); }\n\t\t return cursorCoords(this, pos, mode || \"page\")\n\t\t },\n\n\t\t charCoords: function(pos, mode) {\n\t\t return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n\t\t },\n\n\t\t coordsChar: function(coords, mode) {\n\t\t coords = fromCoordSystem(this, coords, mode || \"page\");\n\t\t return coordsChar(this, coords.left, coords.top)\n\t\t },\n\n\t\t lineAtHeight: function(height, mode) {\n\t\t height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n\t\t return lineAtHeight(this.doc, height + this.display.viewOffset)\n\t\t },\n\t\t heightAtLine: function(line, mode, includeWidgets) {\n\t\t var end = false, lineObj;\n\t\t if (typeof line == \"number\") {\n\t\t var last = this.doc.first + this.doc.size - 1;\n\t\t if (line < this.doc.first) { line = this.doc.first; }\n\t\t else if (line > last) { line = last; end = true; }\n\t\t lineObj = getLine(this.doc, line);\n\t\t } else {\n\t\t lineObj = line;\n\t\t }\n\t\t return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n\t\t (end ? this.doc.height - heightAtLine(lineObj) : 0)\n\t\t },\n\n\t\t defaultTextHeight: function() { return textHeight(this.display) },\n\t\t defaultCharWidth: function() { return charWidth(this.display) },\n\n\t\t getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n\t\t addWidget: function(pos, node, scroll, vert, horiz) {\n\t\t var display = this.display;\n\t\t pos = cursorCoords(this, clipPos(this.doc, pos));\n\t\t var top = pos.bottom, left = pos.left;\n\t\t node.style.position = \"absolute\";\n\t\t node.setAttribute(\"cm-ignore-events\", \"true\");\n\t\t this.display.input.setUneditable(node);\n\t\t display.sizer.appendChild(node);\n\t\t if (vert == \"over\") {\n\t\t top = pos.top;\n\t\t } else if (vert == \"above\" || vert == \"near\") {\n\t\t var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n\t\t hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n\t\t // Default to positioning above (if specified and possible); otherwise default to positioning below\n\t\t if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n\t\t { top = pos.top - node.offsetHeight; }\n\t\t else if (pos.bottom + node.offsetHeight <= vspace)\n\t\t { top = pos.bottom; }\n\t\t if (left + node.offsetWidth > hspace)\n\t\t { left = hspace - node.offsetWidth; }\n\t\t }\n\t\t node.style.top = top + \"px\";\n\t\t node.style.left = node.style.right = \"\";\n\t\t if (horiz == \"right\") {\n\t\t left = display.sizer.clientWidth - node.offsetWidth;\n\t\t node.style.right = \"0px\";\n\t\t } else {\n\t\t if (horiz == \"left\") { left = 0; }\n\t\t else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n\t\t node.style.left = left + \"px\";\n\t\t }\n\t\t if (scroll)\n\t\t { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n\t\t },\n\n\t\t triggerOnKeyDown: methodOp(onKeyDown),\n\t\t triggerOnKeyPress: methodOp(onKeyPress),\n\t\t triggerOnKeyUp: onKeyUp,\n\t\t triggerOnMouseDown: methodOp(onMouseDown),\n\n\t\t execCommand: function(cmd) {\n\t\t if (commands.hasOwnProperty(cmd))\n\t\t { return commands[cmd].call(null, this) }\n\t\t },\n\n\t\t triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n\t\t findPosH: function(from, amount, unit, visually) {\n\t\t var dir = 1;\n\t\t if (amount < 0) { dir = -1; amount = -amount; }\n\t\t var cur = clipPos(this.doc, from);\n\t\t for (var i = 0; i < amount; ++i) {\n\t\t cur = findPosH(this.doc, cur, dir, unit, visually);\n\t\t if (cur.hitSide) { break }\n\t\t }\n\t\t return cur\n\t\t },\n\n\t\t moveH: methodOp(function(dir, unit) {\n\t\t var this$1$1 = this;\n\n\t\t this.extendSelectionsBy(function (range) {\n\t\t if (this$1$1.display.shift || this$1$1.doc.extend || range.empty())\n\t\t { return findPosH(this$1$1.doc, range.head, dir, unit, this$1$1.options.rtlMoveVisually) }\n\t\t else\n\t\t { return dir < 0 ? range.from() : range.to() }\n\t\t }, sel_move);\n\t\t }),\n\n\t\t deleteH: methodOp(function(dir, unit) {\n\t\t var sel = this.doc.sel, doc = this.doc;\n\t\t if (sel.somethingSelected())\n\t\t { doc.replaceSelection(\"\", null, \"+delete\"); }\n\t\t else\n\t\t { deleteNearSelection(this, function (range) {\n\t\t var other = findPosH(doc, range.head, dir, unit, false);\n\t\t return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other}\n\t\t }); }\n\t\t }),\n\n\t\t findPosV: function(from, amount, unit, goalColumn) {\n\t\t var dir = 1, x = goalColumn;\n\t\t if (amount < 0) { dir = -1; amount = -amount; }\n\t\t var cur = clipPos(this.doc, from);\n\t\t for (var i = 0; i < amount; ++i) {\n\t\t var coords = cursorCoords(this, cur, \"div\");\n\t\t if (x == null) { x = coords.left; }\n\t\t else { coords.left = x; }\n\t\t cur = findPosV(this, coords, dir, unit);\n\t\t if (cur.hitSide) { break }\n\t\t }\n\t\t return cur\n\t\t },\n\n\t\t moveV: methodOp(function(dir, unit) {\n\t\t var this$1$1 = this;\n\n\t\t var doc = this.doc, goals = [];\n\t\t var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n\t\t doc.extendSelectionsBy(function (range) {\n\t\t if (collapse)\n\t\t { return dir < 0 ? range.from() : range.to() }\n\t\t var headPos = cursorCoords(this$1$1, range.head, \"div\");\n\t\t if (range.goalColumn != null) { headPos.left = range.goalColumn; }\n\t\t goals.push(headPos.left);\n\t\t var pos = findPosV(this$1$1, headPos, dir, unit);\n\t\t if (unit == \"page\" && range == doc.sel.primary())\n\t\t { addToScrollTop(this$1$1, charCoords(this$1$1, pos, \"div\").top - headPos.top); }\n\t\t return pos\n\t\t }, sel_move);\n\t\t if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n\t\t { doc.sel.ranges[i].goalColumn = goals[i]; } }\n\t\t }),\n\n\t\t // Find the word at the given position (as returned by coordsChar).\n\t\t findWordAt: function(pos) {\n\t\t var doc = this.doc, line = getLine(doc, pos.line).text;\n\t\t var start = pos.ch, end = pos.ch;\n\t\t if (line) {\n\t\t var helper = this.getHelper(pos, \"wordChars\");\n\t\t if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n\t\t var startChar = line.charAt(start);\n\t\t var check = isWordChar(startChar, helper)\n\t\t ? function (ch) { return isWordChar(ch, helper); }\n\t\t : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n\t\t : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n\t\t while (start > 0 && check(line.charAt(start - 1))) { --start; }\n\t\t while (end < line.length && check(line.charAt(end))) { ++end; }\n\t\t }\n\t\t return new Range(Pos(pos.line, start), Pos(pos.line, end))\n\t\t },\n\n\t\t toggleOverwrite: function(value) {\n\t\t if (value != null && value == this.state.overwrite) { return }\n\t\t if (this.state.overwrite = !this.state.overwrite)\n\t\t { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\t\t else\n\t\t { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n\t\t signal(this, \"overwriteToggle\", this, this.state.overwrite);\n\t\t },\n\t\t hasFocus: function() { return this.display.input.getField() == activeElt(doc(this)) },\n\t\t isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n\t\t scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n\t\t getScrollInfo: function() {\n\t\t var scroller = this.display.scroller;\n\t\t return {left: scroller.scrollLeft, top: scroller.scrollTop,\n\t\t height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n\t\t width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n\t\t clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n\t\t },\n\n\t\t scrollIntoView: methodOp(function(range, margin) {\n\t\t if (range == null) {\n\t\t range = {from: this.doc.sel.primary().head, to: null};\n\t\t if (margin == null) { margin = this.options.cursorScrollMargin; }\n\t\t } else if (typeof range == \"number\") {\n\t\t range = {from: Pos(range, 0), to: null};\n\t\t } else if (range.from == null) {\n\t\t range = {from: range, to: null};\n\t\t }\n\t\t if (!range.to) { range.to = range.from; }\n\t\t range.margin = margin || 0;\n\n\t\t if (range.from.line != null) {\n\t\t scrollToRange(this, range);\n\t\t } else {\n\t\t scrollToCoordsRange(this, range.from, range.to, range.margin);\n\t\t }\n\t\t }),\n\n\t\t setSize: methodOp(function(width, height) {\n\t\t var this$1$1 = this;\n\n\t\t var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n\t\t if (width != null) { this.display.wrapper.style.width = interpret(width); }\n\t\t if (height != null) { this.display.wrapper.style.height = interpret(height); }\n\t\t if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n\t\t var lineNo = this.display.viewFrom;\n\t\t this.doc.iter(lineNo, this.display.viewTo, function (line) {\n\t\t if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n\t\t { if (line.widgets[i].noHScroll) { regLineChange(this$1$1, lineNo, \"widget\"); break } } }\n\t\t ++lineNo;\n\t\t });\n\t\t this.curOp.forceUpdate = true;\n\t\t signal(this, \"refresh\", this);\n\t\t }),\n\n\t\t operation: function(f){return runInOp(this, f)},\n\t\t startOperation: function(){return startOperation(this)},\n\t\t endOperation: function(){return endOperation(this)},\n\n\t\t refresh: methodOp(function() {\n\t\t var oldHeight = this.display.cachedTextHeight;\n\t\t regChange(this);\n\t\t this.curOp.forceUpdate = true;\n\t\t clearCaches(this);\n\t\t scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n\t\t updateGutterSpace(this.display);\n\t\t if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5 || this.options.lineWrapping)\n\t\t { estimateLineHeights(this); }\n\t\t signal(this, \"refresh\", this);\n\t\t }),\n\n\t\t swapDoc: methodOp(function(doc) {\n\t\t var old = this.doc;\n\t\t old.cm = null;\n\t\t // Cancel the current text selection if any (#5821)\n\t\t if (this.state.selectingText) { this.state.selectingText(); }\n\t\t attachDoc(this, doc);\n\t\t clearCaches(this);\n\t\t this.display.input.reset();\n\t\t scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n\t\t this.curOp.forceScroll = true;\n\t\t signalLater(this, \"swapDoc\", this, old);\n\t\t return old\n\t\t }),\n\n\t\t phrase: function(phraseText) {\n\t\t var phrases = this.options.phrases;\n\t\t return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n\t\t },\n\n\t\t getInputField: function(){return this.display.input.getField()},\n\t\t getWrapperElement: function(){return this.display.wrapper},\n\t\t getScrollerElement: function(){return this.display.scroller},\n\t\t getGutterElement: function(){return this.display.gutters}\n\t\t };\n\t\t eventMixin(CodeMirror);\n\n\t\t CodeMirror.registerHelper = function(type, name, value) {\n\t\t if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n\t\t helpers[type][name] = value;\n\t\t };\n\t\t CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n\t\t CodeMirror.registerHelper(type, name, value);\n\t\t helpers[type]._global.push({pred: predicate, val: value});\n\t\t };\n\t\t }", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers\n\n var helpers = CodeMirror.helpers = {}\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus()},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option]\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old) }\n signal(this, \"optionChange\", this, option)\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map))\n },\n removeKeyMap: function(map) {\n var maps = this.state.keyMaps\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map || maps[i].name == map) {\n maps.splice(i, 1)\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec)\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; })\n this.state.modeGen++\n regChange(this)\n }),\n removeOverlay: methodOp(function(spec) {\n var this$1 = this;\n\n var overlays = this.state.overlays\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1)\n this$1.state.modeGen++\n regChange(this$1)\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\" }\n else { dir = dir ? \"add\" : \"subtract\" }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive) }\n }),\n indentSelection: methodOp(function(how) {\n var this$1 = this;\n\n var ranges = this.doc.sel.ranges, end = -1\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i]\n if (!range.empty()) {\n var from = range.from(), to = range.to()\n var start = Math.max(end, from.line)\n end = Math.min(this$1.lastLine(), to.line - (to.ch ? 0 : 1)) + 1\n for (var j = start; j < end; ++j)\n { indentLine(this$1, j, how) }\n var newRanges = this$1.doc.sel.ranges\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll) }\n } else if (range.head.line > end) {\n indentLine(this$1, range.head.line, how, true)\n end = range.head.line\n if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1) }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos)\n var styles = getLineStyles(this, getLine(this.doc, pos.line))\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch\n var type\n if (ch == 0) { type = styles[2] }\n else { for (;;) {\n var mid = (before + after) >> 1\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1 }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var this$1 = this;\n\n var found = []\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos)\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]) }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]]\n if (val) { found.push(val) }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType])\n } else if (help[mode.name]) {\n found.push(help[mode.name])\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1]\n if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1)\n { found.push(cur.val) }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line)\n return getStateBefore(this, line + 1, precise)\n },\n\n cursorCoords: function(start, mode) {\n var pos, range = this.doc.sel.primary()\n if (start == null) { pos = range.head }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start) }\n else { pos = start ? range.from() : range.to() }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\")\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1\n if (line < this.doc.first) { line = this.doc.first }\n else if (line > last) { line = last; end = true }\n lineObj = getLine(this.doc, line)\n } else {\n lineObj = line\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display\n pos = cursorCoords(this, clipPos(this.doc, pos))\n var top = pos.bottom, left = pos.left\n node.style.position = \"absolute\"\n node.setAttribute(\"cm-ignore-events\", \"true\")\n this.display.input.setUneditable(node)\n display.sizer.appendChild(node)\n if (vert == \"over\") {\n top = pos.top\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth)\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth }\n }\n node.style.top = top + \"px\"\n node.style.left = node.style.right = \"\"\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth\n node.style.right = \"0px\"\n } else {\n if (horiz == \"left\") { left = 0 }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2 }\n node.style.left = left + \"px\"\n }\n if (scroll)\n { scrollIntoView(this, left, top, left + node.offsetWidth, top + node.offsetHeight) }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text) }),\n\n findPosH: function(from, amount, unit, visually) {\n var this$1 = this;\n\n var dir = 1\n if (amount < 0) { dir = -1; amount = -amount }\n var cur = clipPos(this.doc, from)\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this$1.doc, cur, dir, unit, visually)\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range) {\n if (this$1.display.shift || this$1.doc.extend || range.empty())\n { return findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range.from() : range.to() }\n }, sel_move)\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\") }\n else\n { deleteNearSelection(this, function (range) {\n var other = findPosH(doc, range.head, dir, unit, false)\n return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other}\n }) }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var this$1 = this;\n\n var dir = 1, x = goalColumn\n if (amount < 0) { dir = -1; amount = -amount }\n var cur = clipPos(this.doc, from)\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this$1, cur, \"div\")\n if (x == null) { x = coords.left }\n else { coords.left = x }\n cur = findPosV(this$1, coords, dir, unit)\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = []\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected()\n doc.extendSelectionsBy(function (range) {\n if (collapse)\n { return dir < 0 ? range.from() : range.to() }\n var headPos = cursorCoords(this$1, range.head, \"div\")\n if (range.goalColumn != null) { headPos.left = range.goalColumn }\n goals.push(headPos.left)\n var pos = findPosV(this$1, headPos, dir, unit)\n if (unit == \"page\" && range == doc.sel.primary())\n { addToScrollPos(this$1, null, charCoords(this$1, pos, \"div\").top - headPos.top) }\n return pos\n }, sel_move)\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i] } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text\n var start = pos.ch, end = pos.ch\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\")\n if ((pos.xRel < 0 || end == line.length) && start) { --start; } else { ++end }\n var startChar = line.charAt(start)\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); }\n while (start > 0 && check(line.charAt(start - 1))) { --start }\n while (end < line.length && check(line.charAt(end))) { ++end }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\") }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\") }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite)\n },\n hasFocus: function() { return this.display.input.getField() == activeElt() },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function(x, y) {\n if (x != null || y != null) { resolveScrollToPos(this) }\n if (x != null) { this.curOp.scrollLeft = x }\n if (y != null) { this.curOp.scrollTop = y }\n }),\n getScrollInfo: function() {\n var scroller = this.display.scroller\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range, margin) {\n if (range == null) {\n range = {from: this.doc.sel.primary().head, to: null}\n if (margin == null) { margin = this.options.cursorScrollMargin }\n } else if (typeof range == \"number\") {\n range = {from: Pos(range, 0), to: null}\n } else if (range.from == null) {\n range = {from: range, to: null}\n }\n if (!range.to) { range.to = range.from }\n range.margin = margin || 0\n\n if (range.from.line != null) {\n resolveScrollToPos(this)\n this.curOp.scrollToPos = range\n } else {\n var sPos = calculateScrollPos(this, Math.min(range.from.left, range.to.left),\n Math.min(range.from.top, range.to.top) - range.margin,\n Math.max(range.from.right, range.to.right),\n Math.max(range.from.bottom, range.to.bottom) + range.margin)\n this.scrollTo(sPos.scrollLeft, sPos.scrollTop)\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; }\n if (width != null) { this.display.wrapper.style.width = interpret(width) }\n if (height != null) { this.display.wrapper.style.height = interpret(height) }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this) }\n var lineNo = this.display.viewFrom\n this.doc.iter(lineNo, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo, \"widget\"); break } } }\n ++lineNo\n })\n this.curOp.forceUpdate = true\n signal(this, \"refresh\", this)\n }),\n\n operation: function(f){return runInOp(this, f)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight\n regChange(this)\n this.curOp.forceUpdate = true\n clearCaches(this)\n this.scrollTo(this.doc.scrollLeft, this.doc.scrollTop)\n updateGutterSpace(this)\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)\n { estimateLineHeights(this) }\n signal(this, \"refresh\", this)\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc\n old.cm = null\n attachDoc(this, doc)\n clearCaches(this)\n this.display.input.reset()\n this.scrollTo(doc.scrollLeft, doc.scrollTop)\n this.curOp.forceScroll = true\n signalLater(this, \"swapDoc\", this, old)\n return old\n }),\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n }\n eventMixin(CodeMirror)\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []} }\n helpers[type][name] = value\n }\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value)\n helpers[type]._global.push({pred: predicate, val: value})\n }\n}", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers\n\n var helpers = CodeMirror.helpers = {}\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus()},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option]\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old) }\n signal(this, \"optionChange\", this, option)\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map))\n },\n removeKeyMap: function(map) {\n var maps = this.state.keyMaps\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map || maps[i].name == map) {\n maps.splice(i, 1)\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec)\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; })\n this.state.modeGen++\n regChange(this)\n }),\n removeOverlay: methodOp(function(spec) {\n var this$1 = this;\n\n var overlays = this.state.overlays\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1)\n this$1.state.modeGen++\n regChange(this$1)\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\" }\n else { dir = dir ? \"add\" : \"subtract\" }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive) }\n }),\n indentSelection: methodOp(function(how) {\n var this$1 = this;\n\n var ranges = this.doc.sel.ranges, end = -1\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i]\n if (!range.empty()) {\n var from = range.from(), to = range.to()\n var start = Math.max(end, from.line)\n end = Math.min(this$1.lastLine(), to.line - (to.ch ? 0 : 1)) + 1\n for (var j = start; j < end; ++j)\n { indentLine(this$1, j, how) }\n var newRanges = this$1.doc.sel.ranges\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll) }\n } else if (range.head.line > end) {\n indentLine(this$1, range.head.line, how, true)\n end = range.head.line\n if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1) }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos)\n var styles = getLineStyles(this, getLine(this.doc, pos.line))\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch\n var type\n if (ch == 0) { type = styles[2] }\n else { for (;;) {\n var mid = (before + after) >> 1\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1 }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var this$1 = this;\n\n var found = []\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos)\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]) }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]]\n if (val) { found.push(val) }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType])\n } else if (help[mode.name]) {\n found.push(help[mode.name])\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1]\n if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1)\n { found.push(cur.val) }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line)\n return getStateBefore(this, line + 1, precise)\n },\n\n cursorCoords: function(start, mode) {\n var pos, range = this.doc.sel.primary()\n if (start == null) { pos = range.head }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start) }\n else { pos = start ? range.from() : range.to() }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\")\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1\n if (line < this.doc.first) { line = this.doc.first }\n else if (line > last) { line = last; end = true }\n lineObj = getLine(this.doc, line)\n } else {\n lineObj = line\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display\n pos = cursorCoords(this, clipPos(this.doc, pos))\n var top = pos.bottom, left = pos.left\n node.style.position = \"absolute\"\n node.setAttribute(\"cm-ignore-events\", \"true\")\n this.display.input.setUneditable(node)\n display.sizer.appendChild(node)\n if (vert == \"over\") {\n top = pos.top\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth)\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth }\n }\n node.style.top = top + \"px\"\n node.style.left = node.style.right = \"\"\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth\n node.style.right = \"0px\"\n } else {\n if (horiz == \"left\") { left = 0 }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2 }\n node.style.left = left + \"px\"\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}) }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text) }),\n\n findPosH: function(from, amount, unit, visually) {\n var this$1 = this;\n\n var dir = 1\n if (amount < 0) { dir = -1; amount = -amount }\n var cur = clipPos(this.doc, from)\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this$1.doc, cur, dir, unit, visually)\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range) {\n if (this$1.display.shift || this$1.doc.extend || range.empty())\n { return findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range.from() : range.to() }\n }, sel_move)\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\") }\n else\n { deleteNearSelection(this, function (range) {\n var other = findPosH(doc, range.head, dir, unit, false)\n return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other}\n }) }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var this$1 = this;\n\n var dir = 1, x = goalColumn\n if (amount < 0) { dir = -1; amount = -amount }\n var cur = clipPos(this.doc, from)\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this$1, cur, \"div\")\n if (x == null) { x = coords.left }\n else { coords.left = x }\n cur = findPosV(this$1, coords, dir, unit)\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = []\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected()\n doc.extendSelectionsBy(function (range) {\n if (collapse)\n { return dir < 0 ? range.from() : range.to() }\n var headPos = cursorCoords(this$1, range.head, \"div\")\n if (range.goalColumn != null) { headPos.left = range.goalColumn }\n goals.push(headPos.left)\n var pos = findPosV(this$1, headPos, dir, unit)\n if (unit == \"page\" && range == doc.sel.primary())\n { addToScrollPos(this$1, null, charCoords(this$1, pos, \"div\").top - headPos.top) }\n return pos\n }, sel_move)\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i] } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text\n var start = pos.ch, end = pos.ch\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\")\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end }\n var startChar = line.charAt(start)\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); }\n while (start > 0 && check(line.charAt(start - 1))) { --start }\n while (end < line.length && check(line.charAt(end))) { ++end }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\") }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\") }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite)\n },\n hasFocus: function() { return this.display.input.getField() == activeElt() },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function(x, y) {\n if (x != null || y != null) { resolveScrollToPos(this) }\n if (x != null) { this.curOp.scrollLeft = x }\n if (y != null) { this.curOp.scrollTop = y }\n }),\n getScrollInfo: function() {\n var scroller = this.display.scroller\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range, margin) {\n if (range == null) {\n range = {from: this.doc.sel.primary().head, to: null}\n if (margin == null) { margin = this.options.cursorScrollMargin }\n } else if (typeof range == \"number\") {\n range = {from: Pos(range, 0), to: null}\n } else if (range.from == null) {\n range = {from: range, to: null}\n }\n if (!range.to) { range.to = range.from }\n range.margin = margin || 0\n\n if (range.from.line != null) {\n resolveScrollToPos(this)\n this.curOp.scrollToPos = range\n } else {\n var sPos = calculateScrollPos(this, {\n left: Math.min(range.from.left, range.to.left),\n top: Math.min(range.from.top, range.to.top) - range.margin,\n right: Math.max(range.from.right, range.to.right),\n bottom: Math.max(range.from.bottom, range.to.bottom) + range.margin\n })\n this.scrollTo(sPos.scrollLeft, sPos.scrollTop)\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; }\n if (width != null) { this.display.wrapper.style.width = interpret(width) }\n if (height != null) { this.display.wrapper.style.height = interpret(height) }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this) }\n var lineNo = this.display.viewFrom\n this.doc.iter(lineNo, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo, \"widget\"); break } } }\n ++lineNo\n })\n this.curOp.forceUpdate = true\n signal(this, \"refresh\", this)\n }),\n\n operation: function(f){return runInOp(this, f)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight\n regChange(this)\n this.curOp.forceUpdate = true\n clearCaches(this)\n this.scrollTo(this.doc.scrollLeft, this.doc.scrollTop)\n updateGutterSpace(this)\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)\n { estimateLineHeights(this) }\n signal(this, \"refresh\", this)\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc\n old.cm = null\n attachDoc(this, doc)\n clearCaches(this)\n this.display.input.reset()\n this.scrollTo(doc.scrollLeft, doc.scrollTop)\n this.curOp.forceScroll = true\n signalLater(this, \"swapDoc\", this, old)\n return old\n }),\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n }\n eventMixin(CodeMirror)\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []} }\n helpers[type][name] = value\n }\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value)\n helpers[type]._global.push({pred: predicate, val: value})\n }\n}", "function restore_options() {\n chrome.storage.sync.get(tcDefaults, function(storage) {\n updateShortcutInputText('popKeyInput', storage.popKeyCode);\n });\n}", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){win(this).focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map));\n },\n removeKeyMap: function(map) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map || maps[i].name == map) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this.state.modeGen++;\n regChange(this);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n if (!range.empty()) {\n var from = range.from(), to = range.to();\n var start = Math.max(end, from.line);\n end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this, j, how); }\n var newRanges = this.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range.head.line > end) {\n indentLine(this, range.head.line, how, true);\n end = range.head.line;\n if (i == this.doc.sel.primIndex) { ensureCursorVisible(this); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range = this.doc.sel.primary();\n if (start == null) { pos = range.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range.from() : range.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range) {\n if (this$1.display.shift || this$1.doc.extend || range.empty())\n { return findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range.from() : range.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range) {\n var other = findPosH(doc, range.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range) {\n if (collapse)\n { return dir < 0 ? range.from() : range.to() }\n var headPos = cursorCoords(this$1, range.head, \"div\");\n if (range.goalColumn != null) { headPos.left = range.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt(doc(this)) },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range, margin) {\n if (range == null) {\n range = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range == \"number\") {\n range = {from: Pos(range, 0), to: null};\n } else if (range.from == null) {\n range = {from: range, to: null};\n }\n if (!range.to) { range.to = range.from; }\n range.margin = margin || 0;\n\n if (range.from.line != null) {\n scrollToRange(this, range);\n } else {\n scrollToCoordsRange(this, range.from, range.to, range.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo = this.display.viewFrom;\n this.doc.iter(lineNo, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo, \"widget\"); break } } }\n ++lineNo;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this.display);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5 || this.options.lineWrapping)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n // Cancel the current text selection if any (#5821)\n if (this.state.selectingText) { this.state.selectingText(); }\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){win(this).focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map));\n },\n removeKeyMap: function(map) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map || maps[i].name == map) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this.state.modeGen++;\n regChange(this);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n if (!range.empty()) {\n var from = range.from(), to = range.to();\n var start = Math.max(end, from.line);\n end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this, j, how); }\n var newRanges = this.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range.head.line > end) {\n indentLine(this, range.head.line, how, true);\n end = range.head.line;\n if (i == this.doc.sel.primIndex) { ensureCursorVisible(this); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range = this.doc.sel.primary();\n if (start == null) { pos = range.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range.from() : range.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range) {\n if (this$1.display.shift || this$1.doc.extend || range.empty())\n { return findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range.from() : range.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range) {\n var other = findPosH(doc, range.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range) {\n if (collapse)\n { return dir < 0 ? range.from() : range.to() }\n var headPos = cursorCoords(this$1, range.head, \"div\");\n if (range.goalColumn != null) { headPos.left = range.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt(doc(this)) },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range, margin) {\n if (range == null) {\n range = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range == \"number\") {\n range = {from: Pos(range, 0), to: null};\n } else if (range.from == null) {\n range = {from: range, to: null};\n }\n if (!range.to) { range.to = range.from; }\n range.margin = margin || 0;\n\n if (range.from.line != null) {\n scrollToRange(this, range);\n } else {\n scrollToCoordsRange(this, range.from, range.to, range.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo = this.display.viewFrom;\n this.doc.iter(lineNo, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo, \"widget\"); break } } }\n ++lineNo;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this.display);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5 || this.options.lineWrapping)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n // Cancel the current text selection if any (#5821)\n if (this.state.selectingText) { this.state.selectingText(); }\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }", "onEditComplete_() {\n this['editing'] = false;\n }", "function restore_options() {\n // Use default value color = 'red' and likesColor = true.\n chrome.storage.sync.get({\n darkGithub: false,\n darkSemaphore: false,\n darkLogentries: false,\n darkThundertix: false,\n darkThunderstage: false,\n darkThunderlocal: false\n }, function(items) {\n document.getElementById('dark_github').checked = items.darkGithub;\n document.getElementById('dark_semaphore').checked = items.darkSemaphore;\n document.getElementById('dark_logentries').checked = items.darkLogentries;\n document.getElementById('dark_thundertix').checked = items.darkThundertix;\n document.getElementById('dark_thunderstage').checked = items.darkThunderstage;\n document.getElementById('dark_localthundertix').checked = items.darkThunderlocal;\n });\n}", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n var helpers = CodeMirror.helpers = {};\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function focus() {\n window.focus();\n this.display.input.focus();\n },\n setOption: function setOption(option, value) {\n var options = this.options,\n old = options[option];\n\n if (options[option] == value && option != \"mode\") {\n return;\n }\n\n options[option] = value;\n\n if (optionHandlers.hasOwnProperty(option)) {\n operation(this, optionHandlers[option])(this, value, old);\n }\n\n signal(this, \"optionChange\", this, option);\n },\n getOption: function getOption(option) {\n return this.options[option];\n },\n getDoc: function getDoc() {\n return this.doc;\n },\n addKeyMap: function addKeyMap(map, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map));\n },\n removeKeyMap: function removeKeyMap(map) {\n var maps = this.state.keyMaps;\n\n for (var i = 0; i < maps.length; ++i) {\n if (maps[i] == map || maps[i].name == map) {\n maps.splice(i, 1);\n return true;\n }\n }\n },\n addOverlay: methodOp(function (spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n\n if (mode.startState) {\n throw new Error(\"Overlays may not be stateful.\");\n }\n\n insertSorted(this.state.overlays, {\n mode: mode,\n modeSpec: spec,\n opaque: options && options.opaque,\n priority: options && options.priority || 0\n }, function (overlay) {\n return overlay.priority;\n });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function (spec) {\n var overlays = this.state.overlays;\n\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this.state.modeGen++;\n regChange(this);\n return;\n }\n }\n }),\n indentLine: methodOp(function (n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) {\n dir = this.options.smartIndent ? \"smart\" : \"prev\";\n } else {\n dir = dir ? \"add\" : \"subtract\";\n }\n }\n\n if (isLine(this.doc, n)) {\n indentLine(this, n, dir, aggressive);\n }\n }),\n indentSelection: methodOp(function (how) {\n var ranges = this.doc.sel.ranges,\n end = -1;\n\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n\n if (!range.empty()) {\n var from = range.from(),\n to = range.to();\n var start = Math.max(end, from.line);\n end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n\n for (var j = start; j < end; ++j) {\n indentLine(this, j, how);\n }\n\n var newRanges = this.doc.sel.ranges;\n\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0) {\n replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll);\n }\n } else if (range.head.line > end) {\n indentLine(this, range.head.line, how, true);\n end = range.head.line;\n\n if (i == this.doc.sel.primIndex) {\n ensureCursorVisible(this);\n }\n }\n }\n }),\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function getTokenAt(pos, precise) {\n return takeToken(this, pos, precise);\n },\n getLineTokens: function getLineTokens(line, precise) {\n return takeToken(this, Pos(line), precise, true);\n },\n getTokenTypeAt: function getTokenTypeAt(pos) {\n pos = _clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0,\n after = (styles.length - 1) / 2,\n ch = pos.ch;\n var type;\n\n if (ch == 0) {\n type = styles[2];\n } else {\n for (;;) {\n var mid = before + after >> 1;\n\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) {\n after = mid;\n } else if (styles[mid * 2 + 1] < ch) {\n before = mid + 1;\n } else {\n type = styles[mid * 2 + 2];\n break;\n }\n }\n }\n\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1);\n },\n getModeAt: function getModeAt(pos) {\n var mode = this.doc.mode;\n\n if (!mode.innerMode) {\n return mode;\n }\n\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode;\n },\n getHelper: function getHelper(pos, type) {\n return this.getHelpers(pos, type)[0];\n },\n getHelpers: function getHelpers(pos, type) {\n var found = [];\n\n if (!helpers.hasOwnProperty(type)) {\n return found;\n }\n\n var help = helpers[type],\n mode = this.getModeAt(pos);\n\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) {\n found.push(help[mode[type]]);\n }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n\n if (val) {\n found.push(val);\n }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n\n if (cur.pred(mode, this) && indexOf(found, cur.val) == -1) {\n found.push(cur.val);\n }\n }\n\n return found;\n },\n getStateAfter: function getStateAfter(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1 : line);\n return getContextBefore(this, line + 1, precise).state;\n },\n cursorCoords: function cursorCoords(start, mode) {\n var pos,\n range = this.doc.sel.primary();\n\n if (start == null) {\n pos = range.head;\n } else if (_typeof(start) == \"object\") {\n pos = _clipPos(this.doc, start);\n } else {\n pos = start ? range.from() : range.to();\n }\n\n return _cursorCoords(this, pos, mode || \"page\");\n },\n charCoords: function charCoords(pos, mode) {\n return _charCoords(this, _clipPos(this.doc, pos), mode || \"page\");\n },\n coordsChar: function coordsChar(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return _coordsChar(this, coords.left, coords.top);\n },\n lineAtHeight: function lineAtHeight(height, mode) {\n height = fromCoordSystem(this, {\n top: height,\n left: 0\n }, mode || \"page\").top;\n return _lineAtHeight(this.doc, height + this.display.viewOffset);\n },\n heightAtLine: function heightAtLine(line, mode, includeWidgets) {\n var end = false,\n lineObj;\n\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n\n if (line < this.doc.first) {\n line = this.doc.first;\n } else if (line > last) {\n line = last;\n end = true;\n }\n\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n\n return intoCoordSystem(this, lineObj, {\n top: 0,\n left: 0\n }, mode || \"page\", includeWidgets || end).top + (end ? this.doc.height - _heightAtLine(lineObj) : 0);\n },\n defaultTextHeight: function defaultTextHeight() {\n return textHeight(this.display);\n },\n defaultCharWidth: function defaultCharWidth() {\n return charWidth(this.display);\n },\n getViewport: function getViewport() {\n return {\n from: this.display.viewFrom,\n to: this.display.viewTo\n };\n },\n addWidget: function addWidget(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = _cursorCoords(this, _clipPos(this.doc, pos));\n var top = pos.bottom,\n left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth); // Default to positioning above (if specified and possible); otherwise default to positioning below\n\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight) {\n top = pos.top - node.offsetHeight;\n } else if (pos.bottom + node.offsetHeight <= vspace) {\n top = pos.bottom;\n }\n\n if (left + node.offsetWidth > hspace) {\n left = hspace - node.offsetWidth;\n }\n }\n\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") {\n left = 0;\n } else if (horiz == \"middle\") {\n left = (display.sizer.clientWidth - node.offsetWidth) / 2;\n }\n\n node.style.left = left + \"px\";\n }\n\n if (scroll) {\n scrollIntoView(this, {\n left: left,\n top: top,\n right: left + node.offsetWidth,\n bottom: top + node.offsetHeight\n });\n }\n },\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n execCommand: function execCommand(cmd) {\n if (commands.hasOwnProperty(cmd)) {\n return commands[cmd].call(null, this);\n }\n },\n triggerElectric: methodOp(function (text) {\n triggerElectric(this, text);\n }),\n findPosH: function findPosH(from, amount, unit, visually) {\n var dir = 1;\n\n if (amount < 0) {\n dir = -1;\n amount = -amount;\n }\n\n var cur = _clipPos(this.doc, from);\n\n for (var i = 0; i < amount; ++i) {\n cur = _findPosH(this.doc, cur, dir, unit, visually);\n\n if (cur.hitSide) {\n break;\n }\n }\n\n return cur;\n },\n moveH: methodOp(function (dir, unit) {\n var this$1 = this;\n this.extendSelectionsBy(function (range) {\n if (this$1.display.shift || this$1.doc.extend || range.empty()) {\n return _findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually);\n } else {\n return dir < 0 ? range.from() : range.to();\n }\n }, sel_move);\n }),\n deleteH: methodOp(function (dir, unit) {\n var sel = this.doc.sel,\n doc = this.doc;\n\n if (sel.somethingSelected()) {\n doc.replaceSelection(\"\", null, \"+delete\");\n } else {\n deleteNearSelection(this, function (range) {\n var other = _findPosH(doc, range.head, dir, unit, false);\n\n return dir < 0 ? {\n from: other,\n to: range.head\n } : {\n from: range.head,\n to: other\n };\n });\n }\n }),\n findPosV: function findPosV(from, amount, unit, goalColumn) {\n var dir = 1,\n x = goalColumn;\n\n if (amount < 0) {\n dir = -1;\n amount = -amount;\n }\n\n var cur = _clipPos(this.doc, from);\n\n for (var i = 0; i < amount; ++i) {\n var coords = _cursorCoords(this, cur, \"div\");\n\n if (x == null) {\n x = coords.left;\n } else {\n coords.left = x;\n }\n\n cur = _findPosV(this, coords, dir, unit);\n\n if (cur.hitSide) {\n break;\n }\n }\n\n return cur;\n },\n moveV: methodOp(function (dir, unit) {\n var this$1 = this;\n var doc = this.doc,\n goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range) {\n if (collapse) {\n return dir < 0 ? range.from() : range.to();\n }\n\n var headPos = _cursorCoords(this$1, range.head, \"div\");\n\n if (range.goalColumn != null) {\n headPos.left = range.goalColumn;\n }\n\n goals.push(headPos.left);\n\n var pos = _findPosV(this$1, headPos, dir, unit);\n\n if (unit == \"page\" && range == doc.sel.primary()) {\n addToScrollTop(this$1, _charCoords(this$1, pos, \"div\").top - headPos.top);\n }\n\n return pos;\n }, sel_move);\n\n if (goals.length) {\n for (var i = 0; i < doc.sel.ranges.length; i++) {\n doc.sel.ranges[i].goalColumn = goals[i];\n }\n }\n }),\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function findWordAt(pos) {\n var doc = this.doc,\n line = getLine(doc, pos.line).text;\n var start = pos.ch,\n end = pos.ch;\n\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n\n if ((pos.sticky == \"before\" || end == line.length) && start) {\n --start;\n } else {\n ++end;\n }\n\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper) ? function (ch) {\n return isWordChar(ch, helper);\n } : /\\s/.test(startChar) ? function (ch) {\n return /\\s/.test(ch);\n } : function (ch) {\n return !/\\s/.test(ch) && !isWordChar(ch);\n };\n\n while (start > 0 && check(line.charAt(start - 1))) {\n --start;\n }\n\n while (end < line.length && check(line.charAt(end))) {\n ++end;\n }\n }\n\n return new Range(Pos(pos.line, start), Pos(pos.line, end));\n },\n toggleOverwrite: function toggleOverwrite(value) {\n if (value != null && value == this.state.overwrite) {\n return;\n }\n\n if (this.state.overwrite = !this.state.overwrite) {\n addClass(this.display.cursorDiv, \"CodeMirror-overwrite\");\n } else {\n rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\");\n }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function hasFocus() {\n return this.display.input.getField() == activeElt();\n },\n isReadOnly: function isReadOnly() {\n return !!(this.options.readOnly || this.doc.cantEdit);\n },\n scrollTo: methodOp(function (x, y) {\n scrollToCoords(this, x, y);\n }),\n getScrollInfo: function getScrollInfo() {\n var scroller = this.display.scroller;\n return {\n left: scroller.scrollLeft,\n top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this),\n clientWidth: displayWidth(this)\n };\n },\n scrollIntoView: methodOp(function (range, margin) {\n if (range == null) {\n range = {\n from: this.doc.sel.primary().head,\n to: null\n };\n\n if (margin == null) {\n margin = this.options.cursorScrollMargin;\n }\n } else if (typeof range == \"number\") {\n range = {\n from: Pos(range, 0),\n to: null\n };\n } else if (range.from == null) {\n range = {\n from: range,\n to: null\n };\n }\n\n if (!range.to) {\n range.to = range.from;\n }\n\n range.margin = margin || 0;\n\n if (range.from.line != null) {\n scrollToRange(this, range);\n } else {\n scrollToCoordsRange(this, range.from, range.to, range.margin);\n }\n }),\n setSize: methodOp(function (width, height) {\n var this$1 = this;\n\n var interpret = function interpret(val) {\n return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val;\n };\n\n if (width != null) {\n this.display.wrapper.style.width = interpret(width);\n }\n\n if (height != null) {\n this.display.wrapper.style.height = interpret(height);\n }\n\n if (this.options.lineWrapping) {\n clearLineMeasurementCache(this);\n }\n\n var lineNo = this.display.viewFrom;\n this.doc.iter(lineNo, this.display.viewTo, function (line) {\n if (line.widgets) {\n for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].noHScroll) {\n regLineChange(this$1, lineNo, \"widget\");\n break;\n }\n }\n }\n\n ++lineNo;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n operation: function operation(f) {\n return runInOp(this, f);\n },\n startOperation: function startOperation() {\n return _startOperation(this);\n },\n endOperation: function endOperation() {\n return _endOperation(this);\n },\n refresh: methodOp(function () {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this.display);\n\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5 || this.options.lineWrapping) {\n estimateLineHeights(this);\n }\n\n signal(this, \"refresh\", this);\n }),\n swapDoc: methodOp(function (doc) {\n var old = this.doc;\n old.cm = null; // Cancel the current text selection if any (#5821)\n\n if (this.state.selectingText) {\n this.state.selectingText();\n }\n\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old;\n }),\n phrase: function phrase(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText;\n },\n getInputField: function getInputField() {\n return this.display.input.getField();\n },\n getWrapperElement: function getWrapperElement() {\n return this.display.wrapper;\n },\n getScrollerElement: function getScrollerElement() {\n return this.display.scroller;\n },\n getGutterElement: function getGutterElement() {\n return this.display.gutters;\n }\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function (type, name, value) {\n if (!helpers.hasOwnProperty(type)) {\n helpers[type] = CodeMirror[type] = {\n _global: []\n };\n }\n\n helpers[type][name] = value;\n };\n\n CodeMirror.registerGlobalHelper = function (type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n\n helpers[type]._global.push({\n pred: predicate,\n val: value\n });\n };\n } // Used for horizontal relative motion. Dir is -1 or 1 (left or", "function resizeEditor() {\n if (_currentEditor) {\n $(_currentEditor.getScrollerElement()).height(_editorHolder.height());\n _currentEditor.refresh();\n }\n }", "function restore_options() {\r\n chrome.storage.sync.get({\r\n hideExtensions: false,\r\n autoTheatre: false,\r\n cursorMute: false\r\n }, function(items) {\r\n document.getElementById('hideExtensions').checked = items.hideExtensions;\r\n document.getElementById('autoTheatre').checked = items.autoTheatre;\r\n document.getElementById('cursorMute').checked = items.cursorMute;\r\n });\r\n}", "function update_interactiveness() {\n var interactive = document.getElementById('interactive').checked;\n// if (!(interactive)) { \n// eb.hide(); \n// } else {\n// eb.show();\n// }\n if (wt.instance.raw) { // && wt.filename) {\n var filename = wt.instance.filename;\n var path = wt.instance.path;\n var current_value = editor.getValue();\n var new_editor = set_data(null, current_value);\n new_editor.instance.filename = filename;\n new_editor.instance.path = path;\n }\n }", "function restore_options() {\n assignNodeReferences();\n chrome.storage.sync.get({\n payWallOption: true,\n adRemovalOption: true,\n trumpOption: true,\n trumpNameOption: 'florida man',\n yoHeaderOption: true,\n yoSuffixOption: 'yo'\n }, function(items) {\n payWallOption.checked = items.payWallOption;\n adRemovalOption.checked = items.adRemovalOption;\n trumpOption.checked = items.trumpOption;\n trumpNameOption.value = items.trumpNameOption.slice(0,30).toLowerCase();\n yoSuffixOption.value = items.yoSuffixOption.slice(0,30).toLowerCase();\n yoHeaderOption.checked = items.yoHeaderOption;\n closeButton.addEventListener(\"click\", function() {save_options()});\n closeButton.removeAttribute('disabled');\n });\n}", "function _updateEditorSize() {\n // The editor itself will call refresh() when it gets the window resize event.\n if (_currentEditor) {\n $(_currentEditor.getScrollerElement()).height(_editorHolder.height());\n }\n }", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map$$1, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map$$1));\n },\n removeKeyMap: function(map$$1) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map$$1 || maps[i].name == map$$1) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var this$1 = this;\n\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this$1.state.modeGen++;\n regChange(this$1);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var this$1 = this;\n\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range$$1 = ranges[i];\n if (!range$$1.empty()) {\n var from = range$$1.from(), to = range$$1.to();\n var start = Math.max(end, from.line);\n end = Math.min(this$1.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this$1, j, how); }\n var newRanges = this$1.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range$$1.head.line > end) {\n indentLine(this$1, range$$1.head.line, how, true);\n end = range$$1.head.line;\n if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var this$1 = this;\n\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range$$1 = this.doc.sel.primary();\n if (start == null) { pos = range$$1.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range$$1.from() : range$$1.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var this$1 = this;\n\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this$1.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range$$1) {\n if (this$1.display.shift || this$1.doc.extend || range$$1.empty())\n { return findPosH(this$1.doc, range$$1.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range$$1.from() : range$$1.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range$$1) {\n var other = findPosH(doc, range$$1.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range$$1.head} : {from: range$$1.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var this$1 = this;\n\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this$1, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this$1, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range$$1) {\n if (collapse)\n { return dir < 0 ? range$$1.from() : range$$1.to() }\n var headPos = cursorCoords(this$1, range$$1.head, \"div\");\n if (range$$1.goalColumn != null) { headPos.left = range$$1.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range$$1 == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt() },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range$$1, margin) {\n if (range$$1 == null) {\n range$$1 = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range$$1 == \"number\") {\n range$$1 = {from: Pos(range$$1, 0), to: null};\n } else if (range$$1.from == null) {\n range$$1 = {from: range$$1, to: null};\n }\n if (!range$$1.to) { range$$1.to = range$$1.from; }\n range$$1.margin = margin || 0;\n\n if (range$$1.from.line != null) {\n scrollToRange(this, range$$1);\n } else {\n scrollToCoordsRange(this, range$$1.from, range$$1.to, range$$1.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo$$1 = this.display.viewFrom;\n this.doc.iter(lineNo$$1, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo$$1, \"widget\"); break } } }\n ++lineNo$$1;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this.display);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n // Cancel the current text selection if any (#5821)\n if (this.state.selectingText) { this.state.selectingText(); }\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map$$1, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map$$1));\n },\n removeKeyMap: function(map$$1) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map$$1 || maps[i].name == map$$1) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var this$1 = this;\n\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this$1.state.modeGen++;\n regChange(this$1);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var this$1 = this;\n\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range$$1 = ranges[i];\n if (!range$$1.empty()) {\n var from = range$$1.from(), to = range$$1.to();\n var start = Math.max(end, from.line);\n end = Math.min(this$1.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this$1, j, how); }\n var newRanges = this$1.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range$$1.head.line > end) {\n indentLine(this$1, range$$1.head.line, how, true);\n end = range$$1.head.line;\n if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var this$1 = this;\n\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range$$1 = this.doc.sel.primary();\n if (start == null) { pos = range$$1.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range$$1.from() : range$$1.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var this$1 = this;\n\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this$1.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range$$1) {\n if (this$1.display.shift || this$1.doc.extend || range$$1.empty())\n { return findPosH(this$1.doc, range$$1.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range$$1.from() : range$$1.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range$$1) {\n var other = findPosH(doc, range$$1.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range$$1.head} : {from: range$$1.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var this$1 = this;\n\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this$1, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this$1, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range$$1) {\n if (collapse)\n { return dir < 0 ? range$$1.from() : range$$1.to() }\n var headPos = cursorCoords(this$1, range$$1.head, \"div\");\n if (range$$1.goalColumn != null) { headPos.left = range$$1.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range$$1 == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt() },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range$$1, margin) {\n if (range$$1 == null) {\n range$$1 = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range$$1 == \"number\") {\n range$$1 = {from: Pos(range$$1, 0), to: null};\n } else if (range$$1.from == null) {\n range$$1 = {from: range$$1, to: null};\n }\n if (!range$$1.to) { range$$1.to = range$$1.from; }\n range$$1.margin = margin || 0;\n\n if (range$$1.from.line != null) {\n scrollToRange(this, range$$1);\n } else {\n scrollToCoordsRange(this, range$$1.from, range$$1.to, range$$1.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo$$1 = this.display.viewFrom;\n this.doc.iter(lineNo$$1, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo$$1, \"widget\"); break } } }\n ++lineNo$$1;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this.display);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n // Cancel the current text selection if any (#5821)\n if (this.state.selectingText) { this.state.selectingText(); }\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map$$1, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map$$1));\n },\n removeKeyMap: function(map$$1) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map$$1 || maps[i].name == map$$1) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var this$1 = this;\n\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this$1.state.modeGen++;\n regChange(this$1);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var this$1 = this;\n\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range$$1 = ranges[i];\n if (!range$$1.empty()) {\n var from = range$$1.from(), to = range$$1.to();\n var start = Math.max(end, from.line);\n end = Math.min(this$1.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this$1, j, how); }\n var newRanges = this$1.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range$$1.head.line > end) {\n indentLine(this$1, range$$1.head.line, how, true);\n end = range$$1.head.line;\n if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var this$1 = this;\n\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range$$1 = this.doc.sel.primary();\n if (start == null) { pos = range$$1.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range$$1.from() : range$$1.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var this$1 = this;\n\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this$1.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range$$1) {\n if (this$1.display.shift || this$1.doc.extend || range$$1.empty())\n { return findPosH(this$1.doc, range$$1.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range$$1.from() : range$$1.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range$$1) {\n var other = findPosH(doc, range$$1.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range$$1.head} : {from: range$$1.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var this$1 = this;\n\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this$1, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this$1, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range$$1) {\n if (collapse)\n { return dir < 0 ? range$$1.from() : range$$1.to() }\n var headPos = cursorCoords(this$1, range$$1.head, \"div\");\n if (range$$1.goalColumn != null) { headPos.left = range$$1.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range$$1 == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt() },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range$$1, margin) {\n if (range$$1 == null) {\n range$$1 = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range$$1 == \"number\") {\n range$$1 = {from: Pos(range$$1, 0), to: null};\n } else if (range$$1.from == null) {\n range$$1 = {from: range$$1, to: null};\n }\n if (!range$$1.to) { range$$1.to = range$$1.from; }\n range$$1.margin = margin || 0;\n\n if (range$$1.from.line != null) {\n scrollToRange(this, range$$1);\n } else {\n scrollToCoordsRange(this, range$$1.from, range$$1.to, range$$1.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo$$1 = this.display.viewFrom;\n this.doc.iter(lineNo$$1, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo$$1, \"widget\"); break } } }\n ++lineNo$$1;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this.display);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n // Cancel the current text selection if any (#5821)\n if (this.state.selectingText) { this.state.selectingText(); }\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map$$1, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map$$1));\n },\n removeKeyMap: function(map$$1) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map$$1 || maps[i].name == map$$1) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var this$1 = this;\n\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this$1.state.modeGen++;\n regChange(this$1);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var this$1 = this;\n\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range$$1 = ranges[i];\n if (!range$$1.empty()) {\n var from = range$$1.from(), to = range$$1.to();\n var start = Math.max(end, from.line);\n end = Math.min(this$1.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this$1, j, how); }\n var newRanges = this$1.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range$$1.head.line > end) {\n indentLine(this$1, range$$1.head.line, how, true);\n end = range$$1.head.line;\n if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var this$1 = this;\n\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range$$1 = this.doc.sel.primary();\n if (start == null) { pos = range$$1.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range$$1.from() : range$$1.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var this$1 = this;\n\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this$1.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range$$1) {\n if (this$1.display.shift || this$1.doc.extend || range$$1.empty())\n { return findPosH(this$1.doc, range$$1.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range$$1.from() : range$$1.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range$$1) {\n var other = findPosH(doc, range$$1.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range$$1.head} : {from: range$$1.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var this$1 = this;\n\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this$1, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this$1, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range$$1) {\n if (collapse)\n { return dir < 0 ? range$$1.from() : range$$1.to() }\n var headPos = cursorCoords(this$1, range$$1.head, \"div\");\n if (range$$1.goalColumn != null) { headPos.left = range$$1.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range$$1 == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt() },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range$$1, margin) {\n if (range$$1 == null) {\n range$$1 = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range$$1 == \"number\") {\n range$$1 = {from: Pos(range$$1, 0), to: null};\n } else if (range$$1.from == null) {\n range$$1 = {from: range$$1, to: null};\n }\n if (!range$$1.to) { range$$1.to = range$$1.from; }\n range$$1.margin = margin || 0;\n\n if (range$$1.from.line != null) {\n scrollToRange(this, range$$1);\n } else {\n scrollToCoordsRange(this, range$$1.from, range$$1.to, range$$1.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo$$1 = this.display.viewFrom;\n this.doc.iter(lineNo$$1, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo$$1, \"widget\"); break } } }\n ++lineNo$$1;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this.display);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n // Cancel the current text selection if any (#5821)\n if (this.state.selectingText) { this.state.selectingText(); }\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map$$1, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map$$1));\n },\n removeKeyMap: function(map$$1) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map$$1 || maps[i].name == map$$1) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var this$1 = this;\n\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this$1.state.modeGen++;\n regChange(this$1);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var this$1 = this;\n\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range$$1 = ranges[i];\n if (!range$$1.empty()) {\n var from = range$$1.from(), to = range$$1.to();\n var start = Math.max(end, from.line);\n end = Math.min(this$1.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this$1, j, how); }\n var newRanges = this$1.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range$$1.head.line > end) {\n indentLine(this$1, range$$1.head.line, how, true);\n end = range$$1.head.line;\n if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var this$1 = this;\n\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range$$1 = this.doc.sel.primary();\n if (start == null) { pos = range$$1.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range$$1.from() : range$$1.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var this$1 = this;\n\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this$1.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range$$1) {\n if (this$1.display.shift || this$1.doc.extend || range$$1.empty())\n { return findPosH(this$1.doc, range$$1.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range$$1.from() : range$$1.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range$$1) {\n var other = findPosH(doc, range$$1.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range$$1.head} : {from: range$$1.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var this$1 = this;\n\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this$1, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this$1, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range$$1) {\n if (collapse)\n { return dir < 0 ? range$$1.from() : range$$1.to() }\n var headPos = cursorCoords(this$1, range$$1.head, \"div\");\n if (range$$1.goalColumn != null) { headPos.left = range$$1.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range$$1 == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt() },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range$$1, margin) {\n if (range$$1 == null) {\n range$$1 = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range$$1 == \"number\") {\n range$$1 = {from: Pos(range$$1, 0), to: null};\n } else if (range$$1.from == null) {\n range$$1 = {from: range$$1, to: null};\n }\n if (!range$$1.to) { range$$1.to = range$$1.from; }\n range$$1.margin = margin || 0;\n\n if (range$$1.from.line != null) {\n scrollToRange(this, range$$1);\n } else {\n scrollToCoordsRange(this, range$$1.from, range$$1.to, range$$1.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo$$1 = this.display.viewFrom;\n this.doc.iter(lineNo$$1, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo$$1, \"widget\"); break } } }\n ++lineNo$$1;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map$$1, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map$$1));\n },\n removeKeyMap: function(map$$1) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map$$1 || maps[i].name == map$$1) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var this$1 = this;\n\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this$1.state.modeGen++;\n regChange(this$1);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var this$1 = this;\n\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range$$1 = ranges[i];\n if (!range$$1.empty()) {\n var from = range$$1.from(), to = range$$1.to();\n var start = Math.max(end, from.line);\n end = Math.min(this$1.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this$1, j, how); }\n var newRanges = this$1.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range$$1.head.line > end) {\n indentLine(this$1, range$$1.head.line, how, true);\n end = range$$1.head.line;\n if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var this$1 = this;\n\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range$$1 = this.doc.sel.primary();\n if (start == null) { pos = range$$1.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range$$1.from() : range$$1.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var this$1 = this;\n\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this$1.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range$$1) {\n if (this$1.display.shift || this$1.doc.extend || range$$1.empty())\n { return findPosH(this$1.doc, range$$1.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range$$1.from() : range$$1.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range$$1) {\n var other = findPosH(doc, range$$1.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range$$1.head} : {from: range$$1.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var this$1 = this;\n\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this$1, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this$1, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range$$1) {\n if (collapse)\n { return dir < 0 ? range$$1.from() : range$$1.to() }\n var headPos = cursorCoords(this$1, range$$1.head, \"div\");\n if (range$$1.goalColumn != null) { headPos.left = range$$1.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range$$1 == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt() },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range$$1, margin) {\n if (range$$1 == null) {\n range$$1 = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range$$1 == \"number\") {\n range$$1 = {from: Pos(range$$1, 0), to: null};\n } else if (range$$1.from == null) {\n range$$1 = {from: range$$1, to: null};\n }\n if (!range$$1.to) { range$$1.to = range$$1.from; }\n range$$1.margin = margin || 0;\n\n if (range$$1.from.line != null) {\n scrollToRange(this, range$$1);\n } else {\n scrollToCoordsRange(this, range$$1.from, range$$1.to, range$$1.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo$$1 = this.display.viewFrom;\n this.doc.iter(lineNo$$1, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo$$1, \"widget\"); break } } }\n ++lineNo$$1;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this.display);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n // Cancel the current text selection if any (#5821)\n if (this.state.selectingText) { this.state.selectingText(); }\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map$$1, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map$$1));\n },\n removeKeyMap: function(map$$1) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map$$1 || maps[i].name == map$$1) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var this$1 = this;\n\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this$1.state.modeGen++;\n regChange(this$1);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var this$1 = this;\n\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range$$1 = ranges[i];\n if (!range$$1.empty()) {\n var from = range$$1.from(), to = range$$1.to();\n var start = Math.max(end, from.line);\n end = Math.min(this$1.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this$1, j, how); }\n var newRanges = this$1.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range$$1.head.line > end) {\n indentLine(this$1, range$$1.head.line, how, true);\n end = range$$1.head.line;\n if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var this$1 = this;\n\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range$$1 = this.doc.sel.primary();\n if (start == null) { pos = range$$1.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range$$1.from() : range$$1.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var this$1 = this;\n\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this$1.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range$$1) {\n if (this$1.display.shift || this$1.doc.extend || range$$1.empty())\n { return findPosH(this$1.doc, range$$1.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range$$1.from() : range$$1.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range$$1) {\n var other = findPosH(doc, range$$1.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range$$1.head} : {from: range$$1.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var this$1 = this;\n\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this$1, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this$1, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range$$1) {\n if (collapse)\n { return dir < 0 ? range$$1.from() : range$$1.to() }\n var headPos = cursorCoords(this$1, range$$1.head, \"div\");\n if (range$$1.goalColumn != null) { headPos.left = range$$1.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range$$1 == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt() },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range$$1, margin) {\n if (range$$1 == null) {\n range$$1 = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range$$1 == \"number\") {\n range$$1 = {from: Pos(range$$1, 0), to: null};\n } else if (range$$1.from == null) {\n range$$1 = {from: range$$1, to: null};\n }\n if (!range$$1.to) { range$$1.to = range$$1.from; }\n range$$1.margin = margin || 0;\n\n if (range$$1.from.line != null) {\n scrollToRange(this, range$$1);\n } else {\n scrollToCoordsRange(this, range$$1.from, range$$1.to, range$$1.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo$$1 = this.display.viewFrom;\n this.doc.iter(lineNo$$1, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo$$1, \"widget\"); break } } }\n ++lineNo$$1;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map$$1, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map$$1));\n },\n removeKeyMap: function(map$$1) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map$$1 || maps[i].name == map$$1) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var this$1 = this;\n\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this$1.state.modeGen++;\n regChange(this$1);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var this$1 = this;\n\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range$$1 = ranges[i];\n if (!range$$1.empty()) {\n var from = range$$1.from(), to = range$$1.to();\n var start = Math.max(end, from.line);\n end = Math.min(this$1.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this$1, j, how); }\n var newRanges = this$1.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range$$1.head.line > end) {\n indentLine(this$1, range$$1.head.line, how, true);\n end = range$$1.head.line;\n if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var this$1 = this;\n\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range$$1 = this.doc.sel.primary();\n if (start == null) { pos = range$$1.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range$$1.from() : range$$1.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var this$1 = this;\n\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this$1.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range$$1) {\n if (this$1.display.shift || this$1.doc.extend || range$$1.empty())\n { return findPosH(this$1.doc, range$$1.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range$$1.from() : range$$1.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range$$1) {\n var other = findPosH(doc, range$$1.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range$$1.head} : {from: range$$1.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var this$1 = this;\n\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this$1, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this$1, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range$$1) {\n if (collapse)\n { return dir < 0 ? range$$1.from() : range$$1.to() }\n var headPos = cursorCoords(this$1, range$$1.head, \"div\");\n if (range$$1.goalColumn != null) { headPos.left = range$$1.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range$$1 == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt() },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range$$1, margin) {\n if (range$$1 == null) {\n range$$1 = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range$$1 == \"number\") {\n range$$1 = {from: Pos(range$$1, 0), to: null};\n } else if (range$$1.from == null) {\n range$$1 = {from: range$$1, to: null};\n }\n if (!range$$1.to) { range$$1.to = range$$1.from; }\n range$$1.margin = margin || 0;\n\n if (range$$1.from.line != null) {\n scrollToRange(this, range$$1);\n } else {\n scrollToCoordsRange(this, range$$1.from, range$$1.to, range$$1.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo$$1 = this.display.viewFrom;\n this.doc.iter(lineNo$$1, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo$$1, \"widget\"); break } } }\n ++lineNo$$1;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }", "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map$$1, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map$$1));\n },\n removeKeyMap: function(map$$1) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map$$1 || maps[i].name == map$$1) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var this$1 = this;\n\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this$1.state.modeGen++;\n regChange(this$1);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var this$1 = this;\n\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range$$1 = ranges[i];\n if (!range$$1.empty()) {\n var from = range$$1.from(), to = range$$1.to();\n var start = Math.max(end, from.line);\n end = Math.min(this$1.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this$1, j, how); }\n var newRanges = this$1.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range$$1.head.line > end) {\n indentLine(this$1, range$$1.head.line, how, true);\n end = range$$1.head.line;\n if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var this$1 = this;\n\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range$$1 = this.doc.sel.primary();\n if (start == null) { pos = range$$1.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range$$1.from() : range$$1.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var this$1 = this;\n\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this$1.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range$$1) {\n if (this$1.display.shift || this$1.doc.extend || range$$1.empty())\n { return findPosH(this$1.doc, range$$1.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range$$1.from() : range$$1.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range$$1) {\n var other = findPosH(doc, range$$1.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range$$1.head} : {from: range$$1.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var this$1 = this;\n\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this$1, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this$1, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range$$1) {\n if (collapse)\n { return dir < 0 ? range$$1.from() : range$$1.to() }\n var headPos = cursorCoords(this$1, range$$1.head, \"div\");\n if (range$$1.goalColumn != null) { headPos.left = range$$1.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range$$1 == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt() },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range$$1, margin) {\n if (range$$1 == null) {\n range$$1 = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range$$1 == \"number\") {\n range$$1 = {from: Pos(range$$1, 0), to: null};\n } else if (range$$1.from == null) {\n range$$1 = {from: range$$1, to: null};\n }\n if (!range$$1.to) { range$$1.to = range$$1.from; }\n range$$1.margin = margin || 0;\n\n if (range$$1.from.line != null) {\n scrollToRange(this, range$$1);\n } else {\n scrollToCoordsRange(this, range$$1.from, range$$1.to, range$$1.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo$$1 = this.display.viewFrom;\n this.doc.iter(lineNo$$1, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo$$1, \"widget\"); break } } }\n ++lineNo$$1;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }", "function optionChanged(newState){\n buildMetadata(newState);\n buildCharts(newState);\n}" ]
[ "0.65174145", "0.6448267", "0.6407012", "0.6382705", "0.63655174", "0.63512903", "0.6341789", "0.6240036", "0.62384015", "0.62281793", "0.6186693", "0.61820716", "0.614012", "0.6127556", "0.61134076", "0.61133647", "0.6105441", "0.6083987", "0.6079587", "0.60270965", "0.60219824", "0.6012482", "0.5997533", "0.59940374", "0.59857947", "0.59834933", "0.59707624", "0.5946352", "0.59446174", "0.59292793", "0.58908594", "0.58908594", "0.58908594", "0.5890247", "0.5888851", "0.58860344", "0.5858741", "0.58512235", "0.5847598", "0.5847315", "0.5831689", "0.5829839", "0.58174884", "0.5814364", "0.5814364", "0.5811746", "0.5810989", "0.58076066", "0.58006483", "0.5796938", "0.57805955", "0.5771937", "0.5741783", "0.57374597", "0.5731593", "0.5718711", "0.57083637", "0.57044494", "0.5697267", "0.56805706", "0.56724876", "0.5661575", "0.56559557", "0.5653354", "0.56516975", "0.5647439", "0.5641623", "0.5641623", "0.5641623", "0.5641623", "0.5641623", "0.5641623", "0.5636556", "0.56357974", "0.56338656", "0.5628713", "0.56286836", "0.5624596", "0.56199074", "0.56199074", "0.5618378", "0.56135714", "0.56135714", "0.56133807", "0.56058985", "0.56026876", "0.56014854", "0.56007165", "0.5595891", "0.5593245", "0.55847424", "0.5583041", "0.5583041", "0.5583041", "0.5583041", "0.5583041", "0.5583041", "0.5583041", "0.5583041", "0.5583041", "0.5581391" ]
0.0
-1
DOCUMENT DATA STRUCTURE By default, updates that start and end at the beginning of a line are treated specially, in order to make the association of line widgets and marker elements with the text behave more intuitive.
function isWholeLineUpdate(doc, change) { return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == "" && (!doc.cm || doc.cm.options.wholeLineUpdateBefore) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "update(text, start, end) {\n this.lineOffsets = undefined;\n const content = this.getText();\n this.setText(content.slice(0, start) + text + content.slice(end));\n }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n\t\t function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n\t\t function update(line, text, spans) {\n\t\t updateLine(line, text, spans, estimateHeight);\n\t\t signalLater(line, \"change\", line, change);\n\t\t }\n\t\t function linesFor(start, end) {\n\t\t var result = [];\n\t\t for (var i = start; i < end; ++i)\n\t\t { result.push(new Line(text[i], spansFor(i), estimateHeight)); }\n\t\t return result\n\t\t }\n\n\t\t var from = change.from, to = change.to, text = change.text;\n\t\t var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n\t\t var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n\t\t // Adjust the line structure\n\t\t if (change.full) {\n\t\t doc.insert(0, linesFor(0, text.length));\n\t\t doc.remove(text.length, doc.size - text.length);\n\t\t } else if (isWholeLineUpdate(doc, change)) {\n\t\t // This is a whole-line replace. Treated specially to make\n\t\t // sure line objects move the way they are supposed to.\n\t\t var added = linesFor(0, text.length - 1);\n\t\t update(lastLine, lastLine.text, lastSpans);\n\t\t if (nlines) { doc.remove(from.line, nlines); }\n\t\t if (added.length) { doc.insert(from.line, added); }\n\t\t } else if (firstLine == lastLine) {\n\t\t if (text.length == 1) {\n\t\t update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n\t\t } else {\n\t\t var added$1 = linesFor(1, text.length - 1);\n\t\t added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n\t\t update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n\t\t doc.insert(from.line + 1, added$1);\n\t\t }\n\t\t } else if (text.length == 1) {\n\t\t update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n\t\t doc.remove(from.line + 1, nlines);\n\t\t } else {\n\t\t update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n\t\t update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n\t\t var added$2 = linesFor(1, text.length - 1);\n\t\t if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n\t\t doc.insert(from.line + 1, added$2);\n\t\t }\n\n\t\t signalLater(doc, \"change\", doc, change);\n\t\t }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n\t\t function spansFor(n) {return markedSpans ? markedSpans[n] : null;}\n\t\t function update(line, text, spans) {\n\t\t updateLine(line, text, spans, estimateHeight);\n\t\t signalLater(line, \"change\", line, change);\n\t\t }\n\t\t function linesFor(start, end) {\n\t\t for (var i = start, result = []; i < end; ++i)\n\t\t result.push(new Line(text[i], spansFor(i), estimateHeight));\n\t\t return result;\n\t\t }\n\t\t\n\t\t var from = change.from, to = change.to, text = change.text;\n\t\t var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n\t\t var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\t\t\n\t\t // Adjust the line structure\n\t\t if (change.full) {\n\t\t doc.insert(0, linesFor(0, text.length));\n\t\t doc.remove(text.length, doc.size - text.length);\n\t\t } else if (isWholeLineUpdate(doc, change)) {\n\t\t // This is a whole-line replace. Treated specially to make\n\t\t // sure line objects move the way they are supposed to.\n\t\t var added = linesFor(0, text.length - 1);\n\t\t update(lastLine, lastLine.text, lastSpans);\n\t\t if (nlines) doc.remove(from.line, nlines);\n\t\t if (added.length) doc.insert(from.line, added);\n\t\t } else if (firstLine == lastLine) {\n\t\t if (text.length == 1) {\n\t\t update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n\t\t } else {\n\t\t var added = linesFor(1, text.length - 1);\n\t\t added.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n\t\t update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n\t\t doc.insert(from.line + 1, added);\n\t\t }\n\t\t } else if (text.length == 1) {\n\t\t update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n\t\t doc.remove(from.line + 1, nlines);\n\t\t } else {\n\t\t update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n\t\t update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n\t\t var added = linesFor(1, text.length - 1);\n\t\t if (nlines > 1) doc.remove(from.line + 1, nlines - 1);\n\t\t doc.insert(from.line + 1, added);\n\t\t }\n\t\t\n\t\t signalLater(doc, \"change\", doc, change);\n\t\t }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight)\n signalLater(line, \"change\", line, change)\n }\n function linesFor(start, end) {\n var result = []\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight)) }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line)\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length))\n doc.remove(text.length, doc.size - text.length)\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1)\n update(lastLine, lastLine.text, lastSpans)\n if (nlines) { doc.remove(from.line, nlines) }\n if (added.length) { doc.insert(from.line, added) }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans)\n } else {\n var added$1 = linesFor(1, text.length - 1)\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight))\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0))\n doc.insert(from.line + 1, added$1)\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0))\n doc.remove(from.line + 1, nlines)\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0))\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans)\n var added$2 = linesFor(1, text.length - 1)\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1) }\n doc.insert(from.line + 1, added$2)\n }\n\n signalLater(doc, \"change\", doc, change)\n}", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight)\n signalLater(line, \"change\", line, change)\n }\n function linesFor(start, end) {\n var result = []\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight)) }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line)\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length))\n doc.remove(text.length, doc.size - text.length)\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1)\n update(lastLine, lastLine.text, lastSpans)\n if (nlines) { doc.remove(from.line, nlines) }\n if (added.length) { doc.insert(from.line, added) }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans)\n } else {\n var added$1 = linesFor(1, text.length - 1)\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight))\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0))\n doc.insert(from.line + 1, added$1)\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0))\n doc.remove(from.line + 1, nlines)\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0))\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans)\n var added$2 = linesFor(1, text.length - 1)\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1) }\n doc.insert(from.line + 1, added$2)\n }\n\n signalLater(doc, \"change\", doc, change)\n}", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\r\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\r\n function update(line, text, spans) {\r\n updateLine(line, text, spans, estimateHeight$$1);\r\n signalLater(line, \"change\", line, change);\r\n }\r\n function linesFor(start, end) {\r\n var result = [];\r\n for (var i = start; i < end; ++i)\r\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\r\n return result\r\n }\r\n\r\n var from = change.from, to = change.to, text = change.text;\r\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\r\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\r\n\r\n // Adjust the line structure\r\n if (change.full) {\r\n doc.insert(0, linesFor(0, text.length));\r\n doc.remove(text.length, doc.size - text.length);\r\n } else if (isWholeLineUpdate(doc, change)) {\r\n // This is a whole-line replace. Treated specially to make\r\n // sure line objects move the way they are supposed to.\r\n var added = linesFor(0, text.length - 1);\r\n update(lastLine, lastLine.text, lastSpans);\r\n if (nlines) { doc.remove(from.line, nlines); }\r\n if (added.length) { doc.insert(from.line, added); }\r\n } else if (firstLine == lastLine) {\r\n if (text.length == 1) {\r\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\r\n } else {\r\n var added$1 = linesFor(1, text.length - 1);\r\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\r\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\r\n doc.insert(from.line + 1, added$1);\r\n }\r\n } else if (text.length == 1) {\r\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\r\n doc.remove(from.line + 1, nlines);\r\n } else {\r\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\r\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\r\n var added$2 = linesFor(1, text.length - 1);\r\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\r\n doc.insert(from.line + 1, added$2);\r\n }\r\n\r\n signalLater(doc, \"change\", doc, change);\r\n}", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n}", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n}", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n}", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n}", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n}", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n}", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n}", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n}", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n}", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n}", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n}", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n\t function spansFor(n) {return markedSpans ? markedSpans[n] : null;}\n\t function update(line, text, spans) {\n\t updateLine(line, text, spans, estimateHeight);\n\t signalLater(line, \"change\", line, change);\n\t }\n\t function linesFor(start, end) {\n\t for (var i = start, result = []; i < end; ++i)\n\t result.push(new Line(text[i], spansFor(i), estimateHeight));\n\t return result;\n\t }\n\t\n\t var from = change.from, to = change.to, text = change.text;\n\t var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n\t var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\t\n\t // Adjust the line structure\n\t if (change.full) {\n\t doc.insert(0, linesFor(0, text.length));\n\t doc.remove(text.length, doc.size - text.length);\n\t } else if (isWholeLineUpdate(doc, change)) {\n\t // This is a whole-line replace. Treated specially to make\n\t // sure line objects move the way they are supposed to.\n\t var added = linesFor(0, text.length - 1);\n\t update(lastLine, lastLine.text, lastSpans);\n\t if (nlines) doc.remove(from.line, nlines);\n\t if (added.length) doc.insert(from.line, added);\n\t } else if (firstLine == lastLine) {\n\t if (text.length == 1) {\n\t update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n\t } else {\n\t var added = linesFor(1, text.length - 1);\n\t added.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n\t update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n\t doc.insert(from.line + 1, added);\n\t }\n\t } else if (text.length == 1) {\n\t update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n\t doc.remove(from.line + 1, nlines);\n\t } else {\n\t update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n\t update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n\t var added = linesFor(1, text.length - 1);\n\t if (nlines > 1) doc.remove(from.line + 1, nlines - 1);\n\t doc.insert(from.line + 1, added);\n\t }\n\t\n\t signalLater(doc, \"change\", doc, change);\n\t }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function isWholeLineUpdate(doc, change) {\n return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == \"\" && (!doc.cm || doc.cm.options.wholeLineUpdateBefore);\n } // Perform a change on the document data structure.", "function updateDoc(doc, change, markedSpans, estimateHeight) {\r\n function spansFor(n) {return markedSpans ? markedSpans[n] : null;}\r\n function update(line, text, spans) {\r\n updateLine(line, text, spans, estimateHeight);\r\n signalLater(line, \"change\", line, change);\r\n }\r\n\r\n var from = change.from, to = change.to, text = change.text;\r\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\r\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\r\n\r\n // Adjust the line structure\r\n if (isWholeLineUpdate(doc, change)) {\r\n // This is a whole-line replace. Treated specially to make\r\n // sure line objects move the way they are supposed to.\r\n for (var i = 0, added = []; i < text.length - 1; ++i)\r\n added.push(new Line(text[i], spansFor(i), estimateHeight));\r\n update(lastLine, lastLine.text, lastSpans);\r\n if (nlines) doc.remove(from.line, nlines);\r\n if (added.length) doc.insert(from.line, added);\r\n } else if (firstLine == lastLine) {\r\n if (text.length == 1) {\r\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\r\n } else {\r\n for (var added = [], i = 1; i < text.length - 1; ++i)\r\n added.push(new Line(text[i], spansFor(i), estimateHeight));\r\n added.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\r\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\r\n doc.insert(from.line + 1, added);\r\n }\r\n } else if (text.length == 1) {\r\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\r\n doc.remove(from.line + 1, nlines);\r\n } else {\r\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\r\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\r\n for (var i = 1, added = []; i < text.length - 1; ++i)\r\n added.push(new Line(text[i], spansFor(i), estimateHeight));\r\n if (nlines > 1) doc.remove(from.line + 1, nlines - 1);\r\n doc.insert(from.line + 1, added);\r\n }\r\n\r\n signalLater(doc, \"change\", doc, change);\r\n }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null;}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n for (var i = start, result = []; i < end; ++i)\n result.push(new Line(text[i], spansFor(i), estimateHeight));\n return result;\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) doc.remove(from.line, nlines);\n if (added.length) doc.insert(from.line, added);\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added = linesFor(1, text.length - 1);\n added.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added = linesFor(1, text.length - 1);\n if (nlines > 1) doc.remove(from.line + 1, nlines - 1);\n doc.insert(from.line + 1, added);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null;}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n for (var i = start, result = []; i < end; ++i)\n result.push(new Line(text[i], spansFor(i), estimateHeight));\n return result;\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) doc.remove(from.line, nlines);\n if (added.length) doc.insert(from.line, added);\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added = linesFor(1, text.length - 1);\n added.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added = linesFor(1, text.length - 1);\n if (nlines > 1) doc.remove(from.line + 1, nlines - 1);\n doc.insert(from.line + 1, added);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null;}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n for (var i = start, result = []; i < end; ++i)\n result.push(new Line(text[i], spansFor(i), estimateHeight));\n return result;\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) doc.remove(from.line, nlines);\n if (added.length) doc.insert(from.line, added);\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added = linesFor(1, text.length - 1);\n added.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added = linesFor(1, text.length - 1);\n if (nlines > 1) doc.remove(from.line + 1, nlines - 1);\n doc.insert(from.line + 1, added);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null;}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n for (var i = start, result = []; i < end; ++i)\n result.push(new Line(text[i], spansFor(i), estimateHeight));\n return result;\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) doc.remove(from.line, nlines);\n if (added.length) doc.insert(from.line, added);\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added = linesFor(1, text.length - 1);\n added.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added = linesFor(1, text.length - 1);\n if (nlines > 1) doc.remove(from.line + 1, nlines - 1);\n doc.insert(from.line + 1, added);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n\t function spansFor(n) {return markedSpans ? markedSpans[n] : null;}\n\t function update(line, text, spans) {\n\t updateLine(line, text, spans, estimateHeight);\n\t signalLater(line, \"change\", line, change);\n\t }\n\t function linesFor(start, end) {\n\t for (var i = start, result = []; i < end; ++i)\n\t result.push(new Line(text[i], spansFor(i), estimateHeight));\n\t return result;\n\t }\n\n\t var from = change.from, to = change.to, text = change.text;\n\t var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n\t var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n\t // Adjust the line structure\n\t if (change.full) {\n\t doc.insert(0, linesFor(0, text.length));\n\t doc.remove(text.length, doc.size - text.length);\n\t } else if (isWholeLineUpdate(doc, change)) {\n\t // This is a whole-line replace. Treated specially to make\n\t // sure line objects move the way they are supposed to.\n\t var added = linesFor(0, text.length - 1);\n\t update(lastLine, lastLine.text, lastSpans);\n\t if (nlines) doc.remove(from.line, nlines);\n\t if (added.length) doc.insert(from.line, added);\n\t } else if (firstLine == lastLine) {\n\t if (text.length == 1) {\n\t update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n\t } else {\n\t var added = linesFor(1, text.length - 1);\n\t added.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n\t update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n\t doc.insert(from.line + 1, added);\n\t }\n\t } else if (text.length == 1) {\n\t update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n\t doc.remove(from.line + 1, nlines);\n\t } else {\n\t update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n\t update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n\t var added = linesFor(1, text.length - 1);\n\t if (nlines > 1) doc.remove(from.line + 1, nlines - 1);\n\t doc.insert(from.line + 1, added);\n\t }\n\n\t signalLater(doc, \"change\", doc, change);\n\t }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n\t function spansFor(n) {return markedSpans ? markedSpans[n] : null;}\n\t function update(line, text, spans) {\n\t updateLine(line, text, spans, estimateHeight);\n\t signalLater(line, \"change\", line, change);\n\t }\n\t function linesFor(start, end) {\n\t for (var i = start, result = []; i < end; ++i)\n\t result.push(new Line(text[i], spansFor(i), estimateHeight));\n\t return result;\n\t }\n\n\t var from = change.from, to = change.to, text = change.text;\n\t var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n\t var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n\t // Adjust the line structure\n\t if (change.full) {\n\t doc.insert(0, linesFor(0, text.length));\n\t doc.remove(text.length, doc.size - text.length);\n\t } else if (isWholeLineUpdate(doc, change)) {\n\t // This is a whole-line replace. Treated specially to make\n\t // sure line objects move the way they are supposed to.\n\t var added = linesFor(0, text.length - 1);\n\t update(lastLine, lastLine.text, lastSpans);\n\t if (nlines) doc.remove(from.line, nlines);\n\t if (added.length) doc.insert(from.line, added);\n\t } else if (firstLine == lastLine) {\n\t if (text.length == 1) {\n\t update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n\t } else {\n\t var added = linesFor(1, text.length - 1);\n\t added.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n\t update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n\t doc.insert(from.line + 1, added);\n\t }\n\t } else if (text.length == 1) {\n\t update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n\t doc.remove(from.line + 1, nlines);\n\t } else {\n\t update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n\t update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n\t var added = linesFor(1, text.length - 1);\n\t if (nlines > 1) doc.remove(from.line + 1, nlines - 1);\n\t doc.insert(from.line + 1, added);\n\t }\n\n\t signalLater(doc, \"change\", doc, change);\n\t }", "getStartLineWidget(paragraph, start, startElement, selectionStartIndex) {\n let offset = paragraph === start.paragraph ? start.offset : this.getStartOffset(paragraph);\n let startInlineObj = undefined;\n if (paragraph === start.paragraph) {\n startInlineObj = start.currentWidget.getInline(offset, selectionStartIndex);\n }\n else {\n startInlineObj = paragraph.firstChild.getInline(offset, selectionStartIndex);\n }\n startElement = startInlineObj.element; //return selectionStartIndex\n selectionStartIndex = startInlineObj.index;\n if (startElement instanceof FieldElementBox) {\n let inlineInfo = this.getRenderedInline(startElement, selectionStartIndex);\n startElement = inlineInfo.element;\n selectionStartIndex = inlineInfo.index;\n }\n if (offset === this.getParagraphLength(start.paragraph) + 1) {\n selectionStartIndex++;\n }\n return {\n 'index': selectionStartIndex, 'element': startElement\n };\n }", "moveToWordStartInternal(type) {\n let endOffset = this.currentWidget.getEndOffset();\n let currentPara = this.currentWidget.paragraph;\n let selection = this.selection;\n if (type === 2 && (this.offset === endOffset || this.offset === endOffset + 1)) {\n return;\n }\n if (this.offset === endOffset + 1) {\n this.offset = endOffset;\n }\n else if (this.offset === selection.getStartOffset(currentPara) && this.currentWidget === currentPara.childWidgets[0]) {\n let previousParagraph = selection.getPreviousParagraphBlock(currentPara);\n if (isNullOrUndefined(previousParagraph)) {\n return;\n }\n this.currentWidget = previousParagraph.childWidgets[previousParagraph.childWidgets.length - 1];\n this.offset = this.currentWidget.getEndOffset();\n }\n else {\n if (this.offset === selection.getStartLineOffset(this.currentWidget)) {\n let lineIndex = currentPara.childWidgets.indexOf(this.currentWidget);\n if (lineIndex - 1 >= 0) {\n this.currentWidget = currentPara.childWidgets[lineIndex - 1];\n this.offset = this.currentWidget.getEndOffset();\n }\n }\n let isStarted = false;\n let endSelection = false;\n let indexInInline = 0;\n let inlineObj = this.currentWidget.getInline(this.offset, indexInInline);\n let inline = inlineObj.element;\n indexInInline = inlineObj.index;\n // tslint:disable-next-line:max-line-length \n this.getPreviousWordOffset(inline, selection, indexInInline, type, (inline instanceof FieldElementBox && inline.fieldType === 1), isStarted, endSelection, this);\n }\n if (type === 1) {\n this.calculateOffset();\n }\n this.updatePhysicalPosition(true);\n }", "moveToNextParagraphStartInternal() {\n let paragraph = this.currentWidget.paragraph;\n if (!isNullOrUndefined(this.selection.getNextParagraphBlock(paragraph))) {\n // tslint:disable-next-line:max-line-length\n this.currentWidget = this.selection.getNextParagraphBlock(paragraph).firstChild;\n this.offset = this.selection.getStartOffset(paragraph);\n this.updatePhysicalPosition(true);\n }\n }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null;}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight);\n signalLater(line, \"change\", line, change);\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n for (var i = 0, added = []; i < text.length - 1; ++i)\n added.push(new Line(text[i], spansFor(i), estimateHeight));\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) doc.remove(from.line, nlines);\n if (added.length) doc.insert(from.line, added);\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n for (var added = [], i = 1; i < text.length - 1; ++i)\n added.push(new Line(text[i], spansFor(i), estimateHeight));\n added.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n for (var i = 1, added = []; i < text.length - 1; ++i)\n added.push(new Line(text[i], spansFor(i), estimateHeight));\n if (nlines > 1) doc.remove(from.line + 1, nlines - 1);\n doc.insert(from.line + 1, added);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null;}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight);\n signalLater(line, \"change\", line, change);\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n for (var i = 0, added = []; i < text.length - 1; ++i)\n added.push(new Line(text[i], spansFor(i), estimateHeight));\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) doc.remove(from.line, nlines);\n if (added.length) doc.insert(from.line, added);\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n for (var added = [], i = 1; i < text.length - 1; ++i)\n added.push(new Line(text[i], spansFor(i), estimateHeight));\n added.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n for (var i = 1, added = []; i < text.length - 1; ++i)\n added.push(new Line(text[i], spansFor(i), estimateHeight));\n if (nlines > 1) doc.remove(from.line + 1, nlines - 1);\n doc.insert(from.line + 1, added);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null;}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight);\n signalLater(line, \"change\", line, change);\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n for (var i = 0, added = []; i < text.length - 1; ++i)\n added.push(new Line(text[i], spansFor(i), estimateHeight));\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) doc.remove(from.line, nlines);\n if (added.length) doc.insert(from.line, added);\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n for (var added = [], i = 1; i < text.length - 1; ++i)\n added.push(new Line(text[i], spansFor(i), estimateHeight));\n added.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n for (var i = 1, added = []; i < text.length - 1; ++i)\n added.push(new Line(text[i], spansFor(i), estimateHeight));\n if (nlines > 1) doc.remove(from.line + 1, nlines - 1);\n doc.insert(from.line + 1, added);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function setupLineOffset(elem) {\n \n if (elem.attr(\"data-start\")) {\n var start = elem.attr(\"data-start\");\n elem.attr(\"data-line-offset\", start-1);\n }\n\n }", "type_at_beginning_of_run(data){\n const target=this.target\n const r=target.closest(\"w\\\\:r\")\n const clonedR=r.clone()\n clonedR.children(\":not(w\\\\:rPr)\").remove()\n clonedR.append(`<w:t>${data}</w:t>`)\n r.before(clonedR)\n const a=this.file.renderChanged(clonedR)\n const $r=this.$target.closest(\"run\")\n $r.before(`#${a.id}`)\n this.cursorAt(this.$(`#${a.id} text`).attr(\"id\"),data.length)\n }", "function cbMakeDocxDocument ( data ) {\n\t\tdata.docStartExtra = data.docStartExtra || '';\n\t\tdata.docEndExtra = data.docEndExtra || '';\n\n\t\tvar outString = gen_private.plugs.type.msoffice.cbMakeMsOfficeBasicXml ( data ) + '<w:' + data.docType + ' xmlns:ve=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\">' + data.docStartExtra;\n\t\tvar objs_list = data.data;\n\t\tvar bookmarkId = 0;\n\n\t\t// In case of an empty document - just place an empty paragraph:\n\t\tif ( !objs_list.length ) {\n\t\t\toutString += '<w:p w:rsidR=\"009F2180\" w:rsidRDefault=\"009F2180\">';\n\t\t\tif ( data.pStyleDef ) {\n\t\t\t\toutString += '<w:pPr><w:pStyle w:val=\"' + data.pStyleDef + '\"/></w:pPr>';\n\t\t\t} // Endif.\n\n\t\t\toutString += '</w:p>';\n\t\t} // Endif.\n\n\t\t// Work on all the stored paragraphs inside this document:\n\t\tfor ( var i = 0, total_size = objs_list.length; i < total_size; i++ ) {\n\n\t\t\tif (objs_list[i] && objs_list[i].type === 'table') {\n\t\t\t\tvar table_obj = docxTable.getTable(objs_list[i].data, objs_list[i].options);\n \t\tvar table_xml = xmlBuilder.create(table_obj,{version: '1.0', encoding: 'UTF-8', standalone: true}).toString({ pretty: true, indent: ' ', newline: '\\n' });\n\t \toutString += table_xml;\n\t \tcontinue;\n\t\t\t}\n\n\t\t\toutString += '<w:p w:rsidR=\"00A77427\" w:rsidRDefault=\"007F1D13\">';\n\t\t\tvar pPrData = '';\n\n\t\t\tif ( objs_list[i].options ) {\n\t\t\t\tif ( objs_list[i].options.align ) {\n\t\t\t\t\tswitch ( objs_list[i].options.align ) {\n\t\t\t\t\t\tcase 'center':\n\t\t\t\t\t\t\tpPrData += '<w:jc w:val=\"center\"/>';\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase 'right':\n\t\t\t\t\t\t\tpPrData += '<w:jc w:val=\"right\"/>';\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase 'justify':\n\t\t\t\t\t\t\tpPrData += '<w:jc w:val=\"both\"/>';\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t} // End of switch.\n\t\t\t\t} // Endif.\n\n\t\t\t\tif ( objs_list[i].options.list_type ) {\n\t\t\t\t\tpPrData += '<w:pStyle w:val=\"ListParagraph\"/><w:numPr><w:ilvl w:val=\"0\"/><w:numId w:val=\"' + objs_list[i].options.list_type + '\"/></w:numPr>';\n\t\t\t\t} // Endif.\n\n\t\t\t\tif ( objs_list[i].options.backline ) {\n\t\t\t\t\tpPrData += '<w:pPr><w:shd w:val=\"solid\" w:color=\"' + objs_list[i].options.backline + '\" w:fill=\"auto\"/></w:pPr>';\n\t\t\t\t} // Endif.\n\t\t\t} // Endif.\n\n\t\t\t// Some resource types have default style in case that there's no style settings:\n\t\t\tif ( !pPrData && data.pStyleDef ) {\n\t\t\t\tpPrData = '<w:pStyle w:val=\"' + data.pStyleDef + '\"/>';\n\t\t\t} // Endif.\n\n\t\t\tif ( pPrData ) {\n\t\t\t\toutString += '<w:pPr>' + pPrData + '</w:pPr>';\n\t\t\t} // Endif.\n\n\t\t\t// Work on all the objects in the document:\n\t\t\tfor ( var j = 0, total_size_j = objs_list[i].data.length; j < total_size_j; j++ ) {\n\t\t\t\tif ( objs_list[i].data[j] ) {\n\t\t\t\t\tvar rExtra = '';\n\t\t\t\t\tvar tExtra = '';\n\t\t\t\t\tvar rPrData = '';\n\t\t\t\t\tvar colorCode;\n\t\t\t\t\tvar valType;\n\t\t\t\t\tvar sizeVal;\n\t\t\t\t\tvar hyperlinkOn = false;\n\n\t\t\t\t\tif ( objs_list[i].data[j].options ) {\n\t\t\t\t\t\tif ( objs_list[i].data[j].options.color ) {\n\t\t\t\t\t\t\trPrData += '<w:color w:val=\"' + objs_list[i].data[j].options.color + '\"/>';\n\t\t\t\t\t\t} // Endif.\n\n\t\t\t\t\t\tif ( objs_list[i].data[j].options.back ) {\n\t\t\t\t\t\t\tcolorCode = objs_list[i].data[j].options.shdColor || 'auto';\n\t\t\t\t\t\t\tvalType = objs_list[i].data[j].options.shdType || 'clear';\n\n\t\t\t\t\t\t\trPrData += '<w:shd w:val=\"' + valType + '\" w:color=\"' + colorCode + '\" w:fill=\"' + objs_list[i].data[j].options.back + '\"/>';\n\t\t\t\t\t\t} // Endif.\n\n\t\t\t\t\t\tif ( objs_list[i].data[j].options.highlight ) {\n\t\t\t\t\t\t\tvalType = 'yellow';\n\n\t\t\t\t\t\t\tif ( typeof objs_list[i].data[j].options.highlight === 'string' ) {\n\t\t\t\t\t\t\t\tvalType = objs_list[i].data[j].options.highlight;\n\t\t\t\t\t\t\t} // Endif.\n\n\t\t\t\t\t\t\trPrData += '<w:highlight w:val=\"' + valType + '\"/>';\n\t\t\t\t\t\t} // Endif.\n\n\t\t\t\t\t\tif ( objs_list[i].data[j].options.bold ) {\n\t\t\t\t\t\t\trPrData += '<w:b/><w:bCs/>';\n\t\t\t\t\t\t} // Endif.\n\n\t\t\t\t\t\tif ( objs_list[i].data[j].options.italic ) {\n\t\t\t\t\t\t\trPrData += '<w:i/><w:iCs/>';\n\t\t\t\t\t\t} // Endif.\n\n\t\t\t\t\t\tif ( objs_list[i].data[j].options.underline ) {\n\t\t\t\t\t\t\tvalType = 'single';\n\n\t\t\t\t\t\t\tif ( typeof objs_list[i].data[j].options.underline === 'string' ) {\n\t\t\t\t\t\t\t\tvalType = objs_list[i].data[j].options.underline;\n\t\t\t\t\t\t\t} // Endif.\n\n\t\t\t\t\t\t\trPrData += '<w:u w:val=\"' + valType + '\"/>';\n\t\t\t\t\t\t} // Endif.\n\n\t\t\t\t\t\tif ( objs_list[i].data[j].options.font_face ) {\n\t\t\t\t\t\t\trPrData += '<w:rFonts w:ascii=\"' + objs_list[i].data[j].options.font_face + '\" w:eastAsia=\"' + objs_list[i].data[j].options.font_face + '\" w:hAnsi=\"' + objs_list[i].data[j].options.font_face + '\" w:cs=\"' + objs_list[i].data[j].options.font_face + '\"/>';\n\t\t\t\t\t\t} // Endif.\n\n\t\t\t\t\t\tif ( objs_list[i].data[j].options.font_size ) {\n\t\t\t\t\t\t\tvar fontSizeInHalfPoints = 2 * objs_list[i].data[j].options.font_size;\n\t\t\t\t\t\t\trPrData += '<w:sz w:val=\"' + fontSizeInHalfPoints + '\"/><w:szCs w:val=\"' + fontSizeInHalfPoints + '\"/>';\n\t\t\t\t\t\t} // Endif.\n\n\t\t\t\t\t\tif ( objs_list[i].data[j].options.border ) {\n\t\t\t\t\t\t\tcolorCode = 'auto';\n\t\t\t\t\t\t\tvalType = 'single';\n\t\t\t\t\t\t\tsizeVal = 4;\n\n\t\t\t\t\t\t\tif ( typeof objs_list[i].data[j].options.borderColor === 'string' ) {\n\t\t\t\t\t\t\t\tcolorCode = objs_list[i].data[j].options.borderColor;\n\t\t\t\t\t\t\t} // Endif.\n\n\t\t\t\t\t\t\tif ( typeof objs_list[i].data[j].options.border === 'string' ) {\n\t\t\t\t\t\t\t\tvalType = objs_list[i].data[j].options.border;\n\t\t\t\t\t\t\t} // Endif.\n\n\t\t\t\t\t\t\tif ( typeof objs_list[i].data[j].options.borderSize === 'number' && objs_list[i].data[j].options.borderSize && objs_list[i].data[j].options.borderSize === objs_list[i].data[j].options.borderSize ) {\n\t\t\t\t\t\t\t\tsizeVal = objs_list[i].data[j].options.borderSize;\n\t\t\t\t\t\t\t} // Endif.\n\n\t\t\t\t\t\t\trPrData += '<w:bdr w:val=\"' + valType + '\" w:sz=\"' + sizeVal + '\" w:space=\"0\" w:color=\"' + colorCode + '\"/>';\n\t\t\t\t\t\t} // Endif.\n\n\t\t\t\t\t\t// Hyperlink support:\n\t\t\t\t\t\tif ( objs_list[i].data[j].options.hyperlink ) {\n\t\t\t\t\t\t\toutString += '<w:hyperlink w:anchor=\"' + objs_list[i].data[j].options.hyperlink +'\">';\n\t\t\t\t\t\t\thyperlinkOn = true;\n\n\t\t\t\t\t\t\tif ( !rPrData ) {\n\t\t\t\t\t\t\t\trPrData = '<w:rStyle w:val=\"Hyperlink\"/>';\n\t\t\t\t\t\t\t} // Endif.\n\t\t\t\t\t\t} // Endif.\n\t\t\t\t\t} // Endif.\n\n\t\t\t\t\t// Field support:\n\t\t\t\t\tif ( objs_list[i].data[j].fieldObj ) {\n\t\t\t\t\t\toutString += '<w:fldSimple w:instr=\"' + objs_list[i].data[j].fieldObj + '\">';\n\t\t\t\t\t} // Endif.\n\n\t\t\t\t\tif ( objs_list[i].data[j].text ) {\n\t\t\t\t\t\tif ( (objs_list[i].data[j].text[0] == ' ') || (objs_list[i].data[j].text[objs_list[i].data[j].text.length - 1] == ' ') ) {\n\t\t\t\t\t\t\ttExtra += ' xml:space=\"preserve\"';\n\t\t\t\t\t\t} // Endif.\n\n\t\t\t\t\t\tif (objs_list[i].data[j].link_rel_id) {\n\t\t\t\t\t\t\toutString += '<w:hyperlink r:id=\"rId' + objs_list[i].data[j].link_rel_id + '\">';\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\toutString += '<w:r' + rExtra + '>';\n\n\t\t\t\t\t\tif ( rPrData ) {\n\t\t\t\t\t\t\toutString += '<w:rPr>' + rPrData + '</w:rPr>';\n\t\t\t\t\t\t} // Endif.\n\n\t\t\t\t\t\toutString += '<w:t' + tExtra + '>' + objs_list[i].data[j].text.encodeHTML () + '</w:t></w:r>';\n\n\t\t\t\t\t\tif (objs_list[i].data[j].link_rel_id) {\n\t\t\t\t\t\t\toutString += '</w:hyperlink>';\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else if ( objs_list[i].data[j].page_break ) {\n\t\t\t\t\t\toutString += '<w:r><w:br w:type=\"page\"/></w:r>';\n\n\t\t\t\t\t} else if ( objs_list[i].data[j].line_break ) {\n\t\t\t\t\t\toutString += '<w:r><w:br/></w:r>';\n\n\t\t\t\t\t} else if ( objs_list[i].data[j].horizontal_line ) {\n\t\t\t\t\t\toutString += '<w:r><w:pict><v:rect style=\"width:0;height:.75pt\" o:hralign=\"center\" o:hrstd=\"t\" o:hr=\"t\" fillcolor=\"#e0e0e0\" stroked=\"f\"/></w:pict></w:r>';\n\n\t\t\t\t\t// Bookmark start support:\n\t\t\t\t\t} else if ( objs_list[i].data[j].bookmark_start ) {\n\t\t\t\t\t\toutString += '<w:bookmarkStart w:id=\"' + bookmarkId + '\" w:name=\"' + objs_list[i].data[j].bookmark_start + '\"/>';\n\n\t\t\t\t\t// Bookmark end support:\n\t\t\t\t\t} else if ( objs_list[i].data[j].bookmark_end ) {\n\t\t\t\t\t\toutString += '<w:bookmarkEnd w:id=\"' + bookmarkId + '\"/>';\n\t\t\t\t\t\tbookmarkId++;\n\n\t\t\t\t\t} else if ( objs_list[i].data[j].image ) {\n\t\t\t\t\t\toutString += '<w:r' + rExtra + '>';\n\n\t\t\t\t\t\trPrData += '<w:noProof/>';\n\n\t\t\t\t\t\tif ( rPrData ) {\n\t\t\t\t\t\t\toutString += '<w:rPr>' + rPrData + '</w:rPr>';\n\t\t\t\t\t\t} // Endif.\n\n\t\t\t\t\t\t//914400L / 96DPI\n\t\t\t\t\t\tvar pixelToEmu = 9525;\n\n\t\t\t\t\t\toutString += '<w:drawing>';\n\t\t\t\t\t\toutString += '<wp:inline distT=\"0\" distB=\"0\" distL=\"0\" distR=\"0\">';\n\t\t\t\t\t\toutString += '<wp:extent cx=\"' + (objs_list[i].data[j].options.cx * pixelToEmu) + '\" cy=\"' + (objs_list[i].data[j].options.cy * pixelToEmu) + '\"/>';\n\t\t\t\t\t\toutString += '<wp:effectExtent l=\"19050\" t=\"0\" r=\"9525\" b=\"0\"/>';\n\n\t\t\t\t\t\toutString += '<wp:docPr id=\"' + (objs_list[i].data[j].image_id + 1) + '\" name=\"Picture ' + objs_list[i].data[j].image_id + '\" descr=\"Picture ' + objs_list[i].data[j].image_id + '\">';\n\t\t\t\t\t\tif(objs_list[i].data[j].link_rel_id){\n\t\t\t\t\t\t\toutString += '<a:hlinkClick xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" r:id=\"rId'+objs_list[i].data[j].link_rel_id+'\"/>';\n\t\t\t\t\t\t}\n\t\t\t\t\t\toutString += '</wp:docPr>';\n\n\t\t\t\t\t\toutString += '<wp:cNvGraphicFramePr>';\n\t\t\t\t\t\toutString += '<a:graphicFrameLocks xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" noChangeAspect=\"1\"/>';\n\t\t\t\t\t\toutString += '</wp:cNvGraphicFramePr>';\n\t\t\t\t\t\toutString += '<a:graphic xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\">';\n\t\t\t\t\t\toutString += '<a:graphicData uri=\"http://schemas.openxmlformats.org/drawingml/2006/picture\">';\n\t\t\t\t\t\toutString += '<pic:pic xmlns:pic=\"http://schemas.openxmlformats.org/drawingml/2006/picture\">';\n\t\t\t\t\t\toutString += '<pic:nvPicPr>';\n\t\t\t\t\t\toutString += '<pic:cNvPr id=\"0\" name=\"Picture ' + objs_list[i].data[j].image_id + '\"/>';\n\t\t\t\t\t\toutString += '<pic:cNvPicPr/>';\n\t\t\t\t\t\toutString += '</pic:nvPicPr>';\n\t\t\t\t\t\toutString += '<pic:blipFill>';\n\t\t\t\t\t\toutString += '<a:blip r:embed=\"rId' + objs_list[i].data[j].rel_id + '\" cstate=\"print\"/>';\n\t\t\t\t\t\toutString += '<a:stretch>';\n\t\t\t\t\t\toutString += '<a:fillRect/>';\n\t\t\t\t\t\toutString += '</a:stretch>';\n\t\t\t\t\t\toutString += '</pic:blipFill>';\n\t\t\t\t\t\toutString += '<pic:spPr>';\n\t\t\t\t\t\toutString += '<a:xfrm>';\n\t\t\t\t\t\toutString += '<a:off x=\"0\" y=\"0\"/>';\n\t\t\t\t\t\toutString += '<a:ext cx=\"' + (objs_list[i].data[j].options.cx * pixelToEmu) + '\" cy=\"' + (objs_list[i].data[j].options.cy * pixelToEmu) + '\"/>';\n\t\t\t\t\t\toutString += '</a:xfrm>';\n\t\t\t\t\t\toutString += '<a:prstGeom prst=\"rect\">';\n\t\t\t\t\t\toutString += '<a:avLst/>';\n\t\t\t\t\t\toutString += '</a:prstGeom>';\n\t\t\t\t\t\toutString += '</pic:spPr>';\n\t\t\t\t\t\toutString += '</pic:pic>';\n\t\t\t\t\t\toutString += '</a:graphicData>';\n\t\t\t\t\t\toutString += '</a:graphic>';\n\t\t\t\t\t\toutString += '</wp:inline>';\n\t\t\t\t\t\toutString += '</w:drawing>';\n\n\t\t\t\t\t\toutString += '</w:r>';\n\t\t\t\t\t} // Endif.\n\n\t\t\t\t\t// Field support:\n\t\t\t\t\tif ( objs_list[i].data[j].fieldObj ) {\n\t\t\t\t\t\toutString += '</w:fldSimple>';\n\t\t\t\t\t} // Endif.\n\n\t\t\t\t\tif ( hyperlinkOn ) {\n\t\t\t\t\t\toutString += '</w:hyperlink>';\n\t\t\t\t\t} // Endif.\n\t\t\t\t} // Endif.\n\t\t\t} // Endif.\n\n\t\t\toutString += '</w:p>';\n\t\t} // End of for loop.\n\n\t\tif ( data.docType === 'document' ) {\n\t\t\toutString += '<w:p w:rsidR=\"00A02F19\" w:rsidRDefault=\"00A02F19\"/>';\n\n\t\t\t// Landscape orientation support:\n\t\t\tif ( options.orientation && options.orientation === 'landscape' ){\n\t\t\t\toutString +=\n\t\t\t\t\t'<w:sectPr w:rsidR=\"00A02F19\" w:rsidSect=\"00897086\">' +\n\t\t\t\t\t(docxData.secPrExtra ? docxData.secPrExtra : '') +\n\t\t\t\t\t'<w:pgSz w:w=\"15840\" w:h=\"12240\" w:orient=\"landscape\"/>' +\n\t\t\t\t\t'<w:pgMar w:top=\"1800\" w:right=\"1440\" w:bottom=\"1800\" w:left=\"1440\" w:header=\"720\" w:footer=\"720\" w:gutter=\"0\"/>' +\n\t\t\t\t\t'<w:cols w:space=\"720\"/>' +\n\t\t\t\t\t'<w:docGrid w:linePitch=\"360\"/>' +\n\t\t\t\t\t'</w:sectPr>';\n\t\t\t} else {\n\t\t\t\toutString +=\n\t\t\t\t\t'<w:sectPr w:rsidR=\"00A02F19\" w:rsidSect=\"00A02F19\">' +\n\t\t\t\t\t(docxData.secPrExtra ? docxData.secPrExtra : '') +\n\t\t\t\t\t'<w:pgSz w:w=\"12240\" w:h=\"15840\"/>' +\n\t\t\t\t\t'<w:pgMar w:top=\"1440\" w:right=\"1800\" w:bottom=\"1440\" w:left=\"1800\" w:header=\"720\" w:footer=\"720\" w:gutter=\"0\"/>' +\n\t\t\t\t\t'<w:cols w:space=\"720\"/>' +\n\t\t\t\t\t'<w:docGrid w:linePitch=\"360\"/>' +\n\t\t\t\t\t'</w:sectPr>';\n\t\t\t} // Endif.\n\t\t} // Endif.\n\n\t\toutString += data.docEndExtra + '</w:' + data.docType + '>';\n\n\t\treturn outString;\n\t}", "extendToParagraphStart() {\n if (isNullOrUndefined(this.start)) {\n return;\n }\n this.end.paragraphStartInternal(this, true);\n this.upDownSelectionLength = this.end.location.x;\n this.fireSelectionChanged(true);\n }", "function insertLineContent(line, builder, styles) {\n\t\t var spans = line.markedSpans, allText = line.text, at = 0;\n\t\t if (!spans) {\n\t\t for (var i$1 = 1; i$1 < styles.length; i$1+=2)\n\t\t { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }\n\t\t return\n\t\t }\n\n\t\t var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n\t\t var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, collapsed, attributes;\n\t\t for (;;) {\n\t\t if (nextChange == pos) { // Update current marker set\n\t\t spanStyle = spanEndStyle = spanStartStyle = css = \"\";\n\t\t attributes = null;\n\t\t collapsed = null; nextChange = Infinity;\n\t\t var foundBookmarks = [], endStyles = (void 0);\n\t\t for (var j = 0; j < spans.length; ++j) {\n\t\t var sp = spans[j], m = sp.marker;\n\t\t if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n\t\t foundBookmarks.push(m);\n\t\t } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n\t\t if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n\t\t nextChange = sp.to;\n\t\t spanEndStyle = \"\";\n\t\t }\n\t\t if (m.className) { spanStyle += \" \" + m.className; }\n\t\t if (m.css) { css = (css ? css + \";\" : \"\") + m.css; }\n\t\t if (m.startStyle && sp.from == pos) { spanStartStyle += \" \" + m.startStyle; }\n\t\t if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }\n\t\t // support for the old title property\n\t\t // https://github.com/codemirror/CodeMirror/pull/5673\n\t\t if (m.title) { (attributes || (attributes = {})).title = m.title; }\n\t\t if (m.attributes) {\n\t\t for (var attr in m.attributes)\n\t\t { (attributes || (attributes = {}))[attr] = m.attributes[attr]; }\n\t\t }\n\t\t if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n\t\t { collapsed = sp; }\n\t\t } else if (sp.from > pos && nextChange > sp.from) {\n\t\t nextChange = sp.from;\n\t\t }\n\t\t }\n\t\t if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)\n\t\t { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += \" \" + endStyles[j$1]; } } }\n\n\t\t if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)\n\t\t { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }\n\t\t if (collapsed && (collapsed.from || 0) == pos) {\n\t\t buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n\t\t collapsed.marker, collapsed.from == null);\n\t\t if (collapsed.to == null) { return }\n\t\t if (collapsed.to == pos) { collapsed = false; }\n\t\t }\n\t\t }\n\t\t if (pos >= len) { break }\n\n\t\t var upto = Math.min(len, nextChange);\n\t\t while (true) {\n\t\t if (text) {\n\t\t var end = pos + text.length;\n\t\t if (!collapsed) {\n\t\t var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n\t\t builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n\t\t spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", css, attributes);\n\t\t }\n\t\t if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}\n\t\t pos = end;\n\t\t spanStartStyle = \"\";\n\t\t }\n\t\t text = allText.slice(at, at = styles[i++]);\n\t\t style = interpretTokenStyle(styles[i++], builder.cm.options);\n\t\t }\n\t\t }\n\t\t }", "function generateTextDocumentContentChange(line, text) {\n return {\n rangeLength: 0,\n text: text,\n range: new vscode_1.Range(new vscode_1.Position(line, 0), new vscode_1.Position(line, text.length))\n };\n}", "function update() {\n\n\t\tif (root == null) {\n\t\t\treturn\n\t\t}\n\n\t\tlet bounds = element.bounds()\n\t\tlet fontSize = element.css('font-size')\n\t\tlet fontWeight = element.css('font-weight')\n\n\t\tif (measuredWidth == bounds.width &&\n\t\t\tmeasuredHeight == bounds.height &&\n\t\t\tmeasuredFontSize == fontSize &&\n\t\t\tmeasuredFontWeight == fontWeight) {\n\n\t\t\t/*\n\t\t\t * The area did not change thus the lines should remain\n\t\t\t * the same.\n\t\t\t */\n\n\t\t\treturn\n\t\t}\n\n\t\tmeasuredWidth = bounds.width\n\t\tmeasuredHeight = bounds.height\n\t\tmeasuredFontSize = fontSize\n\t\tmeasuredFontWeight = fontWeight\n\n\t\troot.innerHTML = html\n\n\t\telement.toggleClass('multiline', false)\n\n\t\tlet fragment = document.createDocumentFragment()\n\n\t\tbreakNode(root, fragment)\n\t\temptyNode(root)\n\n\t\troot.appendChild(fragment)\n\n\t\telement.toggleClass('multiline', true)\n\n\t\telement.find('.line').each((i, line) => {\n\n\t\t\tline = $(line)\n\t\t\tline.attr('data-nth-line', i + 1);\n\n\t\t\tline.attr('data-text', line.text())\n\n\t\t\tlet others = line.find(':not(.word)')\n\t\t\tline.toggleClass('plain', others.length == 0)\n\t\t\tline.toggleClass('mixed', others.length != 0)\n\n\t\t})\n\n\t\tif (options &&\n\t\t\toptions.onComplete) {\n\t\t\toptions.onComplete(element)\n\t\t}\n\n\t\telement.emit('breaklines/complete', element)\n\t}", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans,\n allText = line.text,\n at = 0;\n\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1 += 2) {\n builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1 + 1], builder.cm.options));\n }\n\n return;\n }\n\n var len = allText.length,\n pos = 0,\n i = 1,\n text = \"\",\n style,\n css;\n var nextChange = 0,\n spanStyle,\n spanEndStyle,\n spanStartStyle,\n collapsed,\n attributes;\n\n for (;;) {\n if (nextChange == pos) {\n // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = css = \"\";\n attributes = null;\n collapsed = null;\n nextChange = Infinity;\n var foundBookmarks = [],\n endStyles = void 0;\n\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j],\n m = sp.marker;\n\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n\n if (m.className) {\n spanStyle += \" \" + m.className;\n }\n\n if (m.css) {\n css = (css ? css + \";\" : \"\") + m.css;\n }\n\n if (m.startStyle && sp.from == pos) {\n spanStartStyle += \" \" + m.startStyle;\n }\n\n if (m.endStyle && sp.to == nextChange) {\n (endStyles || (endStyles = [])).push(m.endStyle, sp.to);\n } // support for the old title property\n // https://github.com/codemirror/CodeMirror/pull/5673\n\n\n if (m.title) {\n (attributes || (attributes = {})).title = m.title;\n }\n\n if (m.attributes) {\n for (var attr in m.attributes) {\n (attributes || (attributes = {}))[attr] = m.attributes[attr];\n }\n }\n\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0)) {\n collapsed = sp;\n }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n\n if (endStyles) {\n for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2) {\n if (endStyles[j$1 + 1] == nextChange) {\n spanEndStyle += \" \" + endStyles[j$1];\n }\n }\n }\n\n if (!collapsed || collapsed.from == pos) {\n for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2) {\n buildCollapsedSpan(builder, 0, foundBookmarks[j$2]);\n }\n }\n\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos, collapsed.marker, collapsed.from == null);\n\n if (collapsed.to == null) {\n return;\n }\n\n if (collapsed.to == pos) {\n collapsed = false;\n }\n }\n }\n\n if (pos >= len) {\n break;\n }\n\n var upto = Math.min(len, nextChange);\n\n while (true) {\n if (text) {\n var end = pos + text.length;\n\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle, spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", css, attributes);\n }\n\n if (end >= upto) {\n text = text.slice(upto - pos);\n pos = upto;\n break;\n }\n\n pos = end;\n spanStartStyle = \"\";\n }\n\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n } // These objects are used to represent the visible (currently drawn)", "function insertLineContent(line, builder, styles) {\n\t\t var spans = line.markedSpans, allText = line.text, at = 0;\n\t\t if (!spans) {\n\t\t for (var i = 1; i < styles.length; i+=2)\n\t\t builder.addToken(builder, allText.slice(at, at = styles[i]), interpretTokenStyle(styles[i+1], builder.cm.options));\n\t\t return;\n\t\t }\n\t\t\n\t\t var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n\t\t var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;\n\t\t for (;;) {\n\t\t if (nextChange == pos) { // Update current marker set\n\t\t spanStyle = spanEndStyle = spanStartStyle = title = css = \"\";\n\t\t collapsed = null; nextChange = Infinity;\n\t\t var foundBookmarks = [], endStyles\n\t\t for (var j = 0; j < spans.length; ++j) {\n\t\t var sp = spans[j], m = sp.marker;\n\t\t if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n\t\t foundBookmarks.push(m);\n\t\t } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n\t\t if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n\t\t nextChange = sp.to;\n\t\t spanEndStyle = \"\";\n\t\t }\n\t\t if (m.className) spanStyle += \" \" + m.className;\n\t\t if (m.css) css = (css ? css + \";\" : \"\") + m.css;\n\t\t if (m.startStyle && sp.from == pos) spanStartStyle += \" \" + m.startStyle;\n\t\t if (m.endStyle && sp.to == nextChange) (endStyles || (endStyles = [])).push(m.endStyle, sp.to)\n\t\t if (m.title && !title) title = m.title;\n\t\t if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n\t\t collapsed = sp;\n\t\t } else if (sp.from > pos && nextChange > sp.from) {\n\t\t nextChange = sp.from;\n\t\t }\n\t\t }\n\t\t if (endStyles) for (var j = 0; j < endStyles.length; j += 2)\n\t\t if (endStyles[j + 1] == nextChange) spanEndStyle += \" \" + endStyles[j]\n\t\t\n\t\t if (!collapsed || collapsed.from == pos) for (var j = 0; j < foundBookmarks.length; ++j)\n\t\t buildCollapsedSpan(builder, 0, foundBookmarks[j]);\n\t\t if (collapsed && (collapsed.from || 0) == pos) {\n\t\t buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n\t\t collapsed.marker, collapsed.from == null);\n\t\t if (collapsed.to == null) return;\n\t\t if (collapsed.to == pos) collapsed = false;\n\t\t }\n\t\t }\n\t\t if (pos >= len) break;\n\t\t\n\t\t var upto = Math.min(len, nextChange);\n\t\t while (true) {\n\t\t if (text) {\n\t\t var end = pos + text.length;\n\t\t if (!collapsed) {\n\t\t var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n\t\t builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n\t\t spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", title, css);\n\t\t }\n\t\t if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;}\n\t\t pos = end;\n\t\t spanStartStyle = \"\";\n\t\t }\n\t\t text = allText.slice(at, at = styles[i++]);\n\t\t style = interpretTokenStyle(styles[i++], builder.cm.options);\n\t\t }\n\t\t }\n\t\t }", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1+=2)\n { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }\n return\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, collapsed, attributes;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = css = \"\";\n attributes = null;\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [], endStyles = (void 0);\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n if (m.className) { spanStyle += \" \" + m.className; }\n if (m.css) { css = (css ? css + \";\" : \"\") + m.css; }\n if (m.startStyle && sp.from == pos) { spanStartStyle += \" \" + m.startStyle; }\n if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }\n // support for the old title property\n // https://github.com/codemirror/CodeMirror/pull/5673\n if (m.title) { (attributes || (attributes = {})).title = m.title; }\n if (m.attributes) {\n for (var attr in m.attributes)\n { (attributes || (attributes = {}))[attr] = m.attributes[attr]; }\n }\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n { collapsed = sp; }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)\n { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += \" \" + endStyles[j$1]; } } }\n\n if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)\n { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) { return }\n if (collapsed.to == pos) { collapsed = false; }\n }\n }\n if (pos >= len) { break }\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", css, attributes);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n }", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1+=2)\n { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }\n return\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, collapsed, attributes;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = css = \"\";\n attributes = null;\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [], endStyles = (void 0);\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n if (m.className) { spanStyle += \" \" + m.className; }\n if (m.css) { css = (css ? css + \";\" : \"\") + m.css; }\n if (m.startStyle && sp.from == pos) { spanStartStyle += \" \" + m.startStyle; }\n if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }\n // support for the old title property\n // https://github.com/codemirror/CodeMirror/pull/5673\n if (m.title) { (attributes || (attributes = {})).title = m.title; }\n if (m.attributes) {\n for (var attr in m.attributes)\n { (attributes || (attributes = {}))[attr] = m.attributes[attr]; }\n }\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n { collapsed = sp; }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)\n { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += \" \" + endStyles[j$1]; } } }\n\n if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)\n { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) { return }\n if (collapsed.to == pos) { collapsed = false; }\n }\n }\n if (pos >= len) { break }\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", css, attributes);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n }", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1+=2)\n { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }\n return\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, collapsed, attributes;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = css = \"\";\n attributes = null;\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [], endStyles = (void 0);\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n if (m.className) { spanStyle += \" \" + m.className; }\n if (m.css) { css = (css ? css + \";\" : \"\") + m.css; }\n if (m.startStyle && sp.from == pos) { spanStartStyle += \" \" + m.startStyle; }\n if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }\n // support for the old title property\n // https://github.com/codemirror/CodeMirror/pull/5673\n if (m.title) { (attributes || (attributes = {})).title = m.title; }\n if (m.attributes) {\n for (var attr in m.attributes)\n { (attributes || (attributes = {}))[attr] = m.attributes[attr]; }\n }\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n { collapsed = sp; }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)\n { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += \" \" + endStyles[j$1]; } } }\n\n if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)\n { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) { return }\n if (collapsed.to == pos) { collapsed = false; }\n }\n }\n if (pos >= len) { break }\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", css, attributes);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n }", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1+=2)\n { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }\n return\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, collapsed, attributes;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = css = \"\";\n attributes = null;\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [], endStyles = (void 0);\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n if (m.className) { spanStyle += \" \" + m.className; }\n if (m.css) { css = (css ? css + \";\" : \"\") + m.css; }\n if (m.startStyle && sp.from == pos) { spanStartStyle += \" \" + m.startStyle; }\n if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }\n // support for the old title property\n // https://github.com/codemirror/CodeMirror/pull/5673\n if (m.title) { (attributes || (attributes = {})).title = m.title; }\n if (m.attributes) {\n for (var attr in m.attributes)\n { (attributes || (attributes = {}))[attr] = m.attributes[attr]; }\n }\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n { collapsed = sp; }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)\n { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += \" \" + endStyles[j$1]; } } }\n\n if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)\n { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) { return }\n if (collapsed.to == pos) { collapsed = false; }\n }\n }\n if (pos >= len) { break }\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", css, attributes);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n }", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1+=2)\n { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }\n return\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, collapsed, attributes;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = css = \"\";\n attributes = null;\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [], endStyles = (void 0);\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n if (m.className) { spanStyle += \" \" + m.className; }\n if (m.css) { css = (css ? css + \";\" : \"\") + m.css; }\n if (m.startStyle && sp.from == pos) { spanStartStyle += \" \" + m.startStyle; }\n if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }\n // support for the old title property\n // https://github.com/codemirror/CodeMirror/pull/5673\n if (m.title) { (attributes || (attributes = {})).title = m.title; }\n if (m.attributes) {\n for (var attr in m.attributes)\n { (attributes || (attributes = {}))[attr] = m.attributes[attr]; }\n }\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n { collapsed = sp; }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)\n { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += \" \" + endStyles[j$1]; } } }\n\n if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)\n { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) { return }\n if (collapsed.to == pos) { collapsed = false; }\n }\n }\n if (pos >= len) { break }\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", css, attributes);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n }", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1+=2)\n { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }\n return\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, collapsed, attributes;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = css = \"\";\n attributes = null;\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [], endStyles = (void 0);\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n if (m.className) { spanStyle += \" \" + m.className; }\n if (m.css) { css = (css ? css + \";\" : \"\") + m.css; }\n if (m.startStyle && sp.from == pos) { spanStartStyle += \" \" + m.startStyle; }\n if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }\n // support for the old title property\n // https://github.com/codemirror/CodeMirror/pull/5673\n if (m.title) { (attributes || (attributes = {})).title = m.title; }\n if (m.attributes) {\n for (var attr in m.attributes)\n { (attributes || (attributes = {}))[attr] = m.attributes[attr]; }\n }\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n { collapsed = sp; }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)\n { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += \" \" + endStyles[j$1]; } } }\n\n if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)\n { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) { return }\n if (collapsed.to == pos) { collapsed = false; }\n }\n }\n if (pos >= len) { break }\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", css, attributes);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n }", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1+=2)\n { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }\n return\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, collapsed, attributes;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = css = \"\";\n attributes = null;\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [], endStyles = (void 0);\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n if (m.className) { spanStyle += \" \" + m.className; }\n if (m.css) { css = (css ? css + \";\" : \"\") + m.css; }\n if (m.startStyle && sp.from == pos) { spanStartStyle += \" \" + m.startStyle; }\n if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }\n // support for the old title property\n // https://github.com/codemirror/CodeMirror/pull/5673\n if (m.title) { (attributes || (attributes = {})).title = m.title; }\n if (m.attributes) {\n for (var attr in m.attributes)\n { (attributes || (attributes = {}))[attr] = m.attributes[attr]; }\n }\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n { collapsed = sp; }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)\n { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += \" \" + endStyles[j$1]; } } }\n\n if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)\n { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) { return }\n if (collapsed.to == pos) { collapsed = false; }\n }\n }\n if (pos >= len) { break }\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", css, attributes);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n }", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1+=2)\n { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }\n return\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, collapsed, attributes;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = css = \"\";\n attributes = null;\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [], endStyles = (void 0);\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n if (m.className) { spanStyle += \" \" + m.className; }\n if (m.css) { css = (css ? css + \";\" : \"\") + m.css; }\n if (m.startStyle && sp.from == pos) { spanStartStyle += \" \" + m.startStyle; }\n if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }\n // support for the old title property\n // https://github.com/codemirror/CodeMirror/pull/5673\n if (m.title) { (attributes || (attributes = {})).title = m.title; }\n if (m.attributes) {\n for (var attr in m.attributes)\n { (attributes || (attributes = {}))[attr] = m.attributes[attr]; }\n }\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n { collapsed = sp; }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)\n { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += \" \" + endStyles[j$1]; } } }\n\n if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)\n { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) { return }\n if (collapsed.to == pos) { collapsed = false; }\n }\n }\n if (pos >= len) { break }\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", css, attributes);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n }", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1+=2)\n { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }\n return\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, collapsed, attributes;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = css = \"\";\n attributes = null;\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [], endStyles = (void 0);\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n if (m.className) { spanStyle += \" \" + m.className; }\n if (m.css) { css = (css ? css + \";\" : \"\") + m.css; }\n if (m.startStyle && sp.from == pos) { spanStartStyle += \" \" + m.startStyle; }\n if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }\n // support for the old title property\n // https://github.com/codemirror/CodeMirror/pull/5673\n if (m.title) { (attributes || (attributes = {})).title = m.title; }\n if (m.attributes) {\n for (var attr in m.attributes)\n { (attributes || (attributes = {}))[attr] = m.attributes[attr]; }\n }\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n { collapsed = sp; }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)\n { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += \" \" + endStyles[j$1]; } } }\n\n if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)\n { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) { return }\n if (collapsed.to == pos) { collapsed = false; }\n }\n }\n if (pos >= len) { break }\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", css, attributes);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n }", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1+=2)\n { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }\n return\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, collapsed, attributes;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = css = \"\";\n attributes = null;\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [], endStyles = (void 0);\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n if (m.className) { spanStyle += \" \" + m.className; }\n if (m.css) { css = (css ? css + \";\" : \"\") + m.css; }\n if (m.startStyle && sp.from == pos) { spanStartStyle += \" \" + m.startStyle; }\n if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }\n // support for the old title property\n // https://github.com/codemirror/CodeMirror/pull/5673\n if (m.title) { (attributes || (attributes = {})).title = m.title; }\n if (m.attributes) {\n for (var attr in m.attributes)\n { (attributes || (attributes = {}))[attr] = m.attributes[attr]; }\n }\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n { collapsed = sp; }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)\n { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += \" \" + endStyles[j$1]; } } }\n\n if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)\n { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) { return }\n if (collapsed.to == pos) { collapsed = false; }\n }\n }\n if (pos >= len) { break }\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", css, attributes);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n }", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1+=2)\n { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }\n return\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, collapsed, attributes;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = css = \"\";\n attributes = null;\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [], endStyles = (void 0);\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n if (m.className) { spanStyle += \" \" + m.className; }\n if (m.css) { css = (css ? css + \";\" : \"\") + m.css; }\n if (m.startStyle && sp.from == pos) { spanStartStyle += \" \" + m.startStyle; }\n if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }\n // support for the old title property\n // https://github.com/codemirror/CodeMirror/pull/5673\n if (m.title) { (attributes || (attributes = {})).title = m.title; }\n if (m.attributes) {\n for (var attr in m.attributes)\n { (attributes || (attributes = {}))[attr] = m.attributes[attr]; }\n }\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n { collapsed = sp; }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)\n { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += \" \" + endStyles[j$1]; } } }\n\n if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)\n { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) { return }\n if (collapsed.to == pos) { collapsed = false; }\n }\n }\n if (pos >= len) { break }\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", css, attributes);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n }", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1+=2)\n { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }\n return\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, collapsed, attributes;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = css = \"\";\n attributes = null;\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [], endStyles = (void 0);\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n if (m.className) { spanStyle += \" \" + m.className; }\n if (m.css) { css = (css ? css + \";\" : \"\") + m.css; }\n if (m.startStyle && sp.from == pos) { spanStartStyle += \" \" + m.startStyle; }\n if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }\n // support for the old title property\n // https://github.com/codemirror/CodeMirror/pull/5673\n if (m.title) { (attributes || (attributes = {})).title = m.title; }\n if (m.attributes) {\n for (var attr in m.attributes)\n { (attributes || (attributes = {}))[attr] = m.attributes[attr]; }\n }\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n { collapsed = sp; }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)\n { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += \" \" + endStyles[j$1]; } } }\n\n if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)\n { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) { return }\n if (collapsed.to == pos) { collapsed = false; }\n }\n }\n if (pos >= len) { break }\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", css, attributes);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n }", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1+=2)\n { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }\n return\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, collapsed, attributes;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = css = \"\";\n attributes = null;\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [], endStyles = (void 0);\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n if (m.className) { spanStyle += \" \" + m.className; }\n if (m.css) { css = (css ? css + \";\" : \"\") + m.css; }\n if (m.startStyle && sp.from == pos) { spanStartStyle += \" \" + m.startStyle; }\n if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }\n // support for the old title property\n // https://github.com/codemirror/CodeMirror/pull/5673\n if (m.title) { (attributes || (attributes = {})).title = m.title; }\n if (m.attributes) {\n for (var attr in m.attributes)\n { (attributes || (attributes = {}))[attr] = m.attributes[attr]; }\n }\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n { collapsed = sp; }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)\n { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += \" \" + endStyles[j$1]; } } }\n\n if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)\n { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) { return }\n if (collapsed.to == pos) { collapsed = false; }\n }\n }\n if (pos >= len) { break }\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", css, attributes);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n }", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1+=2)\n { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }\n return\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, collapsed, attributes;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = css = \"\";\n attributes = null;\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [], endStyles = (void 0);\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n if (m.className) { spanStyle += \" \" + m.className; }\n if (m.css) { css = (css ? css + \";\" : \"\") + m.css; }\n if (m.startStyle && sp.from == pos) { spanStartStyle += \" \" + m.startStyle; }\n if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }\n // support for the old title property\n // https://github.com/codemirror/CodeMirror/pull/5673\n if (m.title) { (attributes || (attributes = {})).title = m.title; }\n if (m.attributes) {\n for (var attr in m.attributes)\n { (attributes || (attributes = {}))[attr] = m.attributes[attr]; }\n }\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n { collapsed = sp; }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)\n { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += \" \" + endStyles[j$1]; } } }\n\n if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)\n { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) { return }\n if (collapsed.to == pos) { collapsed = false; }\n }\n }\n if (pos >= len) { break }\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", css, attributes);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n }", "function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1+=2)\n { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }\n return\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, collapsed, attributes;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = css = \"\";\n attributes = null;\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [], endStyles = (void 0);\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n if (m.className) { spanStyle += \" \" + m.className; }\n if (m.css) { css = (css ? css + \";\" : \"\") + m.css; }\n if (m.startStyle && sp.from == pos) { spanStartStyle += \" \" + m.startStyle; }\n if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }\n // support for the old title property\n // https://github.com/codemirror/CodeMirror/pull/5673\n if (m.title) { (attributes || (attributes = {})).title = m.title; }\n if (m.attributes) {\n for (var attr in m.attributes)\n { (attributes || (attributes = {}))[attr] = m.attributes[attr]; }\n }\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n { collapsed = sp; }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)\n { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += \" \" + endStyles[j$1]; } } }\n\n if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)\n { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) { return }\n if (collapsed.to == pos) { collapsed = false; }\n }\n }\n if (pos >= len) { break }\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", css, attributes);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n }", "function isWholeLineUpdate(doc, change) {\n\t\t return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == \"\" &&\n\t\t (!doc.cm || doc.cm.options.wholeLineUpdateBefore)\n\t\t }", "function isWholeLineUpdate(doc, change) {\n\t\t return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == \"\" &&\n\t\t (!doc.cm || doc.cm.options.wholeLineUpdateBefore);\n\t\t }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line\n // Continuing lines, if any\n this.rest = visualLineContinued(line)\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1\n this.node = this.text = null\n this.hidden = lineIsHidden(doc, line)\n}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line\n // Continuing lines, if any\n this.rest = visualLineContinued(line)\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1\n this.node = this.text = null\n this.hidden = lineIsHidden(doc, line)\n}", "moveToLineStartInternal(selection, moveToPreviousLine) {\n if (this.location.x > this.viewer.clientActiveArea.right) {\n this.offset = this.offset - 1;\n }\n let currentLine = selection.getLineWidgetInternal(this.currentWidget, this.offset, moveToPreviousLine);\n let firstElement;\n let isParaBidi = this.currentWidget.paragraph.paragraphFormat.bidi;\n if (isParaBidi && currentLine.children.length > 0 && this.containsRtlText(currentLine)) {\n firstElement = currentLine.children[currentLine.children.length - 1];\n if (firstElement instanceof ListTextElementBox) {\n firstElement = undefined;\n }\n }\n else {\n firstElement = selection.getFirstElementInternal(currentLine);\n }\n this.viewer.moveCaretPosition = 1;\n let startOffset = selection.getStartOffset(this.currentWidget.paragraph);\n if (isNullOrUndefined(firstElement) && this.offset > startOffset) {\n let index = 0;\n let inlineObj = this.currentWidget.getInline(this.offset, index);\n let inline = inlineObj.element;\n index = inlineObj.index;\n if (inline instanceof TextElementBox && inline.text !== '\\v') {\n this.offset = startOffset;\n }\n }\n else if (!isNullOrUndefined(firstElement)) {\n let indexInInline = 0;\n this.currentWidget = firstElement.line;\n this.offset = this.currentWidget.getOffset(firstElement, indexInInline);\n indexInInline = 0;\n let inlineObj = this.currentWidget.getInline(this.offset, indexInInline);\n let inline = inlineObj.element;\n indexInInline = inlineObj.index;\n if (inline instanceof FieldElementBox) {\n //Checks if field character is part of rendered field, otherwise moves to previous rendered content.\n let prevInline = selection.getPreviousValidElement(inline);\n if (!isNullOrUndefined(prevInline)) {\n inline = prevInline;\n this.currentWidget = inline.line;\n this.offset = this.currentWidget.getOffset(inline, inline.length);\n if (inline instanceof FieldElementBox) {\n this.offset--;\n }\n }\n }\n }\n this.updatePhysicalPosition(true);\n }", "reLayoutLine(paragraph, lineIndex, isBidi) {\n if (this.viewer.owner.isDocumentLoaded && this.viewer.owner.editorModule) {\n this.viewer.owner.editorModule.updateWholeListItems(paragraph);\n }\n let lineWidget;\n if (paragraph.paragraphFormat.listFormat && paragraph.paragraphFormat.listFormat.listId !== -1) {\n lineWidget = paragraph.getSplitWidgets()[0].firstChild;\n }\n else {\n lineWidget = paragraph.childWidgets[lineIndex];\n }\n if (!this.isBidiReLayout && (paragraph.paragraphFormat.bidi || this.isContainsRtl(lineWidget))) {\n let newLineIndex = lineIndex <= 0 ? 0 : lineIndex - 1;\n for (let i = newLineIndex; i < paragraph.childWidgets.length; i++) {\n if (isBidi || !(paragraph.paragraphFormat.bidi && this.isContainsRtl(lineWidget))) {\n if (i === lineIndex) {\n continue;\n }\n }\n this.reArrangeElementsForRtl(paragraph.childWidgets[i], paragraph.paragraphFormat.bidi);\n }\n }\n let lineToLayout = lineWidget.previousLine;\n if (isNullOrUndefined(lineToLayout)) {\n lineToLayout = lineWidget;\n }\n let currentParagraph = lineToLayout.paragraph;\n let bodyWidget = paragraph.containerWidget;\n bodyWidget.height -= paragraph.height;\n if (this.viewer.owner.enableHeaderAndFooter || paragraph.isInHeaderFooter) {\n paragraph.bodyWidget.isEmpty = false;\n // tslint:disable-next-line:max-line-length\n this.viewer.updateHCFClientAreaWithTop(paragraph.bodyWidget.sectionFormat, this.viewer.isBlockInHeader(paragraph), bodyWidget.page);\n }\n else {\n this.viewer.updateClientArea(bodyWidget.sectionFormat, bodyWidget.page);\n }\n this.viewer.updateClientAreaForBlock(paragraph, true);\n if (lineToLayout.paragraph.isEmpty()) {\n this.viewer.cutFromTop(paragraph.y);\n this.layoutParagraph(paragraph, 0);\n }\n else {\n this.updateClientAreaForLine(lineToLayout.paragraph, lineToLayout, 0);\n this.layoutListItems(lineToLayout.paragraph);\n if (lineToLayout.isFirstLine() && !isNullOrUndefined(paragraph.paragraphFormat)) {\n let firstLineIndent = -HelperMethods.convertPointToPixel(paragraph.paragraphFormat.firstLineIndent);\n this.viewer.updateClientWidth(firstLineIndent);\n }\n do {\n lineToLayout = this.layoutLine(lineToLayout, 0);\n paragraph = lineToLayout.paragraph;\n lineToLayout = lineToLayout.nextLine;\n } while (lineToLayout);\n this.updateWidgetToPage(this.viewer, paragraph);\n this.viewer.updateClientAreaForBlock(paragraph, false);\n }\n this.layoutNextItemsBlock(paragraph, this.viewer);\n }", "function fillWithLineAndComments() {\n\t arrayOfLines = []; // An array of references to li tags.\n\t $ol.empty(); // Emptying childs of ol tag.\n\t comments.sort(SortByEndline);\n\n\t var current = 0;\n\t for (var line = 0; line < lines.length; line++) {\n\t \t\tvar $lineRef = createLine(lines[line], line); \n\t \t\tarrayOfLines.push($lineRef);\n\t \t \t$ol.append($lineRef);\n\t \t\twhile(current < comments.length && comments[current][\"end\"] == line) {\n\t \t\t\tvar $commentRef = createComment(comments[current]); \n\t \t\t\tarrayOfComments.push($commentRef);\n\t\t\t $ol.append($commentRef);\n\t\t\t current += 1;\n\t \t\t}\n\t }\n\t}", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }", "function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }" ]
[ "0.62110734", "0.57639134", "0.5717615", "0.5717556", "0.5717556", "0.5697219", "0.56847644", "0.56847644", "0.56847644", "0.56847644", "0.56847644", "0.56847644", "0.56847644", "0.56847644", "0.56847644", "0.56847644", "0.56847644", "0.56392586", "0.56392586", "0.56392586", "0.56392586", "0.56392586", "0.56392586", "0.56392586", "0.56392586", "0.56392586", "0.5638813", "0.5623308", "0.5623308", "0.5623308", "0.5623308", "0.5623308", "0.5623308", "0.5623308", "0.5623308", "0.5614929", "0.5603861", "0.5593767", "0.5593767", "0.5593767", "0.5593767", "0.5593153", "0.5593153", "0.5588008", "0.55830204", "0.55730194", "0.5546518", "0.5546518", "0.5546518", "0.551542", "0.5470207", "0.54524565", "0.54420495", "0.5441942", "0.54278064", "0.5405481", "0.5319921", "0.53148186", "0.5289378", "0.5289378", "0.5289378", "0.5289378", "0.5289378", "0.5289378", "0.5289378", "0.5289378", "0.5289378", "0.5289378", "0.5289378", "0.5289378", "0.5289378", "0.5289378", "0.5289378", "0.5287356", "0.52775556", "0.5276004", "0.5276004", "0.52759695", "0.52695286", "0.5263941", "0.5260901", "0.5260901", "0.5260901", "0.5260901", "0.5260901", "0.5260901", "0.5260901", "0.5260901", "0.5260901", "0.5260901", "0.5260901", "0.5260901", "0.5260901", "0.5260901", "0.5260901", "0.5260901", "0.5260901", "0.5260901", "0.5260901", "0.5260901", "0.5260901" ]
0.0
-1
Perform a change on the document data structure.
function updateDoc(doc, change, markedSpans, estimateHeight) { function spansFor(n) {return markedSpans ? markedSpans[n] : null} function update(line, text, spans) { updateLine(line, text, spans, estimateHeight); signalLater(line, "change", line, change); } function linesFor(start, end) { var result = []; for (var i = start; i < end; ++i) { result.push(new Line(text[i], spansFor(i), estimateHeight)); } return result } var from = change.from, to = change.to, text = change.text; var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line); var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line; // Adjust the line structure if (change.full) { doc.insert(0, linesFor(0, text.length)); doc.remove(text.length, doc.size - text.length); } else if (isWholeLineUpdate(doc, change)) { // This is a whole-line replace. Treated specially to make // sure line objects move the way they are supposed to. var added = linesFor(0, text.length - 1); update(lastLine, lastLine.text, lastSpans); if (nlines) { doc.remove(from.line, nlines); } if (added.length) { doc.insert(from.line, added); } } else if (firstLine == lastLine) { if (text.length == 1) { update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans); } else { var added$1 = linesFor(1, text.length - 1); added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight)); update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0)); doc.insert(from.line + 1, added$1); } } else if (text.length == 1) { update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0)); doc.remove(from.line + 1, nlines); } else { update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0)); update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans); var added$2 = linesFor(1, text.length - 1); if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); } doc.insert(from.line + 1, added$2); } signalLater(doc, "change", doc, change); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "change(docId, doc) {\n const cleanedDoc = this._getCleanedObject(doc);\n let storedDoc = this.store[docId];\n deepExtend(storedDoc, cleanedDoc);\n\n let changedData = {};\n _.each(cleanedDoc, (value, key) => {\n changedData[key] = storedDoc[key];\n });\n\n this.send('changed', docId, changedData);\n }", "apply(doc) {\n if (this.length != doc.length)\n throw new RangeError(\"Applying change set to a document with the wrong length\");\n iterChanges(this, (fromA, toA, fromB, _toB, text) => doc = doc.replace(fromB, fromB + (toA - fromA), text), false);\n return doc;\n }", "async updateDocument(ctx, documentId, newValue) {\n const exists = await this.documentExists(ctx, documentId);\n if (!exists) {\n throw new Error(`The document ${documentId} does not exist`);\n }\n const asset = { value: newValue };\n const buffer = Buffer.from(JSON.stringify(asset));\n await ctx.stub.putState(documentId, buffer);\n }", "onChange(document) {\n if (fspath.basename(document.uri.fsPath) == \"property.json\") {\t\t\n this.refreshProperty.updateFolder(serve.opeParam.rootPath,serve.opeParam.workspacePath,document.uri.fsPath);\n this.refreshProperty.updatePrjInfo(serve.opeParam.rootPath,document.uri.fsPath);\n return;\n }\n if (!this.getHDLDocumentType(document)) {\n return;\n }\n else if (this.getHDLDocumentType(document) == 1 ) {\n this.HDLparam = this.parser.removeCurrentFileParam(document, this.HDLparam);\n this.parser.get_HDLfileparam(document, null, 0, null, this.HDLparam);\n this.parser.get_instModulePath(this.HDLparam);\n this.refresh();\n }\n }", "updateSelfData(ro) {}", "function myEdit(e){\n Logger.log(\"change triggered\");\n\n refetch();\n //Logger.log(e);\n}", "_runProcessChanges() {\n // Don't run this functionality if the element has disconnected.\n if (!this.isConnected) return;\n\n store.dispatch(ui.reportDirtyForm(this.formName, this.isDirty));\n this.dispatchEvent(new CustomEvent('change', {\n detail: {\n delta: this.delta,\n commentContent: this.getCommentContent(),\n },\n }));\n }", "set modified(value) {\n this.data.modified = value;\n }", "function applyChange(para, raw) {\n para.attr('raw', raw);\n updateRefs(para);\n para.removeClass('changed');\n}", "_rebaseChange(args, cb) {\n this.documentEngine.getChanges({\n documentId: args.documentId,\n sinceVersion: args.version\n }, function(err, result) {\n let B = result.changes.map(this.deserializeChange)\n let a = this.deserializeChange(args.change)\n // transform changes\n DocumentChange.transformInplace(a, B)\n let ops = B.reduce(function(ops, change) {\n return ops.concat(change.ops)\n }, [])\n let serverChange = new DocumentChange(ops, {}, {})\n\n cb(null, {\n change: this.serializeChange(a),\n serverChange: this.serializeChange(serverChange),\n version: result.version\n })\n }.bind(this))\n }", "function update(data) {\n console.log('+++ TODO');\n }", "function domUpdateitem(doc){\r\n\r\n var updatedValue = document.getElementById(doc.id);\r\n\r\n updatedValue.childNodes[0].nodeValue = doc.data().todo;\r\n \r\n}", "triggerUpdate() {\n let fileId = this.fileNode.id\n this.context.editorSession.transaction((tx) => {\n tx.set([fileId, '__changed__'], '')\n }, { history: false })\n }", "function updateDatabase(){\n db.collection(\"<collection>\").doc(\"<document>\").set({\n\tcongratulated: congratulated,\n\tcurrentCup: currentCup,\n\tgoal: goal,\n\tprogress: progress,\n \ttotalDailyWeight: totalWeight,\n\tcurrentMonth: currentMonth,\n\tcurrentDay: currentDay,\n\tdaysMetGoal: daysMetGoal,\n\ttotalMonthlyWeight: monthlyTotal,\n\tdaysInMonth: daysInMonth\n })\n}", "updated() {}", "function updateDoc(cm, from, to, newText, selUpdate, origin) {\n // Possibly split or suppress the update based on the presence\n // of read-only spans in its range.\n var split = sawReadOnlySpans &&\n removeReadOnlyRanges(cm.view.doc, from, to);\n if (split) {\n for (var i = split.length - 1; i >= 1; --i)\n updateDocInner(cm, split[i].from, split[i].to, [\"\"], origin);\n if (split.length)\n return updateDocInner(cm, split[0].from, split[0].to, newText, selUpdate, origin);\n } else {\n return updateDocInner(cm, from, to, newText, selUpdate, origin);\n }\n }", "function updateDoc(cm, from, to, newText, selUpdate, origin) {\n // Possibly split or suppress the update based on the presence\n // of read-only spans in its range.\n var split = sawReadOnlySpans &&\n removeReadOnlyRanges(cm.view.doc, from, to);\n if (split) {\n for (var i = split.length - 1; i >= 1; --i)\n updateDocInner(cm, split[i].from, split[i].to, [\"\"], origin);\n if (split.length)\n return updateDocInner(cm, split[0].from, split[0].to, newText, selUpdate, origin);\n } else {\n return updateDocInner(cm, from, to, newText, selUpdate, origin);\n }\n }", "function updateDoc(cm, from, to, newText, selUpdate, origin) {\n // Possibly split or suppress the update based on the presence\n // of read-only spans in its range.\n var split = sawReadOnlySpans &&\n removeReadOnlyRanges(cm.view.doc, from, to);\n if (split) {\n for (var i = split.length - 1; i >= 1; --i)\n updateDocInner(cm, split[i].from, split[i].to, [\"\"], origin);\n if (split.length)\n return updateDocInner(cm, split[0].from, split[0].to, newText, selUpdate, origin);\n } else {\n return updateDocInner(cm, from, to, newText, selUpdate, origin);\n }\n }", "static onUpdateData(col, fn) {\n db.collection(col).onSnapshot(snapshot => {\n snapshot.docChanges().forEach(change => {\n if (change.type === 'modified') fn();\n });\n });\n }", "_onUpdateTextElement(nodeId) {\n let newValue = this.refs[nodeId].val()\n let editorSession = this.context.editorSession\n editorSession.transaction((doc) => {\n let element = doc.get(nodeId)\n element.setText(newValue)\n doc.setSelection(null)\n })\n // Trigger custom ref:updated which leads to an update of the rendered\n // record (see RefComponent)\n editorSession.emit('ref:updated', this.props.node.id)\n }", "update(data) {\n this.data = data;\n this.populate(this.dindex);\n console.log(\"Infographic of type \\\"\" + this.typename + \"\\\" updated.\");\n }", "function UpdatePouchDB() {\n console.log('updating pouchdb using google drive data');\n startUpdatingUI();\n }", "function updatedoc() {\n currentuseruid = auth.currentUser.uid\n var updatedata = {\n collection: 'new1',\n doc: 'newdoc2',\n contents: {\n newfield: 'updated',\n newfield2: 'newly added by abcd'\n }\n }\n // console.log(newdoc1)\n // get the current user\n db.collection(updatedata.collection).doc(updatedata.doc).update(updatedata.contents).then(d => {\n console.log('document updated')\n });\n }", "update(dn, changes, callback) {\n this.modify(dn, changes, callback);\n }", "static async modifyDocument (id, document) {\n if (typeof document !== 'object') {\n throw new Error('Bad Parameter');\n }\n const db = await Mongo.instance().getDb();\n const isValid = await Document.isDocument(document);\n if (isValid.valid) {\n // Create a new document\n // Uploaded document with new informations.\n const res = await db.collection(Document.COLLECTION).updateOne(\n {\n _id: ObjectId(id)\n },\n {\n $set: {\n ...document,\n updatedAt: moment().toDate()\n }\n }\n );\n return res;\n } else {\n log.debug('Warning - couldn\\'t modify document \\n', document);\n return null;\n }\n }", "function onDocumentDataChanged() {\n //TODO now do this on editing all input fields\n let changes = documentHasUnsavedChanges();\n if (changes) {\n showUnsavedDocumentSpan();\n } else {\n hideUnsavedDocumentSpan();\n }\n}", "function changeSynchronized() {\n db.allDocs( { include_docs: true, descending: false } ).then( doc => {\n doc.rows.forEach( register => {\n register.doc.sincronizado = true;\n db.put( register.doc ).then( () => {\n console.log('Registro actualizado');\n }).catch( error => {\n console.log('Ha ocurrido un error al sincronizar: ', error);\n });\n });\n });\n}", "function docFromChanges(options, changes) {\n const doc = init(options)\n const [state, _] = Backend.applyChanges(Backend.init(), changes)\n const patch = Backend.getPatch(state)\n patch.state = state\n return Frontend.applyPatch(doc, patch)\n}", "get docChanged() { return !this.changes.empty; }", "function update(document, changes, version) {\n if (document instanceof FullTextDocument) {\n document.update(changes, version);\n return document;\n }\n else {\n throw new Error('TextDocument.update: document must be created by TextDocument.create');\n }\n }", "update(index, Object) {\n this.rangeCheck(index);\n this.elementData[index] = Object;\n }", "update(){}", "update(){}", "update(){}", "onStoreUpdate({ changes, record }) {\n const { editorContext } = this;\n\n if (editorContext && editorContext.editor.isVisible) {\n if (record === editorContext.record && editorContext.editor.dataField in changes) {\n editorContext.editor.refreshEdit();\n }\n }\n }", "update(node, outerDeco, innerDeco, view) {\n if (this.dirty == NODE_DIRTY)\n return false;\n if (this.spec.update) {\n let result = this.spec.update(node, outerDeco, innerDeco);\n if (result)\n this.updateInner(node, outerDeco, innerDeco, view);\n return result;\n } else if (!this.contentDOM && !node.isLeaf) {\n return false;\n } else {\n return super.update(node, outerDeco, innerDeco, view);\n }\n }", "onModifyAtk() {}", "onStoreUpdate({\n changes,\n record\n }) {\n const {\n editorContext\n } = this;\n\n if (editorContext && editorContext.editor.isVisible) {\n if (record === editorContext.record && editorContext.editor.dataField in changes) {\n editorContext.editor.refreshEdit();\n }\n }\n }", "function updateDoc(doc, db){\n\tdb.update({ _refObjectUUID: doc._refObjectUUID }, doc, {}, function(err, count){\n\t\t//console.log('Update: ', count);\n\t});\n}", "get newDoc() {\n return this._doc || (this._doc = this.changes.apply(this.startState.doc));\n }", "reTriggerChanges() {\n for (const attr in this.attributes) {\n this.trigger(`change:${attr}`, this, this.get(attr), {});\n }\n this.trigger(\"change\", this, {});\n }", "function update(document, changes, version) {\n if (document instanceof FullTextDocument) {\n document.update(changes, version);\n return document;\n }\n else {\n throw new Error('TextDocument.update: document must be created by TextDocument.create');\n }\n }", "function writeDocument(collection, changedDocument) {\n var id = changedDocument._id;\n if (id === undefined) {\n throw new Error(`You cannot write a document to the database without an _id! Use AddDocument if this is a new object.`);\n }\n // Store a copy of the object into the database. Models a database's behavior.\n data[collection][id] = JSONClone(changedDocument);\n // Update our 'database'.\n updated = true;\n}", "function writeDocument(collection, changedDocument) {\n var id = changedDocument._id;\n if (id === undefined) {\n throw new Error(`You cannot write a document to the database without an _id! Use AddDocument if this is a new object.`);\n }\n // Store a copy of the object into the database. Models a database's behavior.\n data[collection][id] = JSONClone(changedDocument);\n // Update our 'database'.\n updated = true;\n}", "function writeDocument(collection, changedDocument) {\n var id = changedDocument._id;\n if (id === undefined) {\n throw new Error(`You cannot write a document to the database without an _id! Use AddDocument if this is a new object.`);\n }\n // Store a copy of the object into the database. Models a database's behavior.\n data[collection][id] = JSONClone(changedDocument);\n // Update our 'database'.\n updated = true;\n}", "function makeChange(doc, change, ignoreReadOnly) {\n\t\t if (doc.cm) {\n\t\t if (!doc.cm.curOp) return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly);\n\t\t if (doc.cm.state.suppressEdits) return;\n\t\t }\n\t\t\n\t\t if (hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\")) {\n\t\t change = filterChange(doc, change, true);\n\t\t if (!change) return;\n\t\t }\n\t\t\n\t\t // Possibly split or suppress the update based on the presence\n\t\t // of read-only spans in its range.\n\t\t var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);\n\t\t if (split) {\n\t\t for (var i = split.length - 1; i >= 0; --i)\n\t\t makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [\"\"] : change.text});\n\t\t } else {\n\t\t makeChangeInner(doc, change);\n\t\t }\n\t\t }", "function handler_designDocumentOnChange() {\n let designDoc = $(\"#couchdb_designDocument\").val();\n getCouchdbViews(designDoc, DOM_fillCouchdbViews);\n }", "update() {\n this.dataChanged = true;\n this.persons.all = undefined;\n this.jobTitles.all = undefined;\n this.updateFiltered();\n this.updateTimed();\n }", "updateData(event,Refname, Relname, Reschool, Reproof, Renum){\n \n var docId = this.state.id\n db.collection('school').doc(docId)\n .update({\n \n FirstName: Refname,\n LastName: Relname,\n Num: Renum,\n Proof:Reproof,\n School:Reschool\n\n\n })\n\n\n \n window.location.reload(true); \n\n\n\n }", "function changeAuthor(position, newValue) {\nauthors[position] = newValue;\ndisplayAuthor(); // Automatically display changes\n}", "updated(_changedProperties) { }", "function makeAChange(){\n contentPanel.SC.run(function(){\n contentPanel.MySystem.store.createRecord(contentPanel.MySystem.Node, { 'title': 'Test node ' + newNodeIndex, 'image': '/lightbulb_tn.png' });\n });\n newNodeIndex += 1;\n }", "function DocumentCreated(doc) {\n ReceiveUpdate(doc);\n}", "function runUpdate(){\n people.forEach(function(element){\n element.update();\n });\n }", "change() {\n this._updateValueProperty();\n\n this.sendAction('action', this.get('value'), this);\n }", "function updateUnits(){\n db.collection(\"Office\").doc(\"officeView\").get().then(function(doc){\n if (doc.exists) {\n drawInUnits(doc.data())\n } else {\n // doc.data() will be undefined in this case\n console.log(\"No such document!\");\n }\n }).catch(function(error) {\n console.log(\"Error getting document:\", error);\n })\n}", "function ex3_update_node(node_name, field_name, value) {\n get_node(node_name)[field_name] = value;\n // Update everything\n update_all();\n}", "reset(doc) {\n if (doc) {\n (0, _debug.default)('Document state reset to revision %s', doc._rev);\n } else {\n (0, _debug.default)('Document state reset to being deleted');\n }\n\n this.document.reset(doc);\n this.rebase([], []);\n this.handleDocConsistencyChanged(this.document.isConsistent());\n }", "function makeChange(doc, change, ignoreReadOnly) {\n\t\t if (doc.cm) {\n\t\t if (!doc.cm.curOp) { return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly) }\n\t\t if (doc.cm.state.suppressEdits) { return }\n\t\t }\n\n\t\t if (hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\")) {\n\t\t change = filterChange(doc, change, true);\n\t\t if (!change) { return }\n\t\t }\n\n\t\t // Possibly split or suppress the update based on the presence\n\t\t // of read-only spans in its range.\n\t\t var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);\n\t\t if (split) {\n\t\t for (var i = split.length - 1; i >= 0; --i)\n\t\t { makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [\"\"] : change.text, origin: change.origin}); }\n\t\t } else {\n\t\t makeChangeInner(doc, change);\n\t\t }\n\t\t }", "function changeTodo() {\n\ttodos[0] = 'item updated';\n}", "ensure(key, document) {\n const state = this.documents.get(key);\n if (!state) {\n const observer = new DocumentTestObserver(document, this.diagnostics, this.config);\n this.documents.set(key, observer);\n observer.onDidChangeCodeLenses(() => this.config.codeLens && this.codeLensChangeEmitter.fire());\n }\n }", "function makeChange(doc, change, ignoreReadOnly) {\n\t if (doc.cm) {\n\t if (!doc.cm.curOp) return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly);\n\t if (doc.cm.state.suppressEdits) return;\n\t }\n\t\n\t if (hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\")) {\n\t change = filterChange(doc, change, true);\n\t if (!change) return;\n\t }\n\t\n\t // Possibly split or suppress the update based on the presence\n\t // of read-only spans in its range.\n\t var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);\n\t if (split) {\n\t for (var i = split.length - 1; i >= 0; --i)\n\t makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [\"\"] : change.text});\n\t } else {\n\t makeChangeInner(doc, change);\n\t }\n\t }", "function change(o) {\n\to.id = 2;\n}", "function KeyValueChangeRecord() { }", "function KeyValueChangeRecord() { }", "function editMade() {\n version += 1;\n emitter({});\n }", "function changeData() {\n elem.name = userData.name;\n elem.star = userData.star;\n elem.time = userData.time;\n elem.moves = userData.moves;\n}", "update(data) {\n return this.ref.update(data);\n }", "function UpdateItem() {\r\n db.collection(\"todo\").doc(parentId).update({\r\n todo: todo.value\r\n })\r\n .then(function() {\r\n parentId = undefined;\r\n todo.value = '';\r\n Bten.innerHTML = \"Add Todo\";\r\n Bten.setAttribute('onclick' , 'addTodoItem()');\r\n })\r\n .catch(function(error) {\r\n // The document probably doesn't exist.\r\n console.error(\"Error updating document: \", error);\r\n });\r\n \r\n}", "update(startingData) {}", "function handleChanges() {\n\n $changes = app.changes();\n $changes.onChange(function(change) {\n\n var section = findById(viewModel.children(), change.id), childNote = findById(viewModel.notes(), change.id);\n if (change.deleted) {\n if (section.index == 0) { // note deleted, go one level up\n goup(viewModel.children()[0]);\n } else if (section.index != -1) { // section deleted\n viewModel.children.splice(section.index, 1);\n } else if (childNote.index != -1) { // child note deleted\n viewModel.notes.splice(childNote.index, 1);\n }\n } else { // updated/added\n if (section.index != -1) {\n section.value.load();\n } else if (childNote.index != -1) {\n // ignore child note update\n } else { // new item?\n app.read(change.id, function(error, doc) {\n if (typeof viewModel.children()[0] != 'undefined' \n && doc.parent_id == viewModel.children()[0]._id) { // new item!\n if (doc.type == 'section') { // insert at certain position\n var added = false;\n for (var i = 0, length = viewModel.children().length; i < length && !added; i++) {\n if (viewModel.children()[i].order > doc.order) {\n viewModel.children.splice(i, 0, observable(doc)); // insert\n added = true;\n }\n }\n if (!added) { // append\n viewModel.children.push(observable(doc));\n }\n } else { // child note added\n viewModel.notes.push(doc); // add\n }\n }\n })\n }\n }\n });\n\n}", "update(path, newValue) {\n // this.currentData is about to become the \"previous generation\"\n const prevData = this.currentData;\n\n if (path.length === 0) {\n // Replace the data entirely. We must manually force its immutability when we do this.\n this.currentData = Immutable(newValue);\n }\n else {\n // Apply the update to produce the next generation. Because this.currentData has\n // been processed by seamless-immutable, nextData will automatically be immutable as well.\n this.currentData = this.currentData.setIn(path, newValue);\n }\n\n // Notify all change listeners\n for (let changeListener of this.changeListeners) {\n let shouldUpdate = true;\n let shorterPathLength = Math.min(path.length, changeListener.path.length);\n\n // Only update if the change listener path is a sub-path of the update path (or vice versa)\n for(let i = 1; i < shorterPathLength; i++) {\n shouldUpdate = shouldUpdate && (path[i] === changeListener.path[i])\n }\n\n if(shouldUpdate) {\n // Only call change listener if associated path data has changed\n if(getIn(this.currentData, changeListener.path) !== getIn(prevData, changeListener.path)) {\n // Pass nextData first because many listeners will ONLY care about that.\n changeListener(this.currentData, prevData, path);\n }\n }\n }\n }", "function makeChange(doc, change, ignoreReadOnly) {\n\t if (doc.cm) {\n\t if (!doc.cm.curOp) return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly);\n\t if (doc.cm.state.suppressEdits) return;\n\t }\n\n\t if (hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\")) {\n\t change = filterChange(doc, change, true);\n\t if (!change) return;\n\t }\n\n\t // Possibly split or suppress the update based on the presence\n\t // of read-only spans in its range.\n\t var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);\n\t if (split) {\n\t for (var i = split.length - 1; i >= 0; --i)\n\t makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [\"\"] : change.text});\n\t } else {\n\t makeChangeInner(doc, change);\n\t }\n\t }", "function makeChange(doc, change, ignoreReadOnly) {\n\t if (doc.cm) {\n\t if (!doc.cm.curOp) return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly);\n\t if (doc.cm.state.suppressEdits) return;\n\t }\n\n\t if (hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\")) {\n\t change = filterChange(doc, change, true);\n\t if (!change) return;\n\t }\n\n\t // Possibly split or suppress the update based on the presence\n\t // of read-only spans in its range.\n\t var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);\n\t if (split) {\n\t for (var i = split.length - 1; i >= 0; --i)\n\t makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [\"\"] : change.text});\n\t } else {\n\t makeChangeInner(doc, change);\n\t }\n\t }", "function onDatabaseChange(change) {\n var index = findIndex(_users, change.id);\n var user = _users[index];\n\n if (change.deleted) {\n if (user) {\n _users.splice(index, 1); // delete\n }\n } else {\n if (user && user._id === change.id) {\n _users[index] = change.doc; // update\n } else {\n _users.splice(index, 0, change.doc); // insert\n }\n }\n }", "function makeChange(doc, change, ignoreReadOnly) {\r\n if (doc.cm) {\r\n if (!doc.cm.curOp) return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly);\r\n if (doc.cm.state.suppressEdits) return;\r\n }\r\n\r\n if (hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\")) {\r\n change = filterChange(doc, change, true);\r\n if (!change) return;\r\n }\r\n\r\n // Possibly split or suppress the update based on the presence\r\n // of read-only spans in its range.\r\n var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);\r\n if (split) {\r\n for (var i = split.length - 1; i >= 0; --i)\r\n makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [\"\"] : change.text});\r\n } else {\r\n makeChangeInner(doc, change);\r\n }\r\n }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n\t\t function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n\t\t function update(line, text, spans) {\n\t\t updateLine(line, text, spans, estimateHeight);\n\t\t signalLater(line, \"change\", line, change);\n\t\t }\n\t\t function linesFor(start, end) {\n\t\t var result = [];\n\t\t for (var i = start; i < end; ++i)\n\t\t { result.push(new Line(text[i], spansFor(i), estimateHeight)); }\n\t\t return result\n\t\t }\n\n\t\t var from = change.from, to = change.to, text = change.text;\n\t\t var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n\t\t var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n\t\t // Adjust the line structure\n\t\t if (change.full) {\n\t\t doc.insert(0, linesFor(0, text.length));\n\t\t doc.remove(text.length, doc.size - text.length);\n\t\t } else if (isWholeLineUpdate(doc, change)) {\n\t\t // This is a whole-line replace. Treated specially to make\n\t\t // sure line objects move the way they are supposed to.\n\t\t var added = linesFor(0, text.length - 1);\n\t\t update(lastLine, lastLine.text, lastSpans);\n\t\t if (nlines) { doc.remove(from.line, nlines); }\n\t\t if (added.length) { doc.insert(from.line, added); }\n\t\t } else if (firstLine == lastLine) {\n\t\t if (text.length == 1) {\n\t\t update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n\t\t } else {\n\t\t var added$1 = linesFor(1, text.length - 1);\n\t\t added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n\t\t update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n\t\t doc.insert(from.line + 1, added$1);\n\t\t }\n\t\t } else if (text.length == 1) {\n\t\t update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n\t\t doc.remove(from.line + 1, nlines);\n\t\t } else {\n\t\t update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n\t\t update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n\t\t var added$2 = linesFor(1, text.length - 1);\n\t\t if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n\t\t doc.insert(from.line + 1, added$2);\n\t\t }\n\n\t\t signalLater(doc, \"change\", doc, change);\n\t\t }", "function makeChange(doc, change, ignoreReadOnly) {\r\n if (doc.cm) {\r\n if (!doc.cm.curOp) { return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly) }\r\n if (doc.cm.state.suppressEdits) { return }\r\n }\r\n\r\n if (hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\")) {\r\n change = filterChange(doc, change, true);\r\n if (!change) { return }\r\n }\r\n\r\n // Possibly split or suppress the update based on the presence\r\n // of read-only spans in its range.\r\n var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);\r\n if (split) {\r\n for (var i = split.length - 1; i >= 0; --i)\r\n { makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [\"\"] : change.text, origin: change.origin}); }\r\n } else {\r\n makeChangeInner(doc, change);\r\n }\r\n}", "function updateNode(obj, node) {\n obj2elems(obj, node);\n expand_collapase_handler(node);\n value_modification_handler(node);\n control_icon_handler(node);\n}", "set data(newValue) {\n privateDataMap.get(this).update(this.path, newValue);\n }", "function modify() {\n\t\t\tconsole.log(\"modify() -> NonMutantCellLineUpdateAPI()\");\n\n\t\t\t// check if record selected\n\t\t\tif (vm.selectedIndex < 0) {\n\t\t\t\talert(\"Cannot Modify if a record is not selected.\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\tpageScope.loadingStart();\n\n vm.apiDomain.processStatus = \"u\";\n\n\t\t\tNonMutantCellLineUpdateAPI.update(vm.apiDomain, function(data) {\n\t\t\t\tif (data.error != null) {\n\t\t\t\t\talert(\"ERROR: \" + data.error + \" - \" + data.message);\n\t\t\t\t\tloadObject();\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tloadObject();\n\t\t\t\t}\n\t\t\t\tpageScope.loadingEnd();\n setFocus();\n\t\t\t}, function(err) {\n\t\t\t\tpageScope.handleError(vm, \"API ERROR: NonMutantCellLineUpdateAPI.update\");\n\t\t\t\tpageScope.loadingEnd();\n setFocus();\n\t\t\t});\n\t\t}", "updated(changedProperties) {\n }", "function makeChange(doc, change, ignoreReadOnly) {\n if (doc.cm) {\n if (!doc.cm.curOp) { return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly) }\n if (doc.cm.state.suppressEdits) { return }\n }\n\n if (hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\")) {\n change = filterChange(doc, change, true);\n if (!change) { return }\n }\n\n // Possibly split or suppress the update based on the presence\n // of read-only spans in its range.\n var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);\n if (split) {\n for (var i = split.length - 1; i >= 0; --i)\n { makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [\"\"] : change.text}); }\n } else {\n makeChangeInner(doc, change);\n }\n}", "_applyChanges(changes) {\n this._viewRepeater.applyChanges(changes, this._viewContainerRef, (record, _adjustedPreviousIndex, currentIndex) => this._getEmbeddedViewArgs(record, currentIndex), (record) => record.item);\n // Update $implicit for any items that had an identity change.\n changes.forEachIdentityChange((record) => {\n const view = this._viewContainerRef.get(record.currentIndex);\n view.context.$implicit = record.item;\n });\n // Update the context variables on all items.\n const count = this._data.length;\n let i = this._viewContainerRef.length;\n while (i--) {\n const view = this._viewContainerRef.get(i);\n view.context.index = this._renderedRange.start + i;\n view.context.count = count;\n this._updateComputedContextProperties(view.context);\n }\n }", "function updateData(collectionName, dataObj) {\n service.collections[collectionName].update(dataObj);\n saveDb();\n }", "function makeChange(doc, change, ignoreReadOnly) {\n if (doc.cm) {\n if (!doc.cm.curOp) return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly);\n if (doc.cm.state.suppressEdits) return;\n }\n\n if (hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\")) {\n change = filterChange(doc, change, true);\n if (!change) return;\n }\n\n // Possibly split or suppress the update based on the presence\n // of read-only spans in its range.\n var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);\n if (split) {\n for (var i = split.length - 1; i >= 0; --i)\n makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [\"\"] : change.text});\n } else {\n makeChangeInner(doc, change);\n }\n }", "function makeChange(doc, change, ignoreReadOnly) {\n if (doc.cm) {\n if (!doc.cm.curOp) return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly);\n if (doc.cm.state.suppressEdits) return;\n }\n\n if (hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\")) {\n change = filterChange(doc, change, true);\n if (!change) return;\n }\n\n // Possibly split or suppress the update based on the presence\n // of read-only spans in its range.\n var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);\n if (split) {\n for (var i = split.length - 1; i >= 0; --i)\n makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [\"\"] : change.text});\n } else {\n makeChangeInner(doc, change);\n }\n }", "function makeChange(doc, change, ignoreReadOnly) {\n if (doc.cm) {\n if (!doc.cm.curOp) return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly);\n if (doc.cm.state.suppressEdits) return;\n }\n\n if (hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\")) {\n change = filterChange(doc, change, true);\n if (!change) return;\n }\n\n // Possibly split or suppress the update based on the presence\n // of read-only spans in its range.\n var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);\n if (split) {\n for (var i = split.length - 1; i >= 0; --i)\n makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [\"\"] : change.text});\n } else {\n makeChangeInner(doc, change);\n }\n }", "function makeChange(doc, change, ignoreReadOnly) {\n if (doc.cm) {\n if (!doc.cm.curOp) return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly);\n if (doc.cm.state.suppressEdits) return;\n }\n\n if (hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\")) {\n change = filterChange(doc, change, true);\n if (!change) return;\n }\n\n // Possibly split or suppress the update based on the presence\n // of read-only spans in its range.\n var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);\n if (split) {\n for (var i = split.length - 1; i >= 0; --i)\n makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [\"\"] : change.text});\n } else {\n makeChangeInner(doc, change);\n }\n }", "function makeChange(doc, change, ignoreReadOnly) {\n if (doc.cm) {\n if (!doc.cm.curOp) return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly);\n if (doc.cm.state.suppressEdits) return;\n }\n\n if (hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\")) {\n change = filterChange(doc, change, true);\n if (!change) return;\n }\n\n // Possibly split or suppress the update based on the presence\n // of read-only spans in its range.\n var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);\n if (split) {\n for (var i = split.length - 1; i >= 0; --i)\n makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [\"\"] : change.text});\n } else {\n makeChangeInner(doc, change);\n }\n }", "function makeChange(doc, change, ignoreReadOnly) {\n if (doc.cm) {\n if (!doc.cm.curOp) return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly);\n if (doc.cm.state.suppressEdits) return;\n }\n\n if (hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\")) {\n change = filterChange(doc, change, true);\n if (!change) return;\n }\n\n // Possibly split or suppress the update based on the presence\n // of read-only spans in its range.\n var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);\n if (split) {\n for (var i = split.length - 1; i >= 0; --i)\n makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [\"\"] : change.text});\n } else {\n makeChangeInner(doc, change);\n }\n }", "function makeChange(doc, change, ignoreReadOnly) {\n if (doc.cm) {\n if (!doc.cm.curOp) return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly);\n if (doc.cm.state.suppressEdits) return;\n }\n\n if (hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\")) {\n change = filterChange(doc, change, true);\n if (!change) return;\n }\n\n // Possibly split or suppress the update based on the presence\n // of read-only spans in its range.\n var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);\n if (split) {\n for (var i = split.length - 1; i >= 0; --i)\n makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [\"\"] : change.text});\n } else {\n makeChangeInner(doc, change);\n }\n }", "onInvalidation(changeInfo) {}", "_applyChanges(changes) {\n this._viewRepeater.applyChanges(changes, this._viewContainerRef, (record, adjustedPreviousIndex, currentIndex) => this._getEmbeddedViewArgs(record, currentIndex), (record) => record.item);\n // Update $implicit for any items that had an identity change.\n changes.forEachIdentityChange((record) => {\n const view = this._viewContainerRef.get(record.currentIndex);\n view.context.$implicit = record.item;\n });\n // Update the context variables on all items.\n const count = this._data.length;\n let i = this._viewContainerRef.length;\n while (i--) {\n const view = this._viewContainerRef.get(i);\n view.context.index = this._renderedRange.start + i;\n view.context.count = count;\n this._updateComputedContextProperties(view.context);\n }\n }", "_changedNode(){\n\n if (this.root.autoMerklify)\n this._refreshHash(true);\n }", "function makeChange(doc, change, ignoreReadOnly) {\n if (doc.cm) {\n if (!doc.cm.curOp) { return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly) }\n if (doc.cm.state.suppressEdits) { return }\n }\n\n if (hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\")) {\n change = filterChange(doc, change, true)\n if (!change) { return }\n }\n\n // Possibly split or suppress the update based on the presence\n // of read-only spans in its range.\n var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to)\n if (split) {\n for (var i = split.length - 1; i >= 0; --i)\n { makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [\"\"] : change.text}) }\n } else {\n makeChangeInner(doc, change)\n }\n}", "function makeChange(doc, change, ignoreReadOnly) {\n if (doc.cm) {\n if (!doc.cm.curOp) { return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly) }\n if (doc.cm.state.suppressEdits) { return }\n }\n\n if (hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\")) {\n change = filterChange(doc, change, true)\n if (!change) { return }\n }\n\n // Possibly split or suppress the update based on the presence\n // of read-only spans in its range.\n var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to)\n if (split) {\n for (var i = split.length - 1; i >= 0; --i)\n { makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [\"\"] : change.text}) }\n } else {\n makeChangeInner(doc, change)\n }\n}", "function listen_for_change(evt)\r\n{\r\n var node = evt.target;\r\n //GM_log('in change node, data='+node.data+'; was='+evt.prevValue);\r\n document.body.removeEventListener( 'DOMCharacterDataModified', listen_for_change, false );\r\n node.data = translate(node.data);\r\n document.body.addEventListener( 'DOMCharacterDataModified', listen_for_change, false );\r\n}", "function changing(obj){\n obj.greeting = 'hola'; //mutate\n}", "function _patchLocal(data, callback) {\n _patchServiceDB(data);\n view_model.lastChecked = generateTimestamp();\n if( _hasIndexedDB() ) {\n _putArrayToIndexedDB(data, function() {\n callback(\"Patched records to ServiceDB & IndexedDB.\");\n });\n } else {\n callback(\"Patched records to ServiceDB only.\");\n }\n }", "function updateDB(action, data) {\n\t\tvar transaction = db.transaction([collection], \"readwrite\" ),\n\t\t\t store = transaction.objectStore(collection),\n\t\t\t request;\n\n\t\tswitch(action) {\n\t\t\tcase \"add\" :\n\t\t\t\trequest = store.add(data);\n\t\t\t\tbreak;\n\t\t\tcase \"edit\" :\n\t\t\t request = store.put(data);\n\t\t\t break;\n\t\t\tcase \"delete\" :\n\t\t\t\t// note deleteIt() passes just the id\n\t\t\t\trequest = store.delete(Number(data));\n\t\t\t\tbreak;\n\t\t\tdefault :\n\t\t\t\tconsole.log( \"Unable to complete a \" + action + \" request.\" );\n\t\t}\n\n\t\trequest.onsuccess = function(event) {\n\t\t\t// updatePage();\n\t\t}\n\n\t\trequest.onerror = function(event) {\n\t\t\tconsole.log( \"Error with \" + action + \" for article \" + data.title );\n\t\t\tconsole.error(event.target.result)\n\t\t}\n\t\ttransaction.oncomplete = function(event) {\n\t\t\tupdatePage();\n\t\t}\n\t}" ]
[ "0.70639664", "0.65255326", "0.60612947", "0.5983165", "0.57900375", "0.5765763", "0.57389504", "0.5728134", "0.56999445", "0.5689289", "0.568801", "0.5685086", "0.5677597", "0.5652581", "0.5643472", "0.563531", "0.563531", "0.563531", "0.56288433", "0.55978465", "0.5595986", "0.55824566", "0.55820024", "0.55719817", "0.5567884", "0.5547309", "0.5514541", "0.5495767", "0.54867357", "0.5471704", "0.5460551", "0.54562056", "0.54562056", "0.54562056", "0.5439997", "0.5424948", "0.5423518", "0.542328", "0.54159755", "0.5414823", "0.5408754", "0.5406257", "0.54014575", "0.54014575", "0.54014575", "0.5400496", "0.54002917", "0.539905", "0.53931373", "0.53853977", "0.5376549", "0.53693706", "0.5366615", "0.536651", "0.53555673", "0.53550243", "0.5344383", "0.5338057", "0.5333712", "0.5324842", "0.53064936", "0.52886057", "0.5284567", "0.5282763", "0.5282763", "0.52788645", "0.52697515", "0.5264372", "0.52634025", "0.526093", "0.52581584", "0.52580583", "0.52562517", "0.52562517", "0.5255758", "0.52551365", "0.5244049", "0.524301", "0.52392143", "0.52368516", "0.5232924", "0.5232633", "0.5228512", "0.5226742", "0.52259207", "0.52224094", "0.52224094", "0.52224094", "0.52224094", "0.52224094", "0.52224094", "0.52224094", "0.5218684", "0.5210612", "0.5209045", "0.5206265", "0.5206265", "0.52061564", "0.5205858", "0.52018714", "0.5200564" ]
0.0
-1
Call f for all linked documents.
function linkedDocs(doc, f, sharedHistOnly) { function propagate(doc, skip, sharedHist) { if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) { var rel = doc.linked[i]; if (rel.doc == skip) { continue } var shared = sharedHist && rel.sharedHist; if (sharedHistOnly && !shared) { continue } f(rel.doc, shared); propagate(rel.doc, doc, shared); } } } propagate(doc, null, true); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function linkedDocs(doc, f, sharedHistOnly) {\r\n function propagate(doc, skip, sharedHist) {\r\n if (doc.linked) for (var i = 0; i < doc.linked.length; ++i) {\r\n var rel = doc.linked[i];\r\n if (rel.doc == skip) continue;\r\n var shared = sharedHist && rel.sharedHist;\r\n if (sharedHistOnly && !shared) continue;\r\n f(rel.doc, shared);\r\n propagate(rel.doc, doc, shared);\r\n }\r\n }\r\n propagate(doc, null, true);\r\n }", "function linkedDocs(doc, f, sharedHistOnly) {\n function propagate(doc, skip, sharedHist) {\n if (doc.linked) for (var i = 0; i < doc.linked.length; ++i) {\n var rel = doc.linked[i];\n if (rel.doc == skip) continue;\n var shared = sharedHist && rel.sharedHist;\n if (sharedHistOnly && !shared) continue;\n f(rel.doc, shared);\n propagate(rel.doc, doc, shared);\n }\n }\n propagate(doc, null, true);\n }", "function linkedDocs(doc, f, sharedHistOnly) {\n function propagate(doc, skip, sharedHist) {\n if (doc.linked) for (var i = 0; i < doc.linked.length; ++i) {\n var rel = doc.linked[i];\n if (rel.doc == skip) continue;\n var shared = sharedHist && rel.sharedHist;\n if (sharedHistOnly && !shared) continue;\n f(rel.doc, shared);\n propagate(rel.doc, doc, shared);\n }\n }\n propagate(doc, null, true);\n }", "function linkedDocs(doc, f, sharedHistOnly) {\n function propagate(doc, skip, sharedHist) {\n if (doc.linked) for (var i = 0; i < doc.linked.length; ++i) {\n var rel = doc.linked[i];\n if (rel.doc == skip) continue;\n var shared = sharedHist && rel.sharedHist;\n if (sharedHistOnly && !shared) continue;\n f(rel.doc, shared);\n propagate(rel.doc, doc, shared);\n }\n }\n propagate(doc, null, true);\n }", "function linkedDocs(doc, f, sharedHistOnly) {\n function propagate(doc, skip, sharedHist) {\n if (doc.linked) for (var i = 0; i < doc.linked.length; ++i) {\n var rel = doc.linked[i];\n if (rel.doc == skip) continue;\n var shared = sharedHist && rel.sharedHist;\n if (sharedHistOnly && !shared) continue;\n f(rel.doc, shared);\n propagate(rel.doc, doc, shared);\n }\n }\n propagate(doc, null, true);\n }", "function linkedDocs(doc, f, sharedHistOnly) {\n function propagate(doc, skip, sharedHist) {\n if (doc.linked) for (var i = 0; i < doc.linked.length; ++i) {\n var rel = doc.linked[i];\n if (rel.doc == skip) continue;\n var shared = sharedHist && rel.sharedHist;\n if (sharedHistOnly && !shared) continue;\n f(rel.doc, shared);\n propagate(rel.doc, doc, shared);\n }\n }\n propagate(doc, null, true);\n }", "function linkedDocs(doc, f, sharedHistOnly) {\n function propagate(doc, skip, sharedHist) {\n if (doc.linked) for (var i = 0; i < doc.linked.length; ++i) {\n var rel = doc.linked[i];\n if (rel.doc == skip) continue;\n var shared = sharedHist && rel.sharedHist;\n if (sharedHistOnly && !shared) continue;\n f(rel.doc, shared);\n propagate(rel.doc, doc, shared);\n }\n }\n propagate(doc, null, true);\n }", "function linkedDocs(doc, f, sharedHistOnly) {\n function propagate(doc, skip, sharedHist) {\n if (doc.linked) for (var i = 0; i < doc.linked.length; ++i) {\n var rel = doc.linked[i];\n if (rel.doc == skip) continue;\n var shared = sharedHist && rel.sharedHist;\n if (sharedHistOnly && !shared) continue;\n f(rel.doc, shared);\n propagate(rel.doc, doc, shared);\n }\n }\n propagate(doc, null, true);\n }", "function linkedDocs(doc, f, sharedHistOnly) {\n\t function propagate(doc, skip, sharedHist) {\n\t if (doc.linked) for (var i = 0; i < doc.linked.length; ++i) {\n\t var rel = doc.linked[i];\n\t if (rel.doc == skip) continue;\n\t var shared = sharedHist && rel.sharedHist;\n\t if (sharedHistOnly && !shared) continue;\n\t f(rel.doc, shared);\n\t propagate(rel.doc, doc, shared);\n\t }\n\t }\n\t propagate(doc, null, true);\n\t }", "function linkedDocs(doc, f, sharedHistOnly) {\n\t function propagate(doc, skip, sharedHist) {\n\t if (doc.linked) for (var i = 0; i < doc.linked.length; ++i) {\n\t var rel = doc.linked[i];\n\t if (rel.doc == skip) continue;\n\t var shared = sharedHist && rel.sharedHist;\n\t if (sharedHistOnly && !shared) continue;\n\t f(rel.doc, shared);\n\t propagate(rel.doc, doc, shared);\n\t }\n\t }\n\t propagate(doc, null, true);\n\t }", "function linkedDocs(doc, f, sharedHistOnly) {\n\t function propagate(doc, skip, sharedHist) {\n\t if (doc.linked) for (var i = 0; i < doc.linked.length; ++i) {\n\t var rel = doc.linked[i];\n\t if (rel.doc == skip) continue;\n\t var shared = sharedHist && rel.sharedHist;\n\t if (sharedHistOnly && !shared) continue;\n\t f(rel.doc, shared);\n\t propagate(rel.doc, doc, shared);\n\t }\n\t }\n\t propagate(doc, null, true);\n\t }", "function linkedDocs(doc, f, sharedHistOnly) {\n\t\t function propagate(doc, skip, sharedHist) {\n\t\t if (doc.linked) for (var i = 0; i < doc.linked.length; ++i) {\n\t\t var rel = doc.linked[i];\n\t\t if (rel.doc == skip) continue;\n\t\t var shared = sharedHist && rel.sharedHist;\n\t\t if (sharedHistOnly && !shared) continue;\n\t\t f(rel.doc, shared);\n\t\t propagate(rel.doc, doc, shared);\n\t\t }\n\t\t }\n\t\t propagate(doc, null, true);\n\t\t }", "function linkedDocs(doc, f, sharedHistOnly) {\r\n function propagate(doc, skip, sharedHist) {\r\n if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) {\r\n var rel = doc.linked[i];\r\n if (rel.doc == skip) { continue }\r\n var shared = sharedHist && rel.sharedHist;\r\n if (sharedHistOnly && !shared) { continue }\r\n f(rel.doc, shared);\r\n propagate(rel.doc, doc, shared);\r\n } }\r\n }\r\n propagate(doc, null, true);\r\n}", "function linkedDocs(doc, f, sharedHistOnly) {\n\t\t function propagate(doc, skip, sharedHist) {\n\t\t if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) {\n\t\t var rel = doc.linked[i];\n\t\t if (rel.doc == skip) { continue }\n\t\t var shared = sharedHist && rel.sharedHist;\n\t\t if (sharedHistOnly && !shared) { continue }\n\t\t f(rel.doc, shared);\n\t\t propagate(rel.doc, doc, shared);\n\t\t } }\n\t\t }\n\t\t propagate(doc, null, true);\n\t\t }", "function linkedDocs(doc, f, sharedHistOnly) {\n function propagate(doc, skip, sharedHist) {\n if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) {\n var rel = doc.linked[i];\n if (rel.doc == skip) { continue }\n var shared = sharedHist && rel.sharedHist;\n if (sharedHistOnly && !shared) { continue }\n f(rel.doc, shared);\n propagate(rel.doc, doc, shared);\n } }\n }\n propagate(doc, null, true);\n}", "function linkedDocs(doc, f, sharedHistOnly) {\n function propagate(doc, skip, sharedHist) {\n if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) {\n var rel = doc.linked[i];\n if (rel.doc == skip) { continue }\n var shared = sharedHist && rel.sharedHist;\n if (sharedHistOnly && !shared) { continue }\n f(rel.doc, shared);\n propagate(rel.doc, doc, shared);\n } }\n }\n propagate(doc, null, true);\n}", "function linkedDocs(doc, f, sharedHistOnly) {\n function propagate(doc, skip, sharedHist) {\n if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) {\n var rel = doc.linked[i];\n if (rel.doc == skip) { continue }\n var shared = sharedHist && rel.sharedHist;\n if (sharedHistOnly && !shared) { continue }\n f(rel.doc, shared);\n propagate(rel.doc, doc, shared);\n } }\n }\n propagate(doc, null, true);\n}", "function linkedDocs(doc, f, sharedHistOnly) {\n function propagate(doc, skip, sharedHist) {\n if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) {\n var rel = doc.linked[i];\n if (rel.doc == skip) { continue }\n var shared = sharedHist && rel.sharedHist;\n if (sharedHistOnly && !shared) { continue }\n f(rel.doc, shared);\n propagate(rel.doc, doc, shared);\n } }\n }\n propagate(doc, null, true);\n}", "function linkedDocs(doc, f, sharedHistOnly) {\n function propagate(doc, skip, sharedHist) {\n if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) {\n var rel = doc.linked[i];\n if (rel.doc == skip) { continue }\n var shared = sharedHist && rel.sharedHist;\n if (sharedHistOnly && !shared) { continue }\n f(rel.doc, shared);\n propagate(rel.doc, doc, shared);\n } }\n }\n propagate(doc, null, true);\n}", "function linkedDocs(doc, f, sharedHistOnly) {\n function propagate(doc, skip, sharedHist) {\n if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) {\n var rel = doc.linked[i];\n if (rel.doc == skip) { continue }\n var shared = sharedHist && rel.sharedHist;\n if (sharedHistOnly && !shared) { continue }\n f(rel.doc, shared);\n propagate(rel.doc, doc, shared);\n } }\n }\n propagate(doc, null, true);\n}", "function linkedDocs(doc, f, sharedHistOnly) {\n function propagate(doc, skip, sharedHist) {\n if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) {\n var rel = doc.linked[i];\n if (rel.doc == skip) { continue }\n var shared = sharedHist && rel.sharedHist;\n if (sharedHistOnly && !shared) { continue }\n f(rel.doc, shared);\n propagate(rel.doc, doc, shared);\n } }\n }\n propagate(doc, null, true);\n}", "function linkedDocs(doc, f, sharedHistOnly) {\n function propagate(doc, skip, sharedHist) {\n if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) {\n var rel = doc.linked[i];\n if (rel.doc == skip) { continue }\n var shared = sharedHist && rel.sharedHist;\n if (sharedHistOnly && !shared) { continue }\n f(rel.doc, shared);\n propagate(rel.doc, doc, shared);\n } }\n }\n propagate(doc, null, true);\n}", "function linkedDocs(doc, f, sharedHistOnly) {\n function propagate(doc, skip, sharedHist) {\n if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) {\n var rel = doc.linked[i];\n if (rel.doc == skip) { continue }\n var shared = sharedHist && rel.sharedHist;\n if (sharedHistOnly && !shared) { continue }\n f(rel.doc, shared);\n propagate(rel.doc, doc, shared);\n } }\n }\n propagate(doc, null, true);\n}", "function linkedDocs(doc, f, sharedHistOnly) {\n function propagate(doc, skip, sharedHist) {\n if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) {\n var rel = doc.linked[i];\n if (rel.doc == skip) { continue }\n var shared = sharedHist && rel.sharedHist;\n if (sharedHistOnly && !shared) { continue }\n f(rel.doc, shared);\n propagate(rel.doc, doc, shared);\n } }\n }\n propagate(doc, null, true);\n}", "function linkedDocs(doc, f, sharedHistOnly) {\n function propagate(doc, skip, sharedHist) {\n if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) {\n var rel = doc.linked[i];\n if (rel.doc == skip) { continue }\n var shared = sharedHist && rel.sharedHist;\n if (sharedHistOnly && !shared) { continue }\n f(rel.doc, shared);\n propagate(rel.doc, doc, shared);\n } }\n }\n propagate(doc, null, true);\n}", "function linkedDocs(doc, f, sharedHistOnly) {\n function propagate(doc, skip, sharedHist) {\n if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) {\n var rel = doc.linked[i]\n if (rel.doc == skip) { continue }\n var shared = sharedHist && rel.sharedHist\n if (sharedHistOnly && !shared) { continue }\n f(rel.doc, shared)\n propagate(rel.doc, doc, shared)\n } }\n }\n propagate(doc, null, true)\n}", "function linkedDocs(doc, f, sharedHistOnly) {\n function propagate(doc, skip, sharedHist) {\n if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) {\n var rel = doc.linked[i]\n if (rel.doc == skip) { continue }\n var shared = sharedHist && rel.sharedHist\n if (sharedHistOnly && !shared) { continue }\n f(rel.doc, shared)\n propagate(rel.doc, doc, shared)\n } }\n }\n propagate(doc, null, true)\n}", "function executeURLS() {\n\n for(var i = 0, len = documentsURL.length; i < len; i++) {\n (function () {\n var aux = i, endChecker = false;\n\n request(documentsURL[i], function (error, response, body) {\n if (!error) {\n if(aux === len - 1) {\n endChecker = true;\n }\n parseDocument(body, documentsURL[aux], endChecker);\n } else {\n console.log(error);\n }\n });\n })();\n }\n }", "forEach(f) {\n for (var i=0,l=this.count; i<l; i++) {\n f(this.get(i));\n }\n }", "forEach(f) {\n this.content.forEach(f);\n }", "function getLinkedDocs(links, more, cb) {\n\n // Make sure the linked array exists and the cLinked counter is initialized\n docs.forEach(function(doc) {\n doc.linked = doc.linked || []\n if (links.length) doc.cLinked = 0\n })\n\n // Short circuit query if no inputs\n if (!links.length) return cb()\n\n var linkedDocIds = []\n links.forEach(function(link) {\n linkedDocIds.push(dirTo ? link._to : link._from)\n })\n\n var linkedDocsSelector = _.assign({}, linkq.linkedFilter)\n _.assign(linkedDocsSelector, {_id: {$in: linkedDocIds}})\n\n read.optimizeSelector(linkedDocsSelector)\n\n // Whitelist some top-level query options that make sense for linked docs\n var linkedDocsOps = _.pick(_.cloneDeep(options), inheritedOptions)\n _.assign(linkedDocsOps, _.pick(linkq, ['refs', 'fields']))\n\n var findMethod = _.isString(linkedDocsSelector._id) ? 'safeFindOne' : 'safeFind'\n\n var timer = util.timer()\n db[clName][findMethod](linkedDocsSelector, linkedDocsOps, function(err, linkedDocs) {\n if (err) return finish(err)\n\n // Convert results to array if necessary\n // linkedDocs can be null if user lacks read permissions\n if (findMethod === 'safeFindOne') {\n linkedDocs = linkedDocs ? [linkedDocs] : []\n }\n\n // debug('linkedDocsSelector', linkedDocsSelector)\n // debug('linkedDocsOps', linkedDocsOps)\n // debug('linkedDocs', linkedDocs)\n\n logPerf(linkedDocsSelector, linkedDocs.length, timer.read())\n\n // Make a map of links by linkedDocId\n var linkMap = {}\n links.forEach(function(link) {\n var linkedDocId = dirTo ? link._to : link._from\n linkMap[linkedDocId] = link\n })\n\n // If the user chose a restricted link field set make sure _id is included\n var linkFields = null\n if (tipe.isObject(linkq.linkFields) && !_.isEmpty(linkq.linkFields)) {\n linkFields = _.union(['_id'], Object.keys(linkq.linkFields))\n }\n\n // If linkq.linkFields is set then graft in each link beneath\n // the linked document\n if (linkq.linkFields) {\n linkedDocs.forEach(function(linkedDoc) {\n var link = linkMap[linkedDoc._id]\n if (linkFields) link = _.pick(link, linkFields)\n linkedDoc.link = link\n })\n }\n\n // Recurse for nested linked queries\n if (linkq.linkCounts || linkq.links || linkq.linked) {\n var linkqOps = _.pick(_.cloneDeep(options), inheritedOptions)\n _.assign(linkqOps, _.pick(linkq, ['linkCounts', 'links', 'linked']))\n return get(collection, linkedDocs, linkqOps, graftLinked)\n }\n\n graftLinked(null, linkedDocs)\n\n function graftLinked(err, linkedDocs) {\n if (err) return cb(err)\n\n var linkedDocMap = {}\n linkedDocs.forEach(function(linkedDoc) {\n linkedDocMap[linkedDoc._id] = linkedDoc\n })\n\n links.forEach(function(link) {\n var docId = dirTo ? link._from : link._to\n var linkedDocId = dirTo ? link._to : link._from\n var doc = docMap[docId]\n var linkedDoc = linkedDocMap[linkedDocId]\n if (linkedDoc) {\n if (doc.cLinked < linkq.limit) {\n doc.linked.push(linkedDoc)\n doc.cLinked++\n }\n else {\n doc.moreLinked = true\n return\n }\n }\n })\n\n // more was passed in by getLinks for singleton parent doc\n if (singleParent && docs.length === 1 && more) docs[0].moreLinked = true\n\n // Remove the internal linked counter per query per doc\n docs.forEach(function(doc) {\n delete doc.cLinked\n })\n\n cb()\n } // pushLinked\n }) // db.cl.findLinked\n } // getLinkedDocs", "function remplirLesDonnees(data) {\n lesDocuments = data.lesDocuments;\n for (const documents of lesDocuments){\n afficherDocument(documents)\n }\n}", "function fillDocuments(sameDocuments, callback) {\n\n\t\t\t\t\t\tif (sameDocuments && callback) {\n\n\t\t\t\t\t\t\tcallback();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tvar data = {\n\t\t\t\t\t\t\tnodes : $scope.graph.nodes\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tMyFamilyService\n\t\t\t\t\t\t\t\t.getViewDocuments($scope.graph.user.id, data)\n\t\t\t\t\t\t\t\t.then(\n\t\t\t\t\t\t\t\t\t\tfunction(resultData) {\n\n\t\t\t\t\t\t\t\t\t\t\t$scope.graph.documents = [];\n\t\t\t\t\t\t\t\t\t\t\t$scope.graph.taggedNodes = [];\n\n\t\t\t\t\t\t\t\t\t\t\tfor (docIndex in resultData.documents) {\n\n\t\t\t\t\t\t\t\t\t\t\t\tvar doc = resultData.documents[docIndex];\n\t\t\t\t\t\t\t\t\t\t\t\tfound = false;\n\n\t\t\t\t\t\t\t\t\t\t\t\tfor (forbiddenDocIndex in $scope.graph.blacklist.forbiddenDocuments) {\n\n\t\t\t\t\t\t\t\t\t\t\t\t\tvar forbiddenDoc = $scope.graph.blacklist.forbiddenDocuments[forbiddenDocIndex];\n\t\t\t\t\t\t\t\t\t\t\t\t\tif (doc.id == forbiddenDoc.id) {\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\t\tif (!found) {\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t$scope.graph.documents\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.push(doc);\n\n\t\t\t\t\t\t\t\t\t\t\t\t\tvar taggedNodesIds = doc.taggedNodes\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.map(function(n) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn n.id;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\t\t\t\t\t\tfor (taggedNodeIndex in taggedNodesIds) {\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar taggedNodeId = taggedNodesIds[taggedNodeIndex];\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif ($scope.graph.taggedNodes\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.indexOf(taggedNodeId) == -1) {\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$scope.graph.taggedNodes\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.push(taggedNodeId);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\tif (callback) {\n\t\t\t\t\t\t\t\t\t\t\t\tcallback();\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t}", "function forEachMatch(path, f) {\r\n\tvar matches = document.evaluate(\r\n\t\tpath, document, null,\r\n\t\tXPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);\r\n\tfor (var i = 0; i < matches.snapshotLength; i++)\r\n\t\tf(matches.snapshotItem(i));\r\n}", "function iterateFunc(doc){cov_20g0dos6ux().f[0]++;cov_20g0dos6ux().s[9]++;console.log(JSON.stringify(doc,null,4));}", "function processLinks() {\n $(document).find('*').each(function () {\n var localName = $(this)[0].localName;\n if (localName.startsWith(\"link-\")) {\n\n var parts = localName.split(\"-\");\n var txt = $(this).text() || parts[1];\n\n $(this).empty();\n $(this).append('<a href=\"#\" onclick=\"$(\\'#list-' + parts[1] + '-list\\').click()\">' + txt + '</a>');\n }\n })\n}", "link() {\n this._participations = this._sbolDocument.lookupURIs(this._participations);\n }", "function processDocuments(log, config, job, documentList, callback) {\n let metastampRecords = [];\n let icn = idUtil.extractIcnFromPid(job.patientIdentifier.value, config);\n let jobsToPublish = [];\n\n log.debug('vler-das-doc-retrieve-handler.processDocuments: entered method');\n async.eachSeries(documentList, function(document, asyncCallback) {\n //decode xml from Base 64\n let documentContent = _.first(_.get(document, 'content'));\n let xmlDoc = Buffer.from(_.get(documentContent, 'attachment.Data') || '', 'base64').toString();\n\n determineKind(log, xmlDoc, function(kind) {\n if (kind === 'unsupportedFormat') {\n log.debug('vler-das-doc-retrieve-handler.processDocuments: ignoring document that is in unsupported format');\n return asyncCallback();\n }\n\n let record = {\n xmlDoc: xmlDoc,\n kind: kind,\n resource: _.get(document, 'resource'),\n pid: job.patientIdentifier.value,\n uid: uidUtils.getUidForDomain('vlerdocument', 'VLER', icn, uuid.v4())\n };\n metastampRecords.push(record);\n\n // Create meta object for job information for all new VlerDasXformVpr jobs.\n // This shouldn't contain a jobId, as the jobUtil will create one for us.\n let meta = {\n jpid: job.jpid,\n rootJobId: job.rootJobId,\n priority: job.priority\n };\n\n if (job.referenceInfo) {\n meta.referenceInfo = job.referenceInfo;\n }\n\n jobsToPublish.push(jobUtil.createVlerDasXformVpr(job.patientIdentifier, record, job.requestStampTime, meta));\n asyncCallback();\n });\n }, function() {\n //create metastamp\n let domainMetastamp = metastampUtils.metastampDomain({\n data: {\n items: metastampRecords\n }\n }, job.requestStampTime, null);\n\n log.debug('vler-das-doc-retrieve-handler.processDocuments: completed');\n callback(domainMetastamp, jobsToPublish);\n });\n}", "link () {\n\t this._attachments = this._sbolDocument.lookupURIs(this._attachments);\n\t this._wasGeneratedBys = this._sbolDocument.lookupURIs(this._wasGeneratedBys);\n\t}", "openDocuments() {\n if (this.thread) {\n this.thread.open();\n } else {\n this._openDocuments();\n }\n }", "function syncDocs() {\n\tfor (var x = 0; x < contextDocs.length; x++) {\n\t\t//IIFE - anon function will be called on each iteration of the for loop\n\t\t// we pass in the value of for loop x as index within the anon funct \n\t\t(function(index){\n\t\t\t//we copy the contents of the JSON objects specified above into the temp var doc here\n\t\t\tvar doc = JSON.parse(JSON.stringify(contextDocs[index]));\n\t\t\t//retreive the doc from couch db\n\t\t\tdb.get(doc['_id'], function(err, body){\n\t\t\t\tif(!err){\n\t\t\t\t\t//if OK, set/create temp doc \"_rev\" field to match current db rev\n\t\t\t\t\tdoc['_rev'] = body['_rev'];\n\t\t\t\t\t//write the doc\n\t\t\t\t\tdb.insert(doc, function(err, body){\n\t\t\t\t\t\tconsole.log(body);\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\t// if the db.get fails\n\t\t\t\t\tconsole.log(err);\n\t\t\t\t}\n\t\t\t\t//console.log(\"doc id is \"+doc['_id']+\" and doc rev is set to \"+doc['_rev']);\n\t\t\t})\n\t\t})(x); // we send the for loop iterator x to the (IIFE) anon function above, where it is defined as 'index' \n\t\t\t // see IIFE links above\n\t}\n}", "forEach(f) {\n for (let i = 0, p = 0; i < this.content.length; i++) {\n let child = this.content[i];\n f(child, p, i);\n p += child.nodeSize;\n }\n }", "function forEachMatch(path, f, root) {\r\n\tvar el;\r\n\tvar root = (root == null) ? document : root;\r\n\tvar matches = root.evaluate(\r\n\t\tpath, root, null,\r\n\t\tXPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);\r\n\tfor (var i = 0; el=matches.snapshotItem(i); i++)\r\n\t\tf(el);\r\n}", "function main() {\n var files = fs.readdirSync(DOC_DIR);\n files.forEach(fileIterator);\n }", "function documentCallback(document, index, documents, context){\t\n\t\t\t$$('*', null, document).each(function (item, index, items){\t\n\t\t\t\tif((! item.linkageExportForAS) || (! item.linkageClassName)) return;\n\t\t\t\tvar duplicateObject = {document: context.dom, item: item};\n\n\t\t\t\tif(linkageNames[item.linkageClassName]){\n\t\t\t\t\tif(! (item.linkageClassName in duplicateLinkageName)){\n\t\t\t\t\t\tduplicateLinkageName[item.linkageClassName] = {duplicates:[linkageNames[item.linkageClassName]], linkageName: item.linkageClassName};\n\t\t\t\t\t}\n\t\t\t\t\tduplicateLinkageName[item.linkageClassName].duplicates.push(duplicateObject);\n\t\t\t\t}\n\t\t\t\tlinkageNames[item.linkageClassName] = duplicateObject;\n\t\t\t});\n\t\t}", "function setDocuments() {\n var divDoc = document.getElementById(\"documents\");\n for (var i = 0; i < docs.length; i++)\n divDoc.innerHTML += \"<ul><a href=\\'\" + docs[i][0] + \"\\'>\" + docs[i][1] + \"</a></ul>\";\n}", "refersTo() {\n //calculate links\n this.compute('coreference')\n // return them\n return this.map(m => {\n if (!m.found) {\n return m.none()\n }\n let term = m.docs[0][0]\n if (term.reference) {\n return m.update([term.reference])\n }\n return m.none()\n })\n }", "link() {\n this._definition = this._sbolDocument.lookupURI(this._definition);\n this._mappings = this._sbolDocument.lookupURIs(this._mappings);\n }", "link() {\n this._definition = this._sbolDocument.lookupURI(this._definition);\n this._mappings = this._sbolDocument.lookupURIs(this._mappings);\n }", "link() {\n this._definition = this._sbolDocument.lookupURI(this._definition);\n this._mappings = this._sbolDocument.lookupURIs(this._mappings);\n }", "function loadAllMdownDocs(doc, anchor){\n\n\t\tvar promises = [];\n\n\t\t$.each(arrDocNames, function(i, name){\n\t\t\tpromises.push(\n\t\t\t\tnew Promise(function (resolve, reject) {\n\t\t\t\t\t\t $.get(\"./markdown/\" + name + \".md\")\n\t\t\t\t\t\t\t .done(function (value) {resolve({value:value, name:name})})\n\t\t\t\t\t\t\t .fail(function () {reject(\"The document loading failed. Check the elements in the array arrDocNames[]\")});\n\t\t\t\t }\n\t\t\t));\n\t\t\t} //function\n\t\t); //each\n\n\t\tPromise.all(promises).then(function (array) {\n\t\t\tarrDocs = array.map(function (item) {\n\t\t\t\treturn {\n\t\t\t\t\tname: item.name,\n\t\t\t\t\ttitle: item.value.substring(item.value.indexOf(\"#\",0)+2,item.value.indexOf(\"\\n\",0)).trim(),\n\t\t\t\t\tcontent: item.value\n\t\t\t\t}\n\t\t\t});\n\t\t\tif(doc != null) loadMdDoc(doc, ['btnMenu','btnEditarDoc','btnToc','btnOpt'], anchor, null);\n\n // array to be used in the find functionality\n reformatedArrDocs = arrDocs.map(\n function(doc){\n var rDoc = {name:\"\",content:\"\",title:\"\"};\n rDoc.name = doc.name;\n rDoc.title = doc.title;\n // removes some markdown and HTML sintax\n rDoc.content = doc.content.replace(/!\\[(.*?)\\)|(#{1,} )|(\\*{2})|(\\_{2})|(\\|:-*)\\||(:-{2,})|(<div .*>)|(<\\/div>)|(<iframe .*>)|(<\\/iframe>)|(<button .*>)|(<\\/button>)/g,'');\n return rDoc;\n }\n );\n\n\t\t})\n} //function", "link() {\n\t\t// Call super link to link members of Top Level (Identified)\n\t\tsuper.link();\n\t\t\n this._built = this._sbolDocument.lookupURI(this._built);\t\t\n }", "iterChanges(f, individual = false) {\n iterChanges(this, f, individual);\n }", "function listAll$1(ref) {\n return listAll(ref);\n}", "function each(f, xs) {\n var ys = seq$a(xs);\n\n while (ys) {\n f(first$d(ys));\n ys = next$a(ys);\n }\n }", "forAllObjects (fcn, obj = {}) {\n for (var i = 0, len = this.length; i < len; i++) {\n this.getObject(i, obj)\n fcn(obj, i)\n }\n }", "function iterateLocal(intr_config) {\n backupDocument.local.doc.push(intr_config.doc);\n }", "link() {\n\t\t// Call super link to link members of Top Level (Identified)\n\t\tsuper.link();\n\n this._modules = this._sbolDocument.lookupURIs(this._modules);\n this._functionalComponents = this._sbolDocument.lookupURIs(this._functionalComponents);\n this._interactions = this._sbolDocument.lookupURIs(this._interactions);\n this._models = this._sbolDocument.lookupURIs(this._models);\n }", "function loadChaplainDocs() {\n\t$(\"#chaplain-docs\").append(\"<p>Loading results for \" + $(\"#chaplain-name\").text() + \"</p>\");\n\tvar displayObjects = [];\n\tvar i = 0;\n\twhile (i < 20) {\n\t\tajaxCall($(\"#chaplain-name\").text(), i + 1, displayObjects);\n\t\ti++;\n\t}\n}", "function FreeTextDocumentationView() {\r\n}", "function FileRefList(theDocURL) {\r this.docURL = theDocURL;\r this.list = new Array();\r}", "_runWhenAllServerDocsAreFlushed(f) {\n var self = this;\n\n var runFAfterUpdates = () => {\n self._afterUpdateCallbacks.push(f);\n };\n\n var unflushedServerDocCount = 0;\n\n var onServerDocFlush = () => {\n --unflushedServerDocCount;\n\n if (unflushedServerDocCount === 0) {\n // This was the last doc to flush! Arrange to run f after the updates\n // have been applied.\n runFAfterUpdates();\n }\n };\n\n keys(self._serverDocuments).forEach((collection) => {\n self._serverDocuments[collection].forEach((serverDoc) => {\n const writtenByStubForAMethodWithSentMessage = keys(\n serverDoc.writtenByStubs\n ).some((methodId) => {\n var invoker = self._methodInvokers[methodId];\n return invoker && invoker.sentMessage;\n });\n\n if (writtenByStubForAMethodWithSentMessage) {\n ++unflushedServerDocCount;\n serverDoc.flushCallbacks.push(onServerDocFlush);\n }\n });\n });\n\n if (unflushedServerDocCount === 0) {\n // There aren't any buffered docs --- we can call f as soon as the current\n // round of updates is applied!\n runFAfterUpdates();\n }\n }", "function execute(document) {\n\t\tlet thisDomain = location.protocol + '//' + location.hostname + '/';\n\t\tArray.from(document.querySelectorAll('a[href]:not([href^=\"/\"]):not([href^=\"' + thisDomain + '\"])')).forEach(a => {\n\t\t\tlet newA = document.createElementNS('http://www.w3.org/1999/xhtml', 'a');\n\t\t\tnewA.href = a.href;\n\t\t\tnewA.setAttribute('class', a.getAttribute('class'));\n\t\t\tnewA.innerHTML = a.innerHTML;\n\t\t\ta.replaceWith(newA);\n\t\t\tconsole.log('relink: Replaced', a, 'with', newA);\n\t\t});\n\n\t\t/* Recurse for (i)frames. */\n\t\ttry {\n\t\t\tArray.from(document.querySelectorAll('frame, iframe, object[type^=\"text/html\"], object[type^=\"application/xhtml+xml\"]')).forEach(\n\t\t\t\telem => { try { execute(elem.contentDocument) } catch (e) { } }\n\t\t\t);\n\t\t} catch (e) {\n\t\t\t/* Catch and ignore exceptions for out-of-domain access. */\n\t\t}\n\t}", "function each(coll, f) {\n if (Array.isArray(coll)) {\n for (var i = 0; i < coll.length; i++) {\n f(coll[i], i);\n }\n } else {\n for (var key in coll) {\n f(coll[key], key);\n }\n }\n }", "function ReceiveUpdate(doc) {\n myDoc = doc;\n for (i = 0; i < functionQueue.length; i++) {\n var t = functionQueue[i];\n t[0](myDoc, t[1]);\n }\n Render(doc);\n}", "static async all(directory) {\n\n\t\tlet path = `${config.api}/directories/${directory}/documents`;\n\n\t\ttry {\n\n\t\t\tlet response = await fetch(path, {headers: store.state.auth.authHeader()});\n\n\t\t\t// if the api responds with a 404 we'll display a special\n\t\t\t// error page so handle that separately\n\t\t\tif (response.status == 404) {\n\t\t\t\tconsole.warn(`directory ${directory} not found`);\n\t\t\t\tstore.state.documents = null;\n\t\t\t\treturn;\n\t\t\t} else if (!checkResponse(response.status)) {\n\t\t\t\t// something more serious has happend, abort!\n\t\t\t\tthrow(response);\n\t\t\t};\n\n\t\t\tlet json = await response.json();\n\n\t\t\t// if we have the metadata, set up the ActiveDirectory\n\t\t\tif (json.info) {\n\t\t\t\tlet dir = new CMSDirectory(\n\t\t\t\t\tdirectory,\n\t\t\t\t\tjson.info.title,\n\t\t\t\t\tjson.info.description,\n\t\t\t\t\tjson.info.body,\n\t\t\t\t\tjson.info.html\n\t\t\t\t);\n\t\t\t\tstore.commit(\"setActiveDirectory\", dir);\n\t\t\t};\n\n\t\t\t// map documents\n\t\t\tlet docs = json.files.map((file) => {\n\t\t\t\treturn new CMSFile(file);\n\t\t\t});\n\n\t\t\tstore.state.documents = docs;\n\t\t\treturn response;\n\n\t\t}\n\t\tcatch(err) {\n\t\t\tconsole.error(`Couldn't retrieve files from directory ${directory}`);\n\t\t};\n\n\t}", "function each(coll,f){\n\t\tif(Array.isArray(coll)){\n\t\t\tfor (var i = 0; i <coll.length; i++) {\n\t\t\t\tf(coll[i],i)\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\tfor(var key in coll){\n\t\t\t\tf(coll[key],key)\n\t\t\t}\n\t\t}\n\t}", "async updateAllLinks() {\n await this.db.transaction('rw', this.db.files, this.db.links, () => {\n this.db.files.where(\"type\").equals(\"file\").each((file) => {\n this.addLinks(file) \n })\n })\n console.log('updateAllLinks() finished.')\n }", "function forEach(iter, f) {\n if (iter.next) {\n try {while (true) {f(iter.next());}}\n catch (e) {if (e != StopIteration) {throw e;}}\n }\n else {\n for (var i = 0; i < iter.length; i++) {\n f(iter[i]);\n }\n }\n}", "function loadDocumentation(loadedCallback) {\n $.getJSON(API_PATH, function (jsonDoc) {\n var documentationArray = [];\n for (var i = 0; i < jsonDoc.length; i++) {\n documentationArray.push(new Documentation(jsonDoc[i]));\n }\n loadedCallback(documentationArray);\n });\n}", "function fetchDocuments(_param, _callback){\n var data = {\n start : parseInt(_param.start,10) || 0,\n cat : _param.cat,\n num : parseInt(_param.num,10) || PAGESIZE\n };\n\n $.ajax({\n url: DOCUMENTS_URL + _param.cat + '/',\n data: data,\n success: function(_res){\n if(_callback){\n _callback(_res);\n }\n },\n error: function(){\n \n }\n });\n }", "_eachPossiblyMatchingDoc(selector, fn) {\n const specificIds = LocalCollection._idsMatchedBySelector(selector);\n\n if (specificIds) {\n specificIds.some(id => {\n const doc = this._docs.get(id);\n\n if (doc) {\n return fn(doc, id) === false;\n }\n });\n } else {\n this._docs.forEach(fn);\n }\n }", "iterChangedRanges(f, individual = false) {\n iterChanges(this, f, individual);\n }", "function get_docs(name, server_name)\n{\n if (name != 'leer') {\n var w = window.open();\n w.location = server_name + '/docs/' + name;\n }\n}", "function withQuery(parent, query, f) {\n const els = selectAll(parent, query);\n for (let i = 0; i < els.length; i++) {\n f(els[i]);\n }\n }", "function nodeLoop(fn, nodes) {\n\t\tvar i;\n\t\t// Good idea to walk up the DOM\n\t\tfor (i = nodes.length - 1; i >= 0; i -= 1) {\n\t\t\tfn(nodes[i]);\n\t\t}\n\t}", "function each(coll, f) {\n if (Array.isArray(coll)) {\n for (var i = 0; i < coll.length; i++) {\n f(coll[i], i);\n }\n } else {\n for (var key in coll) {\n f(coll[key], key);\n }\n }\n}", "function renderPages(doc) {\n const pagePromises = [];\n // 1-based indexing >_>\n for(var p = 1; p <= doc.numPages; p++) {\n console.log(p);\n pagePromises.push(doc.getPage(p));\n //doc.getPage(p).then(renderPage);\n }\n console.log(pagePromises);\n Promise.all(pagePromises).then(function(resultsArr) {\n for(var i = 0; i < resultsArr.length; i++)\n renderPage(resultsArr[i]);\n });\n }", "function each(coll, f) { \r\n\tif (Array.isArray(coll)) { \r\n\t\t for (var i = 0; i < coll.length; i++) { \r\n\t\t\t\tf(coll[i], i); \r\n\t\t } \r\n\t} else { \r\n\t\t for (var key in coll) { \r\n\t\t\t\tf(coll[key], key); \r\n\t\t } \r\n\t} \r\n}", "function getLinks(updateDocs){\n\n\tvar workersIds = visualizedWorkerId.join(\",\");\n\tvar docId = visualizedDocId.join(\",\");\n\tvar keyWords = visualizedKeywords.join(\",\");\n\tvar removedWords = deletedKeywords.join(\",\");\n\t\n\tif(workersIds.length == 0){\n\t\tworkersIds = [\"null\"];\n\t}\n\tif(docId.length == 0){\n\t\tdocId = [\"null\"];\n\t}\n\tif(keyWords.length == 0){\n\t\tkeyWords = [\"null\"];\n\t}\n\tif(removedWords.length == 0){\n\t\tremovedWords = [\"null\"];\n\t}\n\t\n\t$.getJSON(\"/users/getLinks/\"+workersIds+\"/\"+docId+\"/\"+keyWords+\"/\"+removedWords,function(data){\n\t\tdrawNewGraphs(data,updateDocs);\t\t\n\t});\n\n\tdeletedKeywords = [];\n}", "function renderFileLinks() {\n //Get all XML files\n let xmlFiles;\n fs.readdir('./data', (err, files)=>{\n console.log(files);\n xmlFiles = files;\n //Map through files and create html link\n let count = 1;\n xmlFiles.map(file =>{\n let xmlFile = document.createElement('a');\n xmlFile.className = \"xml-link\"\n xmlFile.innerText = count++;\n xmlFile.addEventListener('click', function(){\n convertedDiv.innerText = \"\";\n convertedDiv.className = \"\";\n\n //Loading indicator\n let loaderDiv = document.createElement('div');\n loaderDiv.id = \"loader\";\n convertedDiv.appendChild(loaderDiv);\n //Load the xml file to be converted\n loadXML(`data/${file}`);\n });\n document.getElementById('links').appendChild(xmlFile);\n })\n })\n}", "adoptedCallback(oldDocument, newDocument) {\r\n console.log(`adoptedCallback ${oldDocument} ${newDocument}`)\r\n }", "function ajaxMultiDoc(){\n\t$.ajax({\n\t\ttype: \"GET\",\n\t\turl: ITOP_WS_URL,\n\t\tdataType: 'jsonp',\n\t\tdata: { auth_user: login, auth_pwd: pwd, json_data: JSON.stringify(oJSON)},\n\t\tcrossDomain: 'true',\n\t\tsuccess: function (data){\n\t\t\trefreshSuccessfullDocCo(data);\n\t\t},\n\t\terror: function (data) {\n\t\t\tdocument.getElementById(\"backlogHardisListId\").innerHTML = \"Erreur. Connectez-vous sur iTop\";\n\t\t\t\t\t\t\n\t\t}\n\t});\n}", "function allHtmlFn(){\n\tcompileAllPugFiles(pugDocDitectory);\n}" ]
[ "0.72876906", "0.7267145", "0.7267145", "0.7267145", "0.7267145", "0.7267145", "0.7267145", "0.7267145", "0.72423947", "0.72423947", "0.72423947", "0.7223533", "0.72208107", "0.71978104", "0.716727", "0.716727", "0.716727", "0.716727", "0.716727", "0.716727", "0.716727", "0.716727", "0.716727", "0.716727", "0.716727", "0.71554935", "0.71554935", "0.5667148", "0.54490143", "0.537777", "0.5363562", "0.5322677", "0.5283984", "0.5212902", "0.5165658", "0.50720835", "0.503762", "0.5030296", "0.49997303", "0.49851578", "0.4971977", "0.4968565", "0.49664754", "0.49611422", "0.49182853", "0.49040502", "0.49007896", "0.4897554", "0.4897554", "0.4897554", "0.4865534", "0.4852748", "0.4849873", "0.48228484", "0.481402", "0.48139438", "0.47790807", "0.47701156", "0.47647187", "0.47534567", "0.47091302", "0.4707325", "0.46823466", "0.46792367", "0.46771312", "0.46592507", "0.46482447", "0.4643567", "0.46421483", "0.46407592", "0.4632508", "0.46298322", "0.46232834", "0.46177652", "0.46047935", "0.4603123", "0.45983958", "0.4598311", "0.45938104", "0.4583336", "0.4578456", "0.45780614", "0.4574991", "0.45710918" ]
0.7237777
26
Attach a document to an editor.
function attachDoc(cm, doc) { if (doc.cm) { throw new Error("This document is already in use.") } cm.doc = doc; doc.cm = cm; estimateLineHeights(cm); loadMode(cm); setDirectionClass(cm); if (!cm.options.lineWrapping) { findMaxLine(cm); } cm.options.mode = doc.modeOption; regChange(cm); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function attachDoc(cm, doc) {\n\t\t if (doc.cm) throw new Error(\"This document is already in use.\");\n\t\t cm.doc = doc;\n\t\t doc.cm = cm;\n\t\t estimateLineHeights(cm);\n\t\t loadMode(cm);\n\t\t if (!cm.options.lineWrapping) findMaxLine(cm);\n\t\t cm.options.mode = doc.modeOption;\n\t\t regChange(cm);\n\t\t }", "function attachDoc(cm, doc) {\n\t\t if (doc.cm) { throw new Error(\"This document is already in use.\") }\n\t\t cm.doc = doc;\n\t\t doc.cm = cm;\n\t\t estimateLineHeights(cm);\n\t\t loadMode(cm);\n\t\t setDirectionClass(cm);\n\t\t cm.options.direction = doc.direction;\n\t\t if (!cm.options.lineWrapping) { findMaxLine(cm); }\n\t\t cm.options.mode = doc.modeOption;\n\t\t regChange(cm);\n\t\t }", "function attachDoc(cm, doc) {\n\t if (doc.cm) throw new Error(\"This document is already in use.\");\n\t cm.doc = doc;\n\t doc.cm = cm;\n\t estimateLineHeights(cm);\n\t loadMode(cm);\n\t if (!cm.options.lineWrapping) findMaxLine(cm);\n\t cm.options.mode = doc.modeOption;\n\t regChange(cm);\n\t }", "function attachDoc(cm, doc) {\n\t if (doc.cm) throw new Error(\"This document is already in use.\");\n\t cm.doc = doc;\n\t doc.cm = cm;\n\t estimateLineHeights(cm);\n\t loadMode(cm);\n\t if (!cm.options.lineWrapping) findMaxLine(cm);\n\t cm.options.mode = doc.modeOption;\n\t regChange(cm);\n\t }", "function attachDoc(cm, doc) {\n\t if (doc.cm) throw new Error(\"This document is already in use.\");\n\t cm.doc = doc;\n\t doc.cm = cm;\n\t estimateLineHeights(cm);\n\t loadMode(cm);\n\t if (!cm.options.lineWrapping) findMaxLine(cm);\n\t cm.options.mode = doc.modeOption;\n\t regChange(cm);\n\t }", "function attachDoc(cm, doc) {\r\n if (doc.cm) throw new Error(\"This document is already in use.\");\r\n cm.doc = doc;\r\n doc.cm = cm;\r\n estimateLineHeights(cm);\r\n loadMode(cm);\r\n if (!cm.options.lineWrapping) findMaxLine(cm);\r\n cm.options.mode = doc.modeOption;\r\n regChange(cm);\r\n }", "function attachDoc(cm, doc) {\n if (doc.cm) throw new Error(\"This document is already in use.\");\n cm.doc = doc;\n doc.cm = cm;\n estimateLineHeights(cm);\n loadMode(cm);\n if (!cm.options.lineWrapping) findMaxLine(cm);\n cm.options.mode = doc.modeOption;\n regChange(cm);\n }", "function attachDoc(cm, doc) {\n if (doc.cm) throw new Error(\"This document is already in use.\");\n cm.doc = doc;\n doc.cm = cm;\n estimateLineHeights(cm);\n loadMode(cm);\n if (!cm.options.lineWrapping) findMaxLine(cm);\n cm.options.mode = doc.modeOption;\n regChange(cm);\n }", "function attachDoc(cm, doc) {\n if (doc.cm) throw new Error(\"This document is already in use.\");\n cm.doc = doc;\n doc.cm = cm;\n estimateLineHeights(cm);\n loadMode(cm);\n if (!cm.options.lineWrapping) findMaxLine(cm);\n cm.options.mode = doc.modeOption;\n regChange(cm);\n }", "function attachDoc(cm, doc) {\n if (doc.cm) throw new Error(\"This document is already in use.\");\n cm.doc = doc;\n doc.cm = cm;\n estimateLineHeights(cm);\n loadMode(cm);\n if (!cm.options.lineWrapping) findMaxLine(cm);\n cm.options.mode = doc.modeOption;\n regChange(cm);\n }", "function attachDoc(cm, doc) {\n if (doc.cm) throw new Error(\"This document is already in use.\");\n cm.doc = doc;\n doc.cm = cm;\n estimateLineHeights(cm);\n loadMode(cm);\n if (!cm.options.lineWrapping) findMaxLine(cm);\n cm.options.mode = doc.modeOption;\n regChange(cm);\n }", "function attachDoc(cm, doc) {\n if (doc.cm) throw new Error(\"This document is already in use.\");\n cm.doc = doc;\n doc.cm = cm;\n estimateLineHeights(cm);\n loadMode(cm);\n if (!cm.options.lineWrapping) findMaxLine(cm);\n cm.options.mode = doc.modeOption;\n regChange(cm);\n }", "function attachDoc(cm, doc) {\n if (doc.cm) throw new Error(\"This document is already in use.\");\n cm.doc = doc;\n doc.cm = cm;\n estimateLineHeights(cm);\n loadMode(cm);\n if (!cm.options.lineWrapping) findMaxLine(cm);\n cm.options.mode = doc.modeOption;\n regChange(cm);\n }", "function attachDoc(cm, doc) {\n if (doc.cm) { throw new Error(\"This document is already in use.\") }\n cm.doc = doc;\n doc.cm = cm;\n estimateLineHeights(cm);\n loadMode(cm);\n setDirectionClass(cm);\n cm.options.direction = doc.direction;\n if (!cm.options.lineWrapping) { findMaxLine(cm); }\n cm.options.mode = doc.modeOption;\n regChange(cm);\n }", "function attachDoc(cm, doc) {\n if (doc.cm) { throw new Error(\"This document is already in use.\") }\n cm.doc = doc;\n doc.cm = cm;\n estimateLineHeights(cm);\n loadMode(cm);\n setDirectionClass(cm);\n cm.options.direction = doc.direction;\n if (!cm.options.lineWrapping) { findMaxLine(cm); }\n cm.options.mode = doc.modeOption;\n regChange(cm);\n }", "function attachDoc(cm, doc) {\n if (doc.cm) { throw new Error(\"This document is already in use.\") }\n cm.doc = doc;\n doc.cm = cm;\n estimateLineHeights(cm);\n loadMode(cm);\n setDirectionClass(cm);\n cm.options.direction = doc.direction;\n if (!cm.options.lineWrapping) { findMaxLine(cm); }\n cm.options.mode = doc.modeOption;\n regChange(cm);\n }", "function attachDoc(cm, doc) {\n if (doc.cm) { throw new Error(\"This document is already in use.\") }\n cm.doc = doc;\n doc.cm = cm;\n estimateLineHeights(cm);\n loadMode(cm);\n setDirectionClass(cm);\n if (!cm.options.lineWrapping) { findMaxLine(cm); }\n cm.options.mode = doc.modeOption;\n regChange(cm);\n}", "function attachDoc(cm, doc) {\n if (doc.cm) { throw new Error(\"This document is already in use.\") }\n cm.doc = doc;\n doc.cm = cm;\n estimateLineHeights(cm);\n loadMode(cm);\n setDirectionClass(cm);\n if (!cm.options.lineWrapping) { findMaxLine(cm); }\n cm.options.mode = doc.modeOption;\n regChange(cm);\n}", "function attachDoc(cm, doc) {\n if (doc.cm) { throw new Error(\"This document is already in use.\") }\n cm.doc = doc;\n doc.cm = cm;\n estimateLineHeights(cm);\n loadMode(cm);\n setDirectionClass(cm);\n if (!cm.options.lineWrapping) { findMaxLine(cm); }\n cm.options.mode = doc.modeOption;\n regChange(cm);\n}", "function attachDoc(cm, doc) {\n if (doc.cm) { throw new Error(\"This document is already in use.\") }\n cm.doc = doc;\n doc.cm = cm;\n estimateLineHeights(cm);\n loadMode(cm);\n setDirectionClass(cm);\n if (!cm.options.lineWrapping) { findMaxLine(cm); }\n cm.options.mode = doc.modeOption;\n regChange(cm);\n}", "function attachDoc(cm, doc) {\n if (doc.cm) { throw new Error(\"This document is already in use.\") }\n cm.doc = doc;\n doc.cm = cm;\n estimateLineHeights(cm);\n loadMode(cm);\n setDirectionClass(cm);\n if (!cm.options.lineWrapping) { findMaxLine(cm); }\n cm.options.mode = doc.modeOption;\n regChange(cm);\n}", "function attachDoc(cm, doc) {\n if (doc.cm) { throw new Error(\"This document is already in use.\") }\n cm.doc = doc;\n doc.cm = cm;\n estimateLineHeights(cm);\n loadMode(cm);\n setDirectionClass(cm);\n if (!cm.options.lineWrapping) { findMaxLine(cm); }\n cm.options.mode = doc.modeOption;\n regChange(cm);\n}", "function attachDoc(cm, doc) {\n if (doc.cm) { throw new Error(\"This document is already in use.\") }\n cm.doc = doc;\n doc.cm = cm;\n estimateLineHeights(cm);\n loadMode(cm);\n setDirectionClass(cm);\n if (!cm.options.lineWrapping) { findMaxLine(cm); }\n cm.options.mode = doc.modeOption;\n regChange(cm);\n}", "function attachDoc(cm, doc) {\n if (doc.cm) { throw new Error(\"This document is already in use.\") }\n cm.doc = doc;\n doc.cm = cm;\n estimateLineHeights(cm);\n loadMode(cm);\n setDirectionClass(cm);\n if (!cm.options.lineWrapping) { findMaxLine(cm); }\n cm.options.mode = doc.modeOption;\n regChange(cm);\n}", "function attachDoc(cm, doc) {\n if (doc.cm) { throw new Error(\"This document is already in use.\") }\n cm.doc = doc;\n doc.cm = cm;\n estimateLineHeights(cm);\n loadMode(cm);\n setDirectionClass(cm);\n if (!cm.options.lineWrapping) { findMaxLine(cm); }\n cm.options.mode = doc.modeOption;\n regChange(cm);\n}", "function attachDoc(cm, doc) {\n if (doc.cm) { throw new Error(\"This document is already in use.\") }\n cm.doc = doc;\n doc.cm = cm;\n estimateLineHeights(cm);\n loadMode(cm);\n setDirectionClass(cm);\n if (!cm.options.lineWrapping) { findMaxLine(cm); }\n cm.options.mode = doc.modeOption;\n regChange(cm);\n}", "function attachDoc(cm, doc) {\n if (doc.cm) { throw new Error(\"This document is already in use.\") }\n cm.doc = doc;\n doc.cm = cm;\n estimateLineHeights(cm);\n loadMode(cm);\n setDirectionClass(cm);\n if (!cm.options.lineWrapping) { findMaxLine(cm); }\n cm.options.mode = doc.modeOption;\n regChange(cm);\n}", "function attachDoc(cm, doc) {\r\n if (doc.cm) { throw new Error(\"This document is already in use.\") }\r\n cm.doc = doc;\r\n doc.cm = cm;\r\n estimateLineHeights(cm);\r\n loadMode(cm);\r\n setDirectionClass(cm);\r\n if (!cm.options.lineWrapping) { findMaxLine(cm); }\r\n cm.options.mode = doc.modeOption;\r\n regChange(cm);\r\n}", "function attachDoc(cm, doc) {\n if (doc.cm) { throw new Error(\"This document is already in use.\") }\n cm.doc = doc\n doc.cm = cm\n estimateLineHeights(cm)\n loadMode(cm)\n if (!cm.options.lineWrapping) { findMaxLine(cm) }\n cm.options.mode = doc.modeOption\n regChange(cm)\n}", "function attachDoc(cm, doc) {\n if (doc.cm) { throw new Error(\"This document is already in use.\") }\n cm.doc = doc\n doc.cm = cm\n estimateLineHeights(cm)\n loadMode(cm)\n setDirectionClass(cm)\n if (!cm.options.lineWrapping) { findMaxLine(cm) }\n cm.options.mode = doc.modeOption\n regChange(cm)\n}", "function attached() {\n\t/* jslint validthis:true */\n\tthis._editor = create( this, this.$.editor );\n} // end FUNCTION attached()", "function linker(scope){\n scope.cid = scope.cid || tinyMceService.getUniqueId() ;\n initEditor(scope, function(content){\n // We must update model, after any change made!\n scope.$apply(function(){scope.document = content;});\n });\n }", "function initialize(editor) {\r\n this.window = editor.getWindow();\r\n this.document = editor.getDocument();\r\n }", "function doOpenDocument() {\n var presenter = new mindmaps.OpenDocumentPresenter(eventBus,\n mindmapModel, new mindmaps.OpenDocumentView(), filePicker);\n presenter.go();\n }", "_onActiveEditorUpdated(type, editor) {\n this._designView = editor;\n }", "enterDocument() {\n this.decorateChildren();\n UpdatableComponent.superClass_.enterDocument.call(this);\n this.updateAfterRedraw();\n }", "insertText(editor, text) {\n editor.insertText(text);\n }", "insertText(editor, text) {\n editor.insertText(text);\n }", "function iisadvanceeditor_textarea_attach(elem){\n\tvar element=$(elem);\n\tif (elem.htmlarea==undefined) {\n\t\telem.htmlarea = function(){ element.htmlarea( {'size':300} );};\n\t\telem.htmlarea();\n\t}\n}", "updateEditor() {\n if (typeof this.engine !== 'undefined') {\n this.engine.process(this.editor.toJSON());\n }\n }", "function openNotesEditor(){\n Swal.fire({\n width: \"80%\",\n customClass: 'editor-swal-height',\n padding: '33px',\n html: \n '<div class=\"editor-container\">\\\n <textarea id=\"sunEditor\"></textarea>\\\n </div>',\n showCloseButton: true,\n showConfirmButton: false,\n }).then(function(result){\n if(typeof editor !== \"undefined\") editor.destroy();\n URL.revokeObjectURL(imgGalleryURL);\n });\n\n createHTMLTemplates();\n dbGetDoc(db, \"Note_\" + currentCalendar.id, {\"not_found\": true}, true).then(function(doc){ \n var content = \"\";\n if(!doc.not_found){\n content = doc.docContent;\n var attachments = doc._attachments;\n Object.keys(attachments).forEach(function(attName){\n var base64 = attachments[attName].data;\n var base64Image = \"data:\" + attachments[attName].content_type + \";base64,\" + base64;\n content = content.replace(\"{{\"+attName+\"}}\", base64Image);\n })\n } \n createEditor(content);\n })\n }", "async openEditor() {\n atom.workspace.open((await new _editor2.default()));\n }", "function attachToDocuments(name, callback, collection) {\n\t\t\t\tvar globalDoc = CKEDITOR.document;\n\n\t\t\t\tvar listeners = [];\n\n\t\t\t\tif (!doc.equals(globalDoc)) {\n\t\t\t\t\tlisteners.push(globalDoc.on(name, callback));\n\t\t\t\t}\n\n\t\t\t\tlisteners.push(doc.on(name, callback));\n\n\t\t\t\tif (collection) {\n\t\t\t\t\tfor (var i = listeners.length; i--;) {\n\t\t\t\t\t\tcollection.push(listeners.pop());\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}", "function clickNoteEditor(e){\n self.focus_manager.setFocusObject(self.focus_manager.NOTE_EDITOR);\n }", "get selectedDocument() {\n return new Document(this.object.document, this)\n }", "function AddOrgAttach(curDoc,templateFilename){\n var newomOrgAttach = objCommon.InputBox(\"org 文件名\", \"请输入需要添加的 org 附件的文件名(可包含或不包含 .org 后缀,但必须为 Windows 文件名允许的字符串):\", \"default\");\n if(MFGetFileExtension(newomOrgAttach).toLowerCase() !== '.org'){\n newomOrgAttach = newomOrgAttach + \".org\";\n }\n else{\n newomOrgAttach = newomOrgAttach;\n }\n\n var templateFileRelativePath = \"Templates/\";\n var TemplateFile = org_mode_pluginPath + templateFileRelativePath + templateFilename;\n var attachPath;\n var destinationFile;\n\n // 确认该 Document 没有包含 org 附件\n if(newomOrgAttach !== \"\" && newomOrgAttach !== \".org\"){\n // 先添加一个附件到 Document,防止没有创建附件文件夹\n var localTemplateFileHdl = curDoc.AddAttachment(TemplateFile);\n attachPath = curDoc.AttachmentsFilePath;\n var localTemplateFile = attachPath + templateFilename;\n destinationFile = attachPath + newomOrgAttach;\n // 附件文件夹下,复制模板附件文件到org附件文件\n objCommon.CopyFile(localTemplateFile,destinationFile);\n // 重命名附件文件名\n // objCommon.RunExe(\"cmd\", \"/c ren \\\"\" + localTemplateFile + \"\\\" \\\"\" + newomOrgAttach + \"\\\"\", true);\n //添加新附件\n var localOrgFileHdl = curDoc.AddAttachment(destinationFile);\n //删除原附件\n localTemplateFileHdl.Delete();\n }\n else{\n objWindow.ShowMessage(\"输入的文件名 \"+ newomOrgAttach + \"错误\", \"Error-org-attach-filename\",0);\n }\n return;\n}", "function createEditor(el) {\n var textarea = el.find('.item__entry');\n var editorId = textarea.attr('id');\n\n if(typeof editorId === 'undefined') {\n editorId = 'knife-story-editor-' + box.data('editor');\n textarea.attr('id', editorId);\n\n box.data().editor++;\n } else {\n wp.editor.remove(editorId);\n }\n\n wp.editor.initialize(editorId, {\n tinymce: true,\n quicktags: true,\n mediaButtons: false,\n tinymce: {\n toolbar1: 'formatselect,bold,italic,bullist,numlist,link',\n block_formats: 'Paragraph=p;Heading 2=h2;Heading 3=h3;Heading 4=h4'\n }\n });\n }", "createView() {\n const doc2 = createDocument(this.options.content, this.schema, this.options.parseOptions);\n const selection = resolveFocusPosition(doc2, this.options.autofocus);\n this.view = new EditorView(this.options.element, {\n ...this.options.editorProps,\n dispatchTransaction: this.dispatchTransaction.bind(this),\n state: EditorState.create({\n doc: doc2,\n selection: selection || void 0\n })\n });\n const newState = this.state.reconfigure({\n plugins: this.extensionManager.plugins\n });\n this.view.updateState(newState);\n this.createNodeViews();\n const dom = this.view.dom;\n dom.editor = this;\n }", "function focusEditor() {\n if (_currentEditor) {\n _currentEditor.focus();\n }\n }", "function DocumentManager(options) {\n this._activateRequested = new signaling_1.Signal(this);\n this._contexts = [];\n this._isDisposed = false;\n this._autosave = true;\n this.registry = options.registry;\n this.services = options.manager;\n this._opener = options.opener;\n var widgetManager = new widgetmanager_1.DocumentWidgetManager({ registry: this.registry });\n widgetManager.activateRequested.connect(this._onActivateRequested, this);\n this._widgetManager = widgetManager;\n }", "function EmbeddedDocument() {\n Subdocument.apply(this, arguments);\n }", "function EmbeddedDocument() {\n Subdocument.apply(this, arguments);\n }", "function EmbeddedDocument() {\n Subdocument.apply(this, arguments);\n }", "bindEditor(editor){\n\t\tlisten(editor, 'compositionstart', () => {\n\t\t\tthis.inputIsComposing = true\n\t\t})\n\t\tlisten(editor, 'compositionend', e => {\n\t\t\tthis.inputIsComposing = false\n\t\t\tthis.input(e)\n\t\t})\n\t\tlisten(editor, 'input', e => {\n\t\t\tif (!this.inputIsComposing){\n\t\t\t\tthis.input(e)\n\t\t\t}\n\t\t})\n\t}", "startExternalEditor() {\n // Pause Readline to prevent stdin and stdout from being modified while the editor is showing\n this.rl.pause();\n editAsync(this.currentText, this.endExternalEditor.bind(this));\n }", "startExternalEditor() {\n // Pause Readline to prevent stdin and stdout from being modified while the editor is showing\n this.rl.pause();\n editAsync(this.currentText, this.endExternalEditor.bind(this));\n }", "function doSaveDocument() {\n var presenter = new mindmaps.SaveDocumentPresenter(eventBus,\n mindmapModel, new mindmaps.SaveDocumentView(), autosaveController, filePicker);\n presenter.go();\n }", "getPersistData() {\n return 'documenteditor';\n }", "insertData(editor, data) {\n editor.insertData(data);\n }", "insertData(editor, data) {\n editor.insertData(data);\n }", "insertData(editor, data) {\n editor.insertData(data);\n }", "function activateEditing( editor )\r\n\t{\r\n\t\tvar win = editor.window,\r\n\t\t\tdoc = editor.document,\r\n\t\t\tbody = editor.document.getBody(),\r\n\t\t\tbodyFirstChild = body.getFirst(),\r\n\t\t\tbodyChildsNum = body.getChildren().count();\r\n\r\n\t\tif ( !bodyChildsNum\r\n\t\t\t|| bodyChildsNum == 1\r\n\t\t\t\t&& bodyFirstChild.type == CKEDITOR.NODE_ELEMENT\r\n\t\t\t\t&& bodyFirstChild.hasAttribute( '_moz_editor_bogus_node' ) )\r\n\t\t{\r\n\t\t\trestoreDirty( editor );\r\n\r\n\t\t\t// Memorize scroll position to restore it later (#4472).\r\n\t\t\tvar hostDocument = editor.element.getDocument();\r\n\t\t\tvar hostDocumentElement = hostDocument.getDocumentElement();\r\n\t\t\tvar scrollTop = hostDocumentElement.$.scrollTop;\r\n\t\t\tvar scrollLeft = hostDocumentElement.$.scrollLeft;\r\n\r\n\t\t\t// Simulating keyboard character input by dispatching a keydown of white-space text.\r\n\t\t\tvar keyEventSimulate = doc.$.createEvent( \"KeyEvents\" );\r\n\t\t\tkeyEventSimulate.initKeyEvent( 'keypress', true, true, win.$, false,\r\n\t\t\t\tfalse, false, false, 0, 32 );\r\n\t\t\tdoc.$.dispatchEvent( keyEventSimulate );\r\n\r\n\t\t\tif ( scrollTop != hostDocumentElement.$.scrollTop || scrollLeft != hostDocumentElement.$.scrollLeft )\r\n\t\t\t\thostDocument.getWindow().$.scrollTo( scrollLeft, scrollTop );\r\n\r\n\t\t\t// Restore the original document status by placing the cursor before a bogus br created (#5021).\r\n\t\t\tbodyChildsNum && body.getFirst().remove();\r\n\t\t\tdoc.getBody().appendBogus();\r\n\t\t\tvar nativeRange = new CKEDITOR.dom.range( doc );\r\n\t\t\tnativeRange.setStartAt( body , CKEDITOR.POSITION_AFTER_START );\r\n\t\t\tnativeRange.select();\r\n\t\t}\r\n\t}", "function setDocument(document) {\n DOCUMENT = document;\n }", "constructor() {\n\t\t/**\n\t\t * Selection done on this document.\n\t\t *\n\t\t * @readonly\n\t\t * @member {module:engine/view/documentselection~DocumentSelection} module:engine/view/document~Document#selection\n\t\t */\n\t\tthis.selection = new DocumentSelection();\n\n\t\t/**\n\t\t * Roots of the view tree. Collection of the {@link module:engine/view/element~Element view elements}.\n\t\t *\n\t\t * View roots are created as a result of binding between {@link module:engine/view/document~Document#roots} and\n\t\t * {@link module:engine/model/document~Document#roots} and this is handled by\n\t\t * {@link module:engine/controller/editingcontroller~EditingController}, so to create view root we need to create\n\t\t * model root using {@link module:engine/model/document~Document#createRoot}.\n\t\t *\n\t\t * @readonly\n\t\t * @member {module:utils/collection~Collection} module:engine/view/document~Document#roots\n\t\t */\n\t\tthis.roots = new Collection( { idProperty: 'rootName' } );\n\n\t\t/**\n\t\t * Defines whether document is in read-only mode.\n\t\t *\n\t\t * When document is read-ony then all roots are read-only as well and caret placed inside this root is hidden.\n\t\t *\n\t\t * @observable\n\t\t * @member {Boolean} #isReadOnly\n\t\t */\n\t\tthis.set( 'isReadOnly', false );\n\n\t\t/**\n\t\t * True if document is focused.\n\t\t *\n\t\t * This property is updated by the {@link module:engine/view/observer/focusobserver~FocusObserver}.\n\t\t * If the {@link module:engine/view/observer/focusobserver~FocusObserver} is disabled this property will not change.\n\t\t *\n\t\t * @readonly\n\t\t * @observable\n\t\t * @member {Boolean} module:engine/view/document~Document#isFocused\n\t\t */\n\t\tthis.set( 'isFocused', false );\n\n\t\t/**\n\t\t * True if composition is in progress inside the document.\n\t\t *\n\t\t * This property is updated by the {@link module:engine/view/observer/compositionobserver~CompositionObserver}.\n\t\t * If the {@link module:engine/view/observer/compositionobserver~CompositionObserver} is disabled this property will not change.\n\t\t *\n\t\t * @readonly\n\t\t * @observable\n\t\t * @member {Boolean} module:engine/view/document~Document#isComposing\n\t\t */\n\t\tthis.set( 'isComposing', false );\n\n\t\t/**\n\t\t * Post-fixer callbacks registered to the view document.\n\t\t *\n\t\t * @private\n\t\t * @member {Set}\n\t\t */\n\t\tthis._postFixers = new Set();\n\t}", "insertFragment(editor, fragment) {\n editor.insertFragment(fragment);\n }", "insertFragment(editor, fragment) {\n editor.insertFragment(fragment);\n }", "function openDraft(id) {\n window.location = './editor/?id=' + id;\n}", "function doNewDocument() {\n // close old document first\n var doc = mindmapModel.getDocument();\n doCloseDocument();\n\n var presenter = new mindmaps.NewDocumentPresenter(eventBus,\n mindmapModel, new mindmaps.NewDocumentView());\n presenter.go();\n }", "_appendAttachment({ id, filename, content }) {\n const renderedPromise = this._renderedCapability.promise;\n\n renderedPromise.then(() => {\n if (renderedPromise !== this._renderedCapability.promise) {\n return; // The FileAttachment annotation belongs to a previous document.\n }\n let attachments = this._attachments;\n\n if (!attachments) {\n attachments = Object.create(null);\n } else {\n for (const name in attachments) {\n if (id === name) {\n return; // Ignore the new attachment if it already exists.\n }\n }\n }\n attachments[id] = {\n filename,\n content,\n };\n this.render({\n attachments,\n keepRenderedCapability: true,\n });\n });\n }", "function setDocument(document) {\n DOCUMENT = document;\n}", "function setDocument(document) {\n DOCUMENT = document;\n}", "function setDocument(document) {\n DOCUMENT = document;\n}", "function setDocument(document) {\n DOCUMENT = document;\n}", "function setDocument(document) {\n DOCUMENT = document;\n}", "function setDocument(document) {\n DOCUMENT = document;\n}", "showEditor(path, selection) {\n if (!path) path = store.file?.path\n // TODO: selection!!!!\n try {\n navigate(new SpellLocation(path).editorUrl)\n store.compileApp()\n } catch (e) {\n store.showError(`Path '${path}' is invalid!`)\n }\n }", "constructor(document = {}) {\n if (!document.sketchObject) {\n const app = NSDocumentController.sharedDocumentController()\n app.newDocument(Document)\n // eslint-disable-next-line no-param-reassign\n document.sketchObject = app.currentDocument()\n }\n\n super(document)\n }", "function openDocument() {\n if (checkLocalStorage()) {\n if (myDiagram.isModified) {\n var save = confirm(\"Would you like to save changes to \" + getCurrentFileName() + \"?\");\n if (save) {\n saveDocument();\n }\n }\n openElement(\"openDocument\", \"mySavedFiles\");\n }\n}", "selectDocument(event) {\n const { attachFile } = this.context;\n\n let file = null;\n if (event.target.files && event.target.files[0]) {\n file = event.target.files[0];\n this.setState({\n file: file\n }, () => attachFile(file));\n }\n }", "function setDocument(document) {\n DOCUMENT = document;\n}", "openDocument(fileName) {\n const existingWindow = this.getDocumentByFilename(fileName);\n if (existingWindow && existingWindow.window) {\n existingWindow.window.show();\n return;\n }\n\n fs.readFile(fileName, 'utf-8', (err, data) => {\n if (err) {\n alert('An error ocurred reading the file: ' + err.message);\n return;\n }\n\n const basename = path.basename(fileName);\n\n const window = this.createWindow({fileName});\n window.setRepresentedFilename(basename);\n window.setTitle(basename);\n window.once('ready-to-show', () => {\n this.setWindowContents(window, JSON.parse(data));\n window.show();\n });\n\n this.addAppRecentDocument(fileName);\n });\n }", "function createDoc(callback) {\n var connection = backend.connect();\n var doc = connection.get('examples', 'richtext');\n doc.fetch(function(err) {\n if (err) throw err;\n if (doc.type === null) {\n doc.create([{insert: ''}], 'rich-text', callback);\n return;\n }\n callback();\n });\n}", "saveTest() {\n // run the editors save method\n this.$refs.textEditor.saveEditorData()\n // save the document\n db.collection('tests').add({\n title: this.title,\n type: this.department,\n description: (this.$refs.textEditor.htmlForEditor === undefined ? '' : this.$refs.textEditor.htmlForEditor),\n editorImages: this.$refs.textEditor.images\n })\n .then(docRef => {\n console.log(\"Document written with ID: \", docRef.id);\n alert(`New test: ` + this.title + ` saved!`)\n })\n .catch(error => {\n console.error(\"Error adding document: \", error);\n return // dont leave the page if save fails\n })\n // return to tests page\n this.$router.push({ path: '/view-tests' })\n }", "function loadEditor() {\n var transaction = db.transaction([\"notes\"]);\n var objectStore = transaction.objectStore(\"notes\");\n var request = objectStore.get(\"settings\");\n request.onsuccess = function(event) {\n var toolbarOptions = [[{ 'header': [1, 2, 3, false] }]];\n if(request.result.tool_bar_standard_text_options) {\n toolbarOptions.push(['bold', 'italic', 'underline', 'strike']);\n }\n if(request.result.tool_bar_quotes) {\n toolbarOptions.push(['blockquote']);\n }\n if(request.result.tool_bar_code_box) {\n toolbarOptions.push(['code-block']);\n }\n if(request.result.tool_bar_list_bullets) {\n toolbarOptions.push([{ 'list': 'ordered'}, { 'list': 'bullet' }]);\n }\n if(request.result.tool_bar_super_sub) {\n toolbarOptions.push([{ 'script': 'sub'}, { 'script': 'super' }]);\n }\n if(request.result.tool_bar_images) {\n toolbarOptions.push(['image']);\n }\n if(request.result.tool_bar_link) {\n toolbarOptions.push(['link']);\n }\n if(request.result.tool_bar_clear_format) {\n toolbarOptions.push(['clean']);\n }\n toolbarOptions.push(['undo']);\n toolbarOptions.push(['redo']);\n toolbarOptions.push(['save']);\n toolbarOptions.push(['expand']);\n\n quill = new Quill('#editor-container', {\n modules: {\n imageResize: {\n modules: [ 'Resize', 'DisplaySize' ],\n displaySize: true,\n displayStyles: {\n backgroundColor: 'rgba(20, 143, 245,.5)',\n border: 'none',\n color: 'white'\n },\n handleStyles: {\n backgroundColor: 'black',\n border: 'none',\n color: \"white\"\n }\n },\n imageDrop: true,\n syntax: true,\n toolbar: toolbarOptions,\n history: {\n delay: 2000,\n maxStack: 500,\n userOnly: true\n },\n },\n placeholder: 'Compose an epic...',\n theme: 'snow' // or 'bubble'\n });\n\n // Creates the custom buttons\n var toolbar = quill.getModule('toolbar');\n toolbar.addHandler('expand', function() {\n console.log('expand')\n }\n );\n\n var toolbar = quill.getModule('toolbar');\n toolbar.addHandler('expand', function() {\n console.log('undo')\n }\n );\n\n var toolbar = quill.getModule('toolbar');\n toolbar.addHandler('save', function() {\n console.log('save')\n }\n );\n\n var toolbar = quill.getModule('toolbar');\n toolbar.addHandler('redo', function() {\n console.log('redo')\n }\n );\n\n var customButton = document.querySelector('.ql-expand');\n customButton.addEventListener('click', function() {\n expand();\n }\n );\n\n var customButton = document.querySelector('.ql-undo');\n customButton.addEventListener('click', function() {\n quill.history.undo();\n }\n );\n\n var customButton = document.querySelector('.ql-redo');\n customButton.addEventListener('click', function() {\n quill.history.redo();\n }\n );\n\n var customButton = document.querySelector('.ql-save');\n customButton.addEventListener('click', function() {\n updateNote();\n }\n );\n\n\n };\n}", "function updateEditor() {\n\t\ttextToEditor();\n\t\tpositionEditorCaret();\n\t}", "function uploadDocument()\n {\n var docWindow = \"\";\n if (docWindow && !docWindow.closed)\n docWindow.focus();\n else\n {\n docWindow = window.open(\"jsp/UploadDocument.jsp\", \"UpdDocWindow\", \"width=550,height=350,top=0,left=0,resizable=yes,scrollbars=yes\");\n }\n }", "function Document() {\n var document = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n _classCallCheck(this, Document);\n\n if (!document.sketchObject) {\n var app = NSDocumentController.sharedDocumentController();\n var error = MOPointer.alloc().init(); // eslint-disable-next-line no-param-reassign\n\n document.sketchObject = app.openUntitledDocumentAndDisplay_error(true, error);\n\n if (error.value() !== null) {\n throw new Error(error.value());\n }\n\n if (!document.sketchObject) {\n throw new Error('could not create a new Document');\n }\n }\n\n return _possibleConstructorReturn(this, _getPrototypeOf(Document).call(this, document));\n }" ]
[ "0.6626215", "0.6624217", "0.6578821", "0.6578821", "0.6578821", "0.65262896", "0.6516365", "0.6516365", "0.6516365", "0.6516365", "0.6516365", "0.6516365", "0.6516365", "0.64938515", "0.64938515", "0.64938515", "0.6477321", "0.6477321", "0.6477321", "0.6477321", "0.6477321", "0.6477321", "0.6477321", "0.6477321", "0.6477321", "0.6477321", "0.6477321", "0.64763856", "0.63952166", "0.6381958", "0.57283854", "0.5278058", "0.516866", "0.51194715", "0.5022004", "0.4973226", "0.49538168", "0.49538168", "0.49264356", "0.4920899", "0.49096036", "0.49068645", "0.49040276", "0.48977873", "0.48915827", "0.4890805", "0.4869084", "0.48447886", "0.48218244", "0.48209503", "0.48069403", "0.48069403", "0.48069403", "0.4798745", "0.4786007", "0.4786007", "0.47726017", "0.47527343", "0.47522742", "0.47522742", "0.47522742", "0.47447783", "0.47433454", "0.47295386", "0.4713433", "0.4713433", "0.47131112", "0.47099957", "0.47021115", "0.4701589", "0.4701589", "0.4701589", "0.4701589", "0.4701589", "0.4701589", "0.4690036", "0.46864632", "0.4680644", "0.46802005", "0.46777052", "0.46685964", "0.46677428", "0.46639258", "0.46560168", "0.46473908", "0.46329135", "0.46121898" ]
0.64563096
37
Create a history change event from an updateDocstyle change object.
function historyChangeFromChange(doc, change) { var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)}; attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true); return histChange }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function historyChangeFromChange(doc, change) {\n\t\t var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n\t\t attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n\t\t linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\n\t\t return histChange;\n\t\t }", "function historyChangeFromChange(doc, change) {\n\t\t var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n\t\t attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n\t\t linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n\t\t return histChange\n\t\t }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)}\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1)\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true)\n return histChange\n}", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)}\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1)\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true)\n return histChange\n}", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n}", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n}", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n}", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n}", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n}", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n}", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n}", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n}", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n}", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n}", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n}", "function historyChangeFromChange(doc, change) {\n\t var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n\t attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n\t linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\n\t return histChange;\n\t }", "function historyChangeFromChange(doc, change) {\n\t var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n\t attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n\t linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\n\t return histChange;\n\t }", "function historyChangeFromChange(doc, change) {\n\t var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n\t attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n\t linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\n\t return histChange;\n\t }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\n return histChange;\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\n return histChange;\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\n return histChange;\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\n return histChange;\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\n return histChange;\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\n return histChange;\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\n return histChange;\n }", "function historyChangeFromChange(doc, change) {\r\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\r\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\r\n linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\r\n return histChange;\r\n }", "function historyChangeFromChange(doc, change) {\r\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\r\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\r\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\r\n return histChange\r\n}", "formatChangeHistory(auditEvent) {\n // when reporting on the change history for \n // a given property, only inclue from the audit:\n // 1. username\n // 2. when\n // 3. type: map to \"event\"\n // 4. event: map to \"change\" [optional]\n const historyEvent = {\n username: auditEvent.username,\n when: auditEvent.when,\n event: auditEvent.type\n };\n if (auditEvent.event) {\n historyEvent.change = auditEvent.event\n }\n\n return historyEvent;\n }", "_rebaseChange(args, cb) {\n this.documentEngine.getChanges({\n documentId: args.documentId,\n sinceVersion: args.version\n }, function(err, result) {\n let B = result.changes.map(this.deserializeChange)\n let a = this.deserializeChange(args.change)\n // transform changes\n DocumentChange.transformInplace(a, B)\n let ops = B.reduce(function(ops, change) {\n return ops.concat(change.ops)\n }, [])\n let serverChange = new DocumentChange(ops, {}, {})\n\n cb(null, {\n change: this.serializeChange(a),\n serverChange: this.serializeChange(serverChange),\n version: result.version\n })\n }.bind(this))\n }", "function filterChange(doc, change, update) {\n\t\t var obj = {\n\t\t canceled: false,\n\t\t from: change.from,\n\t\t to: change.to,\n\t\t text: change.text,\n\t\t origin: change.origin,\n\t\t cancel: function() { this.canceled = true; }\n\t\t };\n\t\t if (update) obj.update = function(from, to, text, origin) {\n\t\t if (from) this.from = clipPos(doc, from);\n\t\t if (to) this.to = clipPos(doc, to);\n\t\t if (text) this.text = text;\n\t\t if (origin !== undefined) this.origin = origin;\n\t\t };\n\t\t signal(doc, \"beforeChange\", doc, obj);\n\t\t if (doc.cm) signal(doc.cm, \"beforeChange\", doc.cm, obj);\n\t\t\n\t\t if (obj.canceled) return null;\n\t\t return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin};\n\t\t }", "function toVersionchangeEvent(evt) {\n evt.db = evt.target.result;\n return evt;\n}", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function cancel() {\n return obj.canceled = true;\n }\n };\n\n if (update) {\n obj.update = function (from, to, text, origin) {\n if (from) {\n obj.from = _clipPos(doc, from);\n }\n\n if (to) {\n obj.to = _clipPos(doc, to);\n }\n\n if (text) {\n obj.text = text;\n }\n\n if (origin !== undefined) {\n obj.origin = origin;\n }\n };\n }\n\n signal(doc, \"beforeChange\", doc, obj);\n\n if (doc.cm) {\n signal(doc.cm, \"beforeChange\", doc.cm, obj);\n }\n\n if (obj.canceled) {\n if (doc.cm) {\n doc.cm.curOp.updateInput = 2;\n }\n\n return null;\n }\n\n return {\n from: obj.from,\n to: obj.to,\n text: obj.text,\n origin: obj.origin\n };\n } // Apply a change to a document, and add it to the document's", "function filterChange(doc, change, update) {\n\t var obj = {\n\t canceled: false,\n\t from: change.from,\n\t to: change.to,\n\t text: change.text,\n\t origin: change.origin,\n\t cancel: function() { this.canceled = true; }\n\t };\n\t if (update) obj.update = function(from, to, text, origin) {\n\t if (from) this.from = clipPos(doc, from);\n\t if (to) this.to = clipPos(doc, to);\n\t if (text) this.text = text;\n\t if (origin !== undefined) this.origin = origin;\n\t };\n\t signal(doc, \"beforeChange\", doc, obj);\n\t if (doc.cm) signal(doc.cm, \"beforeChange\", doc.cm, obj);\n\t\n\t if (obj.canceled) return null;\n\t return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin};\n\t }", "function filterChange(doc, change, update) {\n\t var obj = {\n\t canceled: false,\n\t from: change.from,\n\t to: change.to,\n\t text: change.text,\n\t origin: change.origin,\n\t cancel: function() { this.canceled = true; }\n\t };\n\t if (update) obj.update = function(from, to, text, origin) {\n\t if (from) this.from = clipPos(doc, from);\n\t if (to) this.to = clipPos(doc, to);\n\t if (text) this.text = text;\n\t if (origin !== undefined) this.origin = origin;\n\t };\n\t signal(doc, \"beforeChange\", doc, obj);\n\t if (doc.cm) signal(doc.cm, \"beforeChange\", doc.cm, obj);\n\n\t if (obj.canceled) return null;\n\t return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin};\n\t }", "function filterChange(doc, change, update) {\n\t var obj = {\n\t canceled: false,\n\t from: change.from,\n\t to: change.to,\n\t text: change.text,\n\t origin: change.origin,\n\t cancel: function() { this.canceled = true; }\n\t };\n\t if (update) obj.update = function(from, to, text, origin) {\n\t if (from) this.from = clipPos(doc, from);\n\t if (to) this.to = clipPos(doc, to);\n\t if (text) this.text = text;\n\t if (origin !== undefined) this.origin = origin;\n\t };\n\t signal(doc, \"beforeChange\", doc, obj);\n\t if (doc.cm) signal(doc.cm, \"beforeChange\", doc.cm, obj);\n\n\t if (obj.canceled) return null;\n\t return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin};\n\t }", "function filterChange(doc, change, update) {\r\n var obj = {\r\n canceled: false,\r\n from: change.from,\r\n to: change.to,\r\n text: change.text,\r\n origin: change.origin,\r\n cancel: function() { this.canceled = true; }\r\n };\r\n if (update) obj.update = function(from, to, text, origin) {\r\n if (from) this.from = clipPos(doc, from);\r\n if (to) this.to = clipPos(doc, to);\r\n if (text) this.text = text;\r\n if (origin !== undefined) this.origin = origin;\r\n };\r\n signal(doc, \"beforeChange\", doc, obj);\r\n if (doc.cm) signal(doc.cm, \"beforeChange\", doc.cm, obj);\r\n\r\n if (obj.canceled) return null;\r\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin};\r\n }", "function filterChange(doc, change, update) {\n\t\t var obj = {\n\t\t canceled: false,\n\t\t from: change.from,\n\t\t to: change.to,\n\t\t text: change.text,\n\t\t origin: change.origin,\n\t\t cancel: function () { return obj.canceled = true; }\n\t\t };\n\t\t if (update) { obj.update = function (from, to, text, origin) {\n\t\t if (from) { obj.from = clipPos(doc, from); }\n\t\t if (to) { obj.to = clipPos(doc, to); }\n\t\t if (text) { obj.text = text; }\n\t\t if (origin !== undefined) { obj.origin = origin; }\n\t\t }; }\n\t\t signal(doc, \"beforeChange\", doc, obj);\n\t\t if (doc.cm) { signal(doc.cm, \"beforeChange\", doc.cm, obj); }\n\n\t\t if (obj.canceled) {\n\t\t if (doc.cm) { doc.cm.curOp.updateInput = 2; }\n\t\t return null\n\t\t }\n\t\t return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}\n\t\t }", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function() { this.canceled = true; }\n };\n if (update) obj.update = function(from, to, text, origin) {\n if (from) this.from = clipPos(doc, from);\n if (to) this.to = clipPos(doc, to);\n if (text) this.text = text;\n if (origin !== undefined) this.origin = origin;\n };\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) signal(doc.cm, \"beforeChange\", doc.cm, obj);\n\n if (obj.canceled) return null;\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin};\n }", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function() { this.canceled = true; }\n };\n if (update) obj.update = function(from, to, text, origin) {\n if (from) this.from = clipPos(doc, from);\n if (to) this.to = clipPos(doc, to);\n if (text) this.text = text;\n if (origin !== undefined) this.origin = origin;\n };\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) signal(doc.cm, \"beforeChange\", doc.cm, obj);\n\n if (obj.canceled) return null;\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin};\n }", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function() { this.canceled = true; }\n };\n if (update) obj.update = function(from, to, text, origin) {\n if (from) this.from = clipPos(doc, from);\n if (to) this.to = clipPos(doc, to);\n if (text) this.text = text;\n if (origin !== undefined) this.origin = origin;\n };\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) signal(doc.cm, \"beforeChange\", doc.cm, obj);\n\n if (obj.canceled) return null;\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin};\n }", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function() { this.canceled = true; }\n };\n if (update) obj.update = function(from, to, text, origin) {\n if (from) this.from = clipPos(doc, from);\n if (to) this.to = clipPos(doc, to);\n if (text) this.text = text;\n if (origin !== undefined) this.origin = origin;\n };\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) signal(doc.cm, \"beforeChange\", doc.cm, obj);\n\n if (obj.canceled) return null;\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin};\n }", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function() { this.canceled = true; }\n };\n if (update) obj.update = function(from, to, text, origin) {\n if (from) this.from = clipPos(doc, from);\n if (to) this.to = clipPos(doc, to);\n if (text) this.text = text;\n if (origin !== undefined) this.origin = origin;\n };\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) signal(doc.cm, \"beforeChange\", doc.cm, obj);\n\n if (obj.canceled) return null;\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin};\n }", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function() { this.canceled = true; }\n };\n if (update) obj.update = function(from, to, text, origin) {\n if (from) this.from = clipPos(doc, from);\n if (to) this.to = clipPos(doc, to);\n if (text) this.text = text;\n if (origin !== undefined) this.origin = origin;\n };\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) signal(doc.cm, \"beforeChange\", doc.cm, obj);\n\n if (obj.canceled) return null;\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin};\n }", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function() { this.canceled = true; }\n };\n if (update) obj.update = function(from, to, text, origin) {\n if (from) this.from = clipPos(doc, from);\n if (to) this.to = clipPos(doc, to);\n if (text) this.text = text;\n if (origin !== undefined) this.origin = origin;\n };\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) signal(doc.cm, \"beforeChange\", doc.cm, obj);\n\n if (obj.canceled) return null;\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin};\n }", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function () { return obj.canceled = true; }\n };\n if (update) { obj.update = function (from, to, text, origin) {\n if (from) { obj.from = clipPos(doc, from); }\n if (to) { obj.to = clipPos(doc, to); }\n if (text) { obj.text = text; }\n if (origin !== undefined) { obj.origin = origin; }\n }; }\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeChange\", doc.cm, obj); }\n\n if (obj.canceled) {\n if (doc.cm) { doc.cm.curOp.updateInput = 2; }\n return null\n }\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}\n }", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function () { return obj.canceled = true; }\n };\n if (update) { obj.update = function (from, to, text, origin) {\n if (from) { obj.from = clipPos(doc, from); }\n if (to) { obj.to = clipPos(doc, to); }\n if (text) { obj.text = text; }\n if (origin !== undefined) { obj.origin = origin; }\n }; }\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeChange\", doc.cm, obj); }\n\n if (obj.canceled) {\n if (doc.cm) { doc.cm.curOp.updateInput = 2; }\n return null\n }\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}\n }", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function () { return obj.canceled = true; }\n };\n if (update) { obj.update = function (from, to, text, origin) {\n if (from) { obj.from = clipPos(doc, from); }\n if (to) { obj.to = clipPos(doc, to); }\n if (text) { obj.text = text; }\n if (origin !== undefined) { obj.origin = origin; }\n }; }\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeChange\", doc.cm, obj); }\n\n if (obj.canceled) {\n if (doc.cm) { doc.cm.curOp.updateInput = 2; }\n return null\n }\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}\n }", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function () { return obj.canceled = true; }\n };\n if (update) { obj.update = function (from, to, text, origin) {\n if (from) { obj.from = clipPos(doc, from); }\n if (to) { obj.to = clipPos(doc, to); }\n if (text) { obj.text = text; }\n if (origin !== undefined) { obj.origin = origin; }\n }; }\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeChange\", doc.cm, obj); }\n\n if (obj.canceled) {\n if (doc.cm) { doc.cm.curOp.updateInput = 2; }\n return null\n }\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}\n }", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function () { return obj.canceled = true; }\n };\n if (update) { obj.update = function (from, to, text, origin) {\n if (from) { obj.from = clipPos(doc, from); }\n if (to) { obj.to = clipPos(doc, to); }\n if (text) { obj.text = text; }\n if (origin !== undefined) { obj.origin = origin; }\n }; }\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeChange\", doc.cm, obj); }\n\n if (obj.canceled) {\n if (doc.cm) { doc.cm.curOp.updateInput = 2; }\n return null\n }\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}\n }", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function () { return obj.canceled = true; }\n };\n if (update) { obj.update = function (from, to, text, origin) {\n if (from) { obj.from = clipPos(doc, from); }\n if (to) { obj.to = clipPos(doc, to); }\n if (text) { obj.text = text; }\n if (origin !== undefined) { obj.origin = origin; }\n }; }\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeChange\", doc.cm, obj); }\n\n if (obj.canceled) {\n if (doc.cm) { doc.cm.curOp.updateInput = 2; }\n return null\n }\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}\n }", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function () { return obj.canceled = true; }\n };\n if (update) { obj.update = function (from, to, text, origin) {\n if (from) { obj.from = clipPos(doc, from); }\n if (to) { obj.to = clipPos(doc, to); }\n if (text) { obj.text = text; }\n if (origin !== undefined) { obj.origin = origin; }\n }; }\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeChange\", doc.cm, obj); }\n\n if (obj.canceled) {\n if (doc.cm) { doc.cm.curOp.updateInput = 2; }\n return null\n }\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}\n }", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function () { return obj.canceled = true; }\n };\n if (update) { obj.update = function (from, to, text, origin) {\n if (from) { obj.from = clipPos(doc, from); }\n if (to) { obj.to = clipPos(doc, to); }\n if (text) { obj.text = text; }\n if (origin !== undefined) { obj.origin = origin; }\n }; }\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeChange\", doc.cm, obj); }\n\n if (obj.canceled) {\n if (doc.cm) { doc.cm.curOp.updateInput = 2; }\n return null\n }\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}\n }", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function () { return obj.canceled = true; }\n };\n if (update) { obj.update = function (from, to, text, origin) {\n if (from) { obj.from = clipPos(doc, from); }\n if (to) { obj.to = clipPos(doc, to); }\n if (text) { obj.text = text; }\n if (origin !== undefined) { obj.origin = origin; }\n }; }\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeChange\", doc.cm, obj); }\n\n if (obj.canceled) {\n if (doc.cm) { doc.cm.curOp.updateInput = 2; }\n return null\n }\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}\n }", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function () { return obj.canceled = true; }\n };\n if (update) { obj.update = function (from, to, text, origin) {\n if (from) { obj.from = clipPos(doc, from); }\n if (to) { obj.to = clipPos(doc, to); }\n if (text) { obj.text = text; }\n if (origin !== undefined) { obj.origin = origin; }\n }; }\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeChange\", doc.cm, obj); }\n\n if (obj.canceled) {\n if (doc.cm) { doc.cm.curOp.updateInput = 2; }\n return null\n }\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}\n }", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function () { return obj.canceled = true; }\n };\n if (update) { obj.update = function (from, to, text, origin) {\n if (from) { obj.from = clipPos(doc, from); }\n if (to) { obj.to = clipPos(doc, to); }\n if (text) { obj.text = text; }\n if (origin !== undefined) { obj.origin = origin; }\n }; }\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeChange\", doc.cm, obj); }\n\n if (obj.canceled) {\n if (doc.cm) { doc.cm.curOp.updateInput = 2; }\n return null\n }\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}\n }", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function () { return obj.canceled = true; }\n };\n if (update) { obj.update = function (from, to, text, origin) {\n if (from) { obj.from = clipPos(doc, from); }\n if (to) { obj.to = clipPos(doc, to); }\n if (text) { obj.text = text; }\n if (origin !== undefined) { obj.origin = origin; }\n }; }\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeChange\", doc.cm, obj); }\n\n if (obj.canceled) {\n if (doc.cm) { doc.cm.curOp.updateInput = 2; }\n return null\n }\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}\n }", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function () { return obj.canceled = true; }\n };\n if (update) { obj.update = function (from, to, text, origin) {\n if (from) { obj.from = clipPos(doc, from); }\n if (to) { obj.to = clipPos(doc, to); }\n if (text) { obj.text = text; }\n if (origin !== undefined) { obj.origin = origin; }\n }; }\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeChange\", doc.cm, obj); }\n\n if (obj.canceled) {\n if (doc.cm) { doc.cm.curOp.updateInput = 2; }\n return null\n }\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}\n }", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function () { return obj.canceled = true; }\n };\n if (update) { obj.update = function (from, to, text, origin) {\n if (from) { obj.from = clipPos(doc, from); }\n if (to) { obj.to = clipPos(doc, to); }\n if (text) { obj.text = text; }\n if (origin !== undefined) { obj.origin = origin; }\n }; }\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeChange\", doc.cm, obj); }\n\n if (obj.canceled) {\n if (doc.cm) { doc.cm.curOp.updateInput = 2; }\n return null\n }\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}\n }", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function () { return obj.canceled = true; }\n };\n if (update) { obj.update = function (from, to, text, origin) {\n if (from) { obj.from = clipPos(doc, from); }\n if (to) { obj.to = clipPos(doc, to); }\n if (text) { obj.text = text; }\n if (origin !== undefined) { obj.origin = origin; }\n }; }\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeChange\", doc.cm, obj); }\n\n if (obj.canceled) {\n if (doc.cm) { doc.cm.curOp.updateInput = 2; }\n return null\n }\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}\n }", "onEventCommit({ changes }) {\n [...changes.added, ...changes.modified].forEach((eventRecord) => this.repaintEvent(eventRecord));\n }", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function () { return obj.canceled = true; }\n };\n if (update) { obj.update = function (from, to, text, origin) {\n if (from) { obj.from = clipPos(doc, from); }\n if (to) { obj.to = clipPos(doc, to); }\n if (text) { obj.text = text; }\n if (origin !== undefined) { obj.origin = origin; }\n }; }\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeChange\", doc.cm, obj); }\n\n if (obj.canceled) { return null }\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}\n }", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function () { return obj.canceled = true; }\n };\n if (update) { obj.update = function (from, to, text, origin) {\n if (from) { obj.from = clipPos(doc, from); }\n if (to) { obj.to = clipPos(doc, to); }\n if (text) { obj.text = text; }\n if (origin !== undefined) { obj.origin = origin; }\n }; }\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeChange\", doc.cm, obj); }\n\n if (obj.canceled) { return null }\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}\n }", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function () { return obj.canceled = true; }\n }\n if (update) { obj.update = function (from, to, text, origin) {\n if (from) { obj.from = clipPos(doc, from) }\n if (to) { obj.to = clipPos(doc, to) }\n if (text) { obj.text = text }\n if (origin !== undefined) { obj.origin = origin }\n } }\n signal(doc, \"beforeChange\", doc, obj)\n if (doc.cm) { signal(doc.cm, \"beforeChange\", doc.cm, obj) }\n\n if (obj.canceled) { return null }\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}\n}", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function () { return obj.canceled = true; }\n }\n if (update) { obj.update = function (from, to, text, origin) {\n if (from) { obj.from = clipPos(doc, from) }\n if (to) { obj.to = clipPos(doc, to) }\n if (text) { obj.text = text }\n if (origin !== undefined) { obj.origin = origin }\n } }\n signal(doc, \"beforeChange\", doc, obj)\n if (doc.cm) { signal(doc.cm, \"beforeChange\", doc.cm, obj) }\n\n if (obj.canceled) { return null }\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}\n}", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function () { return obj.canceled = true; }\n };\n if (update) { obj.update = function (from, to, text, origin) {\n if (from) { obj.from = clipPos(doc, from); }\n if (to) { obj.to = clipPos(doc, to); }\n if (text) { obj.text = text; }\n if (origin !== undefined) { obj.origin = origin; }\n }; }\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeChange\", doc.cm, obj); }\n\n if (obj.canceled) { return null }\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}\n}", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function () { return obj.canceled = true; }\n };\n if (update) { obj.update = function (from, to, text, origin) {\n if (from) { obj.from = clipPos(doc, from); }\n if (to) { obj.to = clipPos(doc, to); }\n if (text) { obj.text = text; }\n if (origin !== undefined) { obj.origin = origin; }\n }; }\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeChange\", doc.cm, obj); }\n\n if (obj.canceled) { return null }\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}\n}", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function () { return obj.canceled = true; }\n };\n if (update) { obj.update = function (from, to, text, origin) {\n if (from) { obj.from = clipPos(doc, from); }\n if (to) { obj.to = clipPos(doc, to); }\n if (text) { obj.text = text; }\n if (origin !== undefined) { obj.origin = origin; }\n }; }\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeChange\", doc.cm, obj); }\n\n if (obj.canceled) { return null }\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}\n}", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function () { return obj.canceled = true; }\n };\n if (update) { obj.update = function (from, to, text, origin) {\n if (from) { obj.from = clipPos(doc, from); }\n if (to) { obj.to = clipPos(doc, to); }\n if (text) { obj.text = text; }\n if (origin !== undefined) { obj.origin = origin; }\n }; }\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeChange\", doc.cm, obj); }\n\n if (obj.canceled) { return null }\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}\n}", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function () { return obj.canceled = true; }\n };\n if (update) { obj.update = function (from, to, text, origin) {\n if (from) { obj.from = clipPos(doc, from); }\n if (to) { obj.to = clipPos(doc, to); }\n if (text) { obj.text = text; }\n if (origin !== undefined) { obj.origin = origin; }\n }; }\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeChange\", doc.cm, obj); }\n\n if (obj.canceled) { return null }\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}\n}", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function () { return obj.canceled = true; }\n };\n if (update) { obj.update = function (from, to, text, origin) {\n if (from) { obj.from = clipPos(doc, from); }\n if (to) { obj.to = clipPos(doc, to); }\n if (text) { obj.text = text; }\n if (origin !== undefined) { obj.origin = origin; }\n }; }\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeChange\", doc.cm, obj); }\n\n if (obj.canceled) { return null }\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}\n}", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function () { return obj.canceled = true; }\n };\n if (update) { obj.update = function (from, to, text, origin) {\n if (from) { obj.from = clipPos(doc, from); }\n if (to) { obj.to = clipPos(doc, to); }\n if (text) { obj.text = text; }\n if (origin !== undefined) { obj.origin = origin; }\n }; }\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeChange\", doc.cm, obj); }\n\n if (obj.canceled) { return null }\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}\n}", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function () { return obj.canceled = true; }\n };\n if (update) { obj.update = function (from, to, text, origin) {\n if (from) { obj.from = clipPos(doc, from); }\n if (to) { obj.to = clipPos(doc, to); }\n if (text) { obj.text = text; }\n if (origin !== undefined) { obj.origin = origin; }\n }; }\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeChange\", doc.cm, obj); }\n\n if (obj.canceled) { return null }\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}\n}", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function () { return obj.canceled = true; }\n };\n if (update) { obj.update = function (from, to, text, origin) {\n if (from) { obj.from = clipPos(doc, from); }\n if (to) { obj.to = clipPos(doc, to); }\n if (text) { obj.text = text; }\n if (origin !== undefined) { obj.origin = origin; }\n }; }\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeChange\", doc.cm, obj); }\n\n if (obj.canceled) { return null }\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}\n}", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function () { return obj.canceled = true; }\n };\n if (update) { obj.update = function (from, to, text, origin) {\n if (from) { obj.from = clipPos(doc, from); }\n if (to) { obj.to = clipPos(doc, to); }\n if (text) { obj.text = text; }\n if (origin !== undefined) { obj.origin = origin; }\n }; }\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeChange\", doc.cm, obj); }\n\n if (obj.canceled) { return null }\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}\n}", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function () { return obj.canceled = true; }\n };\n if (update) { obj.update = function (from, to, text, origin) {\n if (from) { obj.from = clipPos(doc, from); }\n if (to) { obj.to = clipPos(doc, to); }\n if (text) { obj.text = text; }\n if (origin !== undefined) { obj.origin = origin; }\n }; }\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeChange\", doc.cm, obj); }\n\n if (obj.canceled) { return null }\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}\n}", "function addChangeToHistory(doc, change, selAfter, opId) {\n\t\t var hist = doc.history;\n\t\t hist.undone.length = 0;\n\t\t var time = +new Date, cur;\n\t\t var last;\n\n\t\t if ((hist.lastOp == opId ||\n\t\t hist.lastOrigin == change.origin && change.origin &&\n\t\t ((change.origin.charAt(0) == \"+\" && hist.lastModTime > time - (doc.cm ? doc.cm.options.historyEventDelay : 500)) ||\n\t\t change.origin.charAt(0) == \"*\")) &&\n\t\t (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n\t\t // Merge this change into the last event\n\t\t last = lst(cur.changes);\n\t\t if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n\t\t // Optimized case for simple insertion -- don't want to add\n\t\t // new changesets for every character typed\n\t\t last.to = changeEnd(change);\n\t\t } else {\n\t\t // Add new sub-event\n\t\t cur.changes.push(historyChangeFromChange(doc, change));\n\t\t }\n\t\t } else {\n\t\t // Can not be merged, start a new event.\n\t\t var before = lst(hist.done);\n\t\t if (!before || !before.ranges)\n\t\t { pushSelectionToHistory(doc.sel, hist.done); }\n\t\t cur = {changes: [historyChangeFromChange(doc, change)],\n\t\t generation: hist.generation};\n\t\t hist.done.push(cur);\n\t\t while (hist.done.length > hist.undoDepth) {\n\t\t hist.done.shift();\n\t\t if (!hist.done[0].ranges) { hist.done.shift(); }\n\t\t }\n\t\t }\n\t\t hist.done.push(selAfter);\n\t\t hist.generation = ++hist.maxGeneration;\n\t\t hist.lastModTime = hist.lastSelTime = time;\n\t\t hist.lastOp = hist.lastSelOp = opId;\n\t\t hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n\t\t if (!last) { signal(doc, \"historyAdded\"); }\n\t\t }", "function addChangeToHistory(doc, change, selAfter, opId) {\n\t\t var hist = doc.history;\n\t\t hist.undone.length = 0;\n\t\t var time = +new Date, cur;\n\t\t\n\t\t if ((hist.lastOp == opId ||\n\t\t hist.lastOrigin == change.origin && change.origin &&\n\t\t ((change.origin.charAt(0) == \"+\" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||\n\t\t change.origin.charAt(0) == \"*\")) &&\n\t\t (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n\t\t // Merge this change into the last event\n\t\t var last = lst(cur.changes);\n\t\t if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n\t\t // Optimized case for simple insertion -- don't want to add\n\t\t // new changesets for every character typed\n\t\t last.to = changeEnd(change);\n\t\t } else {\n\t\t // Add new sub-event\n\t\t cur.changes.push(historyChangeFromChange(doc, change));\n\t\t }\n\t\t } else {\n\t\t // Can not be merged, start a new event.\n\t\t var before = lst(hist.done);\n\t\t if (!before || !before.ranges)\n\t\t pushSelectionToHistory(doc.sel, hist.done);\n\t\t cur = {changes: [historyChangeFromChange(doc, change)],\n\t\t generation: hist.generation};\n\t\t hist.done.push(cur);\n\t\t while (hist.done.length > hist.undoDepth) {\n\t\t hist.done.shift();\n\t\t if (!hist.done[0].ranges) hist.done.shift();\n\t\t }\n\t\t }\n\t\t hist.done.push(selAfter);\n\t\t hist.generation = ++hist.maxGeneration;\n\t\t hist.lastModTime = hist.lastSelTime = time;\n\t\t hist.lastOp = hist.lastSelOp = opId;\n\t\t hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\t\t\n\t\t if (!last) signal(doc, \"historyAdded\");\n\t\t }", "function filterChange(doc, change, update) {\r\n var obj = {\r\n canceled: false,\r\n from: change.from,\r\n to: change.to,\r\n text: change.text,\r\n origin: change.origin,\r\n cancel: function () { return obj.canceled = true; }\r\n };\r\n if (update) { obj.update = function (from, to, text, origin) {\r\n if (from) { obj.from = clipPos(doc, from); }\r\n if (to) { obj.to = clipPos(doc, to); }\r\n if (text) { obj.text = text; }\r\n if (origin !== undefined) { obj.origin = origin; }\r\n }; }\r\n signal(doc, \"beforeChange\", doc, obj);\r\n if (doc.cm) { signal(doc.cm, \"beforeChange\", doc.cm, obj); }\r\n\r\n if (obj.canceled) { return null }\r\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}\r\n}", "function createChange(name, op, obj) {\n self.changes.push({\n name: name,\n operation: op,\n obj: JSON.parse(JSON.stringify(obj))\n });\n }", "function makeChangeFromHistory(doc, type, allowSelectionOnly) {\n\t\t if (doc.cm && doc.cm.state.suppressEdits && !allowSelectionOnly) return;\n\t\t\n\t\t var hist = doc.history, event, selAfter = doc.sel;\n\t\t var source = type == \"undo\" ? hist.done : hist.undone, dest = type == \"undo\" ? hist.undone : hist.done;\n\t\t\n\t\t // Verify that there is a useable event (so that ctrl-z won't\n\t\t // needlessly clear selection events)\n\t\t for (var i = 0; i < source.length; i++) {\n\t\t event = source[i];\n\t\t if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges)\n\t\t break;\n\t\t }\n\t\t if (i == source.length) return;\n\t\t hist.lastOrigin = hist.lastSelOrigin = null;\n\t\t\n\t\t for (;;) {\n\t\t event = source.pop();\n\t\t if (event.ranges) {\n\t\t pushSelectionToHistory(event, dest);\n\t\t if (allowSelectionOnly && !event.equals(doc.sel)) {\n\t\t setSelection(doc, event, {clearRedo: false});\n\t\t return;\n\t\t }\n\t\t selAfter = event;\n\t\t }\n\t\t else break;\n\t\t }\n\t\t\n\t\t // Build up a reverse change object to add to the opposite history\n\t\t // stack (redo when undoing, and vice versa).\n\t\t var antiChanges = [];\n\t\t pushSelectionToHistory(selAfter, dest);\n\t\t dest.push({changes: antiChanges, generation: hist.generation});\n\t\t hist.generation = event.generation || ++hist.maxGeneration;\n\t\t\n\t\t var filter = hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\");\n\t\t\n\t\t for (var i = event.changes.length - 1; i >= 0; --i) {\n\t\t var change = event.changes[i];\n\t\t change.origin = type;\n\t\t if (filter && !filterChange(doc, change, false)) {\n\t\t source.length = 0;\n\t\t return;\n\t\t }\n\t\t\n\t\t antiChanges.push(historyChangeFromChange(doc, change));\n\t\t\n\t\t var after = i ? computeSelAfterChange(doc, change) : lst(source);\n\t\t makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change));\n\t\t if (!i && doc.cm) doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)});\n\t\t var rebased = [];\n\t\t\n\t\t // Propagate to the linked documents\n\t\t linkedDocs(doc, function(doc, sharedHist) {\n\t\t if (!sharedHist && indexOf(rebased, doc.history) == -1) {\n\t\t rebaseHist(doc.history, change);\n\t\t rebased.push(doc.history);\n\t\t }\n\t\t makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change));\n\t\t });\n\t\t }\n\t\t }", "function makeChangeFromHistory(doc, type, allowSelectionOnly) {\n\t\t var suppress = doc.cm && doc.cm.state.suppressEdits;\n\t\t if (suppress && !allowSelectionOnly) { return }\n\n\t\t var hist = doc.history, event, selAfter = doc.sel;\n\t\t var source = type == \"undo\" ? hist.done : hist.undone, dest = type == \"undo\" ? hist.undone : hist.done;\n\n\t\t // Verify that there is a useable event (so that ctrl-z won't\n\t\t // needlessly clear selection events)\n\t\t var i = 0;\n\t\t for (; i < source.length; i++) {\n\t\t event = source[i];\n\t\t if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges)\n\t\t { break }\n\t\t }\n\t\t if (i == source.length) { return }\n\t\t hist.lastOrigin = hist.lastSelOrigin = null;\n\n\t\t for (;;) {\n\t\t event = source.pop();\n\t\t if (event.ranges) {\n\t\t pushSelectionToHistory(event, dest);\n\t\t if (allowSelectionOnly && !event.equals(doc.sel)) {\n\t\t setSelection(doc, event, {clearRedo: false});\n\t\t return\n\t\t }\n\t\t selAfter = event;\n\t\t } else if (suppress) {\n\t\t source.push(event);\n\t\t return\n\t\t } else { break }\n\t\t }\n\n\t\t // Build up a reverse change object to add to the opposite history\n\t\t // stack (redo when undoing, and vice versa).\n\t\t var antiChanges = [];\n\t\t pushSelectionToHistory(selAfter, dest);\n\t\t dest.push({changes: antiChanges, generation: hist.generation});\n\t\t hist.generation = event.generation || ++hist.maxGeneration;\n\n\t\t var filter = hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\");\n\n\t\t var loop = function ( i ) {\n\t\t var change = event.changes[i];\n\t\t change.origin = type;\n\t\t if (filter && !filterChange(doc, change, false)) {\n\t\t source.length = 0;\n\t\t return {}\n\t\t }\n\n\t\t antiChanges.push(historyChangeFromChange(doc, change));\n\n\t\t var after = i ? computeSelAfterChange(doc, change) : lst(source);\n\t\t makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change));\n\t\t if (!i && doc.cm) { doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)}); }\n\t\t var rebased = [];\n\n\t\t // Propagate to the linked documents\n\t\t linkedDocs(doc, function (doc, sharedHist) {\n\t\t if (!sharedHist && indexOf(rebased, doc.history) == -1) {\n\t\t rebaseHist(doc.history, change);\n\t\t rebased.push(doc.history);\n\t\t }\n\t\t makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change));\n\t\t });\n\t\t };\n\n\t\t for (var i$1 = event.changes.length - 1; i$1 >= 0; --i$1) {\n\t\t var returned = loop( i$1 );\n\n\t\t if ( returned ) return returned.v;\n\t\t }\n\t\t }", "function makeChangeFromHistory(doc, type, allowSelectionOnly) {\n if (doc.cm && doc.cm.state.suppressEdits && !allowSelectionOnly) { return }\n\n var hist = doc.history, event, selAfter = doc.sel\n var source = type == \"undo\" ? hist.done : hist.undone, dest = type == \"undo\" ? hist.undone : hist.done\n\n // Verify that there is a useable event (so that ctrl-z won't\n // needlessly clear selection events)\n var i = 0\n for (; i < source.length; i++) {\n event = source[i]\n if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges)\n { break }\n }\n if (i == source.length) { return }\n hist.lastOrigin = hist.lastSelOrigin = null\n\n for (;;) {\n event = source.pop()\n if (event.ranges) {\n pushSelectionToHistory(event, dest)\n if (allowSelectionOnly && !event.equals(doc.sel)) {\n setSelection(doc, event, {clearRedo: false})\n return\n }\n selAfter = event\n }\n else { break }\n }\n\n // Build up a reverse change object to add to the opposite history\n // stack (redo when undoing, and vice versa).\n var antiChanges = []\n pushSelectionToHistory(selAfter, dest)\n dest.push({changes: antiChanges, generation: hist.generation})\n hist.generation = event.generation || ++hist.maxGeneration\n\n var filter = hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\")\n\n var loop = function ( i ) {\n var change = event.changes[i]\n change.origin = type\n if (filter && !filterChange(doc, change, false)) {\n source.length = 0\n return {}\n }\n\n antiChanges.push(historyChangeFromChange(doc, change))\n\n var after = i ? computeSelAfterChange(doc, change) : lst(source)\n makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change))\n if (!i && doc.cm) { doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)}) }\n var rebased = []\n\n // Propagate to the linked documents\n linkedDocs(doc, function (doc, sharedHist) {\n if (!sharedHist && indexOf(rebased, doc.history) == -1) {\n rebaseHist(doc.history, change)\n rebased.push(doc.history)\n }\n makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change))\n })\n };\n\n for (var i$1 = event.changes.length - 1; i$1 >= 0; --i$1) {\n var returned = loop( i$1 );\n\n if ( returned ) return returned.v;\n }\n}", "function makeChangeFromHistory(doc, type, allowSelectionOnly) {\n if (doc.cm && doc.cm.state.suppressEdits && !allowSelectionOnly) { return }\n\n var hist = doc.history, event, selAfter = doc.sel\n var source = type == \"undo\" ? hist.done : hist.undone, dest = type == \"undo\" ? hist.undone : hist.done\n\n // Verify that there is a useable event (so that ctrl-z won't\n // needlessly clear selection events)\n var i = 0\n for (; i < source.length; i++) {\n event = source[i]\n if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges)\n { break }\n }\n if (i == source.length) { return }\n hist.lastOrigin = hist.lastSelOrigin = null\n\n for (;;) {\n event = source.pop()\n if (event.ranges) {\n pushSelectionToHistory(event, dest)\n if (allowSelectionOnly && !event.equals(doc.sel)) {\n setSelection(doc, event, {clearRedo: false})\n return\n }\n selAfter = event\n }\n else { break }\n }\n\n // Build up a reverse change object to add to the opposite history\n // stack (redo when undoing, and vice versa).\n var antiChanges = []\n pushSelectionToHistory(selAfter, dest)\n dest.push({changes: antiChanges, generation: hist.generation})\n hist.generation = event.generation || ++hist.maxGeneration\n\n var filter = hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\")\n\n var loop = function ( i ) {\n var change = event.changes[i]\n change.origin = type\n if (filter && !filterChange(doc, change, false)) {\n source.length = 0\n return {}\n }\n\n antiChanges.push(historyChangeFromChange(doc, change))\n\n var after = i ? computeSelAfterChange(doc, change) : lst(source)\n makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change))\n if (!i && doc.cm) { doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)}) }\n var rebased = []\n\n // Propagate to the linked documents\n linkedDocs(doc, function (doc, sharedHist) {\n if (!sharedHist && indexOf(rebased, doc.history) == -1) {\n rebaseHist(doc.history, change)\n rebased.push(doc.history)\n }\n makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change))\n })\n };\n\n for (var i$1 = event.changes.length - 1; i$1 >= 0; --i$1) {\n var returned = loop( i$1 );\n\n if ( returned ) return returned.v;\n }\n}", "function addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history;\n hist.undone.length = 0;\n var time = +new Date, cur;\n var last;\n\n if ((hist.lastOp == opId ||\n hist.lastOrigin == change.origin && change.origin &&\n ((change.origin.charAt(0) == \"+\" && hist.lastModTime > time - (doc.cm ? doc.cm.options.historyEventDelay : 500)) ||\n change.origin.charAt(0) == \"*\")) &&\n (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n // Merge this change into the last event\n last = lst(cur.changes);\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n last.to = changeEnd(change);\n } else {\n // Add new sub-event\n cur.changes.push(historyChangeFromChange(doc, change));\n }\n } else {\n // Can not be merged, start a new event.\n var before = lst(hist.done);\n if (!before || !before.ranges)\n { pushSelectionToHistory(doc.sel, hist.done); }\n cur = {changes: [historyChangeFromChange(doc, change)],\n generation: hist.generation};\n hist.done.push(cur);\n while (hist.done.length > hist.undoDepth) {\n hist.done.shift();\n if (!hist.done[0].ranges) { hist.done.shift(); }\n }\n }\n hist.done.push(selAfter);\n hist.generation = ++hist.maxGeneration;\n hist.lastModTime = hist.lastSelTime = time;\n hist.lastOp = hist.lastSelOp = opId;\n hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n if (!last) { signal(doc, \"historyAdded\"); }\n}" ]
[ "0.696248", "0.694849", "0.69350445", "0.69350445", "0.6926954", "0.6926954", "0.6926954", "0.6926954", "0.6926954", "0.6926954", "0.6926954", "0.6926954", "0.6926954", "0.6926954", "0.6926954", "0.69227433", "0.69227433", "0.69227433", "0.6911714", "0.6911714", "0.6911714", "0.6911714", "0.6911714", "0.6911714", "0.6911714", "0.69033945", "0.6875936", "0.57087916", "0.5550027", "0.54602206", "0.54505044", "0.5440461", "0.54179263", "0.5410032", "0.5410032", "0.5408717", "0.5405152", "0.54023486", "0.54023486", "0.54023486", "0.54023486", "0.54023486", "0.54023486", "0.54023486", "0.5370273", "0.5370273", "0.5370273", "0.5370273", "0.5370273", "0.5370273", "0.5370273", "0.5370273", "0.5370273", "0.5370273", "0.5370273", "0.5370273", "0.5370273", "0.5370273", "0.5370273", "0.5365812", "0.53480023", "0.53480023", "0.5343585", "0.5343585", "0.53185153", "0.53185153", "0.53185153", "0.53185153", "0.53185153", "0.53185153", "0.53185153", "0.53185153", "0.53185153", "0.53185153", "0.53185153", "0.5314553", "0.53091156", "0.5283525", "0.5256427", "0.522673", "0.5225467", "0.52152056", "0.52152056", "0.5205216" ]
0.68901587
38
Pop all selection events off the end of a history array. Stop at a change event.
function clearSelectionEvents(array) { while (array.length) { var last = lst(array); if (last.ranges) { array.pop(); } else { break } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clearSelectionEvents(array) {\n\t\t while (array.length) {\n\t\t var last = lst(array);\n\t\t if (last.ranges) array.pop();\n\t\t else break;\n\t\t }\n\t\t }", "function clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array);\n if (last.ranges) array.pop();\n else break;\n }\n }", "function clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array);\n if (last.ranges) array.pop();\n else break;\n }\n }", "function clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array);\n if (last.ranges) array.pop();\n else break;\n }\n }", "function clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array);\n if (last.ranges) array.pop();\n else break;\n }\n }", "function clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array);\n if (last.ranges) array.pop();\n else break;\n }\n }", "function clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array);\n if (last.ranges) array.pop();\n else break;\n }\n }", "function clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array);\n if (last.ranges) array.pop();\n else break;\n }\n }", "function clearSelectionEvents(array) {\n\t\t while (array.length) {\n\t\t var last = lst(array);\n\t\t if (last.ranges) { array.pop(); }\n\t\t else { break }\n\t\t }\n\t\t }", "function clearSelectionEvents(array) {\n\t while (array.length) {\n\t var last = lst(array);\n\t if (last.ranges) array.pop();\n\t else break;\n\t }\n\t }", "function clearSelectionEvents(array) {\n\t while (array.length) {\n\t var last = lst(array);\n\t if (last.ranges) array.pop();\n\t else break;\n\t }\n\t }", "function clearSelectionEvents(array) {\n\t while (array.length) {\n\t var last = lst(array);\n\t if (last.ranges) array.pop();\n\t else break;\n\t }\n\t }", "function clearSelectionEvents(array) {\r\n while (array.length) {\r\n var last = lst(array);\r\n if (last.ranges) array.pop();\r\n else break;\r\n }\r\n }", "function clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array);\n if (last.ranges) { array.pop(); }\n else { break }\n }\n}", "function clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array);\n if (last.ranges) { array.pop(); }\n else { break }\n }\n}", "function clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array);\n if (last.ranges) { array.pop(); }\n else { break }\n }\n}", "function clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array);\n if (last.ranges) { array.pop(); }\n else { break }\n }\n}", "function clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array);\n if (last.ranges) { array.pop(); }\n else { break }\n }\n}", "function clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array);\n if (last.ranges) { array.pop(); }\n else { break }\n }\n}", "function clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array);\n if (last.ranges) { array.pop(); }\n else { break }\n }\n}", "function clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array);\n if (last.ranges) { array.pop(); }\n else { break }\n }\n}", "function clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array);\n if (last.ranges) { array.pop(); }\n else { break }\n }\n}", "function clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array);\n if (last.ranges) { array.pop(); }\n else { break }\n }\n}", "function clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array);\n if (last.ranges) { array.pop(); }\n else { break }\n }\n}", "function clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array)\n if (last.ranges) { array.pop() }\n else { break }\n }\n}", "function clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array)\n if (last.ranges) { array.pop() }\n else { break }\n }\n}", "function clearSelectionEvents(array) {\r\n while (array.length) {\r\n var last = lst(array);\r\n if (last.ranges) { array.pop(); }\r\n else { break }\r\n }\r\n}", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done);\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done);\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done);\n }\n } // Register a change in the history. Merges changes that are within", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n }", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n }", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n }", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n }", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n }", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n }", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n }", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n }", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n }", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n }", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n }", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n }", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n }", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n }", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n }", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n }", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n }", "function lastChangeEvent(hist, force) {\n\t\t if (force) {\n\t\t clearSelectionEvents(hist.done);\n\t\t return lst(hist.done)\n\t\t } else if (hist.done.length && !lst(hist.done).ranges) {\n\t\t return lst(hist.done)\n\t\t } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n\t\t hist.done.pop();\n\t\t return lst(hist.done)\n\t\t }\n\t\t }", "function lastChangeEvent(hist, force) {\n\t if (force) {\n\t clearSelectionEvents(hist.done);\n\t return lst(hist.done);\n\t } else if (hist.done.length && !lst(hist.done).ranges) {\n\t return lst(hist.done);\n\t } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n\t hist.done.pop();\n\t return lst(hist.done);\n\t }\n\t }", "function lastChangeEvent(hist, force) {\n\t if (force) {\n\t clearSelectionEvents(hist.done);\n\t return lst(hist.done);\n\t } else if (hist.done.length && !lst(hist.done).ranges) {\n\t return lst(hist.done);\n\t } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n\t hist.done.pop();\n\t return lst(hist.done);\n\t }\n\t }", "function lastChangeEvent(hist, force) {\n\t if (force) {\n\t clearSelectionEvents(hist.done);\n\t return lst(hist.done);\n\t } else if (hist.done.length && !lst(hist.done).ranges) {\n\t return lst(hist.done);\n\t } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n\t hist.done.pop();\n\t return lst(hist.done);\n\t }\n\t }", "function lastChangeEvent(hist, force) {\n\t\t if (force) {\n\t\t clearSelectionEvents(hist.done);\n\t\t return lst(hist.done);\n\t\t } else if (hist.done.length && !lst(hist.done).ranges) {\n\t\t return lst(hist.done);\n\t\t } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n\t\t hist.done.pop();\n\t\t return lst(hist.done);\n\t\t }\n\t\t }", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done);\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done);\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done);\n }\n }", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done);\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done);\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done);\n }\n }", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done);\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done);\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done);\n }\n }", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done);\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done);\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done);\n }\n }", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done);\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done);\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done);\n }\n }", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done);\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done);\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done);\n }\n }", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done);\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done);\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done);\n }\n }", "function lastChangeEvent(hist, force) {\r\n if (force) {\r\n clearSelectionEvents(hist.done);\r\n return lst(hist.done);\r\n } else if (hist.done.length && !lst(hist.done).ranges) {\r\n return lst(hist.done);\r\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\r\n hist.done.pop();\r\n return lst(hist.done);\r\n }\r\n }", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n}", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n}", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n}", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n}", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n}", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n}", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n}", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n}", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n}", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n}", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n}", "function lastChangeEvent(hist, force) {\r\n if (force) {\r\n clearSelectionEvents(hist.done);\r\n return lst(hist.done)\r\n } else if (hist.done.length && !lst(hist.done).ranges) {\r\n return lst(hist.done)\r\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\r\n hist.done.pop();\r\n return lst(hist.done)\r\n }\r\n}", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done)\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop()\n return lst(hist.done)\n }\n}", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done)\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop()\n return lst(hist.done)\n }\n}", "function copyHistoryArray(events, newGroup, instantiateSel) {\n\t\t for (var i = 0, copy = []; i < events.length; ++i) {\n\t\t var event = events[i];\n\t\t if (event.ranges) {\n\t\t copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);\n\t\t continue;\n\t\t }\n\t\t var changes = event.changes, newChanges = [];\n\t\t copy.push({changes: newChanges});\n\t\t for (var j = 0; j < changes.length; ++j) {\n\t\t var change = changes[j], m;\n\t\t newChanges.push({from: change.from, to: change.to, text: change.text});\n\t\t if (newGroup) for (var prop in change) if (m = prop.match(/^spans_(\\d+)$/)) {\n\t\t if (indexOf(newGroup, Number(m[1])) > -1) {\n\t\t lst(newChanges)[prop] = change[prop];\n\t\t delete change[prop];\n\t\t }\n\t\t }\n\t\t }\n\t\t }\n\t\t return copy;\n\t\t }", "function copyHistoryArray(events, newGroup, instantiateSel) {\n var copy = [];\n\n for (var i = 0; i < events.length; ++i) {\n var event = events[i];\n\n if (event.ranges) {\n copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);\n continue;\n }\n\n var changes = event.changes,\n newChanges = [];\n copy.push({\n changes: newChanges\n });\n\n for (var j = 0; j < changes.length; ++j) {\n var change = changes[j],\n m = void 0;\n newChanges.push({\n from: change.from,\n to: change.to,\n text: change.text\n });\n\n if (newGroup) {\n for (var prop in change) {\n if (m = prop.match(/^spans_(\\d+)$/)) {\n if (indexOf(newGroup, Number(m[1])) > -1) {\n lst(newChanges)[prop] = change[prop];\n delete change[prop];\n }\n }\n }\n }\n }\n }\n\n return copy;\n } // The 'scroll' parameter given to many of these indicated whether", "function copyHistoryArray(events, newGroup, instantiateSel) {\n\t\t var copy = [];\n\t\t for (var i = 0; i < events.length; ++i) {\n\t\t var event = events[i];\n\t\t if (event.ranges) {\n\t\t copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);\n\t\t continue\n\t\t }\n\t\t var changes = event.changes, newChanges = [];\n\t\t copy.push({changes: newChanges});\n\t\t for (var j = 0; j < changes.length; ++j) {\n\t\t var change = changes[j], m = (void 0);\n\t\t newChanges.push({from: change.from, to: change.to, text: change.text});\n\t\t if (newGroup) { for (var prop in change) { if (m = prop.match(/^spans_(\\d+)$/)) {\n\t\t if (indexOf(newGroup, Number(m[1])) > -1) {\n\t\t lst(newChanges)[prop] = change[prop];\n\t\t delete change[prop];\n\t\t }\n\t\t } } }\n\t\t }\n\t\t }\n\t\t return copy\n\t\t }", "_emitChangeEvent() {\n // Clear the selected values so they can be re-cached.\n this._selected = null;\n\n if (this._selectedToEmit.length || this._deselectedToEmit.length) {\n this.changed.next({\n source: this,\n added: this._selectedToEmit,\n removed: this._deselectedToEmit\n });\n this._deselectedToEmit = [];\n this._selectedToEmit = [];\n }\n }", "function clearChangeHistory() {\n changeHistory = [];\n historyPosition = 0;\n }", "function copyHistoryArray(events, newGroup, instantiateSel) {\n\t for (var i = 0, copy = []; i < events.length; ++i) {\n\t var event = events[i];\n\t if (event.ranges) {\n\t copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);\n\t continue;\n\t }\n\t var changes = event.changes, newChanges = [];\n\t copy.push({changes: newChanges});\n\t for (var j = 0; j < changes.length; ++j) {\n\t var change = changes[j], m;\n\t newChanges.push({from: change.from, to: change.to, text: change.text});\n\t if (newGroup) for (var prop in change) if (m = prop.match(/^spans_(\\d+)$/)) {\n\t if (indexOf(newGroup, Number(m[1])) > -1) {\n\t lst(newChanges)[prop] = change[prop];\n\t delete change[prop];\n\t }\n\t }\n\t }\n\t }\n\t return copy;\n\t }", "function copyHistoryArray(events, newGroup, instantiateSel) {\n\t for (var i = 0, copy = []; i < events.length; ++i) {\n\t var event = events[i];\n\t if (event.ranges) {\n\t copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);\n\t continue;\n\t }\n\t var changes = event.changes, newChanges = [];\n\t copy.push({changes: newChanges});\n\t for (var j = 0; j < changes.length; ++j) {\n\t var change = changes[j], m;\n\t newChanges.push({from: change.from, to: change.to, text: change.text});\n\t if (newGroup) for (var prop in change) if (m = prop.match(/^spans_(\\d+)$/)) {\n\t if (indexOf(newGroup, Number(m[1])) > -1) {\n\t lst(newChanges)[prop] = change[prop];\n\t delete change[prop];\n\t }\n\t }\n\t }\n\t }\n\t return copy;\n\t }", "function copyHistoryArray(events, newGroup, instantiateSel) {\n\t for (var i = 0, copy = []; i < events.length; ++i) {\n\t var event = events[i];\n\t if (event.ranges) {\n\t copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);\n\t continue;\n\t }\n\t var changes = event.changes, newChanges = [];\n\t copy.push({changes: newChanges});\n\t for (var j = 0; j < changes.length; ++j) {\n\t var change = changes[j], m;\n\t newChanges.push({from: change.from, to: change.to, text: change.text});\n\t if (newGroup) for (var prop in change) if (m = prop.match(/^spans_(\\d+)$/)) {\n\t if (indexOf(newGroup, Number(m[1])) > -1) {\n\t lst(newChanges)[prop] = change[prop];\n\t delete change[prop];\n\t }\n\t }\n\t }\n\t }\n\t return copy;\n\t }", "_emitChangeEvent() {\n // Clear the selected values so they can be re-cached.\n this._selected = null;\n if (this._selectedToEmit.length || this._deselectedToEmit.length) {\n this.changed.next({\n source: this,\n added: this._selectedToEmit,\n removed: this._deselectedToEmit\n });\n this._deselectedToEmit = [];\n this._selectedToEmit = [];\n }\n }", "_emitChangeEvent() {\n // Clear the selected values so they can be re-cached.\n this._selected = null;\n if (this._selectedToEmit.length || this._deselectedToEmit.length) {\n this.changed.next({\n source: this,\n added: this._selectedToEmit,\n removed: this._deselectedToEmit\n });\n this._deselectedToEmit = [];\n this._selectedToEmit = [];\n }\n }", "function copyHistoryArray(events, newGroup, instantiateSel) {\n var copy = [];\n for (var i = 0; i < events.length; ++i) {\n var event = events[i];\n if (event.ranges) {\n copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);\n continue\n }\n var changes = event.changes, newChanges = [];\n copy.push({changes: newChanges});\n for (var j = 0; j < changes.length; ++j) {\n var change = changes[j], m = (void 0);\n newChanges.push({from: change.from, to: change.to, text: change.text});\n if (newGroup) { for (var prop in change) { if (m = prop.match(/^spans_(\\d+)$/)) {\n if (indexOf(newGroup, Number(m[1])) > -1) {\n lst(newChanges)[prop] = change[prop];\n delete change[prop];\n }\n } } }\n }\n }\n return copy\n }", "function copyHistoryArray(events, newGroup, instantiateSel) {\n var copy = [];\n for (var i = 0; i < events.length; ++i) {\n var event = events[i];\n if (event.ranges) {\n copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);\n continue\n }\n var changes = event.changes, newChanges = [];\n copy.push({changes: newChanges});\n for (var j = 0; j < changes.length; ++j) {\n var change = changes[j], m = (void 0);\n newChanges.push({from: change.from, to: change.to, text: change.text});\n if (newGroup) { for (var prop in change) { if (m = prop.match(/^spans_(\\d+)$/)) {\n if (indexOf(newGroup, Number(m[1])) > -1) {\n lst(newChanges)[prop] = change[prop];\n delete change[prop];\n }\n } } }\n }\n }\n return copy\n }" ]
[ "0.7114935", "0.7105218", "0.7105218", "0.7105218", "0.7105218", "0.7105218", "0.7105218", "0.7105218", "0.71047795", "0.71020734", "0.71020734", "0.71020734", "0.70783186", "0.69916886", "0.69916886", "0.69916886", "0.69916886", "0.69916886", "0.69916886", "0.69916886", "0.69916886", "0.69916886", "0.69916886", "0.69916886", "0.6986545", "0.6986545", "0.6984379", "0.6480903", "0.64544725", "0.64544725", "0.64544725", "0.64544725", "0.64544725", "0.64544725", "0.64544725", "0.64544725", "0.64544725", "0.64544725", "0.64544725", "0.64544725", "0.64544725", "0.64544725", "0.64544725", "0.64544725", "0.64544725", "0.6445547", "0.6424096", "0.6424096", "0.6424096", "0.6414392", "0.6412145", "0.6412145", "0.6412145", "0.6412145", "0.6412145", "0.6412145", "0.6412145", "0.6392813", "0.6379418", "0.6379418", "0.6379418", "0.6379418", "0.6379418", "0.6379418", "0.6379418", "0.6379418", "0.6379418", "0.6379418", "0.6379418", "0.63730574", "0.6371138", "0.6371138", "0.6325889", "0.62917006", "0.62755126", "0.6253001", "0.62403595", "0.62351763", "0.62351763", "0.62351763", "0.62292457", "0.62292457", "0.62143356", "0.62143356" ]
0.7082853
24
Find the top change event in the history. Pop off selection events that are in the way.
function lastChangeEvent(hist, force) { if (force) { clearSelectionEvents(hist.done); return lst(hist.done) } else if (hist.done.length && !lst(hist.done).ranges) { return lst(hist.done) } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) { hist.done.pop(); return lst(hist.done) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done);\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done);\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done);\n }\n } // Register a change in the history. Merges changes that are within", "function lastChangeEvent(hist, force) {\n\t\t if (force) {\n\t\t clearSelectionEvents(hist.done);\n\t\t return lst(hist.done)\n\t\t } else if (hist.done.length && !lst(hist.done).ranges) {\n\t\t return lst(hist.done)\n\t\t } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n\t\t hist.done.pop();\n\t\t return lst(hist.done)\n\t\t }\n\t\t }", "function lastChangeEvent(hist, force) {\n\t\t if (force) {\n\t\t clearSelectionEvents(hist.done);\n\t\t return lst(hist.done);\n\t\t } else if (hist.done.length && !lst(hist.done).ranges) {\n\t\t return lst(hist.done);\n\t\t } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n\t\t hist.done.pop();\n\t\t return lst(hist.done);\n\t\t }\n\t\t }", "function lastChangeEvent(hist, force) {\n\t if (force) {\n\t clearSelectionEvents(hist.done);\n\t return lst(hist.done);\n\t } else if (hist.done.length && !lst(hist.done).ranges) {\n\t return lst(hist.done);\n\t } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n\t hist.done.pop();\n\t return lst(hist.done);\n\t }\n\t }", "function lastChangeEvent(hist, force) {\n\t if (force) {\n\t clearSelectionEvents(hist.done);\n\t return lst(hist.done);\n\t } else if (hist.done.length && !lst(hist.done).ranges) {\n\t return lst(hist.done);\n\t } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n\t hist.done.pop();\n\t return lst(hist.done);\n\t }\n\t }", "function lastChangeEvent(hist, force) {\n\t if (force) {\n\t clearSelectionEvents(hist.done);\n\t return lst(hist.done);\n\t } else if (hist.done.length && !lst(hist.done).ranges) {\n\t return lst(hist.done);\n\t } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n\t hist.done.pop();\n\t return lst(hist.done);\n\t }\n\t }", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done);\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done);\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done);\n }\n }", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done);\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done);\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done);\n }\n }", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done);\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done);\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done);\n }\n }", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done);\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done);\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done);\n }\n }", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done);\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done);\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done);\n }\n }", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done);\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done);\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done);\n }\n }", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done);\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done);\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done);\n }\n }", "function lastChangeEvent(hist, force) {\r\n if (force) {\r\n clearSelectionEvents(hist.done);\r\n return lst(hist.done);\r\n } else if (hist.done.length && !lst(hist.done).ranges) {\r\n return lst(hist.done);\r\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\r\n hist.done.pop();\r\n return lst(hist.done);\r\n }\r\n }", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done)\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop()\n return lst(hist.done)\n }\n}", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done)\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop()\n return lst(hist.done)\n }\n}", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n}", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n}", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n}", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n}", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n}", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n}", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n}", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n}", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n}", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n}", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n}", "function lastChangeEvent(hist, force) {\r\n if (force) {\r\n clearSelectionEvents(hist.done);\r\n return lst(hist.done)\r\n } else if (hist.done.length && !lst(hist.done).ranges) {\r\n return lst(hist.done)\r\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\r\n hist.done.pop();\r\n return lst(hist.done)\r\n }\r\n}", "function historyChangeFromChange(doc, change) {\n\t\t var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n\t\t attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n\t\t linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n\t\t return histChange\n\t\t }", "function historyChangeFromChange(doc, change) {\n\t\t var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n\t\t attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n\t\t linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\n\t\t return histChange;\n\t\t }", "function historyChangeFromChange(doc, change) {\n\t var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n\t attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n\t linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\n\t return histChange;\n\t }", "function historyChangeFromChange(doc, change) {\n\t var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n\t attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n\t linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\n\t return histChange;\n\t }", "function historyChangeFromChange(doc, change) {\n\t var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n\t attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n\t linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\n\t return histChange;\n\t }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\n return histChange;\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\n return histChange;\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\n return histChange;\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\n return histChange;\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\n return histChange;\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\n return histChange;\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\n return histChange;\n }", "function historyChangeFromChange(doc, change) {\r\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\r\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\r\n linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\r\n return histChange;\r\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n}", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n}", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n}", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n}", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n}", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n}", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n}", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n}", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n}", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n}", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n}", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)}\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1)\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true)\n return histChange\n}", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)}\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1)\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true)\n return histChange\n}", "function addChangeToHistory(doc, change, selAfter, opId) {\n\t\t var hist = doc.history;\n\t\t hist.undone.length = 0;\n\t\t var time = +new Date, cur;\n\t\t var last;\n\n\t\t if ((hist.lastOp == opId ||\n\t\t hist.lastOrigin == change.origin && change.origin &&\n\t\t ((change.origin.charAt(0) == \"+\" && hist.lastModTime > time - (doc.cm ? doc.cm.options.historyEventDelay : 500)) ||\n\t\t change.origin.charAt(0) == \"*\")) &&\n\t\t (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n\t\t // Merge this change into the last event\n\t\t last = lst(cur.changes);\n\t\t if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n\t\t // Optimized case for simple insertion -- don't want to add\n\t\t // new changesets for every character typed\n\t\t last.to = changeEnd(change);\n\t\t } else {\n\t\t // Add new sub-event\n\t\t cur.changes.push(historyChangeFromChange(doc, change));\n\t\t }\n\t\t } else {\n\t\t // Can not be merged, start a new event.\n\t\t var before = lst(hist.done);\n\t\t if (!before || !before.ranges)\n\t\t { pushSelectionToHistory(doc.sel, hist.done); }\n\t\t cur = {changes: [historyChangeFromChange(doc, change)],\n\t\t generation: hist.generation};\n\t\t hist.done.push(cur);\n\t\t while (hist.done.length > hist.undoDepth) {\n\t\t hist.done.shift();\n\t\t if (!hist.done[0].ranges) { hist.done.shift(); }\n\t\t }\n\t\t }\n\t\t hist.done.push(selAfter);\n\t\t hist.generation = ++hist.maxGeneration;\n\t\t hist.lastModTime = hist.lastSelTime = time;\n\t\t hist.lastOp = hist.lastSelOp = opId;\n\t\t hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n\t\t if (!last) { signal(doc, \"historyAdded\"); }\n\t\t }", "function historyChangeFromChange(doc, change) {\r\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\r\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\r\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\r\n return histChange\r\n}", "function addChangeToHistory(doc, change, selAfter, opId) {\n\t\t var hist = doc.history;\n\t\t hist.undone.length = 0;\n\t\t var time = +new Date, cur;\n\t\t\n\t\t if ((hist.lastOp == opId ||\n\t\t hist.lastOrigin == change.origin && change.origin &&\n\t\t ((change.origin.charAt(0) == \"+\" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||\n\t\t change.origin.charAt(0) == \"*\")) &&\n\t\t (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n\t\t // Merge this change into the last event\n\t\t var last = lst(cur.changes);\n\t\t if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n\t\t // Optimized case for simple insertion -- don't want to add\n\t\t // new changesets for every character typed\n\t\t last.to = changeEnd(change);\n\t\t } else {\n\t\t // Add new sub-event\n\t\t cur.changes.push(historyChangeFromChange(doc, change));\n\t\t }\n\t\t } else {\n\t\t // Can not be merged, start a new event.\n\t\t var before = lst(hist.done);\n\t\t if (!before || !before.ranges)\n\t\t pushSelectionToHistory(doc.sel, hist.done);\n\t\t cur = {changes: [historyChangeFromChange(doc, change)],\n\t\t generation: hist.generation};\n\t\t hist.done.push(cur);\n\t\t while (hist.done.length > hist.undoDepth) {\n\t\t hist.done.shift();\n\t\t if (!hist.done[0].ranges) hist.done.shift();\n\t\t }\n\t\t }\n\t\t hist.done.push(selAfter);\n\t\t hist.generation = ++hist.maxGeneration;\n\t\t hist.lastModTime = hist.lastSelTime = time;\n\t\t hist.lastOp = hist.lastSelOp = opId;\n\t\t hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\t\t\n\t\t if (!last) signal(doc, \"historyAdded\");\n\t\t }", "function pushChangeHistory( changeType ) {\n if ( historyPosition < changeHistory.length-1 )\n changeHistory = changeHistory.slice(0,historyPosition+1);\n\n var state = {\n type: changeType,\n svg: self.getSvgClone(true),\n panzoom: panzoom ? [ xmin, ymin, width, height, boxX0, boxY0, boxW, boxH ] : false ,\n mode: self.mode.current,\n selected: getElementPath( $(svgRoot).find('.selected') )\n };\n\n if ( changeHistory.length && changeHistory[changeHistory.length-1].type === changeType )\n changeHistory[changeHistory.length-1] = state;\n else\n changeHistory.push(state);\n\n if ( changeHistory.length > self.cfg.historySize )\n changeHistory.shift();\n\n historyPosition = changeHistory.length-1;\n //self.util.changeHistory = changeHistory;\n }", "function makeChangeFromHistory(doc, type, allowSelectionOnly) {\n\t\t var suppress = doc.cm && doc.cm.state.suppressEdits;\n\t\t if (suppress && !allowSelectionOnly) { return }\n\n\t\t var hist = doc.history, event, selAfter = doc.sel;\n\t\t var source = type == \"undo\" ? hist.done : hist.undone, dest = type == \"undo\" ? hist.undone : hist.done;\n\n\t\t // Verify that there is a useable event (so that ctrl-z won't\n\t\t // needlessly clear selection events)\n\t\t var i = 0;\n\t\t for (; i < source.length; i++) {\n\t\t event = source[i];\n\t\t if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges)\n\t\t { break }\n\t\t }\n\t\t if (i == source.length) { return }\n\t\t hist.lastOrigin = hist.lastSelOrigin = null;\n\n\t\t for (;;) {\n\t\t event = source.pop();\n\t\t if (event.ranges) {\n\t\t pushSelectionToHistory(event, dest);\n\t\t if (allowSelectionOnly && !event.equals(doc.sel)) {\n\t\t setSelection(doc, event, {clearRedo: false});\n\t\t return\n\t\t }\n\t\t selAfter = event;\n\t\t } else if (suppress) {\n\t\t source.push(event);\n\t\t return\n\t\t } else { break }\n\t\t }\n\n\t\t // Build up a reverse change object to add to the opposite history\n\t\t // stack (redo when undoing, and vice versa).\n\t\t var antiChanges = [];\n\t\t pushSelectionToHistory(selAfter, dest);\n\t\t dest.push({changes: antiChanges, generation: hist.generation});\n\t\t hist.generation = event.generation || ++hist.maxGeneration;\n\n\t\t var filter = hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\");\n\n\t\t var loop = function ( i ) {\n\t\t var change = event.changes[i];\n\t\t change.origin = type;\n\t\t if (filter && !filterChange(doc, change, false)) {\n\t\t source.length = 0;\n\t\t return {}\n\t\t }\n\n\t\t antiChanges.push(historyChangeFromChange(doc, change));\n\n\t\t var after = i ? computeSelAfterChange(doc, change) : lst(source);\n\t\t makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change));\n\t\t if (!i && doc.cm) { doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)}); }\n\t\t var rebased = [];\n\n\t\t // Propagate to the linked documents\n\t\t linkedDocs(doc, function (doc, sharedHist) {\n\t\t if (!sharedHist && indexOf(rebased, doc.history) == -1) {\n\t\t rebaseHist(doc.history, change);\n\t\t rebased.push(doc.history);\n\t\t }\n\t\t makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change));\n\t\t });\n\t\t };\n\n\t\t for (var i$1 = event.changes.length - 1; i$1 >= 0; --i$1) {\n\t\t var returned = loop( i$1 );\n\n\t\t if ( returned ) return returned.v;\n\t\t }\n\t\t }", "function fr(e,t,a,n){var r=e.history;r.undone.length=0;var f,o,i=+new Date;if((r.lastOp==n||r.lastOrigin==t.origin&&t.origin&&(\"+\"==t.origin.charAt(0)&&r.lastModTime>i-(e.cm?e.cm.options.historyEventDelay:500)||\"*\"==t.origin.charAt(0)))&&(f=rr(r,r.lastOp==n)))\n // Merge this change into the last event\n o=p(f.changes),0==P(t.from,t.to)&&0==P(t.from,o.to)?\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n o.to=qn(t):\n // Add new sub-event\n f.changes.push(ar(e,t));else{\n // Can not be merged, start a new event.\n var s=p(r.done);for(s&&s.ranges||sr(e.sel,r.done),f={changes:[ar(e,t)],generation:r.generation},r.done.push(f);r.done.length>r.undoDepth;)r.done.shift(),r.done[0].ranges||r.done.shift()}r.done.push(a),r.generation=++r.maxGeneration,r.lastModTime=r.lastSelTime=i,r.lastOp=r.lastSelOp=n,r.lastOrigin=r.lastSelOrigin=t.origin,o||Te(e,\"historyAdded\")}", "function addChangeToHistory(doc, change, selAfter, opId) {\n\t var hist = doc.history;\n\t hist.undone.length = 0;\n\t var time = +new Date, cur;\n\t\n\t if ((hist.lastOp == opId ||\n\t hist.lastOrigin == change.origin && change.origin &&\n\t ((change.origin.charAt(0) == \"+\" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||\n\t change.origin.charAt(0) == \"*\")) &&\n\t (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n\t // Merge this change into the last event\n\t var last = lst(cur.changes);\n\t if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n\t // Optimized case for simple insertion -- don't want to add\n\t // new changesets for every character typed\n\t last.to = changeEnd(change);\n\t } else {\n\t // Add new sub-event\n\t cur.changes.push(historyChangeFromChange(doc, change));\n\t }\n\t } else {\n\t // Can not be merged, start a new event.\n\t var before = lst(hist.done);\n\t if (!before || !before.ranges)\n\t pushSelectionToHistory(doc.sel, hist.done);\n\t cur = {changes: [historyChangeFromChange(doc, change)],\n\t generation: hist.generation};\n\t hist.done.push(cur);\n\t while (hist.done.length > hist.undoDepth) {\n\t hist.done.shift();\n\t if (!hist.done[0].ranges) hist.done.shift();\n\t }\n\t }\n\t hist.done.push(selAfter);\n\t hist.generation = ++hist.maxGeneration;\n\t hist.lastModTime = hist.lastSelTime = time;\n\t hist.lastOp = hist.lastSelOp = opId;\n\t hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\t\n\t if (!last) signal(doc, \"historyAdded\");\n\t }", "function addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history;\n hist.undone.length = 0;\n var time = +new Date, cur;\n var last;\n\n if ((hist.lastOp == opId ||\n hist.lastOrigin == change.origin && change.origin &&\n ((change.origin.charAt(0) == \"+\" && hist.lastModTime > time - (doc.cm ? doc.cm.options.historyEventDelay : 500)) ||\n change.origin.charAt(0) == \"*\")) &&\n (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n // Merge this change into the last event\n last = lst(cur.changes);\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n last.to = changeEnd(change);\n } else {\n // Add new sub-event\n cur.changes.push(historyChangeFromChange(doc, change));\n }\n } else {\n // Can not be merged, start a new event.\n var before = lst(hist.done);\n if (!before || !before.ranges)\n { pushSelectionToHistory(doc.sel, hist.done); }\n cur = {changes: [historyChangeFromChange(doc, change)],\n generation: hist.generation};\n hist.done.push(cur);\n while (hist.done.length > hist.undoDepth) {\n hist.done.shift();\n if (!hist.done[0].ranges) { hist.done.shift(); }\n }\n }\n hist.done.push(selAfter);\n hist.generation = ++hist.maxGeneration;\n hist.lastModTime = hist.lastSelTime = time;\n hist.lastOp = hist.lastSelOp = opId;\n hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n if (!last) { signal(doc, \"historyAdded\"); }\n}", "function addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history;\n hist.undone.length = 0;\n var time = +new Date, cur;\n var last;\n\n if ((hist.lastOp == opId ||\n hist.lastOrigin == change.origin && change.origin &&\n ((change.origin.charAt(0) == \"+\" && hist.lastModTime > time - (doc.cm ? doc.cm.options.historyEventDelay : 500)) ||\n change.origin.charAt(0) == \"*\")) &&\n (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n // Merge this change into the last event\n last = lst(cur.changes);\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n last.to = changeEnd(change);\n } else {\n // Add new sub-event\n cur.changes.push(historyChangeFromChange(doc, change));\n }\n } else {\n // Can not be merged, start a new event.\n var before = lst(hist.done);\n if (!before || !before.ranges)\n { pushSelectionToHistory(doc.sel, hist.done); }\n cur = {changes: [historyChangeFromChange(doc, change)],\n generation: hist.generation};\n hist.done.push(cur);\n while (hist.done.length > hist.undoDepth) {\n hist.done.shift();\n if (!hist.done[0].ranges) { hist.done.shift(); }\n }\n }\n hist.done.push(selAfter);\n hist.generation = ++hist.maxGeneration;\n hist.lastModTime = hist.lastSelTime = time;\n hist.lastOp = hist.lastSelOp = opId;\n hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n if (!last) { signal(doc, \"historyAdded\"); }\n}", "function addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history;\n hist.undone.length = 0;\n var time = +new Date, cur;\n var last;\n\n if ((hist.lastOp == opId ||\n hist.lastOrigin == change.origin && change.origin &&\n ((change.origin.charAt(0) == \"+\" && hist.lastModTime > time - (doc.cm ? doc.cm.options.historyEventDelay : 500)) ||\n change.origin.charAt(0) == \"*\")) &&\n (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n // Merge this change into the last event\n last = lst(cur.changes);\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n last.to = changeEnd(change);\n } else {\n // Add new sub-event\n cur.changes.push(historyChangeFromChange(doc, change));\n }\n } else {\n // Can not be merged, start a new event.\n var before = lst(hist.done);\n if (!before || !before.ranges)\n { pushSelectionToHistory(doc.sel, hist.done); }\n cur = {changes: [historyChangeFromChange(doc, change)],\n generation: hist.generation};\n hist.done.push(cur);\n while (hist.done.length > hist.undoDepth) {\n hist.done.shift();\n if (!hist.done[0].ranges) { hist.done.shift(); }\n }\n }\n hist.done.push(selAfter);\n hist.generation = ++hist.maxGeneration;\n hist.lastModTime = hist.lastSelTime = time;\n hist.lastOp = hist.lastSelOp = opId;\n hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n if (!last) { signal(doc, \"historyAdded\"); }\n}", "function addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history;\n hist.undone.length = 0;\n var time = +new Date, cur;\n var last;\n\n if ((hist.lastOp == opId ||\n hist.lastOrigin == change.origin && change.origin &&\n ((change.origin.charAt(0) == \"+\" && hist.lastModTime > time - (doc.cm ? doc.cm.options.historyEventDelay : 500)) ||\n change.origin.charAt(0) == \"*\")) &&\n (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n // Merge this change into the last event\n last = lst(cur.changes);\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n last.to = changeEnd(change);\n } else {\n // Add new sub-event\n cur.changes.push(historyChangeFromChange(doc, change));\n }\n } else {\n // Can not be merged, start a new event.\n var before = lst(hist.done);\n if (!before || !before.ranges)\n { pushSelectionToHistory(doc.sel, hist.done); }\n cur = {changes: [historyChangeFromChange(doc, change)],\n generation: hist.generation};\n hist.done.push(cur);\n while (hist.done.length > hist.undoDepth) {\n hist.done.shift();\n if (!hist.done[0].ranges) { hist.done.shift(); }\n }\n }\n hist.done.push(selAfter);\n hist.generation = ++hist.maxGeneration;\n hist.lastModTime = hist.lastSelTime = time;\n hist.lastOp = hist.lastSelOp = opId;\n hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n if (!last) { signal(doc, \"historyAdded\"); }\n}", "function addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history;\n hist.undone.length = 0;\n var time = +new Date, cur;\n var last;\n\n if ((hist.lastOp == opId ||\n hist.lastOrigin == change.origin && change.origin &&\n ((change.origin.charAt(0) == \"+\" && hist.lastModTime > time - (doc.cm ? doc.cm.options.historyEventDelay : 500)) ||\n change.origin.charAt(0) == \"*\")) &&\n (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n // Merge this change into the last event\n last = lst(cur.changes);\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n last.to = changeEnd(change);\n } else {\n // Add new sub-event\n cur.changes.push(historyChangeFromChange(doc, change));\n }\n } else {\n // Can not be merged, start a new event.\n var before = lst(hist.done);\n if (!before || !before.ranges)\n { pushSelectionToHistory(doc.sel, hist.done); }\n cur = {changes: [historyChangeFromChange(doc, change)],\n generation: hist.generation};\n hist.done.push(cur);\n while (hist.done.length > hist.undoDepth) {\n hist.done.shift();\n if (!hist.done[0].ranges) { hist.done.shift(); }\n }\n }\n hist.done.push(selAfter);\n hist.generation = ++hist.maxGeneration;\n hist.lastModTime = hist.lastSelTime = time;\n hist.lastOp = hist.lastSelOp = opId;\n hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n if (!last) { signal(doc, \"historyAdded\"); }\n}", "function addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history;\n hist.undone.length = 0;\n var time = +new Date, cur;\n var last;\n\n if ((hist.lastOp == opId ||\n hist.lastOrigin == change.origin && change.origin &&\n ((change.origin.charAt(0) == \"+\" && hist.lastModTime > time - (doc.cm ? doc.cm.options.historyEventDelay : 500)) ||\n change.origin.charAt(0) == \"*\")) &&\n (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n // Merge this change into the last event\n last = lst(cur.changes);\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n last.to = changeEnd(change);\n } else {\n // Add new sub-event\n cur.changes.push(historyChangeFromChange(doc, change));\n }\n } else {\n // Can not be merged, start a new event.\n var before = lst(hist.done);\n if (!before || !before.ranges)\n { pushSelectionToHistory(doc.sel, hist.done); }\n cur = {changes: [historyChangeFromChange(doc, change)],\n generation: hist.generation};\n hist.done.push(cur);\n while (hist.done.length > hist.undoDepth) {\n hist.done.shift();\n if (!hist.done[0].ranges) { hist.done.shift(); }\n }\n }\n hist.done.push(selAfter);\n hist.generation = ++hist.maxGeneration;\n hist.lastModTime = hist.lastSelTime = time;\n hist.lastOp = hist.lastSelOp = opId;\n hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n if (!last) { signal(doc, \"historyAdded\"); }\n}" ]
[ "0.6685738", "0.63823617", "0.6360518", "0.6342472", "0.6342472", "0.6342472", "0.6278475", "0.6278475", "0.6278475", "0.6278475", "0.6278475", "0.6278475", "0.6278475", "0.62490594", "0.623188", "0.623188", "0.62148124", "0.62148124", "0.62148124", "0.62148124", "0.62148124", "0.62148124", "0.62148124", "0.62148124", "0.62148124", "0.62148124", "0.62148124", "0.6197767", "0.60240734", "0.6019671", "0.599199", "0.599199", "0.599199", "0.59276307", "0.59276307", "0.59276307", "0.59276307", "0.59276307", "0.59276307", "0.59276307", "0.5913896", "0.5910462", "0.5910462", "0.5910462", "0.5910462", "0.5910462", "0.5910462", "0.5910462", "0.5910462", "0.5910462", "0.5910462", "0.5910462", "0.5910462", "0.5910462", "0.5910462", "0.5910462", "0.5910462", "0.5910462", "0.58746517", "0.58746517", "0.58746517", "0.58746517", "0.58746517", "0.58746517", "0.58746517", "0.58746517", "0.58746517", "0.58746517", "0.58746517", "0.5872534", "0.5872534", "0.5844426", "0.5844302", "0.5821813", "0.58025944", "0.5794968", "0.5783536", "0.5693899", "0.56879437", "0.56879437", "0.56879437", "0.56879437", "0.56879437", "0.56879437" ]
0.6287687
22
Register a change in the history. Merges changes that are within a single operation, or are close together with an origin that allows merging (starting with "+") into a single event.
function addChangeToHistory(doc, change, selAfter, opId) { var hist = doc.history; hist.undone.length = 0; var time = +new Date, cur; var last; if ((hist.lastOp == opId || hist.lastOrigin == change.origin && change.origin && ((change.origin.charAt(0) == "+" && hist.lastModTime > time - (doc.cm ? doc.cm.options.historyEventDelay : 500)) || change.origin.charAt(0) == "*")) && (cur = lastChangeEvent(hist, hist.lastOp == opId))) { // Merge this change into the last event last = lst(cur.changes); if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) { // Optimized case for simple insertion -- don't want to add // new changesets for every character typed last.to = changeEnd(change); } else { // Add new sub-event cur.changes.push(historyChangeFromChange(doc, change)); } } else { // Can not be merged, start a new event. var before = lst(hist.done); if (!before || !before.ranges) { pushSelectionToHistory(doc.sel, hist.done); } cur = {changes: [historyChangeFromChange(doc, change)], generation: hist.generation}; hist.done.push(cur); while (hist.done.length > hist.undoDepth) { hist.done.shift(); if (!hist.done[0].ranges) { hist.done.shift(); } } } hist.done.push(selAfter); hist.generation = ++hist.maxGeneration; hist.lastModTime = hist.lastSelTime = time; hist.lastOp = hist.lastSelOp = opId; hist.lastOrigin = hist.lastSelOrigin = change.origin; if (!last) { signal(doc, "historyAdded"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history;\n hist.undone.length = 0;\n var time = +new Date, cur;\n\n if ((hist.lastOp == opId ||\n hist.lastOrigin == change.origin && change.origin &&\n ((change.origin.charAt(0) == \"+\" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||\n change.origin.charAt(0) == \"*\")) &&\n (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n // Merge this change into the last event\n var last = lst(cur.changes);\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n last.to = changeEnd(change);\n } else {\n // Add new sub-event\n cur.changes.push(historyChangeFromChange(doc, change));\n }\n } else {\n // Can not be merged, start a new event.\n var before = lst(hist.done);\n if (!before || !before.ranges)\n pushSelectionToHistory(doc.sel, hist.done);\n cur = {changes: [historyChangeFromChange(doc, change)],\n generation: hist.generation};\n hist.done.push(cur);\n while (hist.done.length > hist.undoDepth) {\n hist.done.shift();\n if (!hist.done[0].ranges) hist.done.shift();\n }\n }\n hist.done.push(selAfter);\n hist.generation = ++hist.maxGeneration;\n hist.lastModTime = hist.lastSelTime = time;\n hist.lastOp = opId;\n hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n if (!last) signal(doc, \"historyAdded\");\n }", "function addChangeToHistory(doc, change, selAfter, opId) {\n\t\t var hist = doc.history;\n\t\t hist.undone.length = 0;\n\t\t var time = +new Date, cur;\n\t\t\n\t\t if ((hist.lastOp == opId ||\n\t\t hist.lastOrigin == change.origin && change.origin &&\n\t\t ((change.origin.charAt(0) == \"+\" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||\n\t\t change.origin.charAt(0) == \"*\")) &&\n\t\t (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n\t\t // Merge this change into the last event\n\t\t var last = lst(cur.changes);\n\t\t if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n\t\t // Optimized case for simple insertion -- don't want to add\n\t\t // new changesets for every character typed\n\t\t last.to = changeEnd(change);\n\t\t } else {\n\t\t // Add new sub-event\n\t\t cur.changes.push(historyChangeFromChange(doc, change));\n\t\t }\n\t\t } else {\n\t\t // Can not be merged, start a new event.\n\t\t var before = lst(hist.done);\n\t\t if (!before || !before.ranges)\n\t\t pushSelectionToHistory(doc.sel, hist.done);\n\t\t cur = {changes: [historyChangeFromChange(doc, change)],\n\t\t generation: hist.generation};\n\t\t hist.done.push(cur);\n\t\t while (hist.done.length > hist.undoDepth) {\n\t\t hist.done.shift();\n\t\t if (!hist.done[0].ranges) hist.done.shift();\n\t\t }\n\t\t }\n\t\t hist.done.push(selAfter);\n\t\t hist.generation = ++hist.maxGeneration;\n\t\t hist.lastModTime = hist.lastSelTime = time;\n\t\t hist.lastOp = hist.lastSelOp = opId;\n\t\t hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\t\t\n\t\t if (!last) signal(doc, \"historyAdded\");\n\t\t }", "function addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history;\n hist.undone.length = 0;\n var time = +new Date, cur;\n\n if ((hist.lastOp == opId ||\n hist.lastOrigin == change.origin && change.origin &&\n ((change.origin.charAt(0) == \"+\" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||\n change.origin.charAt(0) == \"*\")) &&\n (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n // Merge this change into the last event\n var last = lst(cur.changes);\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n last.to = changeEnd(change);\n } else {\n // Add new sub-event\n cur.changes.push(historyChangeFromChange(doc, change));\n }\n } else {\n // Can not be merged, start a new event.\n var before = lst(hist.done);\n if (!before || !before.ranges)\n pushSelectionToHistory(doc.sel, hist.done);\n cur = {changes: [historyChangeFromChange(doc, change)],\n generation: hist.generation};\n hist.done.push(cur);\n while (hist.done.length > hist.undoDepth) {\n hist.done.shift();\n if (!hist.done[0].ranges) hist.done.shift();\n }\n }\n hist.done.push(selAfter);\n hist.generation = ++hist.maxGeneration;\n hist.lastModTime = hist.lastSelTime = time;\n hist.lastOp = hist.lastSelOp = opId;\n hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n if (!last) signal(doc, \"historyAdded\");\n }", "function addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history;\n hist.undone.length = 0;\n var time = +new Date, cur;\n\n if ((hist.lastOp == opId ||\n hist.lastOrigin == change.origin && change.origin &&\n ((change.origin.charAt(0) == \"+\" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||\n change.origin.charAt(0) == \"*\")) &&\n (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n // Merge this change into the last event\n var last = lst(cur.changes);\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n last.to = changeEnd(change);\n } else {\n // Add new sub-event\n cur.changes.push(historyChangeFromChange(doc, change));\n }\n } else {\n // Can not be merged, start a new event.\n var before = lst(hist.done);\n if (!before || !before.ranges)\n pushSelectionToHistory(doc.sel, hist.done);\n cur = {changes: [historyChangeFromChange(doc, change)],\n generation: hist.generation};\n hist.done.push(cur);\n while (hist.done.length > hist.undoDepth) {\n hist.done.shift();\n if (!hist.done[0].ranges) hist.done.shift();\n }\n }\n hist.done.push(selAfter);\n hist.generation = ++hist.maxGeneration;\n hist.lastModTime = hist.lastSelTime = time;\n hist.lastOp = hist.lastSelOp = opId;\n hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n if (!last) signal(doc, \"historyAdded\");\n }", "function addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history;\n hist.undone.length = 0;\n var time = +new Date, cur;\n\n if ((hist.lastOp == opId ||\n hist.lastOrigin == change.origin && change.origin &&\n ((change.origin.charAt(0) == \"+\" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||\n change.origin.charAt(0) == \"*\")) &&\n (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n // Merge this change into the last event\n var last = lst(cur.changes);\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n last.to = changeEnd(change);\n } else {\n // Add new sub-event\n cur.changes.push(historyChangeFromChange(doc, change));\n }\n } else {\n // Can not be merged, start a new event.\n var before = lst(hist.done);\n if (!before || !before.ranges)\n pushSelectionToHistory(doc.sel, hist.done);\n cur = {changes: [historyChangeFromChange(doc, change)],\n generation: hist.generation};\n hist.done.push(cur);\n while (hist.done.length > hist.undoDepth) {\n hist.done.shift();\n if (!hist.done[0].ranges) hist.done.shift();\n }\n }\n hist.done.push(selAfter);\n hist.generation = ++hist.maxGeneration;\n hist.lastModTime = hist.lastSelTime = time;\n hist.lastOp = hist.lastSelOp = opId;\n hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n if (!last) signal(doc, \"historyAdded\");\n }", "function addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history;\n hist.undone.length = 0;\n var time = +new Date, cur;\n\n if ((hist.lastOp == opId ||\n hist.lastOrigin == change.origin && change.origin &&\n ((change.origin.charAt(0) == \"+\" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||\n change.origin.charAt(0) == \"*\")) &&\n (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n // Merge this change into the last event\n var last = lst(cur.changes);\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n last.to = changeEnd(change);\n } else {\n // Add new sub-event\n cur.changes.push(historyChangeFromChange(doc, change));\n }\n } else {\n // Can not be merged, start a new event.\n var before = lst(hist.done);\n if (!before || !before.ranges)\n pushSelectionToHistory(doc.sel, hist.done);\n cur = {changes: [historyChangeFromChange(doc, change)],\n generation: hist.generation};\n hist.done.push(cur);\n while (hist.done.length > hist.undoDepth) {\n hist.done.shift();\n if (!hist.done[0].ranges) hist.done.shift();\n }\n }\n hist.done.push(selAfter);\n hist.generation = ++hist.maxGeneration;\n hist.lastModTime = hist.lastSelTime = time;\n hist.lastOp = hist.lastSelOp = opId;\n hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n if (!last) signal(doc, \"historyAdded\");\n }", "function addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history;\n hist.undone.length = 0;\n var time = +new Date, cur;\n\n if ((hist.lastOp == opId ||\n hist.lastOrigin == change.origin && change.origin &&\n ((change.origin.charAt(0) == \"+\" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||\n change.origin.charAt(0) == \"*\")) &&\n (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n // Merge this change into the last event\n var last = lst(cur.changes);\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n last.to = changeEnd(change);\n } else {\n // Add new sub-event\n cur.changes.push(historyChangeFromChange(doc, change));\n }\n } else {\n // Can not be merged, start a new event.\n var before = lst(hist.done);\n if (!before || !before.ranges)\n pushSelectionToHistory(doc.sel, hist.done);\n cur = {changes: [historyChangeFromChange(doc, change)],\n generation: hist.generation};\n hist.done.push(cur);\n while (hist.done.length > hist.undoDepth) {\n hist.done.shift();\n if (!hist.done[0].ranges) hist.done.shift();\n }\n }\n hist.done.push(selAfter);\n hist.generation = ++hist.maxGeneration;\n hist.lastModTime = hist.lastSelTime = time;\n hist.lastOp = hist.lastSelOp = opId;\n hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n if (!last) signal(doc, \"historyAdded\");\n }", "function addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history;\n hist.undone.length = 0;\n var time = +new Date, cur;\n\n if ((hist.lastOp == opId ||\n hist.lastOrigin == change.origin && change.origin &&\n ((change.origin.charAt(0) == \"+\" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||\n change.origin.charAt(0) == \"*\")) &&\n (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n // Merge this change into the last event\n var last = lst(cur.changes);\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n last.to = changeEnd(change);\n } else {\n // Add new sub-event\n cur.changes.push(historyChangeFromChange(doc, change));\n }\n } else {\n // Can not be merged, start a new event.\n var before = lst(hist.done);\n if (!before || !before.ranges)\n pushSelectionToHistory(doc.sel, hist.done);\n cur = {changes: [historyChangeFromChange(doc, change)],\n generation: hist.generation};\n hist.done.push(cur);\n while (hist.done.length > hist.undoDepth) {\n hist.done.shift();\n if (!hist.done[0].ranges) hist.done.shift();\n }\n }\n hist.done.push(selAfter);\n hist.generation = ++hist.maxGeneration;\n hist.lastModTime = hist.lastSelTime = time;\n hist.lastOp = hist.lastSelOp = opId;\n hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n if (!last) signal(doc, \"historyAdded\");\n }", "function addChangeToHistory(doc, change, selAfter, opId) {\n\t\t var hist = doc.history;\n\t\t hist.undone.length = 0;\n\t\t var time = +new Date, cur;\n\t\t var last;\n\n\t\t if ((hist.lastOp == opId ||\n\t\t hist.lastOrigin == change.origin && change.origin &&\n\t\t ((change.origin.charAt(0) == \"+\" && hist.lastModTime > time - (doc.cm ? doc.cm.options.historyEventDelay : 500)) ||\n\t\t change.origin.charAt(0) == \"*\")) &&\n\t\t (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n\t\t // Merge this change into the last event\n\t\t last = lst(cur.changes);\n\t\t if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n\t\t // Optimized case for simple insertion -- don't want to add\n\t\t // new changesets for every character typed\n\t\t last.to = changeEnd(change);\n\t\t } else {\n\t\t // Add new sub-event\n\t\t cur.changes.push(historyChangeFromChange(doc, change));\n\t\t }\n\t\t } else {\n\t\t // Can not be merged, start a new event.\n\t\t var before = lst(hist.done);\n\t\t if (!before || !before.ranges)\n\t\t { pushSelectionToHistory(doc.sel, hist.done); }\n\t\t cur = {changes: [historyChangeFromChange(doc, change)],\n\t\t generation: hist.generation};\n\t\t hist.done.push(cur);\n\t\t while (hist.done.length > hist.undoDepth) {\n\t\t hist.done.shift();\n\t\t if (!hist.done[0].ranges) { hist.done.shift(); }\n\t\t }\n\t\t }\n\t\t hist.done.push(selAfter);\n\t\t hist.generation = ++hist.maxGeneration;\n\t\t hist.lastModTime = hist.lastSelTime = time;\n\t\t hist.lastOp = hist.lastSelOp = opId;\n\t\t hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n\t\t if (!last) { signal(doc, \"historyAdded\"); }\n\t\t }", "function addChangeToHistory(doc, change, selAfter, opId) {\n\t var hist = doc.history;\n\t hist.undone.length = 0;\n\t var time = +new Date, cur;\n\n\t if ((hist.lastOp == opId ||\n\t hist.lastOrigin == change.origin && change.origin &&\n\t ((change.origin.charAt(0) == \"+\" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||\n\t change.origin.charAt(0) == \"*\")) &&\n\t (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n\t // Merge this change into the last event\n\t var last = lst(cur.changes);\n\t if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n\t // Optimized case for simple insertion -- don't want to add\n\t // new changesets for every character typed\n\t last.to = changeEnd(change);\n\t } else {\n\t // Add new sub-event\n\t cur.changes.push(historyChangeFromChange(doc, change));\n\t }\n\t } else {\n\t // Can not be merged, start a new event.\n\t var before = lst(hist.done);\n\t if (!before || !before.ranges)\n\t pushSelectionToHistory(doc.sel, hist.done);\n\t cur = {changes: [historyChangeFromChange(doc, change)],\n\t generation: hist.generation};\n\t hist.done.push(cur);\n\t while (hist.done.length > hist.undoDepth) {\n\t hist.done.shift();\n\t if (!hist.done[0].ranges) hist.done.shift();\n\t }\n\t }\n\t hist.done.push(selAfter);\n\t hist.generation = ++hist.maxGeneration;\n\t hist.lastModTime = hist.lastSelTime = time;\n\t hist.lastOp = hist.lastSelOp = opId;\n\t hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n\t if (!last) signal(doc, \"historyAdded\");\n\t }", "function addChangeToHistory(doc, change, selAfter, opId) {\n\t var hist = doc.history;\n\t hist.undone.length = 0;\n\t var time = +new Date, cur;\n\n\t if ((hist.lastOp == opId ||\n\t hist.lastOrigin == change.origin && change.origin &&\n\t ((change.origin.charAt(0) == \"+\" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||\n\t change.origin.charAt(0) == \"*\")) &&\n\t (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n\t // Merge this change into the last event\n\t var last = lst(cur.changes);\n\t if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n\t // Optimized case for simple insertion -- don't want to add\n\t // new changesets for every character typed\n\t last.to = changeEnd(change);\n\t } else {\n\t // Add new sub-event\n\t cur.changes.push(historyChangeFromChange(doc, change));\n\t }\n\t } else {\n\t // Can not be merged, start a new event.\n\t var before = lst(hist.done);\n\t if (!before || !before.ranges)\n\t pushSelectionToHistory(doc.sel, hist.done);\n\t cur = {changes: [historyChangeFromChange(doc, change)],\n\t generation: hist.generation};\n\t hist.done.push(cur);\n\t while (hist.done.length > hist.undoDepth) {\n\t hist.done.shift();\n\t if (!hist.done[0].ranges) hist.done.shift();\n\t }\n\t }\n\t hist.done.push(selAfter);\n\t hist.generation = ++hist.maxGeneration;\n\t hist.lastModTime = hist.lastSelTime = time;\n\t hist.lastOp = hist.lastSelOp = opId;\n\t hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n\t if (!last) signal(doc, \"historyAdded\");\n\t }", "function addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history;\n hist.undone.length = 0;\n var time = +new Date(),\n cur;\n var last;\n\n if ((hist.lastOp == opId || hist.lastOrigin == change.origin && change.origin && (change.origin.charAt(0) == \"+\" && hist.lastModTime > time - (doc.cm ? doc.cm.options.historyEventDelay : 500) || change.origin.charAt(0) == \"*\")) && (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n // Merge this change into the last event\n last = lst(cur.changes);\n\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n last.to = changeEnd(change);\n } else {\n // Add new sub-event\n cur.changes.push(historyChangeFromChange(doc, change));\n }\n } else {\n // Can not be merged, start a new event.\n var before = lst(hist.done);\n\n if (!before || !before.ranges) {\n pushSelectionToHistory(doc.sel, hist.done);\n }\n\n cur = {\n changes: [historyChangeFromChange(doc, change)],\n generation: hist.generation\n };\n hist.done.push(cur);\n\n while (hist.done.length > hist.undoDepth) {\n hist.done.shift();\n\n if (!hist.done[0].ranges) {\n hist.done.shift();\n }\n }\n }\n\n hist.done.push(selAfter);\n hist.generation = ++hist.maxGeneration;\n hist.lastModTime = hist.lastSelTime = time;\n hist.lastOp = hist.lastSelOp = opId;\n hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n if (!last) {\n signal(doc, \"historyAdded\");\n }\n }", "function addChangeToHistory(doc, change, selAfter, opId) {\n\t var hist = doc.history;\n\t hist.undone.length = 0;\n\t var time = +new Date, cur;\n\t\n\t if ((hist.lastOp == opId ||\n\t hist.lastOrigin == change.origin && change.origin &&\n\t ((change.origin.charAt(0) == \"+\" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||\n\t change.origin.charAt(0) == \"*\")) &&\n\t (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n\t // Merge this change into the last event\n\t var last = lst(cur.changes);\n\t if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n\t // Optimized case for simple insertion -- don't want to add\n\t // new changesets for every character typed\n\t last.to = changeEnd(change);\n\t } else {\n\t // Add new sub-event\n\t cur.changes.push(historyChangeFromChange(doc, change));\n\t }\n\t } else {\n\t // Can not be merged, start a new event.\n\t var before = lst(hist.done);\n\t if (!before || !before.ranges)\n\t pushSelectionToHistory(doc.sel, hist.done);\n\t cur = {changes: [historyChangeFromChange(doc, change)],\n\t generation: hist.generation};\n\t hist.done.push(cur);\n\t while (hist.done.length > hist.undoDepth) {\n\t hist.done.shift();\n\t if (!hist.done[0].ranges) hist.done.shift();\n\t }\n\t }\n\t hist.done.push(selAfter);\n\t hist.generation = ++hist.maxGeneration;\n\t hist.lastModTime = hist.lastSelTime = time;\n\t hist.lastOp = hist.lastSelOp = opId;\n\t hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\t\n\t if (!last) signal(doc, \"historyAdded\");\n\t }", "function addChangeToHistory(doc, change, selAfter, opId) {\r\n var hist = doc.history;\r\n hist.undone.length = 0;\r\n var time = +new Date, cur;\r\n\r\n if ((hist.lastOp == opId ||\r\n hist.lastOrigin == change.origin && change.origin &&\r\n ((change.origin.charAt(0) == \"+\" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||\r\n change.origin.charAt(0) == \"*\")) &&\r\n (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\r\n // Merge this change into the last event\r\n var last = lst(cur.changes);\r\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\r\n // Optimized case for simple insertion -- don't want to add\r\n // new changesets for every character typed\r\n last.to = changeEnd(change);\r\n } else {\r\n // Add new sub-event\r\n cur.changes.push(historyChangeFromChange(doc, change));\r\n }\r\n } else {\r\n // Can not be merged, start a new event.\r\n var before = lst(hist.done);\r\n if (!before || !before.ranges)\r\n pushSelectionToHistory(doc.sel, hist.done);\r\n cur = {changes: [historyChangeFromChange(doc, change)],\r\n generation: hist.generation};\r\n hist.done.push(cur);\r\n while (hist.done.length > hist.undoDepth) {\r\n hist.done.shift();\r\n if (!hist.done[0].ranges) hist.done.shift();\r\n }\r\n }\r\n hist.done.push(selAfter);\r\n hist.generation = ++hist.maxGeneration;\r\n hist.lastModTime = hist.lastSelTime = time;\r\n hist.lastOp = hist.lastSelOp = opId;\r\n hist.lastOrigin = hist.lastSelOrigin = change.origin;\r\n\r\n if (!last) signal(doc, \"historyAdded\");\r\n }", "function addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history\n hist.undone.length = 0\n var time = +new Date, cur\n var last\n\n if ((hist.lastOp == opId ||\n hist.lastOrigin == change.origin && change.origin &&\n ((change.origin.charAt(0) == \"+\" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||\n change.origin.charAt(0) == \"*\")) &&\n (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n // Merge this change into the last event\n last = lst(cur.changes)\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n last.to = changeEnd(change)\n } else {\n // Add new sub-event\n cur.changes.push(historyChangeFromChange(doc, change))\n }\n } else {\n // Can not be merged, start a new event.\n var before = lst(hist.done)\n if (!before || !before.ranges)\n { pushSelectionToHistory(doc.sel, hist.done) }\n cur = {changes: [historyChangeFromChange(doc, change)],\n generation: hist.generation}\n hist.done.push(cur)\n while (hist.done.length > hist.undoDepth) {\n hist.done.shift()\n if (!hist.done[0].ranges) { hist.done.shift() }\n }\n }\n hist.done.push(selAfter)\n hist.generation = ++hist.maxGeneration\n hist.lastModTime = hist.lastSelTime = time\n hist.lastOp = hist.lastSelOp = opId\n hist.lastOrigin = hist.lastSelOrigin = change.origin\n\n if (!last) { signal(doc, \"historyAdded\") }\n}", "function addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history\n hist.undone.length = 0\n var time = +new Date, cur\n var last\n\n if ((hist.lastOp == opId ||\n hist.lastOrigin == change.origin && change.origin &&\n ((change.origin.charAt(0) == \"+\" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||\n change.origin.charAt(0) == \"*\")) &&\n (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n // Merge this change into the last event\n last = lst(cur.changes)\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n last.to = changeEnd(change)\n } else {\n // Add new sub-event\n cur.changes.push(historyChangeFromChange(doc, change))\n }\n } else {\n // Can not be merged, start a new event.\n var before = lst(hist.done)\n if (!before || !before.ranges)\n { pushSelectionToHistory(doc.sel, hist.done) }\n cur = {changes: [historyChangeFromChange(doc, change)],\n generation: hist.generation}\n hist.done.push(cur)\n while (hist.done.length > hist.undoDepth) {\n hist.done.shift()\n if (!hist.done[0].ranges) { hist.done.shift() }\n }\n }\n hist.done.push(selAfter)\n hist.generation = ++hist.maxGeneration\n hist.lastModTime = hist.lastSelTime = time\n hist.lastOp = hist.lastSelOp = opId\n hist.lastOrigin = hist.lastSelOrigin = change.origin\n\n if (!last) { signal(doc, \"historyAdded\") }\n}", "function addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history;\n hist.undone.length = 0;\n var time = +new Date, cur;\n var last;\n\n if ((hist.lastOp == opId ||\n hist.lastOrigin == change.origin && change.origin &&\n ((change.origin.charAt(0) == \"+\" && hist.lastModTime > time - (doc.cm ? doc.cm.options.historyEventDelay : 500)) ||\n change.origin.charAt(0) == \"*\")) &&\n (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n // Merge this change into the last event\n last = lst(cur.changes);\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n last.to = changeEnd(change);\n } else {\n // Add new sub-event\n cur.changes.push(historyChangeFromChange(doc, change));\n }\n } else {\n // Can not be merged, start a new event.\n var before = lst(hist.done);\n if (!before || !before.ranges)\n { pushSelectionToHistory(doc.sel, hist.done); }\n cur = {changes: [historyChangeFromChange(doc, change)],\n generation: hist.generation};\n hist.done.push(cur);\n while (hist.done.length > hist.undoDepth) {\n hist.done.shift();\n if (!hist.done[0].ranges) { hist.done.shift(); }\n }\n }\n hist.done.push(selAfter);\n hist.generation = ++hist.maxGeneration;\n hist.lastModTime = hist.lastSelTime = time;\n hist.lastOp = hist.lastSelOp = opId;\n hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n if (!last) { signal(doc, \"historyAdded\"); }\n}", "function addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history;\n hist.undone.length = 0;\n var time = +new Date, cur;\n var last;\n\n if ((hist.lastOp == opId ||\n hist.lastOrigin == change.origin && change.origin &&\n ((change.origin.charAt(0) == \"+\" && hist.lastModTime > time - (doc.cm ? doc.cm.options.historyEventDelay : 500)) ||\n change.origin.charAt(0) == \"*\")) &&\n (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n // Merge this change into the last event\n last = lst(cur.changes);\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n last.to = changeEnd(change);\n } else {\n // Add new sub-event\n cur.changes.push(historyChangeFromChange(doc, change));\n }\n } else {\n // Can not be merged, start a new event.\n var before = lst(hist.done);\n if (!before || !before.ranges)\n { pushSelectionToHistory(doc.sel, hist.done); }\n cur = {changes: [historyChangeFromChange(doc, change)],\n generation: hist.generation};\n hist.done.push(cur);\n while (hist.done.length > hist.undoDepth) {\n hist.done.shift();\n if (!hist.done[0].ranges) { hist.done.shift(); }\n }\n }\n hist.done.push(selAfter);\n hist.generation = ++hist.maxGeneration;\n hist.lastModTime = hist.lastSelTime = time;\n hist.lastOp = hist.lastSelOp = opId;\n hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n if (!last) { signal(doc, \"historyAdded\"); }\n}", "function addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history;\n hist.undone.length = 0;\n var time = +new Date, cur;\n var last;\n\n if ((hist.lastOp == opId ||\n hist.lastOrigin == change.origin && change.origin &&\n ((change.origin.charAt(0) == \"+\" && hist.lastModTime > time - (doc.cm ? doc.cm.options.historyEventDelay : 500)) ||\n change.origin.charAt(0) == \"*\")) &&\n (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n // Merge this change into the last event\n last = lst(cur.changes);\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n last.to = changeEnd(change);\n } else {\n // Add new sub-event\n cur.changes.push(historyChangeFromChange(doc, change));\n }\n } else {\n // Can not be merged, start a new event.\n var before = lst(hist.done);\n if (!before || !before.ranges)\n { pushSelectionToHistory(doc.sel, hist.done); }\n cur = {changes: [historyChangeFromChange(doc, change)],\n generation: hist.generation};\n hist.done.push(cur);\n while (hist.done.length > hist.undoDepth) {\n hist.done.shift();\n if (!hist.done[0].ranges) { hist.done.shift(); }\n }\n }\n hist.done.push(selAfter);\n hist.generation = ++hist.maxGeneration;\n hist.lastModTime = hist.lastSelTime = time;\n hist.lastOp = hist.lastSelOp = opId;\n hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n if (!last) { signal(doc, \"historyAdded\"); }\n}", "function addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history;\n hist.undone.length = 0;\n var time = +new Date, cur;\n var last;\n\n if ((hist.lastOp == opId ||\n hist.lastOrigin == change.origin && change.origin &&\n ((change.origin.charAt(0) == \"+\" && hist.lastModTime > time - (doc.cm ? doc.cm.options.historyEventDelay : 500)) ||\n change.origin.charAt(0) == \"*\")) &&\n (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n // Merge this change into the last event\n last = lst(cur.changes);\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n last.to = changeEnd(change);\n } else {\n // Add new sub-event\n cur.changes.push(historyChangeFromChange(doc, change));\n }\n } else {\n // Can not be merged, start a new event.\n var before = lst(hist.done);\n if (!before || !before.ranges)\n { pushSelectionToHistory(doc.sel, hist.done); }\n cur = {changes: [historyChangeFromChange(doc, change)],\n generation: hist.generation};\n hist.done.push(cur);\n while (hist.done.length > hist.undoDepth) {\n hist.done.shift();\n if (!hist.done[0].ranges) { hist.done.shift(); }\n }\n }\n hist.done.push(selAfter);\n hist.generation = ++hist.maxGeneration;\n hist.lastModTime = hist.lastSelTime = time;\n hist.lastOp = hist.lastSelOp = opId;\n hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n if (!last) { signal(doc, \"historyAdded\"); }\n}", "function addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history;\n hist.undone.length = 0;\n var time = +new Date, cur;\n var last;\n\n if ((hist.lastOp == opId ||\n hist.lastOrigin == change.origin && change.origin &&\n ((change.origin.charAt(0) == \"+\" && hist.lastModTime > time - (doc.cm ? doc.cm.options.historyEventDelay : 500)) ||\n change.origin.charAt(0) == \"*\")) &&\n (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n // Merge this change into the last event\n last = lst(cur.changes);\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n last.to = changeEnd(change);\n } else {\n // Add new sub-event\n cur.changes.push(historyChangeFromChange(doc, change));\n }\n } else {\n // Can not be merged, start a new event.\n var before = lst(hist.done);\n if (!before || !before.ranges)\n { pushSelectionToHistory(doc.sel, hist.done); }\n cur = {changes: [historyChangeFromChange(doc, change)],\n generation: hist.generation};\n hist.done.push(cur);\n while (hist.done.length > hist.undoDepth) {\n hist.done.shift();\n if (!hist.done[0].ranges) { hist.done.shift(); }\n }\n }\n hist.done.push(selAfter);\n hist.generation = ++hist.maxGeneration;\n hist.lastModTime = hist.lastSelTime = time;\n hist.lastOp = hist.lastSelOp = opId;\n hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n if (!last) { signal(doc, \"historyAdded\"); }\n}", "function addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history;\n hist.undone.length = 0;\n var time = +new Date, cur;\n var last;\n\n if ((hist.lastOp == opId ||\n hist.lastOrigin == change.origin && change.origin &&\n ((change.origin.charAt(0) == \"+\" && hist.lastModTime > time - (doc.cm ? doc.cm.options.historyEventDelay : 500)) ||\n change.origin.charAt(0) == \"*\")) &&\n (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n // Merge this change into the last event\n last = lst(cur.changes);\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n last.to = changeEnd(change);\n } else {\n // Add new sub-event\n cur.changes.push(historyChangeFromChange(doc, change));\n }\n } else {\n // Can not be merged, start a new event.\n var before = lst(hist.done);\n if (!before || !before.ranges)\n { pushSelectionToHistory(doc.sel, hist.done); }\n cur = {changes: [historyChangeFromChange(doc, change)],\n generation: hist.generation};\n hist.done.push(cur);\n while (hist.done.length > hist.undoDepth) {\n hist.done.shift();\n if (!hist.done[0].ranges) { hist.done.shift(); }\n }\n }\n hist.done.push(selAfter);\n hist.generation = ++hist.maxGeneration;\n hist.lastModTime = hist.lastSelTime = time;\n hist.lastOp = hist.lastSelOp = opId;\n hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n if (!last) { signal(doc, \"historyAdded\"); }\n}", "function addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history;\n hist.undone.length = 0;\n var time = +new Date, cur;\n var last;\n\n if ((hist.lastOp == opId ||\n hist.lastOrigin == change.origin && change.origin &&\n ((change.origin.charAt(0) == \"+\" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||\n change.origin.charAt(0) == \"*\")) &&\n (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n // Merge this change into the last event\n last = lst(cur.changes);\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n last.to = changeEnd(change);\n } else {\n // Add new sub-event\n cur.changes.push(historyChangeFromChange(doc, change));\n }\n } else {\n // Can not be merged, start a new event.\n var before = lst(hist.done);\n if (!before || !before.ranges)\n { pushSelectionToHistory(doc.sel, hist.done); }\n cur = {changes: [historyChangeFromChange(doc, change)],\n generation: hist.generation};\n hist.done.push(cur);\n while (hist.done.length > hist.undoDepth) {\n hist.done.shift();\n if (!hist.done[0].ranges) { hist.done.shift(); }\n }\n }\n hist.done.push(selAfter);\n hist.generation = ++hist.maxGeneration;\n hist.lastModTime = hist.lastSelTime = time;\n hist.lastOp = hist.lastSelOp = opId;\n hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n if (!last) { signal(doc, \"historyAdded\"); }\n}", "function addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history;\n hist.undone.length = 0;\n var time = +new Date, cur;\n var last;\n\n if ((hist.lastOp == opId ||\n hist.lastOrigin == change.origin && change.origin &&\n ((change.origin.charAt(0) == \"+\" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||\n change.origin.charAt(0) == \"*\")) &&\n (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n // Merge this change into the last event\n last = lst(cur.changes);\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n last.to = changeEnd(change);\n } else {\n // Add new sub-event\n cur.changes.push(historyChangeFromChange(doc, change));\n }\n } else {\n // Can not be merged, start a new event.\n var before = lst(hist.done);\n if (!before || !before.ranges)\n { pushSelectionToHistory(doc.sel, hist.done); }\n cur = {changes: [historyChangeFromChange(doc, change)],\n generation: hist.generation};\n hist.done.push(cur);\n while (hist.done.length > hist.undoDepth) {\n hist.done.shift();\n if (!hist.done[0].ranges) { hist.done.shift(); }\n }\n }\n hist.done.push(selAfter);\n hist.generation = ++hist.maxGeneration;\n hist.lastModTime = hist.lastSelTime = time;\n hist.lastOp = hist.lastSelOp = opId;\n hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n if (!last) { signal(doc, \"historyAdded\"); }\n}", "function addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history;\n hist.undone.length = 0;\n var time = +new Date, cur;\n var last;\n\n if ((hist.lastOp == opId ||\n hist.lastOrigin == change.origin && change.origin &&\n ((change.origin.charAt(0) == \"+\" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||\n change.origin.charAt(0) == \"*\")) &&\n (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n // Merge this change into the last event\n last = lst(cur.changes);\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n last.to = changeEnd(change);\n } else {\n // Add new sub-event\n cur.changes.push(historyChangeFromChange(doc, change));\n }\n } else {\n // Can not be merged, start a new event.\n var before = lst(hist.done);\n if (!before || !before.ranges)\n { pushSelectionToHistory(doc.sel, hist.done); }\n cur = {changes: [historyChangeFromChange(doc, change)],\n generation: hist.generation};\n hist.done.push(cur);\n while (hist.done.length > hist.undoDepth) {\n hist.done.shift();\n if (!hist.done[0].ranges) { hist.done.shift(); }\n }\n }\n hist.done.push(selAfter);\n hist.generation = ++hist.maxGeneration;\n hist.lastModTime = hist.lastSelTime = time;\n hist.lastOp = hist.lastSelOp = opId;\n hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n if (!last) { signal(doc, \"historyAdded\"); }\n}", "function addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history;\n hist.undone.length = 0;\n var time = +new Date, cur;\n var last;\n\n if ((hist.lastOp == opId ||\n hist.lastOrigin == change.origin && change.origin &&\n ((change.origin.charAt(0) == \"+\" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||\n change.origin.charAt(0) == \"*\")) &&\n (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n // Merge this change into the last event\n last = lst(cur.changes);\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n last.to = changeEnd(change);\n } else {\n // Add new sub-event\n cur.changes.push(historyChangeFromChange(doc, change));\n }\n } else {\n // Can not be merged, start a new event.\n var before = lst(hist.done);\n if (!before || !before.ranges)\n { pushSelectionToHistory(doc.sel, hist.done); }\n cur = {changes: [historyChangeFromChange(doc, change)],\n generation: hist.generation};\n hist.done.push(cur);\n while (hist.done.length > hist.undoDepth) {\n hist.done.shift();\n if (!hist.done[0].ranges) { hist.done.shift(); }\n }\n }\n hist.done.push(selAfter);\n hist.generation = ++hist.maxGeneration;\n hist.lastModTime = hist.lastSelTime = time;\n hist.lastOp = hist.lastSelOp = opId;\n hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n if (!last) { signal(doc, \"historyAdded\"); }\n}", "function addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history;\n hist.undone.length = 0;\n var time = +new Date, cur;\n var last;\n\n if ((hist.lastOp == opId ||\n hist.lastOrigin == change.origin && change.origin &&\n ((change.origin.charAt(0) == \"+\" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||\n change.origin.charAt(0) == \"*\")) &&\n (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n // Merge this change into the last event\n last = lst(cur.changes);\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n last.to = changeEnd(change);\n } else {\n // Add new sub-event\n cur.changes.push(historyChangeFromChange(doc, change));\n }\n } else {\n // Can not be merged, start a new event.\n var before = lst(hist.done);\n if (!before || !before.ranges)\n { pushSelectionToHistory(doc.sel, hist.done); }\n cur = {changes: [historyChangeFromChange(doc, change)],\n generation: hist.generation};\n hist.done.push(cur);\n while (hist.done.length > hist.undoDepth) {\n hist.done.shift();\n if (!hist.done[0].ranges) { hist.done.shift(); }\n }\n }\n hist.done.push(selAfter);\n hist.generation = ++hist.maxGeneration;\n hist.lastModTime = hist.lastSelTime = time;\n hist.lastOp = hist.lastSelOp = opId;\n hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n if (!last) { signal(doc, \"historyAdded\"); }\n}", "function addChangeToHistory(doc, change, selAfter, opId) {\r\n var hist = doc.history;\r\n hist.undone.length = 0;\r\n var time = +new Date, cur;\r\n var last;\r\n\r\n if ((hist.lastOp == opId ||\r\n hist.lastOrigin == change.origin && change.origin &&\r\n ((change.origin.charAt(0) == \"+\" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||\r\n change.origin.charAt(0) == \"*\")) &&\r\n (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\r\n // Merge this change into the last event\r\n last = lst(cur.changes);\r\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\r\n // Optimized case for simple insertion -- don't want to add\r\n // new changesets for every character typed\r\n last.to = changeEnd(change);\r\n } else {\r\n // Add new sub-event\r\n cur.changes.push(historyChangeFromChange(doc, change));\r\n }\r\n } else {\r\n // Can not be merged, start a new event.\r\n var before = lst(hist.done);\r\n if (!before || !before.ranges)\r\n { pushSelectionToHistory(doc.sel, hist.done); }\r\n cur = {changes: [historyChangeFromChange(doc, change)],\r\n generation: hist.generation};\r\n hist.done.push(cur);\r\n while (hist.done.length > hist.undoDepth) {\r\n hist.done.shift();\r\n if (!hist.done[0].ranges) { hist.done.shift(); }\r\n }\r\n }\r\n hist.done.push(selAfter);\r\n hist.generation = ++hist.maxGeneration;\r\n hist.lastModTime = hist.lastSelTime = time;\r\n hist.lastOp = hist.lastSelOp = opId;\r\n hist.lastOrigin = hist.lastSelOrigin = change.origin;\r\n\r\n if (!last) { signal(doc, \"historyAdded\"); }\r\n}", "function fr(e,t,a,n){var r=e.history;r.undone.length=0;var f,o,i=+new Date;if((r.lastOp==n||r.lastOrigin==t.origin&&t.origin&&(\"+\"==t.origin.charAt(0)&&r.lastModTime>i-(e.cm?e.cm.options.historyEventDelay:500)||\"*\"==t.origin.charAt(0)))&&(f=rr(r,r.lastOp==n)))\n // Merge this change into the last event\n o=p(f.changes),0==P(t.from,t.to)&&0==P(t.from,o.to)?\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n o.to=qn(t):\n // Add new sub-event\n f.changes.push(ar(e,t));else{\n // Can not be merged, start a new event.\n var s=p(r.done);for(s&&s.ranges||sr(e.sel,r.done),f={changes:[ar(e,t)],generation:r.generation},r.done.push(f);r.done.length>r.undoDepth;)r.done.shift(),r.done[0].ranges||r.done.shift()}r.done.push(a),r.generation=++r.maxGeneration,r.lastModTime=r.lastSelTime=i,r.lastOp=r.lastSelOp=n,r.lastOrigin=r.lastSelOrigin=t.origin,o||Te(e,\"historyAdded\")}", "addToHistory({ commit }, command) {\n commit('ADD_TO_HISTORY', command)\n }", "function registerChange(opts) {\n coreChanges.validateChange(opts);\n var collection = opts.collection;\n var mapping = opts.mapping;\n var _id = opts._id;\n if (!unmergedChanges[collection.name]) {\n unmergedChanges[collection.name] = {};\n }\n var collectionChanges = unmergedChanges[collection.name];\n if (!collectionChanges[mapping.type]) {\n collectionChanges[mapping.type] = {};\n }\n if (!collectionChanges[mapping.type][_id]) {\n collectionChanges[mapping.type][_id] = [];\n }\n var objChanges = collectionChanges[mapping.type][_id];\n var c = coreChanges.registerChange(opts);\n objChanges.push(c);\n}", "function addSelectionToHistory(doc, sel, opId, options) {\n\t var hist = doc.history, origin = options && options.origin;\n\n\t // A new event is started when the previous origin does not match\n\t // the current, or the origins don't allow matching. Origins\n\t // starting with * are always merged, those starting with + are\n\t // merged when similar and close together in time.\n\t if (opId == hist.lastSelOp ||\n\t (origin && hist.lastSelOrigin == origin &&\n\t (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n\t selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n\t hist.done[hist.done.length - 1] = sel;\n\t else\n\t pushSelectionToHistory(sel, hist.done);\n\n\t hist.lastSelTime = +new Date;\n\t hist.lastSelOrigin = origin;\n\t hist.lastSelOp = opId;\n\t if (options && options.clearRedo !== false)\n\t clearSelectionEvents(hist.undone);\n\t }", "function addSelectionToHistory(doc, sel, opId, options) {\n\t var hist = doc.history, origin = options && options.origin;\n\n\t // A new event is started when the previous origin does not match\n\t // the current, or the origins don't allow matching. Origins\n\t // starting with * are always merged, those starting with + are\n\t // merged when similar and close together in time.\n\t if (opId == hist.lastSelOp ||\n\t (origin && hist.lastSelOrigin == origin &&\n\t (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n\t selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n\t hist.done[hist.done.length - 1] = sel;\n\t else\n\t pushSelectionToHistory(sel, hist.done);\n\n\t hist.lastSelTime = +new Date;\n\t hist.lastSelOrigin = origin;\n\t hist.lastSelOp = opId;\n\t if (options && options.clearRedo !== false)\n\t clearSelectionEvents(hist.undone);\n\t }", "function addSelectionToHistory(doc, sel, opId, options) {\n\t var hist = doc.history, origin = options && options.origin;\n\t\n\t // A new event is started when the previous origin does not match\n\t // the current, or the origins don't allow matching. Origins\n\t // starting with * are always merged, those starting with + are\n\t // merged when similar and close together in time.\n\t if (opId == hist.lastSelOp ||\n\t (origin && hist.lastSelOrigin == origin &&\n\t (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n\t selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n\t hist.done[hist.done.length - 1] = sel;\n\t else\n\t pushSelectionToHistory(sel, hist.done);\n\t\n\t hist.lastSelTime = +new Date;\n\t hist.lastSelOrigin = origin;\n\t hist.lastSelOp = opId;\n\t if (options && options.clearRedo !== false)\n\t clearSelectionEvents(hist.undone);\n\t }", "function addSelectionToHistory(doc, sel, opId, options) {\n\t\t var hist = doc.history, origin = options && options.origin;\n\n\t\t // A new event is started when the previous origin does not match\n\t\t // the current, or the origins don't allow matching. Origins\n\t\t // starting with * are always merged, those starting with + are\n\t\t // merged when similar and close together in time.\n\t\t if (opId == hist.lastSelOp ||\n\t\t (origin && hist.lastSelOrigin == origin &&\n\t\t (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n\t\t selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n\t\t { hist.done[hist.done.length - 1] = sel; }\n\t\t else\n\t\t { pushSelectionToHistory(sel, hist.done); }\n\n\t\t hist.lastSelTime = +new Date;\n\t\t hist.lastSelOrigin = origin;\n\t\t hist.lastSelOp = opId;\n\t\t if (options && options.clearRedo !== false)\n\t\t { clearSelectionEvents(hist.undone); }\n\t\t }", "function concHistory(newInput){\n history += newInput;\n setHistory(history);\n }", "function addSelectionToHistory(doc, sel, opId, options) {\n\t\t var hist = doc.history, origin = options && options.origin;\n\t\t\n\t\t // A new event is started when the previous origin does not match\n\t\t // the current, or the origins don't allow matching. Origins\n\t\t // starting with * are always merged, those starting with + are\n\t\t // merged when similar and close together in time.\n\t\t if (opId == hist.lastSelOp ||\n\t\t (origin && hist.lastSelOrigin == origin &&\n\t\t (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n\t\t selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n\t\t hist.done[hist.done.length - 1] = sel;\n\t\t else\n\t\t pushSelectionToHistory(sel, hist.done);\n\t\t\n\t\t hist.lastSelTime = +new Date;\n\t\t hist.lastSelOrigin = origin;\n\t\t hist.lastSelOp = opId;\n\t\t if (options && options.clearRedo !== false)\n\t\t clearSelectionEvents(hist.undone);\n\t\t }", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n hist.done[hist.done.length - 1] = sel;\n else\n pushSelectionToHistory(sel, hist.done);\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastOp = opId;\n if (options && options.clearRedo !== false)\n clearSelectionEvents(hist.undone);\n }", "addRegister(register) {\n if (!this.isMergeable(register)) {\n throw new Error('Can\\'t merge discontinuous registers in one reading operation');\n }\n this._registers.push(register);\n }", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done);\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done);\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done);\n }\n } // Register a change in the history. Merges changes that are within", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n }", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n }", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n }", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n }", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n }", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n }", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n }", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n }", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n }", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n }", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n }", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n }", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n }", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n }", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n }", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n }", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n }", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n hist.done[hist.done.length - 1] = sel;\n else\n pushSelectionToHistory(sel, hist.done);\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n clearSelectionEvents(hist.undone);\n }", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n hist.done[hist.done.length - 1] = sel;\n else\n pushSelectionToHistory(sel, hist.done);\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n clearSelectionEvents(hist.undone);\n }", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n hist.done[hist.done.length - 1] = sel;\n else\n pushSelectionToHistory(sel, hist.done);\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n clearSelectionEvents(hist.undone);\n }", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n hist.done[hist.done.length - 1] = sel;\n else\n pushSelectionToHistory(sel, hist.done);\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n clearSelectionEvents(hist.undone);\n }", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n hist.done[hist.done.length - 1] = sel;\n else\n pushSelectionToHistory(sel, hist.done);\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n clearSelectionEvents(hist.undone);\n }", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n hist.done[hist.done.length - 1] = sel;\n else\n pushSelectionToHistory(sel, hist.done);\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n clearSelectionEvents(hist.undone);\n }", "function addSelectionToHistory(doc, sel, opId, options) {\r\n var hist = doc.history, origin = options && options.origin;\r\n\r\n // A new event is started when the previous origin does not match\r\n // the current, or the origins don't allow matching. Origins\r\n // starting with * are always merged, those starting with + are\r\n // merged when similar and close together in time.\r\n if (opId == hist.lastSelOp ||\r\n (origin && hist.lastSelOrigin == origin &&\r\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\r\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\r\n hist.done[hist.done.length - 1] = sel;\r\n else\r\n pushSelectionToHistory(sel, hist.done);\r\n\r\n hist.lastSelTime = +new Date;\r\n hist.lastSelOrigin = origin;\r\n hist.lastSelOp = opId;\r\n if (options && options.clearRedo !== false)\r\n clearSelectionEvents(hist.undone);\r\n }", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel }\n else\n { pushSelectionToHistory(sel, hist.done) }\n\n hist.lastSelTime = +new Date\n hist.lastSelOrigin = origin\n hist.lastSelOp = opId\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone) }\n}", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel }\n else\n { pushSelectionToHistory(sel, hist.done) }\n\n hist.lastSelTime = +new Date\n hist.lastSelOrigin = origin\n hist.lastSelOp = opId\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone) }\n}", "registerChange() {\n if (this.editor && this.editor.save && this.shouldSaveHistory && !this.editor.configuration.readOnly) {\n this.editor.save().then((savedData) => {\n if (this.editorDidUpdate(savedData.blocks)) this.save(savedData.blocks);\n });\n }\n this.shouldSaveHistory = true;\n }", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n}", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n}", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n}", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n}", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n}", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n}", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n}", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n}", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n}", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n}", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n}", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history,\n origin = options && options.origin; // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n\n if (opId == hist.lastSelOp || origin && hist.lastSelOrigin == origin && (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin || selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))) {\n hist.done[hist.done.length - 1] = sel;\n } else {\n pushSelectionToHistory(sel, hist.done);\n }\n\n hist.lastSelTime = +new Date();\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n\n if (options && options.clearRedo !== false) {\n clearSelectionEvents(hist.undone);\n }\n }", "function addSelectionToHistory(doc, sel, opId, options) {\r\n var hist = doc.history, origin = options && options.origin;\r\n\r\n // A new event is started when the previous origin does not match\r\n // the current, or the origins don't allow matching. Origins\r\n // starting with * are always merged, those starting with + are\r\n // merged when similar and close together in time.\r\n if (opId == hist.lastSelOp ||\r\n (origin && hist.lastSelOrigin == origin &&\r\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\r\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\r\n { hist.done[hist.done.length - 1] = sel; }\r\n else\r\n { pushSelectionToHistory(sel, hist.done); }\r\n\r\n hist.lastSelTime = +new Date;\r\n hist.lastSelOrigin = origin;\r\n hist.lastSelOp = opId;\r\n if (options && options.clearRedo !== false)\r\n { clearSelectionEvents(hist.undone); }\r\n}", "addNewAtom(curAtom, atoms, changes, x, y) {\n var newAtom = new Atom(new Coord(x, y, 0), curAtom.atom.atomicSymbol,\n curAtom.atom.elementName, curAtom.atom.atomicRadius,\n curAtom.atom.atomColor, null, new Set());\n atoms.add(newAtom);\n changes.push({type:\"atom\", payLoad:newAtom, action:\"added\", overwritten:null});\n }", "function push_history() {\n\tedit_history_index++;\n\tsave_history();\n\tedit_history.length = edit_history_index+1;\n}", "function ir(e,t,a,n){var r=e.history,f=n&&n.origin;\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n a==r.lastSelOp||f&&r.lastSelOrigin==f&&(r.lastModTime==r.lastSelTime&&r.lastOrigin==f||or(e,f,p(r.done),t))?r.done[r.done.length-1]=t:sr(t,r.done),r.lastSelTime=+new Date,r.lastSelOrigin=f,r.lastSelOp=a,n&&!1!==n.clearRedo&&nr(r.undone)}", "function histTransaction(history, state, dispatch, redo) {\n var preserveItems = mustPreserveItems(state), histOptions = historyKey.get(state).spec.config;\n var pop = (redo ? history.undone : history.done).popEvent(state, preserveItems);\n if (!pop) { return }\n\n var selection = pop.selection.resolve(pop.transform.doc);\n var added = (redo ? history.done : history.undone).addTransform(pop.transform, state.selection.getBookmark(),\n histOptions, preserveItems);\n\n var newHist = new HistoryState(redo ? added : pop.remaining, redo ? pop.remaining : added, null, 0);\n dispatch(pop.transform.setSelection(selection).setMeta(historyKey, {redo: redo, historyState: newHist}).scrollIntoView());\n}" ]
[ "0.6184258", "0.6176788", "0.6174049", "0.6174049", "0.6174049", "0.6174049", "0.6174049", "0.6174049", "0.6159121", "0.6155636", "0.6155636", "0.61505264", "0.6144719", "0.61193234", "0.611699", "0.611699", "0.6108021", "0.6108021", "0.6108021", "0.6108021", "0.6108021", "0.6108021", "0.6093494", "0.6093494", "0.6093494", "0.6093494", "0.6093494", "0.6089222", "0.60087407", "0.5784369", "0.5522874", "0.54865456", "0.54865456", "0.54840267", "0.54439074", "0.5430061", "0.54260695", "0.54210037", "0.54195964", "0.5418566", "0.5410287", "0.5410287", "0.5410287", "0.5410287", "0.5410287", "0.5410287", "0.5410287", "0.5410287", "0.5410287", "0.5410287", "0.5410287", "0.5410287", "0.5410287", "0.5410287", "0.5410287", "0.5410287", "0.5410287", "0.5398089", "0.5398089", "0.5398089", "0.5398089", "0.5398089", "0.5398089", "0.53816324", "0.5366788", "0.5366788", "0.53538823", "0.5340991", "0.5340991", "0.5340991", "0.5340991", "0.5340991", "0.5340991", "0.5340991", "0.5340991", "0.5340991", "0.5340991", "0.5340991", "0.53228205", "0.5322221", "0.5254049", "0.5158105", "0.5155086", "0.5137027" ]
0.6182238
17
Called whenever the selection changes, sets the new selection as the pending selection in the history, and pushes the old pending selection into the 'done' array when it was significantly different (in number of selected ranges, emptiness, or time).
function addSelectionToHistory(doc, sel, opId, options) { var hist = doc.history, origin = options && options.origin; // A new event is started when the previous origin does not match // the current, or the origins don't allow matching. Origins // starting with * are always merged, those starting with + are // merged when similar and close together in time. if (opId == hist.lastSelOp || (origin && hist.lastSelOrigin == origin && (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin || selectionEventCanBeMerged(doc, origin, lst(hist.done), sel)))) { hist.done[hist.done.length - 1] = sel; } else { pushSelectionToHistory(sel, hist.done); } hist.lastSelTime = +new Date; hist.lastSelOrigin = origin; hist.lastSelOp = opId; if (options && options.clearRedo !== false) { clearSelectionEvents(hist.undone); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_gcSelections () {\n for (let i = 0; i < this._selections.length; ++i) {\n const s = this._selections[i]\n const oldOffset = s.offset\n\n // check for newly downloaded pieces in selection\n while (this.bitfield.get(s.from + s.offset) && s.from + s.offset < s.to) {\n s.offset += 1\n }\n\n if (oldOffset !== s.offset) s.notify()\n if (s.to !== s.from + s.offset) continue\n if (!this.bitfield.get(s.from + s.offset)) continue\n\n this._selections.splice(i, 1) // remove fully downloaded selection\n i -= 1 // decrement i to offset splice\n\n s.notify()\n this._updateInterest()\n }\n\n if (!this._selections.length) this.emit('idle')\n }", "_gcSelections () {\n for (let i = 0; i < this._selections.length; ++i) {\n const s = this._selections[i]\n const oldOffset = s.offset\n\n // check for newly downloaded pieces in selection\n while (this.bitfield.get(s.from + s.offset) && s.from + s.offset < s.to) {\n s.offset += 1\n }\n\n if (oldOffset !== s.offset) s.notify()\n if (s.to !== s.from + s.offset) continue\n if (!this.bitfield.get(s.from + s.offset)) continue\n\n this._selections.splice(i, 1) // remove fully downloaded selection\n i -= 1 // decrement i to offset splice\n\n s.notify()\n this._updateInterest()\n }\n\n if (!this._selections.length) this.emit('idle')\n }", "_gcSelections () {\n for (let i = 0; i < this._selections.length; ++i) {\n const s = this._selections[i]\n const oldOffset = s.offset\n\n // check for newly downloaded pieces in selection\n while (this.bitfield.get(s.from + s.offset) && s.from + s.offset < s.to) {\n s.offset += 1\n }\n\n if (oldOffset !== s.offset) s.notify()\n if (s.to !== s.from + s.offset) continue\n if (!this.bitfield.get(s.from + s.offset)) continue\n\n this._selections.splice(i, 1) // remove fully downloaded selection\n i -= 1 // decrement i to offset splice\n\n s.notify()\n this._updateInterest()\n }\n\n if (!this._selections.length) this.emit('idle')\n }", "function updateSelection(){\n\t\t\tif(lastMousePos.pageX == null) return;\n\t\t\t\n\t\t\tsetSelectionPos(selection.second, lastMousePos);\n\t\t\tclearSelection();\n\t\t\t\n\t\t\tif(selectionIsSane()) drawSelection();\n\t\t}", "_resetSelection() {\n this.__selectedRangeArr = [];\n this.__anchorSelectionIndex = -1;\n this.__leadSelectionIndex = -1;\n }", "function setSelection(from, to, oldFrom, oldTo) {\n if (posEq(sel.from, from) && posEq(sel.to, to)) return;\n if (posLess(to, from)) {var tmp = to; to = from; from = tmp;}\n\n if (posEq(from, to)) sel.inverted = false;\n else if (posEq(from, sel.to)) sel.inverted = false;\n else if (posEq(to, sel.from)) sel.inverted = true;\n\n // Some ugly logic used to only mark the lines that actually did\n // see a change in selection as changed, rather than the whole\n // selected range.\n if (oldFrom == null) {oldFrom = sel.from.line; oldTo = sel.to.line;}\n if (posEq(from, to)) {\n if (!posEq(sel.from, sel.to))\n changes.push({from: oldFrom, to: oldTo + 1});\n }\n else if (posEq(sel.from, sel.to)) {\n changes.push({from: from.line, to: to.line + 1});\n }\n else {\n if (!posEq(from, sel.from)) {\n if (from.line < oldFrom)\n changes.push({from: from.line, to: Math.min(to.line, oldFrom) + 1});\n else\n changes.push({from: oldFrom, to: Math.min(oldTo, from.line) + 1});\n }\n if (!posEq(to, sel.to)) {\n if (to.line < oldTo)\n changes.push({from: Math.max(oldFrom, from.line), to: oldTo + 1});\n else\n changes.push({from: Math.max(from.line, oldTo), to: to.line + 1});\n }\n }\n sel.from = from; sel.to = to;\n selectionChanged = true;\n }", "function setSelection(from, to, oldFrom, oldTo) {\n if (posEq(sel.from, from) && posEq(sel.to, to)) return;\n if (posLess(to, from)) {var tmp = to; to = from; from = tmp;}\n\n if (posEq(from, to)) sel.inverted = false;\n else if (posEq(from, sel.to)) sel.inverted = false;\n else if (posEq(to, sel.from)) sel.inverted = true;\n\n // Some ugly logic used to only mark the lines that actually did\n // see a change in selection as changed, rather than the whole\n // selected range.\n if (oldFrom == null) {oldFrom = sel.from.line; oldTo = sel.to.line;}\n if (posEq(from, to)) {\n if (!posEq(sel.from, sel.to))\n changes.push({from: oldFrom, to: oldTo + 1});\n }\n else if (posEq(sel.from, sel.to)) {\n changes.push({from: from.line, to: to.line + 1});\n }\n else {\n if (!posEq(from, sel.from)) {\n if (from.line < oldFrom)\n changes.push({from: from.line, to: Math.min(to.line, oldFrom) + 1});\n else\n changes.push({from: oldFrom, to: Math.min(oldTo, from.line) + 1});\n }\n if (!posEq(to, sel.to)) {\n if (to.line < oldTo)\n changes.push({from: Math.max(oldFrom, from.line), to: oldTo + 1});\n else\n changes.push({from: Math.max(from.line, oldTo), to: to.line + 1});\n }\n }\n sel.from = from; sel.to = to;\n selectionChanged = true;\n }", "function setSelection(from, to, oldFrom, oldTo) {\n if (posEq(sel.from, from) && posEq(sel.to, to)) return;\n if (posLess(to, from)) {var tmp = to; to = from; from = tmp;}\n\n if (posEq(from, to)) sel.inverted = false;\n else if (posEq(from, sel.to)) sel.inverted = false;\n else if (posEq(to, sel.from)) sel.inverted = true;\n\n // Some ugly logic used to only mark the lines that actually did\n // see a change in selection as changed, rather than the whole\n // selected range.\n if (oldFrom == null) {oldFrom = sel.from.line; oldTo = sel.to.line;}\n if (posEq(from, to)) {\n if (!posEq(sel.from, sel.to))\n changes.push({from: oldFrom, to: oldTo + 1});\n }\n else if (posEq(sel.from, sel.to)) {\n changes.push({from: from.line, to: to.line + 1});\n }\n else {\n if (!posEq(from, sel.from)) {\n if (from.line < oldFrom)\n changes.push({from: from.line, to: Math.min(to.line, oldFrom) + 1});\n else\n changes.push({from: oldFrom, to: Math.min(oldTo, from.line) + 1});\n }\n if (!posEq(to, sel.to)) {\n if (to.line < oldTo)\n changes.push({from: Math.max(oldFrom, from.line), to: oldTo + 1});\n else\n changes.push({from: Math.max(from.line, oldTo), to: to.line + 1});\n }\n }\n sel.from = from; sel.to = to;\n selectionChanged = true;\n }", "_applyPendingSelection() {\n if (this._model !== this._globalModel) {\n this._globalModel.updateSelection(this._model.selection, this);\n }\n }", "function setSelection(from, to, oldFrom, oldTo) {\n goalColumn = null;\n if (oldFrom == null) {oldFrom = sel.from.line; oldTo = sel.to.line;}\n if (posEq(sel.from, from) && posEq(sel.to, to)) return;\n if (posLess(to, from)) {var tmp = to; to = from; from = tmp;}\n\n // Skip over hidden lines.\n if (from.line != oldFrom) from = skipHidden(from, oldFrom, sel.from.ch);\n if (to.line != oldTo) to = skipHidden(to, oldTo, sel.to.ch);\n\n if (posEq(from, to)) sel.inverted = false;\n else if (posEq(from, sel.to)) sel.inverted = false;\n else if (posEq(to, sel.from)) sel.inverted = true;\n\n // Some ugly logic used to only mark the lines that actually did\n // see a change in selection as changed, rather than the whole\n // selected range.\n if (posEq(from, to)) {\n if (!posEq(sel.from, sel.to))\n changes.push({from: oldFrom, to: oldTo + 1});\n }\n else if (posEq(sel.from, sel.to)) {\n changes.push({from: from.line, to: to.line + 1});\n }\n else {\n if (!posEq(from, sel.from)) {\n if (from.line < oldFrom)\n changes.push({from: from.line, to: Math.min(to.line, oldFrom) + 1});\n else\n changes.push({from: oldFrom, to: Math.min(oldTo, from.line) + 1});\n }\n if (!posEq(to, sel.to)) {\n if (to.line < oldTo)\n changes.push({from: Math.max(oldFrom, from.line), to: oldTo + 1});\n else\n changes.push({from: Math.max(from.line, oldTo), to: to.line + 1});\n }\n }\n sel.from = from; sel.to = to;\n selectionChanged = true;\n }", "function selection_update() {\n\n // if the new selection is not in the valid moves area don't update the last_selection var\n if (selection.row != '') {\n last_selection = selection;\n }\n\n $(\"#log\").html(\"clicked: \" + clicked.row + \"x\" + clicked.col + \"<br />\" + clicked.piece);\n\n\n}", "function addSelectionToHistory(doc, sel, opId, options) {\n\t var hist = doc.history, origin = options && options.origin;\n\n\t // A new event is started when the previous origin does not match\n\t // the current, or the origins don't allow matching. Origins\n\t // starting with * are always merged, those starting with + are\n\t // merged when similar and close together in time.\n\t if (opId == hist.lastSelOp ||\n\t (origin && hist.lastSelOrigin == origin &&\n\t (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n\t selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n\t hist.done[hist.done.length - 1] = sel;\n\t else\n\t pushSelectionToHistory(sel, hist.done);\n\n\t hist.lastSelTime = +new Date;\n\t hist.lastSelOrigin = origin;\n\t hist.lastSelOp = opId;\n\t if (options && options.clearRedo !== false)\n\t clearSelectionEvents(hist.undone);\n\t }", "function addSelectionToHistory(doc, sel, opId, options) {\n\t var hist = doc.history, origin = options && options.origin;\n\n\t // A new event is started when the previous origin does not match\n\t // the current, or the origins don't allow matching. Origins\n\t // starting with * are always merged, those starting with + are\n\t // merged when similar and close together in time.\n\t if (opId == hist.lastSelOp ||\n\t (origin && hist.lastSelOrigin == origin &&\n\t (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n\t selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n\t hist.done[hist.done.length - 1] = sel;\n\t else\n\t pushSelectionToHistory(sel, hist.done);\n\n\t hist.lastSelTime = +new Date;\n\t hist.lastSelOrigin = origin;\n\t hist.lastSelOp = opId;\n\t if (options && options.clearRedo !== false)\n\t clearSelectionEvents(hist.undone);\n\t }", "function addSelectionToHistory(doc, sel, opId, options) {\n\t var hist = doc.history, origin = options && options.origin;\n\t\n\t // A new event is started when the previous origin does not match\n\t // the current, or the origins don't allow matching. Origins\n\t // starting with * are always merged, those starting with + are\n\t // merged when similar and close together in time.\n\t if (opId == hist.lastSelOp ||\n\t (origin && hist.lastSelOrigin == origin &&\n\t (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n\t selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n\t hist.done[hist.done.length - 1] = sel;\n\t else\n\t pushSelectionToHistory(sel, hist.done);\n\t\n\t hist.lastSelTime = +new Date;\n\t hist.lastSelOrigin = origin;\n\t hist.lastSelOp = opId;\n\t if (options && options.clearRedo !== false)\n\t clearSelectionEvents(hist.undone);\n\t }", "function addSelectionToHistory(doc, sel, opId, options) {\n\t\t var hist = doc.history, origin = options && options.origin;\n\n\t\t // A new event is started when the previous origin does not match\n\t\t // the current, or the origins don't allow matching. Origins\n\t\t // starting with * are always merged, those starting with + are\n\t\t // merged when similar and close together in time.\n\t\t if (opId == hist.lastSelOp ||\n\t\t (origin && hist.lastSelOrigin == origin &&\n\t\t (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n\t\t selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n\t\t { hist.done[hist.done.length - 1] = sel; }\n\t\t else\n\t\t { pushSelectionToHistory(sel, hist.done); }\n\n\t\t hist.lastSelTime = +new Date;\n\t\t hist.lastSelOrigin = origin;\n\t\t hist.lastSelOp = opId;\n\t\t if (options && options.clearRedo !== false)\n\t\t { clearSelectionEvents(hist.undone); }\n\t\t }", "function newSelection(x1,x2, y1,y2, keepOld) {\n\t// debugLog(\"newSelection\");\n\n\t// debugLog(\"newSelection \" + x1 + \" \" + x2 + \" \" + y1 + \" \" + y2 + \" \" + keepOld);\n\n\tif(unique > 0) {\n\t x1 = Math.max(x1, leftMarg);\n\t x2 = Math.min(x2, leftMarg + drawW);\n\n\t y1 = Math.max(y1, topMarg);\n\t y2 = Math.min(y2, topMarg + drawH);\n\t \n\t var newSel = [pixel2valX(x1), pixel2valX(x2), pixel2valY(y2), pixel2valY(y1), // y1 and y2 need to be switched here, because we flip the y axis\n\t\t\t x1,x2,y1,y2];\n\t // debugLog(\"newSel: \" + JSON.stringify(newSel));\n\t \n\t var overlap = false;\n\t for(var s = 0; s < selections.length; s++) {\n\t\tvar sel = selections[s];\n\t\tif(sel[4] == newSel[4]\n\t\t && sel[5] == newSel[5]\n\t\t && sel[6] == newSel[6]\n\t\t && sel[7] == newSel[7]) {\n\t\t // debugLog(\"Ignoring selection because it overlaps 100% with already existing selection\");\n\t\t overlap = true;\n\t\t break;\n\t\t}\n\t }\n\n\t if(!overlap) {\n\t\tif(!keepOld) {\n\t\t selections = [];\n\t\t}\n\t\tselections.push(newSel);\n\t\tdrawSelections();\n\t\tupdateLocalSelections(false);\n\t\tsaveSelectionsInSlot();\n\t }\n\t}\n }", "_updateSelections () {\n if (!this.ready || this.destroyed) return\n\n process.nextTick(() => {\n this._gcSelections()\n })\n this._updateInterest()\n this._update()\n }", "_updateSelections () {\n if (!this.ready || this.destroyed) return\n\n process.nextTick(() => {\n this._gcSelections()\n })\n this._updateInterest()\n this._update()\n }", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history,\n origin = options && options.origin; // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n\n if (opId == hist.lastSelOp || origin && hist.lastSelOrigin == origin && (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin || selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))) {\n hist.done[hist.done.length - 1] = sel;\n } else {\n pushSelectionToHistory(sel, hist.done);\n }\n\n hist.lastSelTime = +new Date();\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n\n if (options && options.clearRedo !== false) {\n clearSelectionEvents(hist.undone);\n }\n }", "function addSelectionToHistory(doc, sel, opId, options) {\n\t\t var hist = doc.history, origin = options && options.origin;\n\t\t\n\t\t // A new event is started when the previous origin does not match\n\t\t // the current, or the origins don't allow matching. Origins\n\t\t // starting with * are always merged, those starting with + are\n\t\t // merged when similar and close together in time.\n\t\t if (opId == hist.lastSelOp ||\n\t\t (origin && hist.lastSelOrigin == origin &&\n\t\t (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n\t\t selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n\t\t hist.done[hist.done.length - 1] = sel;\n\t\t else\n\t\t pushSelectionToHistory(sel, hist.done);\n\t\t\n\t\t hist.lastSelTime = +new Date;\n\t\t hist.lastSelOrigin = origin;\n\t\t hist.lastSelOp = opId;\n\t\t if (options && options.clearRedo !== false)\n\t\t clearSelectionEvents(hist.undone);\n\t\t }", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n hist.done[hist.done.length - 1] = sel;\n else\n pushSelectionToHistory(sel, hist.done);\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n clearSelectionEvents(hist.undone);\n }", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n hist.done[hist.done.length - 1] = sel;\n else\n pushSelectionToHistory(sel, hist.done);\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n clearSelectionEvents(hist.undone);\n }", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n hist.done[hist.done.length - 1] = sel;\n else\n pushSelectionToHistory(sel, hist.done);\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n clearSelectionEvents(hist.undone);\n }", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n hist.done[hist.done.length - 1] = sel;\n else\n pushSelectionToHistory(sel, hist.done);\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n clearSelectionEvents(hist.undone);\n }", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n hist.done[hist.done.length - 1] = sel;\n else\n pushSelectionToHistory(sel, hist.done);\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n clearSelectionEvents(hist.undone);\n }", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n hist.done[hist.done.length - 1] = sel;\n else\n pushSelectionToHistory(sel, hist.done);\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n clearSelectionEvents(hist.undone);\n }", "function addSelectionToHistory(doc, sel, opId, options) {\r\n var hist = doc.history, origin = options && options.origin;\r\n\r\n // A new event is started when the previous origin does not match\r\n // the current, or the origins don't allow matching. Origins\r\n // starting with * are always merged, those starting with + are\r\n // merged when similar and close together in time.\r\n if (opId == hist.lastSelOp ||\r\n (origin && hist.lastSelOrigin == origin &&\r\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\r\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\r\n hist.done[hist.done.length - 1] = sel;\r\n else\r\n pushSelectionToHistory(sel, hist.done);\r\n\r\n hist.lastSelTime = +new Date;\r\n hist.lastSelOrigin = origin;\r\n hist.lastSelOp = opId;\r\n if (options && options.clearRedo !== false)\r\n clearSelectionEvents(hist.undone);\r\n }", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n hist.done[hist.done.length - 1] = sel;\n else\n pushSelectionToHistory(sel, hist.done);\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastOp = opId;\n if (options && options.clearRedo !== false)\n clearSelectionEvents(hist.undone);\n }", "_updateSelections () {\n if (!this.ready || this.destroyed) return\n\n queueMicrotask(() => {\n this._gcSelections()\n })\n this._updateInterest()\n this._update()\n }", "resetSelection() {\n if (!this.isSelectionEmpty()) {\n this._resetSelection();\n this._fireChangeSelection();\n }\n }", "function optionChanged (newSelection) {\n buildCharts(newSelection);\n buildMetadata(newSelection);\n}", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel }\n else\n { pushSelectionToHistory(sel, hist.done) }\n\n hist.lastSelTime = +new Date\n hist.lastSelOrigin = origin\n hist.lastSelOp = opId\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone) }\n}", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel }\n else\n { pushSelectionToHistory(sel, hist.done) }\n\n hist.lastSelTime = +new Date\n hist.lastSelOrigin = origin\n hist.lastSelOp = opId\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone) }\n}", "function addSelectionToHistory(doc, sel, opId, options) {\r\n var hist = doc.history, origin = options && options.origin;\r\n\r\n // A new event is started when the previous origin does not match\r\n // the current, or the origins don't allow matching. Origins\r\n // starting with * are always merged, those starting with + are\r\n // merged when similar and close together in time.\r\n if (opId == hist.lastSelOp ||\r\n (origin && hist.lastSelOrigin == origin &&\r\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\r\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\r\n { hist.done[hist.done.length - 1] = sel; }\r\n else\r\n { pushSelectionToHistory(sel, hist.done); }\r\n\r\n hist.lastSelTime = +new Date;\r\n hist.lastSelOrigin = origin;\r\n hist.lastSelOp = opId;\r\n if (options && options.clearRedo !== false)\r\n { clearSelectionEvents(hist.undone); }\r\n}", "get newSelection() {\n return this.selection || this.startState.selection.map(this.changes);\n }", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n}", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n}", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n}", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n}", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n}", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n}", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n}", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n}", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n}", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n}", "function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n}", "setSelection(selection) {\n if (selection.$from.doc != this.doc)\n throw new RangeError(\"Selection passed to setSelection must point at the current document\");\n this.curSelection = selection;\n this.curSelectionFor = this.steps.length;\n this.updated = (this.updated | UPDATED_SEL) & ~UPDATED_MARKS;\n this.storedMarks = null;\n return this;\n }", "restoreSelections() {\n if (!this.trackedSelections) {\n return;\n }\n const value = AppContext.getInstance().hash.getProp(AppConstants.HASH_PROPS.SELECTION, '');\n if (value === '') {\n return;\n }\n const ranges = value.split(';').map((s) => ParseRangeUtils.parseRangeLike(s));\n this.trackedSelections.select(ranges);\n }", "_updateTrackedSelection(buildHighlight) {\n var trackedSelection = this._computeTrackedSelection(buildHighlight);\n\n this.setState({\n trackedSelection\n });\n }", "function updateLastSelection(cm, vim) {\n var anchor = vim.sel.anchor;\n var head = vim.sel.head;\n // To accommodate the effect of lastPastedText in the last selection\n if (vim.lastPastedText) {\n head = cm.posFromIndex(cm.indexFromPos(anchor) + vim.lastPastedText.length);\n vim.lastPastedText = null;\n }\n vim.lastSelection = {'anchorMark': cm.setBookmark(anchor),\n 'headMark': cm.setBookmark(head),\n 'anchor': copyCursor(anchor),\n 'head': copyCursor(head),\n 'visualMode': vim.visualMode,\n 'visualLine': vim.visualLine,\n 'visualBlock': vim.visualBlock};\n }", "function updateLastSelection(cm, vim) {\n var anchor = vim.sel.anchor;\n var head = vim.sel.head;\n // To accommodate the effect of lastPastedText in the last selection\n if (vim.lastPastedText) {\n head = cm.posFromIndex(cm.indexFromPos(anchor) + vim.lastPastedText.length);\n vim.lastPastedText = null;\n }\n vim.lastSelection = {'anchorMark': cm.setBookmark(anchor),\n 'headMark': cm.setBookmark(head),\n 'anchor': copyCursor(anchor),\n 'head': copyCursor(head),\n 'visualMode': vim.visualMode,\n 'visualLine': vim.visualLine,\n 'visualBlock': vim.visualBlock};\n }", "_applySelectionMode(initial) {\n const that = this;\n let newDate = [],\n preventEvent = initial ? true : false;\n\n switch (that.selectionMode) {\n case 'none':\n that._clearSelection(preventEvent);\n return;\n case 'many':\n case 'default':\n case 'oneOrMany':\n if (that.selectedDates.length === 0) {\n newDate.push(new Date(Math.min(Math.max(that.min.getTime(), new Date().setHours(0, 0, 0, 0)), that.max.getTime())));\n break;\n }\n\n return;\n case 'one':\n if (that.selectedDates.length === 1) {\n return;\n }\n\n if (that.selectedDates.length > 1) {\n newDate.push(that.selectedDates[that.selectedDates.length - 1]);\n that._clearSelection(preventEvent);\n }\n else {\n newDate.push(new Date(Math.min(Math.max(that.min.getTime(), new Date().setHours(0, 0, 0, 0)), that.max.getTime())));\n }\n\n break;\n case 'zeroOrOne':\n if (that.selectedDates.length > 1) {\n newDate.push(that.selectedDates[that.selectedDates.length - 1]);\n that._clearSelection(preventEvent);\n break;\n }\n\n return;\n case 'zeroOrMany':\n return;\n case 'week':\n if (that.selectedDates.length >= 1) {\n let date = that.selectedDates[that.selectedDates.length - 1];\n\n for (let i = 0; i < 8; i++) {\n newDate.push(new Date(date));\n date.setDate(date.getDate() + 1);\n }\n\n that._clearSelection(preventEvent);\n }\n\n break;\n }\n\n that.selectedDates = [];\n\n if (initial) {\n that.selectedDates = newDate;\n return;\n }\n\n const newDates = newDate.length;\n\n for (let d = 0; d < newDates; d++) {\n that._selectDate(newDate[d], d < newDates - 1);\n }\n }", "function onSelectedChange() {\n if (onSelectedChange.queued) return;\n onSelectedChange.queued = true;\n\n $scope.$evalAsync(function() {\n $scope.$broadcast(EVENT.TABS_CHANGED, selected);\n onSelectedChange.queued = false;\n });\n }", "updateAvailabilityDraft(selectionEnd, callback) {\n const {\n selectionType,\n selectionStart\n } = this.state;\n if (selectionType === null || selectionStart === null) return;\n let newSelection = [];\n\n if (selectionStart && selectionEnd && selectionType) {\n newSelection = this.selectionSchemeHandlers[this.props.selectionScheme](selectionStart, selectionEnd, this.state.dates);\n }\n\n let nextDraft = [...this.props.selection];\n\n if (selectionType === 'add') {\n nextDraft = Array.from(new Set([...nextDraft, ...newSelection]));\n } else if (selectionType === 'remove') {\n nextDraft = nextDraft.filter(a => !newSelection.find(b => (0, _is_same_minute.default)(a, b)));\n }\n\n this.setState({\n selectionDraft: nextDraft\n }, callback);\n }", "function newSelection(newDim, v1, v2, keepOld) {\n\t\t//$log.log(preDebugMsg + \"newSelection\");\n\t\tvar minVal = Math.floor(Math.min(v1, v2));\n\t\tvar maxVal = Math.ceil(Math.max(v1, v2));\n\t\tvar sel = {\"minVal\":minVal, \"maxVal\":maxVal};\n\t\tvar dup = false;\n\n\t\tif(selections.length <= newDim) {\n\t\t\tfor(var d = selections.length; d < 3; d++) {\n\t\t\t\tselections.push([]);\n\t\t\t\tdirty = true;\n\t\t\t}\n\t\t}\n\n\t\tif(!keepOld) {\n\t\t\tselections[newDim] = [];\n\t\t\tdirty = true;\n\t\t}\n\n\t\tfor(var s = 0; s < selections[newDim].length; s++) {\n\t\t\tif(selections[newDim][s].minVal == sel.minVal && selections[newDim][s].maxVal == sel.maxVal) {\n\t\t\t\tdup = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif(!dup) {\n\t\t\tselections[newDim].push(sel);\n\t\t\tdirty = true;\n\t\t}\n\n\t\tfor(var d = 0; d < 3; d++) {\n\t\t\tif(selections[d].length <= 0) {\n\t\t\t\tselections[d].push({\"minVal\":0, \"maxVal\":dim[d] - 1});\n\t\t\t\tdirty = true;\n\t\t\t}\n\t\t}\n\n\t\tif(dirty) {\n\t\t\tdrawSelections();\n\t\t\tupdateLocalSelections(false);\n\t\t\tsaveSelectionsInSlot();\n\t\t}\n\t}", "function setSelection(from, to, oldFrom, oldTo) {\n goalColumn = null;\n if (oldFrom == null) {oldFrom = sel.from.line; oldTo = sel.to.line;}\n if (posEq(sel.from, from) && posEq(sel.to, to)) return;\n if (posLess(to, from)) {var tmp = to; to = from; from = tmp;}\n\n // Skip over hidden lines.\n if (from.line != oldFrom) {\n var from1 = skipHidden(from, oldFrom, sel.from.ch);\n // If there is no non-hidden line left, force visibility on current line\n if (!from1) setLineHidden(from.line, false);\n else from = from1;\n }\n if (to.line != oldTo) to = skipHidden(to, oldTo, sel.to.ch);\n\n if (posEq(from, to)) sel.inverted = false;\n else if (posEq(from, sel.to)) sel.inverted = false;\n else if (posEq(to, sel.from)) sel.inverted = true;\n\n if (options.autoClearEmptyLines && posEq(sel.from, sel.to)) {\n var head = sel.inverted ? from : to;\n if (head.line != sel.from.line && sel.from.line < doc.size) {\n var oldLine = getLine(sel.from.line);\n if (/^\\s+$/.test(oldLine.text))\n setTimeout(operation(function() {\n if (oldLine.parent && /^\\s+$/.test(oldLine.text)) {\n var no = lineNo(oldLine);\n replaceRange(\"\", {line: no, ch: 0}, {line: no, ch: oldLine.text.length});\n }\n }, 10));\n }\n }\n\n sel.from = from; sel.to = to;\n selectionChanged = true;\n }", "function setSelection(from, to, oldFrom, oldTo) {\n goalColumn = null;\n if (oldFrom == null) {oldFrom = sel.from.line; oldTo = sel.to.line;}\n if (posEq(sel.from, from) && posEq(sel.to, to)) return;\n if (posLess(to, from)) {var tmp = to; to = from; from = tmp;}\n\n // Skip over hidden lines.\n if (from.line != oldFrom) {\n var from1 = skipHidden(from, oldFrom, sel.from.ch);\n // If there is no non-hidden line left, force visibility on current line\n if (!from1) setLineHidden(from.line, false);\n else from = from1;\n }\n if (to.line != oldTo) to = skipHidden(to, oldTo, sel.to.ch);\n\n if (posEq(from, to)) sel.inverted = false;\n else if (posEq(from, sel.to)) sel.inverted = false;\n else if (posEq(to, sel.from)) sel.inverted = true;\n\n if (options.autoClearEmptyLines && posEq(sel.from, sel.to)) {\n var head = sel.inverted ? from : to;\n if (head.line != sel.from.line && sel.from.line < doc.size) {\n var oldLine = getLine(sel.from.line);\n if (/^\\s+$/.test(oldLine.text))\n setTimeout(operation(function() {\n if (oldLine.parent && /^\\s+$/.test(oldLine.text)) {\n var no = lineNo(oldLine);\n replaceRange(\"\", {line: no, ch: 0}, {line: no, ch: oldLine.text.length});\n }\n }, 10));\n }\n }\n\n sel.from = from; sel.to = to;\n selectionChanged = true;\n }", "function setSelection(from, to, oldFrom, oldTo) {\n goalColumn = null;\n if (oldFrom == null) {oldFrom = sel.from.line; oldTo = sel.to.line;}\n if (posEq(sel.from, from) && posEq(sel.to, to)) return;\n if (posLess(to, from)) {var tmp = to; to = from; from = tmp;}\n\n // Skip over hidden lines.\n if (from.line != oldFrom) {\n var from1 = skipHidden(from, oldFrom, sel.from.ch);\n // If there is no non-hidden line left, force visibility on current line\n if (!from1) setLineHidden(from.line, false);\n else from = from1;\n }\n if (to.line != oldTo) to = skipHidden(to, oldTo, sel.to.ch);\n\n if (posEq(from, to)) sel.inverted = false;\n else if (posEq(from, sel.to)) sel.inverted = false;\n else if (posEq(to, sel.from)) sel.inverted = true;\n\n if (options.autoClearEmptyLines && posEq(sel.from, sel.to)) {\n var head = sel.inverted ? from : to;\n if (head.line != sel.from.line && sel.from.line < doc.size) {\n var oldLine = getLine(sel.from.line);\n if (/^\\s+$/.test(oldLine.text))\n setTimeout(operation(function() {\n if (oldLine.parent && /^\\s+$/.test(oldLine.text)) {\n var no = lineNo(oldLine);\n replaceRange(\"\", {line: no, ch: 0}, {line: no, ch: oldLine.text.length});\n }\n }, 10));\n }\n }\n\n sel.from = from; sel.to = to;\n selectionChanged = true;\n }", "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done);\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done);\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done);\n }\n } // Register a change in the history. Merges changes that are within", "function changeStateForSelection(selection) {\n const temp = statesBody.select(\"#temp\");\n\n const $selected = $body.querySelector(\"div.selected\");\n const stateNew = +$selected.dataset.id;\n const color = pack.states[stateNew].color || \"#ffffff\";\n\n selection.forEach(function (i) {\n const exists = temp.select(\"polygon[data-cell='\" + i + \"']\");\n const stateOld = exists.size() ? +exists.attr(\"data-state\") : pack.cells.state[i];\n if (stateNew === stateOld) return;\n if (i === pack.states[stateOld].center) return;\n\n // change of append new element\n if (exists.size()) exists.attr(\"data-state\", stateNew).attr(\"fill\", color).attr(\"stroke\", color);\n else\n temp\n .append(\"polygon\")\n .attr(\"data-cell\", i)\n .attr(\"data-state\", stateNew)\n .attr(\"points\", getPackPolygon(i))\n .attr(\"fill\", color)\n .attr(\"stroke\", color);\n });\n}", "function onSelection(ranges, event) {\n selections.push({\n ranges: ranges,\n event: event\n });\n }", "function optionChanged(newSelection) {\n buildChart(newSelection);\n}", "function updateSelectionHighlight(selection) {\r\n if (selection.isRotatable) {\r\n var x = that.fromPiecePos(selection.xP) - that.spacing;\r\n var y = that.fromPiecePos(selection.yP) - that.spacing;\r\n var width = that.fromPieceDist(selection.widthP) + \r\n 2 * that.spacing;\r\n var height = that.fromPieceDist(selection.heightP) + \r\n 2 * that.spacing;\r\n selectionRect.setShape({\r\n x: x, y: y, width: width, height: height}).\r\n moveToBack();\r\n var tmpRotIndicator = rotIndicators\r\n [selection.rotateBy180 ? \"180\" : \"90\"]\r\n [selection.rotateCW ? \"cw\" : \"ccw\"];\r\n if (tmpRotIndicator != rotIndicator) {\r\n hideRotIndicator();\r\n rotIndicator = tmpRotIndicator;\r\n }\r\n rotIndicator.setShape({\r\n x: x + width - rotIndicator.shape.width - that.spacing, \r\n y: y + height - rotIndicator.shape.height - that.spacing});\r\n rotIndicator.moveToFront();\r\n } else {\r\n removeSelectionHighlight();\r\n }\r\n }", "function optionChanged(newSelection) {\n console.log(newSelection);\n updateTable(newSelection);\n}", "function selectRangeByNewPosition(newOriginSelectionPosition, newFocusPosition) {\n\n //console.log('select new range', newOriginSelectionPosition, newFocusPosition);\n\n // Switch position references\n selModel.currentFocusPosition = newFocusPosition;\n selModel.originSelectionPosition = newOriginSelectionPosition;\n\n // Try selecting range\n selModel.selectFocusRange(true);\n }", "function moveSelected(delta) {\n setSelectedIndex(selectedIndex + delta);\n }", "updateSelection(value, source) {\n this.selection = value;\n this._selectionChanged.next({ selection: value, source });\n }", "updateSelection(value, source) {\n this.selection = value;\n this._selectionChanged.next({ selection: value, source });\n }", "function drawSelection() {\n\t\t\tif(prevSelection != null &&\n\t\t\t\tselection.first.x == prevSelection.first.x &&\n\t\t\t\tselection.first.y == prevSelection.first.y && \n\t\t\t\tselection.second.x == prevSelection.second.x &&\n\t\t\t\tselection.second.y == prevSelection.second.y)\n\t\t\t\treturn;\n\t\t\t\n\t\t\toctx.strokeStyle = parseColor(options.selection.color).scale(null, null, null, 0.8).toString();\n\t\t\toctx.lineWidth = 1;\n\t\t\tctx.lineJoin = 'round';\n\t\t\toctx.fillStyle = parseColor(options.selection.color).scale(null, null, null, 0.4).toString();\n\n\t\t\tprevSelection = { first: { x: selection.first.x,\n\t\t\t\t\t\t\t\t\t\ty: selection.first.y },\n\t\t\t\t\t\t\t second: { x: selection.second.x,\n\t\t\t\t\t\t\t\t\t\ty: selection.second.y } };\n\n\t\t\tvar x = Math.min(selection.first.x, selection.second.x),\n\t\t\t\ty = Math.min(selection.first.y, selection.second.y),\n\t\t\t\tw = Math.abs(selection.second.x - selection.first.x),\n\t\t\t\th = Math.abs(selection.second.y - selection.first.y);\n\t\t\t\n\t\t\toctx.fillRect(x + plotOffset.left, y + plotOffset.top, w, h);\n\t\t\toctx.strokeRect(x + plotOffset.left, y + plotOffset.top, w, h);\n\t\t}", "function markAsAdded(selection) {\n $(selection)\n .css('background-color', originalBackground)\n .css('border', '2px solid red')\n .addClass('added')\n .removeClass('highlighted');\n}", "function updateSelected(newSlot) {\n if (selectedSlot >= 0) {\n // remove the highlight class (see utilities.js)\n removeClass(slots[selectedSlot], 'highlight');\n }\n if (newSlot >= 0) {\n addClass(slots[newSlot], 'highlight');\n }\n selectedSlot = newSlot;\n}", "function SelectionChange() {}", "function SelectionChange() {}", "function SelectionChange() {}", "function SelectionChange() {}", "function updateSelection(e) {\n\t\t\t\tdiagram.model.selectedNodeData = null;\n\t\t\t\tvar it = diagram.selection.iterator;\n\t\t\t\twhile (it.next()) {\n\t\t\t\t\tvar selnode = it.value;\n\t\t\t\t\t// ignore a selected link or a deleted node\n\t\t\t\t\tif (selnode instanceof go.Node && selnode.data !== null) {\n\t\t\t\t\t\tdiagram.model.selectedNodeData = selnode.data;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tscope.$apply();\n\t\t\t}", "setInitialSelection() {\n var handler = this.chart.getSelectionHandler();\n if (!handler) return;\n\n var selected = DvtChartDataUtils.getInitialSelection(this.chart);\n var selectedIds = [];\n for (var i = 0; i < selected.length; i++) {\n for (var j = 0; j < this._slices.length; j++) {\n var peerId = this._slices[j].getId();\n if (\n peerId != null &&\n ((selected[i]['id'] != null && peerId.id == selected[i]['id']) ||\n (peerId.series == selected[i]['series'] && peerId.group == selected[i]['group']))\n ) {\n selectedIds.push(peerId);\n continue;\n }\n }\n }\n\n // Add other slice to the list if all series in the \"other\" slice is selected\n if (DvtChartPieUtils.isOtherSliceSelected(this.chart, selected)) {\n var otherPeerId = DvtChartPieUtils.getOtherSliceId(this.chart);\n selectedIds.push(otherPeerId);\n }\n\n handler.processInitialSelections(selectedIds, this._slices);\n }", "function lastChangeEvent(hist, force) {\n\t\t if (force) {\n\t\t clearSelectionEvents(hist.done);\n\t\t return lst(hist.done)\n\t\t } else if (hist.done.length && !lst(hist.done).ranges) {\n\t\t return lst(hist.done)\n\t\t } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n\t\t hist.done.pop();\n\t\t return lst(hist.done)\n\t\t }\n\t\t }", "function updateSelection(e) {\n diagram.model.selectedNodeData = null;\n var it = diagram.selection.iterator;\n while (it.next()) {\n var selnode = it.value;\n // ignore a selected link or a deleted node\n if (selnode instanceof go.Node && selnode.data !== null) {\n diagram.model.selectedNodeData = selnode.data;\n break;\n }\n }\n $scope.$apply();\n }", "function sync_selected(evt) {\n\t\tvar nodes_selected = [];\n\t\tvar edges_selected = [];\n\t\tvar eles = g.elements(\"node:selected\");\n\t\t$(document).trigger(\"edit_mode\");\n\t\t$.each(eles, function(i, ele){\n\t\t\t// update the view information (position etc.)\n\t\t\tvar node_data = ele.data();\n\t\t\tvar pos = ele.renderedPosition();\n\t\t\tif (!node_data.view) {\n\t\t\t\tnode_data.view = {};\n\t\t\t}\n\t\t\tnode_data.view.position = pos;\n\t\t\tnodes_selected.push(node_data);\n\t\t});\n\t\t$('#node_editor').trigger(\"update_form\", [nodes_selected]);\n\t\t\n\t\t// next handle edges\n\t\teles = g.elements(\"edge:selected\");\n\t\t$.each(eles, function(i, ele){\n\t\t\tvar edge_data = ele.data();\n\t\t\tedges_selected.push(edge_data);\n\t\t});\n\t\t$(\"#edge_editor\").trigger(\"update_form\", [edges_selected]);\n\t}", "resetSelection () {\n this.currentSelection = null\n }", "function toggle_currently_selected(old_index, cur_index){ \n if (old_index != cur_index){\n coord_array[6*old_index] = 0; //turn off old index\n coord_array[6*cur_index] = 1; //turn on new index\n } else {\n coord_array[6*cur_index] = (coord_array[6*cur_index] == 1) ? 0 : 1; //toggle old index\n };\n saved_index = cur_index;\n // context.fillText(coord_array[6*old_index], 10+160*foobar, 10);\n // context.fillText(coord_array[6*cur_index], 40+160*foobar, 10);\n // context.fillText(old_index, 70+160*foobar, 10);\n // context.fillText(cur_index, 100+160*foobar, 10);\n // foobar++;\n}", "function lastChangeEvent(hist, force) {\n\t\t if (force) {\n\t\t clearSelectionEvents(hist.done);\n\t\t return lst(hist.done);\n\t\t } else if (hist.done.length && !lst(hist.done).ranges) {\n\t\t return lst(hist.done);\n\t\t } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n\t\t hist.done.pop();\n\t\t return lst(hist.done);\n\t\t }\n\t\t }", "function moveSelected(delta) {\n var idx = selectedIndex + delta;\n idx = Math.max(idx, 0);\n idx = Math.min(idx, filteredDeclarations.length - 1);\n\n // select\n setSelectedIndex(idx)\n refreshSelected();\n }" ]
[ "0.66112244", "0.66112244", "0.66112244", "0.6406183", "0.6334268", "0.62584734", "0.62584734", "0.62584734", "0.6165519", "0.6138466", "0.6100709", "0.6091438", "0.6091438", "0.60838115", "0.60519296", "0.60515946", "0.6047643", "0.6047643", "0.6046075", "0.60457534", "0.6022574", "0.6022574", "0.6022574", "0.6022574", "0.6022574", "0.6022574", "0.6015631", "0.59884316", "0.5979848", "0.5965248", "0.59462553", "0.5935999", "0.5935999", "0.5927868", "0.5925113", "0.5911117", "0.5911117", "0.5911117", "0.5911117", "0.5911117", "0.5911117", "0.5911117", "0.5911117", "0.5911117", "0.5911117", "0.5911117", "0.5882575", "0.5822761", "0.58218414", "0.5788591", "0.5788591", "0.57449937", "0.57409585", "0.57287854", "0.5724867", "0.57169", "0.57169", "0.57169", "0.5703472", "0.57029295", "0.56913304", "0.56896", "0.56729484", "0.5652583", "0.5652175", "0.56397325", "0.56347954", "0.56347954", "0.5621594", "0.5604114", "0.5599544", "0.5596912", "0.5596912", "0.5596912", "0.5596912", "0.5580452", "0.557661", "0.5570622", "0.5559931", "0.5552525", "0.55498284", "0.55491006", "0.55439854", "0.5539466" ]
0.6019837
38
Used to store marked span information in the history.
function attachLocalSpans(doc, change, from, to) { var existing = change["spans_" + doc.id], n = 0; doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) { if (line.markedSpans) { (existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans; } ++n; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addMarkedSpan(line, span) {\n\t\t line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n\t\t span.marker.attachLine(line);\n\t\t }", "function addMarkedSpan(line, span) {\n\t line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n\t span.marker.attachLine(line);\n\t }", "function addMarkedSpan(line, span) {\n\t line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n\t span.marker.attachLine(line);\n\t }", "function addMarkedSpan(line, span) {\n\t line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n\t span.marker.attachLine(line);\n\t }", "function addMarkedSpan(line, span, op) {\n\t\t var inThisOp = op && window.WeakSet && (op.markedSpans || (op.markedSpans = new WeakSet));\n\t\t if (inThisOp && line.markedSpans && inThisOp.has(line.markedSpans)) {\n\t\t line.markedSpans.push(span);\n\t\t } else {\n\t\t line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n\t\t if (inThisOp) { inThisOp.add(line.markedSpans); }\n\t\t }\n\t\t span.marker.attachLine(line);\n\t\t }", "function Q(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}", "function addMarkedSpan(line, span, op) {\n var inThisOp = op && window.WeakSet && (op.markedSpans || (op.markedSpans = new WeakSet));\n if (inThisOp && inThisOp.has(line.markedSpans)) {\n line.markedSpans.push(span);\n } else {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n if (inThisOp) { inThisOp.add(line.markedSpans); }\n }\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span, op) {\n var inThisOp = op && window.WeakSet && (op.markedSpans || (op.markedSpans = new WeakSet));\n if (inThisOp && line.markedSpans && inThisOp.has(line.markedSpans)) {\n line.markedSpans.push(span);\n } else {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n if (inThisOp) { inThisOp.add(line.markedSpans); }\n }\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span, op) {\n var inThisOp = op && window.WeakSet && (op.markedSpans || (op.markedSpans = new WeakSet));\n if (inThisOp && line.markedSpans && inThisOp.has(line.markedSpans)) {\n line.markedSpans.push(span);\n } else {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n if (inThisOp) { inThisOp.add(line.markedSpans); }\n }\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\r\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\r\n span.marker.attachLine(line);\r\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "addStoredMark(mark) {\n return this.ensureMarks(mark.addToSet(this.storedMarks || this.selection.$head.marks()));\n }", "function addMarkedSpan(line, span) {\r\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\r\n span.marker.attachLine(line);\r\n}", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span]\n span.marker.attachLine(line)\n}", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span]\n span.marker.attachLine(line)\n}", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n}", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n}", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n}", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n}", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n}", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n}", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n}", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n}", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n}", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n}", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n}", "saveInHistory(state) {\n let histName = state.currentHistoryName;\n\n if (histName === null) {\n // New history row\n histName = this.getNewHistoryName(state);\n state.currentHistoryName = histName;\n }\n\n state.history[histName] = {\n name: histName,\n lastModification: Date.now(),\n points: state.points,\n links: state.links,\n tooltips: state.tooltips,\n defaultPointColor: state.defaultPointColor,\n defaultLinkColor: state.defaultLinkColor,\n defaultTooltipColor: state.defaultTooltipColor,\n defaultTooltipFontColor: state.defaultTooltipFontColor\n };\n\n this.storeHistory(state.history);\n }", "mark(markName) {\n this.marks[markName] = new Mark()\n }", "function save_history () {\n\tvar ds = currHds();\n\tedit_history [edit_history_index] = JSON.stringify(ds.toJSON());\n}", "function getMarkedSpanFor(spans, marker) {\n\t\t if (spans) { for (var i = 0; i < spans.length; ++i) {\n\t\t var span = spans[i];\n\t\t if (span.marker == marker) { return span }\n\t\t } }\n\t\t }", "setStoredMarks(marks) {\n this.storedMarks = marks;\n this.updated |= UPDATED_MARKS;\n return this;\n }", "function attachLocalSpans(doc, change, from, to) {\n\t\t var existing = change[\"spans_\" + doc.id], n = 0;\n\t\t doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n\t\t if (line.markedSpans)\n\t\t { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n\t\t ++n;\n\t\t });\n\t\t }", "function attachLocalSpans(doc, change, from, to) {\n\t\t var existing = change[\"spans_\" + doc.id], n = 0;\n\t\t doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\n\t\t if (line.markedSpans)\n\t\t (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\n\t\t ++n;\n\t\t });\n\t\t }", "function getMarkedSpanFor(spans, marker) {\n\t\t if (spans) for (var i = 0; i < spans.length; ++i) {\n\t\t var span = spans[i];\n\t\t if (span.marker == marker) return span;\n\t\t }\n\t\t }", "function AddSkidMark(pos : Vector3, normal : Vector3, intensity : float, lastIndex : int)\n{ \n\tif(intensity > 1)\n\t\tintensity = 1.0;\n\tif(intensity < 0)\n\t\treturn -1;\n\t\t \n\tvar curr : markSection = skidmarks[numMarks % maxMarks];\n\tcurr.pos = pos + normal * groundOffset;\n\tcurr.normal = normal;\n\tcurr.intensity = intensity;\n\tcurr.lastIndex = lastIndex;\n\n\tif(lastIndex != -1)\n\t{\n\t\tvar last : markSection = skidmarks[lastIndex % maxMarks];\n\t\tvar dir : Vector3 = (curr.pos - last.pos);\n\t\tvar xDir : Vector3 = Vector3.Cross(dir,normal).normalized;\n\t\t\n\t\tcurr.posl = curr.pos + xDir * markWidth * 0.5;\n\t\tcurr.posr = curr.pos - xDir * markWidth * 0.5;\n\t\tcurr.tangent = new Vector4(xDir.x, xDir.y, xDir.z, 1);\n\t\t\n\t\tif(last.lastIndex == -1)\n\t\t{\n\t\t\tlast.tangent = curr.tangent;\n\t\t\tlast.posl = curr.pos + xDir * markWidth * 0.5;\n\t\t\tlast.posr = curr.pos - xDir * markWidth * 0.5;\n\t\t}\n\t}\n\tnumMarks++;\n\tupdated = true;\n\treturn numMarks -1;\n}", "function attachLocalSpans(doc, change, from, to) {\n\t var existing = change[\"spans_\" + doc.id], n = 0;\n\t doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\n\t if (line.markedSpans)\n\t (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\n\t ++n;\n\t });\n\t }", "function attachLocalSpans(doc, change, from, to) {\n\t var existing = change[\"spans_\" + doc.id], n = 0;\n\t doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\n\t if (line.markedSpans)\n\t (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\n\t ++n;\n\t });\n\t }", "function attachLocalSpans(doc, change, from, to) {\n\t var existing = change[\"spans_\" + doc.id], n = 0;\n\t doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\n\t if (line.markedSpans)\n\t (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\n\t ++n;\n\t });\n\t }", "function attachLocalSpans(doc, change, from, to) {\r\n var existing = change[\"spans_\" + doc.id], n = 0;\r\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\r\n if (line.markedSpans)\r\n (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\r\n ++n;\r\n });\r\n }", "function saveLabelState(label,coords){\n\t\t\t\t\n\t\t\t\tvar slider = document.getElementById(\"size_input\");\n\t\t\t\tvar size = slider.value;\n\t\t\t\tvar invisible = false;\t\n\t\t\t\t\n\t\t\t\tif (document.getElementById('btn-visibility-brush').innerHTML == 'Reveal'){\n\t\t\t\t\tinvisible=true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tvar token = new Object();\n\t\t\t\ttoken.size = size;\n\t\t\t\ttoken.label = label;\n\t\t\t\ttoken.brushType = indBrush.getCurrentBrush();\n\t\t\t\ttoken.brushShape = brushShape;\n\t\t\t\ttoken.coords = coords;\n\t\t\t\ttoken.invisible = invisible;\n\t\t\t\tlabelMap[label] = token;\n\t\t\t}", "function getMarkedSpanFor(spans, marker) {\n\t if (spans) for (var i = 0; i < spans.length; ++i) {\n\t var span = spans[i];\n\t if (span.marker == marker) return span;\n\t }\n\t }", "function getMarkedSpanFor(spans, marker) {\n\t if (spans) for (var i = 0; i < spans.length; ++i) {\n\t var span = spans[i];\n\t if (span.marker == marker) return span;\n\t }\n\t }", "function getMarkedSpanFor(spans, marker) {\n\t if (spans) for (var i = 0; i < spans.length; ++i) {\n\t var span = spans[i];\n\t if (span.marker == marker) return span;\n\t }\n\t }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\n if (line.markedSpans)\n (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\n if (line.markedSpans)\n (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\n if (line.markedSpans)\n (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\n if (line.markedSpans)\n (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\n if (line.markedSpans)\n (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\n if (line.markedSpans)\n (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\n if (line.markedSpans)\n (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\n ++n;\n });\n }", "function getMarkedSpanFor(spans, marker) {\r\n if (spans) for (var i = 0; i < spans.length; ++i) {\r\n var span = spans[i];\r\n if (span.marker == marker) return span;\r\n }\r\n }", "setMark() {\r\n mark = stack.length;\r\n }", "function attachLocalSpans(doc, change, from, to) {\r\n var existing = change[\"spans_\" + doc.id], n = 0;\r\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\r\n if (line.markedSpans)\r\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\r\n ++n;\r\n });\r\n}", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans }\n ++n\n })\n}", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans }\n ++n\n })\n}", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n}", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n}", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n}", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n}", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n}", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n}", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n}", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n}", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n}" ]
[ "0.6327484", "0.6285503", "0.6285503", "0.6285503", "0.62029684", "0.61554384", "0.6131782", "0.6125477", "0.6125477", "0.6085742", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.6053831", "0.59207094", "0.591192", "0.591192", "0.58958644", "0.58958644", "0.58958644", "0.58958644", "0.58958644", "0.58958644", "0.58958644", "0.58958644", "0.58958644", "0.58958644", "0.58958644", "0.5894046", "0.5776944", "0.5694889", "0.5642168", "0.5640156", "0.56145966", "0.56125534", "0.56009966", "0.5560274", "0.55549306", "0.55549306", "0.55549306", "0.5554014", "0.5547795", "0.5537876", "0.5537876", "0.5537876", "0.551508", "0.551508", "0.551508", "0.551508", "0.551508", "0.551508", "0.551508", "0.5474215", "0.54732686", "0.54554516", "0.54424334", "0.54424334", "0.5436802", "0.5436802", "0.5436802", "0.5436802", "0.5436802", "0.5436802", "0.5436802", "0.5436802", "0.5436802" ]
0.54982615
82
When un/redoing restores text containing marked spans, those that have been explicitly cleared should not be restored.
function removeClearedSpans(spans) { if (!spans) { return null } var out; for (var i = 0; i < spans.length; ++i) { if (spans[i].marker.explicitlyCleared) { if (!out) { out = spans.slice(0, i); } } else if (out) { out.push(spans[i]); } } return !out ? spans : out.length ? out : null }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function remark() {\n for (var i = 0; i < vm.game.marked.length; i++) {\n var element = angular.element(document.getElementById('text-' + i));\n var marked = vm.game.marked[i];\n element.removeClass('last');\n element.removeClass('first');\n if (marked) {\n element.addClass('marked');\n var next = i + 1;\n var after = next < vm.game.marked.length;\n if (after && !vm.game.marked[next]) {\n element.addClass('last');\n }\n } else {\n element.removeClass('marked');\n }\n }\n clearSelection();\n }", "function unHighlight() {\r\n var sel = window.getSelection && window.getSelection();\r\n if (sel && sel.rangeCount == 0 && savedRange != null) {\r\n sel.addRange(savedRange);\r\n }\r\n if (sel && sel.rangeCount > 0) {\r\n // Get location and text info\r\n let range = sel.getRangeAt(0);\r\n console.log(range)\r\n let node = document.createElement('p')\r\n node.setAttribute('class', 'unhighlight')\r\n let selText = range.cloneContents();\r\n node.appendChild(selText);\r\n let markedList = node.getElementsByTagName('mark');\r\n for (let i = 0; i < markedList.length; i++) {\r\n markedList[i].outerHTML = markedList[i].innerHTML;\r\n }\r\n\r\n range.deleteContents();\r\n range.insertNode(node);\r\n // Remove the tags from inserted node\r\n var unHiteLiteList = document.getElementsByClassName('unhighlight');\r\n\r\n for (let i = 0 ; i < unHiteLiteList.length; i ++) {\r\n var parent = unHiteLiteList[i].parentNode;\r\n while (unHiteLiteList[i].firstChild) {\r\n parent.insertBefore(unHiteLiteList[i].firstChild, unHiteLiteList[i]);\r\n }\r\n parent.removeChild(unHiteLiteList[i]);\r\n }\r\n // range.selectNodeContents(selText); \r\n saveCurrentState();\r\n }\r\n }", "function ae(e){var t=e.markedSpans;if(t){for(var a=0;a<t.length;++a)t[a].marker.detachLine(e);e.markedSpans=null}}", "function removeClearedSpans(spans) {\n if (!spans) {\n return null;\n }\n\n var out;\n\n for (var i = 0; i < spans.length; ++i) {\n if (spans[i].marker.explicitlyCleared) {\n if (!out) {\n out = spans.slice(0, i);\n }\n } else if (out) {\n out.push(spans[i]);\n }\n }\n\n return !out ? spans : out.length ? out : null;\n } // Retrieve and filter the old marked spans stored in a change event.", "function removeMarkedSpan(spans, span) {\n\t\t for (var r, i = 0; i < spans.length; ++i)\n\t\t if (spans[i] != span) (r || (r = [])).push(spans[i]);\n\t\t return r;\n\t\t }", "function clearAll() {\n if (activeHighlight && activeHighlight.applied) {\n activeHighlight.cleanup();\n }\n activeHighlight = null;\n }", "resetHighlighted() {\n this.highlights.forEach((h) => h.remove());\n this.highlights.length = 0; // Clear\n }", "function removeMarkedSpan(spans, span) {\n\t\t var r;\n\t\t for (var i = 0; i < spans.length; ++i)\n\t\t { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n\t\t return r\n\t\t }", "function removeMarkedSpan(spans, span) {\n\t for (var r, i = 0; i < spans.length; ++i)\n\t if (spans[i] != span) (r || (r = [])).push(spans[i]);\n\t return r;\n\t }", "function removeMarkedSpan(spans, span) {\n\t for (var r, i = 0; i < spans.length; ++i)\n\t if (spans[i] != span) (r || (r = [])).push(spans[i]);\n\t return r;\n\t }", "function removeMarkedSpan(spans, span) {\n\t for (var r, i = 0; i < spans.length; ++i)\n\t if (spans[i] != span) (r || (r = [])).push(spans[i]);\n\t return r;\n\t }", "restore() {\n if(this.saved.caret)\n this.set(this.saved.startNodeIndex, this.saved.startOffset);\n else\n this.set(this.saved.startNodeIndex, this.saved.startOffset,\n this.saved.endNodeIndex, this.saved.endOffset);\n }", "function removeMarkedSpan(spans, span) {\r\n for (var r, i = 0; i < spans.length; ++i)\r\n if (spans[i] != span) (r || (r = [])).push(spans[i]);\r\n return r;\r\n }", "function clearHighlights() {\n $(getContainer()).find('.' + className).each(function() {\n var $wrapped = $(this);\n $wrapped.replaceWith($wrapped.text());\n });\n }", "clearHighlight() {\n\n //TODO - your code goes here -\n }", "removeStoredMark(mark) {\n return this.ensureMarks(mark.removeFromSet(this.storedMarks || this.selection.$head.marks()));\n }", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n }", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n }", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n }", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n }", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n }", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n }", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n }", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n }", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n }", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n }", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n }", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n }", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n }", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n }", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n }", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n }", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n }", "function removeMarkedSpan(spans, span) {\n for (var r, i = 0; i < spans.length; ++i)\n if (spans[i] != span) (r || (r = [])).push(spans[i]);\n return r;\n }", "function removeMarkedSpan(spans, span) {\n for (var r, i = 0; i < spans.length; ++i)\n if (spans[i] != span) (r || (r = [])).push(spans[i]);\n return r;\n }", "function removeMarkedSpan(spans, span) {\n for (var r, i = 0; i < spans.length; ++i)\n if (spans[i] != span) (r || (r = [])).push(spans[i]);\n return r;\n }", "function removeMarkedSpan(spans, span) {\n for (var r, i = 0; i < spans.length; ++i)\n if (spans[i] != span) (r || (r = [])).push(spans[i]);\n return r;\n }", "function removeMarkedSpan(spans, span) {\n for (var r, i = 0; i < spans.length; ++i)\n if (spans[i] != span) (r || (r = [])).push(spans[i]);\n return r;\n }", "function removeMarkedSpan(spans, span) {\n for (var r, i = 0; i < spans.length; ++i)\n if (spans[i] != span) (r || (r = [])).push(spans[i]);\n return r;\n }", "function removeMarkedSpan(spans, span) {\n for (var r, i = 0; i < spans.length; ++i)\n if (spans[i] != span) (r || (r = [])).push(spans[i]);\n return r;\n }", "resetEditor() {\n // best solution to clear all text/cursor position without issues\n // see https://github.com/facebook/draft-js/issues/410\n\n const editorState = this.state.editorState;\n\n const contentState = editorState.getCurrentContent();\n const selectionState = editorState.getSelection();\n\n const isBackward = selectionState.getIsBackward();\n\n const firstBlock = contentState.getFirstBlock();\n const lastBlock = contentState.getLastBlock();\n\n const leftmostBlock = !isBackward ? firstBlock : lastBlock;\n const rightmostBlock = !isBackward ? lastBlock : firstBlock;\n\n const rightmostBlockLength = rightmostBlock.getLength();\n\n const anchorKey = leftmostBlock.getKey();\n const anchorOffset = !isBackward ? 0 : rightmostBlockLength;\n\n const focusKey = rightmostBlock.getKey();\n const focusOffset = !isBackward ? rightmostBlockLength : 0;\n\n const newSelectionState = selectionState.merge({\n anchorKey,\n anchorOffset,\n focusKey,\n focusOffset,\n hasFocus: true\n });\n\n const newEditorState = EditorState.push(\n EditorState.moveFocusToEnd(editorState),\n Modifier.replaceText(contentState, newSelectionState, \"\")\n );\n this.setState({\n editorState: newEditorState\n });\n }", "function removeMarkedSpan(spans, span) {\r\n var r;\r\n for (var i = 0; i < spans.length; ++i)\r\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\r\n return r\r\n}", "function undoHighlightContext() {\n highlightDOM.style.display = \"none\";\n document.body.removeChild(highlightDOM);\n}", "function removeMarkedSpan(spans, span) {\n var r\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]) } }\n return r\n}", "function removeMarkedSpan(spans, span) {\n var r\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]) } }\n return r\n}", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n}", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n}", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n}", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n}", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n}", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n}", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n}", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n}", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n}", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n}", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n}", "function removeMarkedSpan(spans, span) {\n var r;\n\n for (var i = 0; i < spans.length; ++i) {\n if (spans[i] != span) {\n (r || (r = [])).push(spans[i]);\n }\n }\n\n return r;\n } // Add a span to a line.", "reset() {\n let i;\n let target;\n for (i = 0; i < this.targetStartIndex; i++) {\n target = this.targets[i];\n target.textNode.textContent = target.textContent;\n target.isRemoved = false;\n }\n for (i = this.targetStartIndex; i < this.targets.length; i++) {\n target = this.targets[i];\n target.textNode.textContent = \"\";\n target.isRemoved = false;\n }\n this.cursor.target = this.targets[this.targetStartIndex];\n }", "finishEditingText() {\n if (!this.editingText) return;\n this.editingText.finishEditing();\n\n if (this.editingText.content === '') {\n this.editingText.remove();\n }\n\n this.editingText = null;\n this.fireEvent('canvasModified');\n }", "function restoreCaretPosition (lastPosition) {\r\n // we go over all span chunks until the right node is identified\r\n var currentChunk = editor.childNodes[0]\r\n var covered = 0\r\n var position = Math.min(lastPosition, editor.innerText.length)\r\n\r\n while (covered < position) { // in case we have removed spaces\r\n if (currentChunk.childNodes[0].length + covered >= position) {\r\n break // chunk found\r\n }\r\n covered += currentChunk.childNodes[0].length\r\n currentChunk = currentChunk.nextSibling\r\n }\r\n\r\n var offset = position - covered\r\n\r\n var range = document.createRange()\r\n var sel = window.getSelection()\r\n range.setStart(currentChunk.childNodes[0], offset)\r\n range.collapse(true)\r\n sel.removeAllRanges()\r\n sel.addRange(range)\r\n}", "function detachMarkedSpans(line) {\n\t\t var spans = line.markedSpans;\n\t\t if (!spans) { return }\n\t\t for (var i = 0; i < spans.length; ++i)\n\t\t { spans[i].marker.detachLine(line); }\n\t\t line.markedSpans = null;\n\t\t }", "function detachMarkedSpans(line) {\n\t\t var spans = line.markedSpans;\n\t\t if (!spans) return;\n\t\t for (var i = 0; i < spans.length; ++i)\n\t\t spans[i].marker.detachLine(line);\n\t\t line.markedSpans = null;\n\t\t }", "undo() {\n\t\tthis.editing = false;\n\t\tthis.query('.edit').value = this.text;\n\t}", "function allClear() {\n previousText.innerHTML = '';\n currentText.innerHTML = '';\n}", "_clear() {\n this.editableNode.innerHTML = \"\";\n }", "function cleanupHighlights() {\n\t\t// Remember range details to restore it later.\n\t\tvar startContainer = rangeObject.startContainer;\n\t\tvar startOffset = rangeObject.startOffset;\n\t\tvar endContainer = rangeObject.endContainer;\n\t\tvar endOffset = rangeObject.endOffset;\n\n\t\t// Remove each of the created highlights.\n\t\tfor (var highlightIdx in highlights) {\n\t\t\tremoveHighlight(highlights[highlightIdx]);\n\t\t}\n\n\t\t// Be kind and restore the rangeObject again.\n\t\trangeObject.setStart(startContainer, startOffset);\n\t\trangeObject.setEnd(endContainer, endOffset);\n\t}", "clearHighlight() {\n\n //TODO - Your code goes here - \n let icon = d3.select('.icon-holder').selectAll('text');\n icon.remove();\n let values = d3.select('.value-holder').selectAll('text');\n values.remove();\n let name = d3.select('.name-holder').selectAll('text');\n name.remove();\n\n }", "function unrender(){\n var textmap = textMap,\n i = textmap.length - 1,\n entry, Node, Parent;\n // 1st pass, remove highlights\n while (i-- > 0) {\n entry = textmap[i];\n Node = entry.n.parentNode;\n if (Node && Node.className && Node.className === 'hi') {\n Node.parentNode.replaceChild(entry.n, Node);\n }\n }\n // 2nd pass, remove highlight parents\n i = textmap.length - 1;\n while (i-- > 0) {\n entry = textmap[i];\n Parent = entry.n.parentNode;\n if (Node && Node.className && Parent.className === '-parent') {\n while (Parent.hasChildNodes()) {\n Parent.parentNode.insertBefore(Parent.firstChild, Parent);\n }\n Parent.parentNode.removeChild(Parent);\n }\n }\n}", "unhighlightAll() {\n if (!this.tf.highlightKeywords) {\n return;\n }\n\n this.unhighlight(null, this.highlightCssClass);\n }", "function undo() {\n window.annotationObjects.pop();\n }", "syncToMarks(marks, inline, view) {\n let keep = 0, depth = this.stack.length >> 1;\n let maxKeep = Math.min(depth, marks.length);\n while (keep < maxKeep && (keep == depth - 1 ? this.top : this.stack[keep + 1 << 1]).matchesMark(marks[keep]) && marks[keep].type.spec.spanning !== false)\n keep++;\n while (keep < depth) {\n this.destroyRest();\n this.top.dirty = NOT_DIRTY;\n this.index = this.stack.pop();\n this.top = this.stack.pop();\n depth--;\n }\n while (depth < marks.length) {\n this.stack.push(this.top, this.index + 1);\n let found2 = -1;\n for (let i = this.index; i < Math.min(this.index + 3, this.top.children.length); i++) {\n let next = this.top.children[i];\n if (next.matchesMark(marks[depth]) && !this.isLocked(next.dom)) {\n found2 = i;\n break;\n }\n }\n if (found2 > -1) {\n if (found2 > this.index) {\n this.changed = true;\n this.destroyBetween(this.index, found2);\n }\n this.top = this.top.children[this.index];\n } else {\n let markDesc = MarkViewDesc.create(this.top, marks[depth], inline, view);\n this.top.children.splice(this.index, 0, markDesc);\n this.top = markDesc;\n this.changed = true;\n }\n this.index = 0;\n depth++;\n }\n }", "revert() {\n // If it's not parsed, then do nothing\n if (!this.isParsed) {\n return\n }\n\n for (let i = 0; i < this.preEls.length; i++) {\n this.preEls[i].removeAttribute('data-highlight')\n // Check content type\n if (typeof this.preElsCache[i] === 'string') {\n this.preEls[i].innerText = this.preElsCache[i]\n }\n else {\n this.preEls[i].innerHTML = ''\n this.preEls[i].appendChild(this.preElsCache[i].cloneNode(true))\n }\n }\n\n this.removeLinkEl()\n this.isParsed = false\n }", "function clearHighlightsOnPage()\n{\n unhighlight(document.getElementsByTagName('body')[0], \"ffff00\");\n highlightedPage = false;\n lastText = \"\";\n}", "function clearUndoBuffer() {\r\n undoObject.origSearchString = \"\";\r\n undoObject.newRanges.length = 0;\r\n}", "clearFromMark() {\r\n if (mark !== null) {\r\n stack.splice(mark);\r\n mark = null;\r\n }\r\n }", "function _removeHighlights() {\n\t\t$(\".find-highlight\").contents().unwrap();\n\t}", "function resetSelection(){\n\t$(\".document-list, #scrapPaperDiv, .scrap-keyword\").find(\"span\").each(function( index ){\n\t\tif($(this).hasClass('ent_highlighted')){\n\t\t\t$(this).removeClass('ent_highlighted');\n\t\t}\n\t\t\n\t\tif($(this).hasClass('highlighted')){\n\t\t\t$(this).parent().unhighlight({className:$(this).text().split(\" \")[0]});\t\t\n\t\t}\n\t});\n\tqueue = [];\n}", "_restoreState() {\n this.bold(this._state.bold);\n this.italic(this._state.italic);\n this.underline(this._state.underline);\n this.invert(this._state.invert);\n\n this._queue([\n 0x1b, 0x74, this._state.codepage,\n ]);\n }", "function removeClearedSpans(spans) {\n\t\t if (!spans) return null;\n\t\t for (var i = 0, out; i < spans.length; ++i) {\n\t\t if (spans[i].marker.explicitlyCleared) { if (!out) out = spans.slice(0, i); }\n\t\t else if (out) out.push(spans[i]);\n\t\t }\n\t\t return !out ? spans : out.length ? out : null;\n\t\t }", "function detachMarkedSpans(line) {\n\t var spans = line.markedSpans;\n\t if (!spans) return;\n\t for (var i = 0; i < spans.length; ++i)\n\t spans[i].marker.detachLine(line);\n\t line.markedSpans = null;\n\t }", "function detachMarkedSpans(line) {\n\t var spans = line.markedSpans;\n\t if (!spans) return;\n\t for (var i = 0; i < spans.length; ++i)\n\t spans[i].marker.detachLine(line);\n\t line.markedSpans = null;\n\t }", "function detachMarkedSpans(line) {\n\t var spans = line.markedSpans;\n\t if (!spans) return;\n\t for (var i = 0; i < spans.length; ++i)\n\t spans[i].marker.detachLine(line);\n\t line.markedSpans = null;\n\t }", "clean() {\r\n\t\tconst\r\n\t\t\tmarkedCells = Array.from(document.querySelectorAll(selectors.marked));\r\n\r\n\t\tmarkedCells.forEach(cell => cell.classList.remove(cssClasses.marked));\r\n\t}", "function reset() {\n processText(task.text);\n remark();\n }", "clearHighlights() {\n\t\tvar t = this;\n\t\tvar len = t.getLength();\n\t\tfor (var x = 0; x < len; x++) {\n\t\t\tt.getRow(x).classList.remove(\"highlight\");\n\t\t}\n\t}", "clearHighlight() {\n this.clearCharts();\n\n let infoSVG = d3.select('#info-svg');\n infoSVG.selectAll(\"text\").remove();\n\n this.updateTable(this.stateDataArray);\n\n }", "function removeClearedSpans(spans) {\r\n if (!spans) return null;\r\n for (var i = 0, out; i < spans.length; ++i) {\r\n if (spans[i].marker.explicitlyCleared) { if (!out) out = spans.slice(0, i); }\r\n else if (out) out.push(spans[i]);\r\n }\r\n return !out ? spans : out.length ? out : null;\r\n }", "function resetHighlight_eecq(e) {\neecq.resetStyle(e.target);\ninfo.update();\n}", "_unmarkAll() {\n if (!this.isEmpty()) {\n this._selection.forEach(value => this._unmarkSelected(value));\n }\n }", "_unmarkAll() {\n if (!this.isEmpty()) {\n this._selection.forEach(value => this._unmarkSelected(value));\n }\n }", "function detachMarkedSpans(line) {\r\n var spans = line.markedSpans;\r\n if (!spans) return;\r\n for (var i = 0; i < spans.length; ++i)\r\n spans[i].marker.detachLine(line);\r\n line.markedSpans = null;\r\n }", "function removeClearedSpans(spans) {\n if (!spans) return null;\n for (var i = 0, out; i < spans.length; ++i) {\n if (spans[i].marker.explicitlyCleared) { if (!out) out = spans.slice(0, i); }\n else if (out) out.push(spans[i]);\n }\n return !out ? spans : out.length ? out : null;\n }", "function removeClearedSpans(spans) {\n if (!spans) return null;\n for (var i = 0, out; i < spans.length; ++i) {\n if (spans[i].marker.explicitlyCleared) { if (!out) out = spans.slice(0, i); }\n else if (out) out.push(spans[i]);\n }\n return !out ? spans : out.length ? out : null;\n }", "function removeClearedSpans(spans) {\n if (!spans) return null;\n for (var i = 0, out; i < spans.length; ++i) {\n if (spans[i].marker.explicitlyCleared) { if (!out) out = spans.slice(0, i); }\n else if (out) out.push(spans[i]);\n }\n return !out ? spans : out.length ? out : null;\n }", "function removeClearedSpans(spans) {\n if (!spans) return null;\n for (var i = 0, out; i < spans.length; ++i) {\n if (spans[i].marker.explicitlyCleared) { if (!out) out = spans.slice(0, i); }\n else if (out) out.push(spans[i]);\n }\n return !out ? spans : out.length ? out : null;\n }", "function removeClearedSpans(spans) {\n if (!spans) return null;\n for (var i = 0, out; i < spans.length; ++i) {\n if (spans[i].marker.explicitlyCleared) { if (!out) out = spans.slice(0, i); }\n else if (out) out.push(spans[i]);\n }\n return !out ? spans : out.length ? out : null;\n }", "function removeClearedSpans(spans) {\n if (!spans) return null;\n for (var i = 0, out; i < spans.length; ++i) {\n if (spans[i].marker.explicitlyCleared) { if (!out) out = spans.slice(0, i); }\n else if (out) out.push(spans[i]);\n }\n return !out ? spans : out.length ? out : null;\n }", "function removeClearedSpans(spans) {\n if (!spans) return null;\n for (var i = 0, out; i < spans.length; ++i) {\n if (spans[i].marker.explicitlyCleared) { if (!out) out = spans.slice(0, i); }\n else if (out) out.push(spans[i]);\n }\n return !out ? spans : out.length ? out : null;\n }", "function removeClearedSpans(spans) {\n\t\t if (!spans) { return null }\n\t\t var out;\n\t\t for (var i = 0; i < spans.length; ++i) {\n\t\t if (spans[i].marker.explicitlyCleared) { if (!out) { out = spans.slice(0, i); } }\n\t\t else if (out) { out.push(spans[i]); }\n\t\t }\n\t\t return !out ? spans : out.length ? out : null\n\t\t }", "undo() {\n if (this.owner.isReadOnlyMode || !this.canUndo() || !this.owner.enableHistoryMode) {\n return;\n }\n //this.owner.ClearTextSearchResults();\n let historyInfo = this.undoStack.pop();\n this.isUndoing = true;\n historyInfo.revert();\n this.isUndoing = false;\n this.owner.selection.checkForCursorVisibility();\n this.owner.editorModule.isBordersAndShadingDialog = false;\n }", "function rem(){\n $(\"#b1\").removeClass(\"Highlight\") ;\n $(\"#b2\").removeClass(\"Highlight\") ;\n $(\"#b3\").removeClass(\"Highlight\") ;\n $(\"#b4\").removeClass(\"Highlight\") ;\n }" ]
[ "0.6541307", "0.65243256", "0.64623547", "0.6354376", "0.63102525", "0.62996334", "0.6291705", "0.6282214", "0.62536573", "0.62536573", "0.62536573", "0.6238591", "0.62097794", "0.6202563", "0.62011385", "0.620092", "0.6195618", "0.6195618", "0.6195618", "0.6195618", "0.6195618", "0.6195618", "0.6195618", "0.6195618", "0.6195618", "0.6195618", "0.6195618", "0.6195618", "0.6195618", "0.6195618", "0.6195618", "0.6195618", "0.6195618", "0.6187878", "0.6187878", "0.6187878", "0.6187878", "0.6187878", "0.6187878", "0.6187878", "0.61784804", "0.6165864", "0.615933", "0.615809", "0.615809", "0.6155102", "0.6155102", "0.6155102", "0.6155102", "0.6155102", "0.6155102", "0.6155102", "0.6155102", "0.6155102", "0.6155102", "0.6155102", "0.6146699", "0.6125358", "0.6102402", "0.6068982", "0.6065557", "0.60558707", "0.6051052", "0.6048281", "0.6039223", "0.6030898", "0.59949493", "0.59822935", "0.59735084", "0.5957722", "0.59528553", "0.595152", "0.594913", "0.594381", "0.5943354", "0.5941444", "0.5941153", "0.59369683", "0.5933711", "0.593333", "0.593333", "0.593333", "0.5930495", "0.59149885", "0.58960336", "0.5892382", "0.58916456", "0.5886429", "0.5879377", "0.5879377", "0.5863177", "0.58625346", "0.58625346", "0.58625346", "0.58625346", "0.58625346", "0.58625346", "0.58625346", "0.58567023", "0.5853821", "0.58492446" ]
0.0
-1
Retrieve and filter the old marked spans stored in a change event.
function getOldSpans(doc, change) { var found = change["spans_" + doc.id]; if (!found) { return null } var nw = []; for (var i = 0; i < change.text.length; ++i) { nw.push(removeClearedSpans(found[i])); } return nw }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getOldSpans(doc, change) {\n\t\t var found = change[\"spans_\" + doc.id];\n\t\t if (!found) { return null }\n\t\t var nw = [];\n\t\t for (var i = 0; i < change.text.length; ++i)\n\t\t { nw.push(removeClearedSpans(found[i])); }\n\t\t return nw\n\t\t }", "function getOldSpans(doc, change) {\n\t\t var found = change[\"spans_\" + doc.id];\n\t\t if (!found) return null;\n\t\t for (var i = 0, nw = []; i < change.text.length; ++i)\n\t\t nw.push(removeClearedSpans(found[i]));\n\t\t return nw;\n\t\t }", "function getOldSpans(doc, change) {\n\t var found = change[\"spans_\" + doc.id];\n\t if (!found) return null;\n\t for (var i = 0, nw = []; i < change.text.length; ++i)\n\t nw.push(removeClearedSpans(found[i]));\n\t return nw;\n\t }", "function getOldSpans(doc, change) {\n\t var found = change[\"spans_\" + doc.id];\n\t if (!found) return null;\n\t for (var i = 0, nw = []; i < change.text.length; ++i)\n\t nw.push(removeClearedSpans(found[i]));\n\t return nw;\n\t }", "function getOldSpans(doc, change) {\n\t var found = change[\"spans_\" + doc.id];\n\t if (!found) return null;\n\t for (var i = 0, nw = []; i < change.text.length; ++i)\n\t nw.push(removeClearedSpans(found[i]));\n\t return nw;\n\t }", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) return null;\n for (var i = 0, nw = []; i < change.text.length; ++i)\n nw.push(removeClearedSpans(found[i]));\n return nw;\n }", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) return null;\n for (var i = 0, nw = []; i < change.text.length; ++i)\n nw.push(removeClearedSpans(found[i]));\n return nw;\n }", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) return null;\n for (var i = 0, nw = []; i < change.text.length; ++i)\n nw.push(removeClearedSpans(found[i]));\n return nw;\n }", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) return null;\n for (var i = 0, nw = []; i < change.text.length; ++i)\n nw.push(removeClearedSpans(found[i]));\n return nw;\n }", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) return null;\n for (var i = 0, nw = []; i < change.text.length; ++i)\n nw.push(removeClearedSpans(found[i]));\n return nw;\n }", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) return null;\n for (var i = 0, nw = []; i < change.text.length; ++i)\n nw.push(removeClearedSpans(found[i]));\n return nw;\n }", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) return null;\n for (var i = 0, nw = []; i < change.text.length; ++i)\n nw.push(removeClearedSpans(found[i]));\n return nw;\n }", "function getOldSpans(doc, change) {\r\n var found = change[\"spans_\" + doc.id];\r\n if (!found) return null;\r\n for (var i = 0, nw = []; i < change.text.length; ++i)\r\n nw.push(removeClearedSpans(found[i]));\r\n return nw;\r\n }", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id]\n if (!found) { return null }\n var nw = []\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])) }\n return nw\n}", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id]\n if (!found) { return null }\n var nw = []\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])) }\n return nw\n}", "function getOldSpans(doc, change) {\r\n var found = change[\"spans_\" + doc.id];\r\n if (!found) { return null }\r\n var nw = [];\r\n for (var i = 0; i < change.text.length; ++i)\r\n { nw.push(removeClearedSpans(found[i])); }\r\n return nw\r\n}", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n}", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n}", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n}", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n}", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n}", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n}", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n}", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n}", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n}", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n}", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n}", "function removeClearedSpans(spans) {\n if (!spans) {\n return null;\n }\n\n var out;\n\n for (var i = 0; i < spans.length; ++i) {\n if (spans[i].marker.explicitlyCleared) {\n if (!out) {\n out = spans.slice(0, i);\n }\n } else if (out) {\n out.push(spans[i]);\n }\n }\n\n return !out ? spans : out.length ? out : null;\n } // Retrieve and filter the old marked spans stored in a change event.", "function mergeOldSpans(doc, change) {\n var old = getOldSpans(doc, change);\n var stretched = stretchSpansOverChange(doc, change);\n\n if (!old) {\n return stretched;\n }\n\n if (!stretched) {\n return old;\n }\n\n for (var i = 0; i < old.length; ++i) {\n var oldCur = old[i],\n stretchCur = stretched[i];\n\n if (oldCur && stretchCur) {\n spans: for (var j = 0; j < stretchCur.length; ++j) {\n var span = stretchCur[j];\n\n for (var k = 0; k < oldCur.length; ++k) {\n if (oldCur[k].marker == span.marker) {\n continue spans;\n }\n }\n\n oldCur.push(span);\n }\n } else if (stretchCur) {\n old[i] = stretchCur;\n }\n }\n\n return old;\n } // Used both to provide a JSON-safe object in .getHistory, and, when", "function attachLocalSpans(doc, change, from, to) {\n\t var existing = change[\"spans_\" + doc.id], n = 0;\n\t doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\n\t if (line.markedSpans)\n\t (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\n\t ++n;\n\t });\n\t }", "function attachLocalSpans(doc, change, from, to) {\n\t var existing = change[\"spans_\" + doc.id], n = 0;\n\t doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\n\t if (line.markedSpans)\n\t (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\n\t ++n;\n\t });\n\t }", "function attachLocalSpans(doc, change, from, to) {\n\t var existing = change[\"spans_\" + doc.id], n = 0;\n\t doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\n\t if (line.markedSpans)\n\t (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\n\t ++n;\n\t });\n\t }", "function attachLocalSpans(doc, change, from, to) {\n\t\t var existing = change[\"spans_\" + doc.id], n = 0;\n\t\t doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n\t\t if (line.markedSpans)\n\t\t { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n\t\t ++n;\n\t\t });\n\t\t }", "function attachLocalSpans(doc, change, from, to) {\n\t\t var existing = change[\"spans_\" + doc.id], n = 0;\n\t\t doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\n\t\t if (line.markedSpans)\n\t\t (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\n\t\t ++n;\n\t\t });\n\t\t }", "function attachLocalSpans(doc, change, from, to) {\r\n var existing = change[\"spans_\" + doc.id], n = 0;\r\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\r\n if (line.markedSpans)\r\n (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\r\n ++n;\r\n });\r\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\n if (line.markedSpans)\n (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\n if (line.markedSpans)\n (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\n if (line.markedSpans)\n (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\n if (line.markedSpans)\n (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\n if (line.markedSpans)\n (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\n if (line.markedSpans)\n (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\n if (line.markedSpans)\n (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\r\n var existing = change[\"spans_\" + doc.id], n = 0;\r\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\r\n if (line.markedSpans)\r\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\r\n ++n;\r\n });\r\n}", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n}", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n}", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n}", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n}", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n}", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n}", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n}", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n}", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n}", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n}", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n}", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans }\n ++n\n })\n}", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans }\n ++n\n })\n}", "function filterChange(doc, change, update) {\n\t var obj = {\n\t canceled: false,\n\t from: change.from,\n\t to: change.to,\n\t text: change.text,\n\t origin: change.origin,\n\t cancel: function() { this.canceled = true; }\n\t };\n\t if (update) obj.update = function(from, to, text, origin) {\n\t if (from) this.from = clipPos(doc, from);\n\t if (to) this.to = clipPos(doc, to);\n\t if (text) this.text = text;\n\t if (origin !== undefined) this.origin = origin;\n\t };\n\t signal(doc, \"beforeChange\", doc, obj);\n\t if (doc.cm) signal(doc.cm, \"beforeChange\", doc.cm, obj);\n\t\n\t if (obj.canceled) return null;\n\t return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin};\n\t }", "function filterChange(doc, change, update) {\n\t var obj = {\n\t canceled: false,\n\t from: change.from,\n\t to: change.to,\n\t text: change.text,\n\t origin: change.origin,\n\t cancel: function() { this.canceled = true; }\n\t };\n\t if (update) obj.update = function(from, to, text, origin) {\n\t if (from) this.from = clipPos(doc, from);\n\t if (to) this.to = clipPos(doc, to);\n\t if (text) this.text = text;\n\t if (origin !== undefined) this.origin = origin;\n\t };\n\t signal(doc, \"beforeChange\", doc, obj);\n\t if (doc.cm) signal(doc.cm, \"beforeChange\", doc.cm, obj);\n\n\t if (obj.canceled) return null;\n\t return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin};\n\t }", "function filterChange(doc, change, update) {\n\t var obj = {\n\t canceled: false,\n\t from: change.from,\n\t to: change.to,\n\t text: change.text,\n\t origin: change.origin,\n\t cancel: function() { this.canceled = true; }\n\t };\n\t if (update) obj.update = function(from, to, text, origin) {\n\t if (from) this.from = clipPos(doc, from);\n\t if (to) this.to = clipPos(doc, to);\n\t if (text) this.text = text;\n\t if (origin !== undefined) this.origin = origin;\n\t };\n\t signal(doc, \"beforeChange\", doc, obj);\n\t if (doc.cm) signal(doc.cm, \"beforeChange\", doc.cm, obj);\n\n\t if (obj.canceled) return null;\n\t return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin};\n\t }", "function mergeOldSpans(doc, change) {\n\t\t var old = getOldSpans(doc, change);\n\t\t var stretched = stretchSpansOverChange(doc, change);\n\t\t if (!old) return stretched;\n\t\t if (!stretched) return old;\n\t\t\n\t\t for (var i = 0; i < old.length; ++i) {\n\t\t var oldCur = old[i], stretchCur = stretched[i];\n\t\t if (oldCur && stretchCur) {\n\t\t spans: for (var j = 0; j < stretchCur.length; ++j) {\n\t\t var span = stretchCur[j];\n\t\t for (var k = 0; k < oldCur.length; ++k)\n\t\t if (oldCur[k].marker == span.marker) continue spans;\n\t\t oldCur.push(span);\n\t\t }\n\t\t } else if (stretchCur) {\n\t\t old[i] = stretchCur;\n\t\t }\n\t\t }\n\t\t return old;\n\t\t }", "function mergeOldSpans(doc, change) {\n\t\t var old = getOldSpans(doc, change);\n\t\t var stretched = stretchSpansOverChange(doc, change);\n\t\t if (!old) { return stretched }\n\t\t if (!stretched) { return old }\n\n\t\t for (var i = 0; i < old.length; ++i) {\n\t\t var oldCur = old[i], stretchCur = stretched[i];\n\t\t if (oldCur && stretchCur) {\n\t\t spans: for (var j = 0; j < stretchCur.length; ++j) {\n\t\t var span = stretchCur[j];\n\t\t for (var k = 0; k < oldCur.length; ++k)\n\t\t { if (oldCur[k].marker == span.marker) { continue spans } }\n\t\t oldCur.push(span);\n\t\t }\n\t\t } else if (stretchCur) {\n\t\t old[i] = stretchCur;\n\t\t }\n\t\t }\n\t\t return old\n\t\t }", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function() { this.canceled = true; }\n };\n if (update) obj.update = function(from, to, text, origin) {\n if (from) this.from = clipPos(doc, from);\n if (to) this.to = clipPos(doc, to);\n if (text) this.text = text;\n if (origin !== undefined) this.origin = origin;\n };\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) signal(doc.cm, \"beforeChange\", doc.cm, obj);\n\n if (obj.canceled) return null;\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin};\n }", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function() { this.canceled = true; }\n };\n if (update) obj.update = function(from, to, text, origin) {\n if (from) this.from = clipPos(doc, from);\n if (to) this.to = clipPos(doc, to);\n if (text) this.text = text;\n if (origin !== undefined) this.origin = origin;\n };\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) signal(doc.cm, \"beforeChange\", doc.cm, obj);\n\n if (obj.canceled) return null;\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin};\n }", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function() { this.canceled = true; }\n };\n if (update) obj.update = function(from, to, text, origin) {\n if (from) this.from = clipPos(doc, from);\n if (to) this.to = clipPos(doc, to);\n if (text) this.text = text;\n if (origin !== undefined) this.origin = origin;\n };\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) signal(doc.cm, \"beforeChange\", doc.cm, obj);\n\n if (obj.canceled) return null;\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin};\n }", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function() { this.canceled = true; }\n };\n if (update) obj.update = function(from, to, text, origin) {\n if (from) this.from = clipPos(doc, from);\n if (to) this.to = clipPos(doc, to);\n if (text) this.text = text;\n if (origin !== undefined) this.origin = origin;\n };\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) signal(doc.cm, \"beforeChange\", doc.cm, obj);\n\n if (obj.canceled) return null;\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin};\n }", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function() { this.canceled = true; }\n };\n if (update) obj.update = function(from, to, text, origin) {\n if (from) this.from = clipPos(doc, from);\n if (to) this.to = clipPos(doc, to);\n if (text) this.text = text;\n if (origin !== undefined) this.origin = origin;\n };\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) signal(doc.cm, \"beforeChange\", doc.cm, obj);\n\n if (obj.canceled) return null;\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin};\n }", "function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function() { this.canceled = true; }\n };\n if (update) obj.update = function(from, to, text, origin) {\n if (from) this.from = clipPos(doc, from);\n if (to) this.to = clipPos(doc, to);\n if (text) this.text = text;\n if (origin !== undefined) this.origin = origin;\n };\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) signal(doc.cm, \"beforeChange\", doc.cm, obj);\n\n if (obj.canceled) return null;\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin};\n }" ]
[ "0.7795729", "0.7775589", "0.7745061", "0.7745061", "0.7745061", "0.76677495", "0.76677495", "0.76677495", "0.76677495", "0.76677495", "0.76677495", "0.76677495", "0.76551306", "0.7651843", "0.7651843", "0.7651643", "0.76475054", "0.76475054", "0.76475054", "0.76475054", "0.76475054", "0.76475054", "0.76475054", "0.76475054", "0.76475054", "0.76475054", "0.76475054", "0.6832377", "0.62971485", "0.6274857", "0.6274857", "0.6274857", "0.6264501", "0.6255545", "0.6215315", "0.6192026", "0.6192026", "0.6192026", "0.6192026", "0.6192026", "0.6192026", "0.6192026", "0.61868805", "0.61868805", "0.61868805", "0.61868805", "0.61868805", "0.61868805", "0.61868805", "0.61868805", "0.61868805", "0.61868805", "0.61868805", "0.61868805", "0.61868805", "0.61868805", "0.61868805", "0.61868805", "0.61868805", "0.61677134", "0.61413455", "0.61413455", "0.61413455", "0.61413455", "0.61413455", "0.61413455", "0.61413455", "0.61413455", "0.61413455", "0.61413455", "0.61413455", "0.61247087", "0.61247087", "0.6119509", "0.6116948", "0.6116948", "0.611305", "0.61053693", "0.60885423", "0.60885423", "0.60885423", "0.60885423", "0.60885423", "0.60885423" ]
0.77104664
21
Used for un/redoing changes from the history. Combines the result of computing the existing spans with the set of spans that existed in the history (so that deleting around a span and then undoing brings back the span).
function mergeOldSpans(doc, change) { var old = getOldSpans(doc, change); var stretched = stretchSpansOverChange(doc, change); if (!old) { return stretched } if (!stretched) { return old } for (var i = 0; i < old.length; ++i) { var oldCur = old[i], stretchCur = stretched[i]; if (oldCur && stretchCur) { spans: for (var j = 0; j < stretchCur.length; ++j) { var span = stretchCur[j]; for (var k = 0; k < oldCur.length; ++k) { if (oldCur[k].marker == span.marker) { continue spans } } oldCur.push(span); } } else if (stretchCur) { old[i] = stretchCur; } } return old }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getOldSpans(doc, change) {\n\t\t var found = change[\"spans_\" + doc.id];\n\t\t if (!found) return null;\n\t\t for (var i = 0, nw = []; i < change.text.length; ++i)\n\t\t nw.push(removeClearedSpans(found[i]));\n\t\t return nw;\n\t\t }", "function getOldSpans(doc, change) {\n\t\t var found = change[\"spans_\" + doc.id];\n\t\t if (!found) { return null }\n\t\t var nw = [];\n\t\t for (var i = 0; i < change.text.length; ++i)\n\t\t { nw.push(removeClearedSpans(found[i])); }\n\t\t return nw\n\t\t }", "function getOldSpans(doc, change) {\n\t var found = change[\"spans_\" + doc.id];\n\t if (!found) return null;\n\t for (var i = 0, nw = []; i < change.text.length; ++i)\n\t nw.push(removeClearedSpans(found[i]));\n\t return nw;\n\t }", "function getOldSpans(doc, change) {\n\t var found = change[\"spans_\" + doc.id];\n\t if (!found) return null;\n\t for (var i = 0, nw = []; i < change.text.length; ++i)\n\t nw.push(removeClearedSpans(found[i]));\n\t return nw;\n\t }", "function getOldSpans(doc, change) {\n\t var found = change[\"spans_\" + doc.id];\n\t if (!found) return null;\n\t for (var i = 0, nw = []; i < change.text.length; ++i)\n\t nw.push(removeClearedSpans(found[i]));\n\t return nw;\n\t }", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) return null;\n for (var i = 0, nw = []; i < change.text.length; ++i)\n nw.push(removeClearedSpans(found[i]));\n return nw;\n }", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) return null;\n for (var i = 0, nw = []; i < change.text.length; ++i)\n nw.push(removeClearedSpans(found[i]));\n return nw;\n }", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) return null;\n for (var i = 0, nw = []; i < change.text.length; ++i)\n nw.push(removeClearedSpans(found[i]));\n return nw;\n }", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) return null;\n for (var i = 0, nw = []; i < change.text.length; ++i)\n nw.push(removeClearedSpans(found[i]));\n return nw;\n }", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) return null;\n for (var i = 0, nw = []; i < change.text.length; ++i)\n nw.push(removeClearedSpans(found[i]));\n return nw;\n }", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) return null;\n for (var i = 0, nw = []; i < change.text.length; ++i)\n nw.push(removeClearedSpans(found[i]));\n return nw;\n }", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) return null;\n for (var i = 0, nw = []; i < change.text.length; ++i)\n nw.push(removeClearedSpans(found[i]));\n return nw;\n }", "function removeClearedSpans(spans) {\n if (!spans) {\n return null;\n }\n\n var out;\n\n for (var i = 0; i < spans.length; ++i) {\n if (spans[i].marker.explicitlyCleared) {\n if (!out) {\n out = spans.slice(0, i);\n }\n } else if (out) {\n out.push(spans[i]);\n }\n }\n\n return !out ? spans : out.length ? out : null;\n } // Retrieve and filter the old marked spans stored in a change event.", "function getOldSpans(doc, change) {\r\n var found = change[\"spans_\" + doc.id];\r\n if (!found) return null;\r\n for (var i = 0, nw = []; i < change.text.length; ++i)\r\n nw.push(removeClearedSpans(found[i]));\r\n return nw;\r\n }", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n }", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n }", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n }", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n }", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n }", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n }", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n }", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n }", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n }", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n }", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n }", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n }", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n }", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n }", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n }", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n }", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n }", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id]\n if (!found) { return null }\n var nw = []\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])) }\n return nw\n}", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id]\n if (!found) { return null }\n var nw = []\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])) }\n return nw\n}", "function removeMarkedSpan(spans, span) {\n var r;\n\n for (var i = 0; i < spans.length; ++i) {\n if (spans[i] != span) {\n (r || (r = [])).push(spans[i]);\n }\n }\n\n return r;\n } // Add a span to a line.", "function getOldSpans(doc, change) {\r\n var found = change[\"spans_\" + doc.id];\r\n if (!found) { return null }\r\n var nw = [];\r\n for (var i = 0; i < change.text.length; ++i)\r\n { nw.push(removeClearedSpans(found[i])); }\r\n return nw\r\n}", "function undo() {\n circles.value = clone(history[--index.value]);\n }", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n}", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n}", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n}", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n}", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n}", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n}", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n}", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n}", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n}", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n}", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n}", "function undo(history) {\n const { past, future, _latestUnfiltered } = history;\n\n if (past.length <= 0) return history;\n\n const newFuture = _latestUnfiltered != null ? [_latestUnfiltered, ...future] : future;\n\n const newPresent = past[past.length - 1];\n\n return {\n ...newPresent,\n past: past.slice(0, past.length - 1),\n future: newFuture,\n _latestUnfiltered: newPresent\n };\n}", "function undo() {\n\t\tif (actionHistory.length) {\n\t\t\tlet lastAction = actionHistory.pop(),\n\t\t\ttermId = lastAction[0], //indicates term moved\n\t\t\tsourceId = lastAction[1], //indicates where it was moved from\n\t\t\tdestinationId = lastAction[2]; //indicates where it was moved to\n\t\t\tvar term = $.get(termId);\n\n\t\t\tif (sourceId.includes(\"termsContainer\")) { //A->B\n\t\t\t\trestoreTerm(term);\n\t\t\t\t$.get(\"new_\"+termId).remove();\n\t\t\t}\n\t\t\telse if (destinationId.includes(\"termsContainer\")) { //B->A\n\t\t\t\t$.get(sourceId).appendChild(copyTerm(term));\n\t\t\t\thideTerm(term);\n\t\t\t}\n\t\t\telse //B -> B\n\t\t\t{\n\t\t\t\t$.get(sourceId).appendChild($.get(\"new_\"+termId));\n\t\t\t}\n\t\t}\n\t}", "function removeMarkedSpan(spans, span) {\n\t\t for (var r, i = 0; i < spans.length; ++i)\n\t\t if (spans[i] != span) (r || (r = [])).push(spans[i]);\n\t\t return r;\n\t\t }", "function undoChanges(){\n\t\t//Get the last change made\n\t\tlast = _.last(changes);\n\n\t\t//Based on its' time get the others\n\t\tlast_changes = _.where(changes, {time: last.time});\n\n\t\t//Undo the changes for each change\n\t\t_.each(last_changes, function(interval){\n\t\t\t//Put previous class\n\t\t\tchange(interval);\n\t\t});\n\n\t\t//Remove the last changes from the changes\n\t\tchanges = _.difference(changes, last_changes);\n\t}", "function undo (history) {\n debug('undo', {history})\n\n const { past, present, future } = history\n\n if (past.length <= 0) return history\n\n return {\n past: past.slice(0, past.length - 1), // remove last element from past\n present: past[past.length - 1], // set element as new present\n future: [\n present, // old present state is in the future now\n ...future\n ]\n }\n}", "function mergeOldSpans(doc, change) {\n var old = getOldSpans(doc, change);\n var stretched = stretchSpansOverChange(doc, change);\n\n if (!old) {\n return stretched;\n }\n\n if (!stretched) {\n return old;\n }\n\n for (var i = 0; i < old.length; ++i) {\n var oldCur = old[i],\n stretchCur = stretched[i];\n\n if (oldCur && stretchCur) {\n spans: for (var j = 0; j < stretchCur.length; ++j) {\n var span = stretchCur[j];\n\n for (var k = 0; k < oldCur.length; ++k) {\n if (oldCur[k].marker == span.marker) {\n continue spans;\n }\n }\n\n oldCur.push(span);\n }\n } else if (stretchCur) {\n old[i] = stretchCur;\n }\n }\n\n return old;\n } // Used both to provide a JSON-safe object in .getHistory, and, when", "function removeMarkedSpan(spans, span) {\n\t for (var r, i = 0; i < spans.length; ++i)\n\t if (spans[i] != span) (r || (r = [])).push(spans[i]);\n\t return r;\n\t }", "function removeMarkedSpan(spans, span) {\n\t for (var r, i = 0; i < spans.length; ++i)\n\t if (spans[i] != span) (r || (r = [])).push(spans[i]);\n\t return r;\n\t }", "function removeMarkedSpan(spans, span) {\n\t for (var r, i = 0; i < spans.length; ++i)\n\t if (spans[i] != span) (r || (r = [])).push(spans[i]);\n\t return r;\n\t }", "function removeMarkedSpan(spans, span) {\n\t\t var r;\n\t\t for (var i = 0; i < spans.length; ++i)\n\t\t { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n\t\t return r\n\t\t }", "function undo(){\n _.last(lines).remove();\n lines.pop();\n}", "function removeMarkedSpan(spans, span) {\r\n for (var r, i = 0; i < spans.length; ++i)\r\n if (spans[i] != span) (r || (r = [])).push(spans[i]);\r\n return r;\r\n }", "function removeMarkedSpan(spans, span) {\n for (var r, i = 0; i < spans.length; ++i)\n if (spans[i] != span) (r || (r = [])).push(spans[i]);\n return r;\n }", "function removeMarkedSpan(spans, span) {\n for (var r, i = 0; i < spans.length; ++i)\n if (spans[i] != span) (r || (r = [])).push(spans[i]);\n return r;\n }", "function removeMarkedSpan(spans, span) {\n for (var r, i = 0; i < spans.length; ++i)\n if (spans[i] != span) (r || (r = [])).push(spans[i]);\n return r;\n }", "function removeMarkedSpan(spans, span) {\n for (var r, i = 0; i < spans.length; ++i)\n if (spans[i] != span) (r || (r = [])).push(spans[i]);\n return r;\n }", "function removeMarkedSpan(spans, span) {\n for (var r, i = 0; i < spans.length; ++i)\n if (spans[i] != span) (r || (r = [])).push(spans[i]);\n return r;\n }", "function removeMarkedSpan(spans, span) {\n for (var r, i = 0; i < spans.length; ++i)\n if (spans[i] != span) (r || (r = [])).push(spans[i]);\n return r;\n }", "function removeMarkedSpan(spans, span) {\n for (var r, i = 0; i < spans.length; ++i)\n if (spans[i] != span) (r || (r = [])).push(spans[i]);\n return r;\n }", "redoHistory() {\n if (!this.canRedo()) return;\n\n let entry = this.history[this.historyPointer+1];\n // converge\n this.doHistory(entry, false);\n //adjust pointer\n this.historyPointer++;\n }", "undo() {\n if (this.owner.isReadOnlyMode || !this.canUndo() || !this.owner.enableHistoryMode) {\n return;\n }\n //this.owner.ClearTextSearchResults();\n let historyInfo = this.undoStack.pop();\n this.isUndoing = true;\n historyInfo.revert();\n this.isUndoing = false;\n this.owner.selection.checkForCursorVisibility();\n this.owner.editorModule.isBordersAndShadingDialog = false;\n }", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n }", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n }", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n }", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n }", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n }", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n }", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n }", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n }", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n }", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n }", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n }", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n }", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n }", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n }", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n }", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n }", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n }", "function removeMarkedSpan(spans, span) {\n var r\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]) } }\n return r\n}", "function removeMarkedSpan(spans, span) {\n var r\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]) } }\n return r\n}", "undo() {\n if (this.canUndo()) {\n this.shouldSaveHistory = false;\n const { index, state } = this.stack[(this.position -= 1)];\n this.onUpdate();\n\n this.editor.blocks.render({ blocks: state }).then(() => this.editor.caret.setToBlock(index, \"end\"));\n }\n }", "function removeMarkedSpan(spans, span) {\r\n var r;\r\n for (var i = 0; i < spans.length; ++i)\r\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\r\n return r\r\n}", "function undo(history) {\n\t debug('undo', { history: history });\n\n\t var past = history.past;\n\t var present = history.present;\n\t var future = history.future;\n\n\n\t if (past.length <= 0) return history;\n\n\t return {\n\t past: past.slice(0, past.length - 1), // remove last element from past\n\t present: past[past.length - 1], // set element as new present\n\t future: [present].concat(_toConsumableArray(future))\n\t };\n\t}", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n}", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n}", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n}", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n}", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n}", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n}", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n}", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n}", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n}", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n}", "function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n}" ]
[ "0.62034744", "0.6182492", "0.6147326", "0.6147326", "0.6147326", "0.60734504", "0.60734504", "0.60734504", "0.60734504", "0.60734504", "0.60734504", "0.60734504", "0.6068917", "0.6055901", "0.6031862", "0.6031862", "0.6031862", "0.6031862", "0.6031862", "0.6031862", "0.6031862", "0.6031862", "0.6031862", "0.6031862", "0.6031862", "0.6031862", "0.6031862", "0.6031862", "0.6031862", "0.6031862", "0.6031862", "0.59898335", "0.59898335", "0.5976341", "0.596976", "0.5966868", "0.5949331", "0.5949331", "0.5949331", "0.5949331", "0.5949331", "0.5949331", "0.5949331", "0.5949331", "0.5949331", "0.5949331", "0.5949331", "0.58599186", "0.5855536", "0.57877696", "0.5767506", "0.5743356", "0.57415086", "0.5740763", "0.5740763", "0.5740763", "0.5737889", "0.57340807", "0.5730245", "0.5720346", "0.5720346", "0.5720346", "0.5720346", "0.5720346", "0.5720346", "0.5720346", "0.5719416", "0.56962913", "0.5690103", "0.5690103", "0.5690103", "0.5690103", "0.5690103", "0.5690103", "0.5690103", "0.5690103", "0.5690103", "0.5690103", "0.5690103", "0.5690103", "0.5690103", "0.5690103", "0.5690103", "0.5690103", "0.5690103", "0.5671512", "0.5671512", "0.5651934", "0.5640761", "0.5629886", "0.5625354", "0.5625354", "0.5625354", "0.5625354", "0.5625354", "0.5625354", "0.5625354", "0.5625354", "0.5625354", "0.5625354", "0.5625354" ]
0.0
-1
Used both to provide a JSONsafe object in .getHistory, and, when detaching a document, to split the history in two
function copyHistoryArray(events, newGroup, instantiateSel) { var copy = []; for (var i = 0; i < events.length; ++i) { var event = events[i]; if (event.ranges) { copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event); continue } var changes = event.changes, newChanges = []; copy.push({changes: newChanges}); for (var j = 0; j < changes.length; ++j) { var change = changes[j], m = (void 0); newChanges.push({from: change.from, to: change.to, text: change.text}); if (newGroup) { for (var prop in change) { if (m = prop.match(/^spans_(\d+)$/)) { if (indexOf(newGroup, Number(m[1])) > -1) { lst(newChanges)[prop] = change[prop]; delete change[prop]; } } } } } } return copy }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "serializeHistory(state) {\r\n if (!state)\r\n return null;\r\n // Ensure sure that all entries have url\r\n var entries = state.entries.filter(e => e.url);\r\n if (!entries.length)\r\n return null;\r\n // Ensure the index is in bounds.\r\n var index = (state.index || entries.length) - 1;\r\n index = Math.min(index, entries.length - 1);\r\n index = Math.max(index, 0);\r\n var historyStart = this.enableSaveHistory ? 0 : index;\r\n var historyEnd = this.enableSaveHistory ? entries.length : index + 1;\r\n var history = [];\r\n\r\n var saveScroll = this.prefBranch.getBoolPref(\"save.scrollposition\");\r\n var currentScroll = saveScroll && state.scroll ? JSON.stringify(state.scroll) : \"0,0\";\r\n if (currentScroll != \"0,0\")\r\n entries[index].scroll = currentScroll;\r\n\r\n for (let j = historyStart; j < historyEnd; j++) {\r\n try {\r\n let historyEntry = entries[j];\r\n let entry = {\r\n url: historyEntry.url,\r\n title: historyEntry.title || \"\",\r\n scroll: saveScroll && historyEntry.scroll || \"0,0\",\r\n };\r\n if (historyEntry.triggeringPrincipal_base64) {\r\n entry.triggeringPrincipal_base64 = historyEntry.triggeringPrincipal_base64;\r\n }\r\n history.push(entry);\r\n } catch (ex) {\r\n Tabmix.assert(ex, \"serializeHistory error at index \" + j);\r\n }\r\n }\r\n return {\r\n history: encodeURI(JSON.stringify(history)),\r\n index,\r\n scroll: currentScroll\r\n };\r\n }", "sendDocumentState(){\n var document = this.revisionHistory[0];\n\n for(var index = 1; index < this.revisionHistory.length; index++){\n document = merge(document, this.revisionHistory[index]);\n }\n\n return document;\n }", "function getHistory() {\n var pastQueriesJSON;\n pastQueries = localStorage.getItem(storageItem);\n try {\n pastQueriesJSON = JSON.parse(pastQueries);\n if (pastQueriesJSON && typeof pastQueriesJSON === \"object\") {\n return pastQueriesJSON;\n }\n }\n catch (e) {}\n pastQueriesJSON = {\n 'queries': []\n };\n return pastQueriesJSON; //Return JSON object of past queries\n }", "function save_history () {\n\tvar ds = currHds();\n\tedit_history [edit_history_index] = JSON.stringify(ds.toJSON());\n}", "extractDocumentHistory() {\n let document_entry = this.extractDocumentEntry();\n let ptr = document_entry.pointer;\n if (ptr === -1) {\n throw Error(\"Could not locate document entry\");\n }\n let xref = {\n id: -1,\n pointer: ptr,\n generation: 0,\n free: false,\n update: true\n };\n this.extractCrossReferenceTables(document_entry, xref);\n // adapt pointer in case there is junk before the header\n let pdf_header_start = util_1.Util.locateSequence(util_1.Util.VERSION, this.data, 0);\n if (pdf_header_start !== 0 && pdf_header_start !== -1) {\n for (let updateSection of this.updates) {\n for (let ref of updateSection.refs) {\n ref.pointer += pdf_header_start;\n }\n }\n }\n }", "function historyChangeFromChange(doc, change) {\n\t var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n\t attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n\t linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\n\t return histChange;\n\t }", "function historyChangeFromChange(doc, change) {\n\t var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n\t attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n\t linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\n\t return histChange;\n\t }", "function historyChangeFromChange(doc, change) {\n\t var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n\t attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n\t linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\n\t return histChange;\n\t }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\n return histChange;\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\n return histChange;\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\n return histChange;\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\n return histChange;\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\n return histChange;\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\n return histChange;\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\n return histChange;\n }", "function historyChangeFromChange(doc, change) {\n\t\t var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n\t\t attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n\t\t linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\n\t\t return histChange;\n\t\t }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n }", "function historyChangeFromChange(doc, change) {\n\t\t var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n\t\t attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n\t\t linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n\t\t return histChange\n\t\t }", "function saveLastVisit(book, chapter){\n refDb.get('ref_history').then(function(doc){\n doc.visit_history = [{\"book\": $('#book-chapter-btn').text(), \"chapter\": chapter, \"bookId\": book}]\n refDb.put(doc).then(function(response) {\n }).catch(function(err) {\n console.log(err);\n }); \n });\n}", "function historyChangeFromChange(doc, change) {\r\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\r\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\r\n linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\r\n return histChange;\r\n }", "function saveHistory(obj) {\n var latest = db.collection('latest');\n latest.insert(obj);\n findObj();\n }", "function snapshot() {\n\t\t\tvar tmp;\n\n\t\t\tif (!hasSnapshot()) { // has no snapshots yet\n\t\t\t\tsnap.history = [angular.copy(object)];\n\t\t\t} else if (isChanged()) { // has snapshots and is changed since last version\n\t\t\t\ttmp = angular.copy(object);\n\t\t\t\tsnap.history.push(tmp);\n\t\t\t}\n\n\t\t\tsaveSnap();\n\t\t}", "function retrieveHistory () {\n $\n .get('/revisions/' + uid)\n .done(function (res) {\n revisions = res.sort(function (a, b) {\n return new Date(a.createdAt) > new Date(b.createdAt);\n });\n\n revisions.forEach(function (revision, i) {\n var date = $.formatDate(revision.createdAt, true);\n var whoDid = (revision.length >= i + 1) ? revision[i + 1].overridenBy : article.lastAuthorName;\n\n if (i === 0) {\n date = $.formatDate(article.updatedAt, true);\n $target.append('<a href=\"#\" class=\"collection-item blue-text\" data-index=\"' + (revisions.length - i) + '\">Dernier article du ' + date + ' par ' + whoDid + '</a>');\n } else {\n $target.append('<a href=\"#\" class=\"collection-item blue-text\" data-index=\"' + (revisions.length - i) + '\">Révision du ' + date + ' par ' + whoDid + '</a>');\n }\n });\n\n var date = $.formatDate(article.createdAt, true);\n\n $target.append('<a href=\"#\" class=\"collection-item initialVersion blue-text\" data-index=\"0\">Création par ' + article.authorName + ' (' + date + ')</a>');\n\n revisions.push({\n content: article.content\n });\n\n $('.collection-item')\n .mouseenter(function () {\n var i = $(this).data('index');\n var content = revisions[i].content;\n\n var html = marked(content, {\n breaks: true,\n sanitize: true,\n highlight: function (code) {\n return hljs.highlightAuto(code).value;\n }\n });\n $preview.html(html);\n\n if (i !== revisions.length - 1) {\n // Select this one\n var $selecter = $('<a href=\"#\" class=\"btn waves-effect waves-light blue\" id=\"restore\">Restorer cette version</a>')\n .click(function (e) {\n e.preventDefault();\n\n $selecter.addClass('disabled').attr('disabled', '');\n $\n .ajax({\n url: '/articles/' + uid,\n type: 'put',\n contentType: 'application/json; charset=utf-8',\n data: JSON.stringify({ content: content })\n })\n .done(function () {\n location.href = '/read/' + uid;\n })\n .fail(function (res) {\n location.href = '/error/' + res.status;\n });\n });\n $preview.append($selecter);\n }\n\n // Fix https://github.com/chjj/marked/issues/255\n $('pre code').addClass('hljs');\n\n // KateX\n renderMathInElement($preview[0]);\n })\n .click(function (e) {\n e.preventDefault();\n });\n })\n .fail(function (res) {\n location.href = '/error/' + res.status;\n });\n }", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n}", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n}", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n}", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n}", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n}", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n}", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n}", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n}", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n}", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n}", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n}", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)}\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1)\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true)\n return histChange\n}", "function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)}\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1)\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true)\n return histChange\n}", "function receiveHistory(json){\n\tconst history = json;\n\treturn {\n\t\ttype: RECEIVE_HISTORY,\n\t\tjobHistory: history\n\t}\n}", "function historyChangeFromChange(doc, change) {\r\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\r\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\r\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\r\n return histChange\r\n}", "async getHistory() {\n this.setState({ loading: true });\n const db = firebase.firestore(firebaseApp);\n const result = { statusResponse: true, error: null, history: [] };\n try {\n const histDoc = await db\n .collection(\"history\")\n .where(\"idUser\", \"==\", getCurrentUser().uid)\n .get();\n await Promise.all(\n map(histDoc.docs, async (doc) => {\n const record = doc.data();\n result.history.push(record);\n })\n );\n } catch (error) {\n result.statusResponse = false;\n result.error = error;\n }\n return result;\n }", "function createHistory() {\n var history = {\n 'subject' : string[1],\n 'date' : new Date().toString()\n };\n saveHistory(history);\n }", "function addHistory( data ) {\n\n if ( typeof(aio.history) != 'object' ) { aio.history = []; } // Change aio.history to array\n if ( typeof(aio.history) == 'object' && aio.history.length > 19 ) { aio.history.pop(); } // Delete oldest record if total exceeds 20\n\n // Add this new record\n aio.history.unshift( data );\n updateHistory();\n\n}", "set_reverse() {\n// this.prev = this.grid.slice(0);\n if (this.history.length < 10) { // only add to database\n this.history.push(this.grid.slice(0));\n } else {\n this.history.shift(); // remove the first element\n this.history.push(this.grid.slice(0));\n }\n }", "function history(response) {\n\tresponse.writeHead(200, {\"Content-Type\": \"text/plain\"});\n\tdb.getHistory( function(result){\n\t\tresponse.write( result);\n\t\tresponse.end();\n\t});\n}", "function setHistory() {\n // clear undo history\n $('#undoHistoryList')\n .empty();\n\n // load new history list from server\n getHistoryFromServer(addHistList);\n}", "function savePageToHistory(parameterObj) {\n\t// get saved storage first\n\tvar domianPath = getContextPathDomain();\n\tvar savedArray = $.jStorage.get(domianPath + PREVIOUS_PAGE_DATA, []);\n\t// store new value to array\n\tsavedArray.push(parameterObj);\n\t// save to storage\n\t$.jStorage.set(domianPath + PREVIOUS_PAGE_DATA, savedArray);\n}", "function delegate_history(data) {\n\tif(haswebsql) {\n\t\tsstorage.lastviewed=Ext.encode(data);\n\t\tglossdb.data.addhistory(data.title,data.target);\n\t}\n\telse {\n\t\tstorage.lastviewed = Ext.encode(data);\n\t}\n}", "function by_history_id(g_by_index){\n // switch link references on each link\n var newlinks = g_by_index.e.map(function(link){\n var newlink = shallow_copy(link);\n newlink.source = g_by_index.n[link.source].history_id;\n newlink.target = g_by_index.n[link.target].history_id;\n return newlink;\n });\n return {n:g_by_index.n, e:newlinks};\n}", "function updateHistoryIndex() {\n historyIndex = JSON.parse(this.responseText);\n}", "function getFormHistory(){\n\t\t_self.emit(\"log\",\"form.js\",\"getFormHistory()\",\"info\",_historyObj);\n\t\tif(_historyObj.length>0){\n\t\t\treturn _historyObj[_historyObj.length-1];\n\t\t}else{\n\t\t\treturn _historyObj;\n\t\t}\n\t}", "updateHistory(currentBoard) {\n /* add current board to history and increment history index\n *** if historyIndex is less than historyLength-1, it \n means that a move has been played after the user has \n used the jump backwards button. Therefore, all elements in history after\n where historyIndex currently is should be erased *** \n */\n const historyIndex = this.state.historyIndex;\n const historyLength = this.state.history.length;\n var history = this.state.history;\n if (historyIndex < historyLength - 1) {\n history = this.state.history.splice(0, historyIndex + 1);\n }\n\n return history.concat([{ currentBoard: currentBoard }]);\n }", "_handleRevisions(annoId, doc, options, cb) {\n // console.log('_handleRevisions', {annoId, _id: doc._id})\n const {_id, _unversioned, _revid, _replyids} = splitIdRepliesRev(annoId)\n if (!Array.isArray(doc._revisions)) {\n console.error(\"!!!! Database Error !!!! Annotation without _revisions\", _unversioned)\n } else {\n\n const latestRevision = doc._revisions[doc._revisions.length - 1]\n\n const rev = (_revid)\n ? doc._revisions[_revid -1]\n : latestRevision\n\n if (!rev)\n return cb(errors.revisionNotFound(_unversioned, _revid))\n\n if (options.latest) {\n annoId = `${_unversioned}~${doc._revisions.length}`\n doc = rev\n }\n\n // Always send the DOI of the latest revision as the DOI of the TLA\n // so people can cite this correctly unless the root has its own DOI\n if (!doc.doi && latestRevision.doi)\n doc.doi = latestRevision.doi\n\n // XXX TODO use urlJoin and such\n if (_replyids.length) doc.replyTo = this._urlFromId(`${_id}${_replyids.map(x=>`.${x}`).join('')}`)\n if (_revid) doc.versionOf = this._urlFromId(_id)\n }\n return cb(null, this._toJSONLD(annoId, doc, options))\n }", "function copyHistoryArray(events, newGroup, instantiateSel) {\n\t\t for (var i = 0, copy = []; i < events.length; ++i) {\n\t\t var event = events[i];\n\t\t if (event.ranges) {\n\t\t copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);\n\t\t continue;\n\t\t }\n\t\t var changes = event.changes, newChanges = [];\n\t\t copy.push({changes: newChanges});\n\t\t for (var j = 0; j < changes.length; ++j) {\n\t\t var change = changes[j], m;\n\t\t newChanges.push({from: change.from, to: change.to, text: change.text});\n\t\t if (newGroup) for (var prop in change) if (m = prop.match(/^spans_(\\d+)$/)) {\n\t\t if (indexOf(newGroup, Number(m[1])) > -1) {\n\t\t lst(newChanges)[prop] = change[prop];\n\t\t delete change[prop];\n\t\t }\n\t\t }\n\t\t }\n\t\t }\n\t\t return copy;\n\t\t }", "async commitHistory() {\n // Do nothing if no history to be committed, otherwise get history\n if (this.historyBuffer.length === 0) return;\n if (this.lock) return;\n this.lock = true;\n let history = canvas.scene.getFlag(this.layername, \"history\");\n // If history storage doesnt exist, create it\n if (!history) {\n history = {\n events: [],\n pointer: 0,\n };\n }\n // If pointer is less than history length (f.x. user undo), truncate history\n history.events = history.events.slice(0, history.pointer);\n // Push the new history buffer to the scene\n history.events.push(this.historyBuffer);\n history.pointer = history.events.length;\n await canvas.scene.unsetFlag(this.layername, \"history\");\n await this.setSetting(\"history\", history);\n simplefogLog(`Pushed ${this.historyBuffer.length} updates.`);\n // Clear the history buffer\n this.historyBuffer = [];\n this.lock = false;\n }", "function copyHistoryArray(events, newGroup, instantiateSel) {\n\t\t var copy = [];\n\t\t for (var i = 0; i < events.length; ++i) {\n\t\t var event = events[i];\n\t\t if (event.ranges) {\n\t\t copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);\n\t\t continue\n\t\t }\n\t\t var changes = event.changes, newChanges = [];\n\t\t copy.push({changes: newChanges});\n\t\t for (var j = 0; j < changes.length; ++j) {\n\t\t var change = changes[j], m = (void 0);\n\t\t newChanges.push({from: change.from, to: change.to, text: change.text});\n\t\t if (newGroup) { for (var prop in change) { if (m = prop.match(/^spans_(\\d+)$/)) {\n\t\t if (indexOf(newGroup, Number(m[1])) > -1) {\n\t\t lst(newChanges)[prop] = change[prop];\n\t\t delete change[prop];\n\t\t }\n\t\t } } }\n\t\t }\n\t\t }\n\t\t return copy\n\t\t }", "function updateBuffer(buffer,history,pageFaultIdx){\n for (var i = 0; i < history.length; i++){\n buffer.data[i]=history[i].page;\n }\n buffer.pageFaultIdx = pageFaultIdx;\n}", "function renderHistoryList() {}", "function getHistoryDataObjects(){\n\tvar raw_data;\n\t//Read data from file: ./data.json\n\ttry {\n\t\traw_data = fs.readFileSync(file);\n\t} catch (err) {\n\t\t//If file doesn't exist, create a new one with '[]'\n\t\tconsole.log('data.json does not exist');\n\t \tfs.writeFile(file, '[]', function (err) {\n\t if (err) throw err;\n\t console.log('data.json has been created');\n \t});\n\t}\n\t\n\t//parse json string to object\n\ttry {\n \tvar obj_data = JSON.parse(raw_data);\n\t} catch (e) {\n\t\t//No data exist in file, create '[]' now\n\t \tconsole.log('No data existed in file data.json, creating now...');\n\t var obj_data = [];\n\t}\n\n\treturn obj_data;\n}", "function restore_history () {\n\tvar text = edit_history [edit_history_index];\n\tvar ds = HalfedgeDS.fromJSON (JSON.parse(text));\n\tannotateHdsPolygonSides(ds);\n\thdsDraw (ds);\n\tconfigureButtons();\n}", "updateHistory(key, options) {\n // console.log(this.cursorIndex);\n // get last history item\n const prevText = this.getLastHistory();\n\n // clone last state..\n const text = cloneDeep(prevText);\n\n let entryGroup;\n const entry = new Entry(key, {});\n if (this.paper) {\n entry.setStyles(this.paper.createEntryStyles(entry));\n }\n\n // Handle delete\n if (key === 'Backspace') {\n if (this._overwrite) {\n this.updateHistory('ArrowLeft', options);\n return;\n }\n if (this.cursorIndex === null) {\n return;\n }\n text.remove(this.cursorIndex);\n this.addToHistory(text);\n\n return;\n } else if (key === 'ArrowLeft' || key === 'ArrowRight') {\n this.addToHistory(text);\n return;\n } else if (key.length === 1 || key === 'Enter') {\n // continue\n } else if (true) {\n // } else if (key[0] == '\\\\') {\n // console.dir(key);\n // don't handle other keys (e.g shift/esc/ctrl)\n // return;\n }\n\n // Add to history\n if (!this.getCurrentEntry()) {\n // is empty\n // console.log('is empty');\n entryGroup = new EntryGroup(entry);\n text.insert(entryGroup, this.nextCursorIndex());\n this.addToHistory(text);\n } else if (this._overwrite) {\n const n = this.nextCursorIndex();\n // Add entry to group at current index\n entryGroup = text.groups[this.cursorIndex];\n if (entryGroup) {\n entryGroup.add(entry);\n text.replace(entryGroup, this.cursorIndex);\n } else {\n entryGroup = new EntryGroup(entry);\n text.insert(entryGroup, this.nextCursorIndex());\n }\n this.addToHistory(text);\n } else {\n // Insert entry in entrygroup at next index\n entryGroup = new EntryGroup(entry);\n const n = this.nextCursorIndex();\n // console.log('next', n);\n text.insert(entryGroup, this.nextCursorIndex());\n // if (this.cursorIndex === null) {\n // text.insert(entryGroup, this.nextCursorIndex());\n // } else {\n // text.insert(entryGroup, this.cursorIndex);\n // }\n\n this.addToHistory(text);\n }\n }", "function copyHistoryArray(events, newGroup, instantiateSel) {\n for (var i = 0, copy = []; i < events.length; ++i) {\n var event = events[i];\n if (event.ranges) {\n copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);\n continue;\n }\n var changes = event.changes, newChanges = [];\n copy.push({changes: newChanges});\n for (var j = 0; j < changes.length; ++j) {\n var change = changes[j], m;\n newChanges.push({from: change.from, to: change.to, text: change.text});\n if (newGroup) for (var prop in change) if (m = prop.match(/^spans_(\\d+)$/)) {\n if (indexOf(newGroup, Number(m[1])) > -1) {\n lst(newChanges)[prop] = change[prop];\n delete change[prop];\n }\n }\n }\n }\n return copy;\n }", "function copyHistoryArray(events, newGroup, instantiateSel) {\n for (var i = 0, copy = []; i < events.length; ++i) {\n var event = events[i];\n if (event.ranges) {\n copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);\n continue;\n }\n var changes = event.changes, newChanges = [];\n copy.push({changes: newChanges});\n for (var j = 0; j < changes.length; ++j) {\n var change = changes[j], m;\n newChanges.push({from: change.from, to: change.to, text: change.text});\n if (newGroup) for (var prop in change) if (m = prop.match(/^spans_(\\d+)$/)) {\n if (indexOf(newGroup, Number(m[1])) > -1) {\n lst(newChanges)[prop] = change[prop];\n delete change[prop];\n }\n }\n }\n }\n return copy;\n }", "function copyHistoryArray(events, newGroup, instantiateSel) {\n for (var i = 0, copy = []; i < events.length; ++i) {\n var event = events[i];\n if (event.ranges) {\n copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);\n continue;\n }\n var changes = event.changes, newChanges = [];\n copy.push({changes: newChanges});\n for (var j = 0; j < changes.length; ++j) {\n var change = changes[j], m;\n newChanges.push({from: change.from, to: change.to, text: change.text});\n if (newGroup) for (var prop in change) if (m = prop.match(/^spans_(\\d+)$/)) {\n if (indexOf(newGroup, Number(m[1])) > -1) {\n lst(newChanges)[prop] = change[prop];\n delete change[prop];\n }\n }\n }\n }\n return copy;\n }", "function copyHistoryArray(events, newGroup, instantiateSel) {\n for (var i = 0, copy = []; i < events.length; ++i) {\n var event = events[i];\n if (event.ranges) {\n copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);\n continue;\n }\n var changes = event.changes, newChanges = [];\n copy.push({changes: newChanges});\n for (var j = 0; j < changes.length; ++j) {\n var change = changes[j], m;\n newChanges.push({from: change.from, to: change.to, text: change.text});\n if (newGroup) for (var prop in change) if (m = prop.match(/^spans_(\\d+)$/)) {\n if (indexOf(newGroup, Number(m[1])) > -1) {\n lst(newChanges)[prop] = change[prop];\n delete change[prop];\n }\n }\n }\n }\n return copy;\n }", "function copyHistoryArray(events, newGroup, instantiateSel) {\n for (var i = 0, copy = []; i < events.length; ++i) {\n var event = events[i];\n if (event.ranges) {\n copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);\n continue;\n }\n var changes = event.changes, newChanges = [];\n copy.push({changes: newChanges});\n for (var j = 0; j < changes.length; ++j) {\n var change = changes[j], m;\n newChanges.push({from: change.from, to: change.to, text: change.text});\n if (newGroup) for (var prop in change) if (m = prop.match(/^spans_(\\d+)$/)) {\n if (indexOf(newGroup, Number(m[1])) > -1) {\n lst(newChanges)[prop] = change[prop];\n delete change[prop];\n }\n }\n }\n }\n return copy;\n }", "function copyHistoryArray(events, newGroup, instantiateSel) {\n for (var i = 0, copy = []; i < events.length; ++i) {\n var event = events[i];\n if (event.ranges) {\n copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);\n continue;\n }\n var changes = event.changes, newChanges = [];\n copy.push({changes: newChanges});\n for (var j = 0; j < changes.length; ++j) {\n var change = changes[j], m;\n newChanges.push({from: change.from, to: change.to, text: change.text});\n if (newGroup) for (var prop in change) if (m = prop.match(/^spans_(\\d+)$/)) {\n if (indexOf(newGroup, Number(m[1])) > -1) {\n lst(newChanges)[prop] = change[prop];\n delete change[prop];\n }\n }\n }\n }\n return copy;\n }", "function copyHistoryArray(events, newGroup, instantiateSel) {\n for (var i = 0, copy = []; i < events.length; ++i) {\n var event = events[i];\n if (event.ranges) {\n copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);\n continue;\n }\n var changes = event.changes, newChanges = [];\n copy.push({changes: newChanges});\n for (var j = 0; j < changes.length; ++j) {\n var change = changes[j], m;\n newChanges.push({from: change.from, to: change.to, text: change.text});\n if (newGroup) for (var prop in change) if (m = prop.match(/^spans_(\\d+)$/)) {\n if (indexOf(newGroup, Number(m[1])) > -1) {\n lst(newChanges)[prop] = change[prop];\n delete change[prop];\n }\n }\n }\n }\n return copy;\n }", "_backToStart() {\n this.setState({\n cur: this.root\n })\n // Flush the old records\n // TODO: move out to be a function\n this.conversationRecords = [{\n type: this.root[0].type,\n content: this.root[0].content\n }]\n }", "function copyHistoryArray(events, newGroup, instantiateSel) {\r\n for (var i = 0, copy = []; i < events.length; ++i) {\r\n var event = events[i];\r\n if (event.ranges) {\r\n copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);\r\n continue;\r\n }\r\n var changes = event.changes, newChanges = [];\r\n copy.push({changes: newChanges});\r\n for (var j = 0; j < changes.length; ++j) {\r\n var change = changes[j], m;\r\n newChanges.push({from: change.from, to: change.to, text: change.text});\r\n if (newGroup) for (var prop in change) if (m = prop.match(/^spans_(\\d+)$/)) {\r\n if (indexOf(newGroup, Number(m[1])) > -1) {\r\n lst(newChanges)[prop] = change[prop];\r\n delete change[prop];\r\n }\r\n }\r\n }\r\n }\r\n return copy;\r\n }", "function addHistory(msg, msgData, authi) {\n // var prev = (msgData.prev && msgData.prev.$msg) ? msgData.prev.$msg.toString('hex') : null\n var entry = { id: msg.id, authi: authi, seq: msgData.seq }\n var index = entry.seq - 1 // seq is 1-based\n\n // branch in history?\n if (state.history[index]) {\n if (!Array.isArray(state.history[index]))\n state.history[index] = [state.history[index]]\n \n // insert in order of author index\n for (var i=0; i < state.history[index].length; i++) {\n var other = state.history[index][i]\n if (other.id.toString('hex') == entry.id.toString('hex'))\n return // dup\n if (other.authi > entry.authi)\n return state.history[index].splice(i, 0, entry)\n }\n return state.history[index].push(entry) // append\n }\n\n // linear\n state.history[index] = entry\n }", "function addPageToHistory( saveToHistory )\r\n\t{\r\n\t\tvar key;\r\n\r\n\t\tvar currentPageObj = {};\r\n\r\n\t\tkey = makePageHistoryKey();\r\n\r\n\t\tcurrentPageObj.view = currentViewType;\r\n\t\tcurrentPageObj.pageSize = pageSize;\r\n\t\tcurrentPageObj.url = makeurl();\r\n\t\tcurrentPageObj.objFilter = objFilter;\r\n\t\tcurrentPageObj.filterValue = filterValue;\r\n\t\tcurrentPageObj.page = currentPageNum;\r\n\r\n\t\t// add this to our history\r\n\t\tif ( saveToHistory && totalPages > 1 )\r\n\t\t{\r\n\t\t\tlog( \"add: \" + key, false );\r\n\t\t\tdhtmlHistory.add( key, currentPageObj );\r\n\t\t}\r\n\t\treturn currentPageObj;\r\n\t}", "getHistory() {\n return this.history;\n }", "getHistory() {\n return this.history;\n }", "function migrateRichHistory(richHistory) {\n var transformedRichHistory = richHistory.map(function (query) {\n var transformedQueries = query.queries.map(function (q, index) {\n return createDataQuery(query, q, index);\n });\n return _objectSpread({}, query, {\n queries: transformedQueries\n });\n });\n return transformedRichHistory;\n}", "function copyHistoryArray(events, newGroup, instantiateSel) {\n\t for (var i = 0, copy = []; i < events.length; ++i) {\n\t var event = events[i];\n\t if (event.ranges) {\n\t copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);\n\t continue;\n\t }\n\t var changes = event.changes, newChanges = [];\n\t copy.push({changes: newChanges});\n\t for (var j = 0; j < changes.length; ++j) {\n\t var change = changes[j], m;\n\t newChanges.push({from: change.from, to: change.to, text: change.text});\n\t if (newGroup) for (var prop in change) if (m = prop.match(/^spans_(\\d+)$/)) {\n\t if (indexOf(newGroup, Number(m[1])) > -1) {\n\t lst(newChanges)[prop] = change[prop];\n\t delete change[prop];\n\t }\n\t }\n\t }\n\t }\n\t return copy;\n\t }", "function copyHistoryArray(events, newGroup, instantiateSel) {\n\t for (var i = 0, copy = []; i < events.length; ++i) {\n\t var event = events[i];\n\t if (event.ranges) {\n\t copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);\n\t continue;\n\t }\n\t var changes = event.changes, newChanges = [];\n\t copy.push({changes: newChanges});\n\t for (var j = 0; j < changes.length; ++j) {\n\t var change = changes[j], m;\n\t newChanges.push({from: change.from, to: change.to, text: change.text});\n\t if (newGroup) for (var prop in change) if (m = prop.match(/^spans_(\\d+)$/)) {\n\t if (indexOf(newGroup, Number(m[1])) > -1) {\n\t lst(newChanges)[prop] = change[prop];\n\t delete change[prop];\n\t }\n\t }\n\t }\n\t }\n\t return copy;\n\t }", "function copyHistoryArray(events, newGroup, instantiateSel) {\n\t for (var i = 0, copy = []; i < events.length; ++i) {\n\t var event = events[i];\n\t if (event.ranges) {\n\t copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);\n\t continue;\n\t }\n\t var changes = event.changes, newChanges = [];\n\t copy.push({changes: newChanges});\n\t for (var j = 0; j < changes.length; ++j) {\n\t var change = changes[j], m;\n\t newChanges.push({from: change.from, to: change.to, text: change.text});\n\t if (newGroup) for (var prop in change) if (m = prop.match(/^spans_(\\d+)$/)) {\n\t if (indexOf(newGroup, Number(m[1])) > -1) {\n\t lst(newChanges)[prop] = change[prop];\n\t delete change[prop];\n\t }\n\t }\n\t }\n\t }\n\t return copy;\n\t }", "function copyHistoryArray(events, newGroup, instantiateSel) {\n var copy = [];\n\n for (var i = 0; i < events.length; ++i) {\n var event = events[i];\n\n if (event.ranges) {\n copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);\n continue;\n }\n\n var changes = event.changes,\n newChanges = [];\n copy.push({\n changes: newChanges\n });\n\n for (var j = 0; j < changes.length; ++j) {\n var change = changes[j],\n m = void 0;\n newChanges.push({\n from: change.from,\n to: change.to,\n text: change.text\n });\n\n if (newGroup) {\n for (var prop in change) {\n if (m = prop.match(/^spans_(\\d+)$/)) {\n if (indexOf(newGroup, Number(m[1])) > -1) {\n lst(newChanges)[prop] = change[prop];\n delete change[prop];\n }\n }\n }\n }\n }\n }\n\n return copy;\n } // The 'scroll' parameter given to many of these indicated whether" ]
[ "0.6128736", "0.597194", "0.5751274", "0.5658887", "0.5648688", "0.55759466", "0.55759466", "0.55759466", "0.5567405", "0.5567405", "0.5567405", "0.5567405", "0.5567405", "0.5567405", "0.5567405", "0.55629796", "0.555769", "0.555769", "0.555769", "0.555769", "0.555769", "0.555769", "0.555769", "0.555769", "0.555769", "0.555769", "0.555769", "0.555769", "0.555769", "0.555769", "0.555769", "0.555769", "0.555769", "0.5544213", "0.5544189", "0.55288047", "0.5519476", "0.551014", "0.5507477", "0.54994243", "0.54994243", "0.54994243", "0.54994243", "0.54994243", "0.54994243", "0.54994243", "0.54994243", "0.54994243", "0.54994243", "0.54994243", "0.5492149", "0.5492149", "0.54575485", "0.5415853", "0.53739125", "0.535025", "0.5292266", "0.5288454", "0.52856135", "0.5275747", "0.5258043", "0.5232988", "0.51986074", "0.51747984", "0.51645195", "0.5153136", "0.5144287", "0.51413816", "0.5132776", "0.5128452", "0.5124411", "0.51232123", "0.5099669", "0.5081961", "0.5080118", "0.5072648", "0.5072648", "0.5072648", "0.5072648", "0.5072648", "0.5072648", "0.5072648", "0.50667673", "0.50627196", "0.50611347", "0.50580776", "0.5057452", "0.5057452", "0.50570625", "0.5056536", "0.5056536", "0.5056536", "0.5054369" ]
0.0
-1
The 'scroll' parameter given to many of these indicated whether the new cursor position should be scrolled into view after modifying the selection. If shift is held or the extend flag is set, extends a range to include a given position (and optionally a second position). Otherwise, simply returns the range between the given positions. Used for cursor motion and such.
function extendRange(range, head, other, extend) { if (extend) { var anchor = range.anchor; if (other) { var posBefore = cmp(head, anchor) < 0; if (posBefore != (cmp(other, anchor) < 0)) { anchor = head; head = other; } else if (posBefore != (cmp(head, other) < 0)) { head = other; } } return new Range(anchor, head) } else { return new Range(other || head, head) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function extendRange(doc, range, head, other) {\n\t\t if (doc.cm && doc.cm.display.shift || doc.extend) {\n\t\t var anchor = range.anchor;\n\t\t if (other) {\n\t\t var posBefore = cmp(head, anchor) < 0;\n\t\t if (posBefore != (cmp(other, anchor) < 0)) {\n\t\t anchor = head;\n\t\t head = other;\n\t\t } else if (posBefore != (cmp(head, other) < 0)) {\n\t\t head = other;\n\t\t }\n\t\t }\n\t\t return new Range(anchor, head);\n\t\t } else {\n\t\t return new Range(other || head, head);\n\t\t }\n\t\t }", "function extendRange(doc, range, head, other) {\n\t if (doc.cm && doc.cm.display.shift || doc.extend) {\n\t var anchor = range.anchor;\n\t if (other) {\n\t var posBefore = cmp(head, anchor) < 0;\n\t if (posBefore != (cmp(other, anchor) < 0)) {\n\t anchor = head;\n\t head = other;\n\t } else if (posBefore != (cmp(head, other) < 0)) {\n\t head = other;\n\t }\n\t }\n\t return new Range(anchor, head);\n\t } else {\n\t return new Range(other || head, head);\n\t }\n\t }", "function extendRange(doc, range, head, other) {\n\t if (doc.cm && doc.cm.display.shift || doc.extend) {\n\t var anchor = range.anchor;\n\t if (other) {\n\t var posBefore = cmp(head, anchor) < 0;\n\t if (posBefore != (cmp(other, anchor) < 0)) {\n\t anchor = head;\n\t head = other;\n\t } else if (posBefore != (cmp(head, other) < 0)) {\n\t head = other;\n\t }\n\t }\n\t return new Range(anchor, head);\n\t } else {\n\t return new Range(other || head, head);\n\t }\n\t }", "function extendRange(doc, range, head, other) {\n\t if (doc.cm && doc.cm.display.shift || doc.extend) {\n\t var anchor = range.anchor;\n\t if (other) {\n\t var posBefore = cmp(head, anchor) < 0;\n\t if (posBefore != (cmp(other, anchor) < 0)) {\n\t anchor = head;\n\t head = other;\n\t } else if (posBefore != (cmp(head, other) < 0)) {\n\t head = other;\n\t }\n\t }\n\t return new Range(anchor, head);\n\t } else {\n\t return new Range(other || head, head);\n\t }\n\t }", "function extendRange(doc, range, head, other) {\r\n if (doc.cm && doc.cm.display.shift || doc.extend) {\r\n var anchor = range.anchor;\r\n if (other) {\r\n var posBefore = cmp(head, anchor) < 0;\r\n if (posBefore != (cmp(other, anchor) < 0)) {\r\n anchor = head;\r\n head = other;\r\n } else if (posBefore != (cmp(head, other) < 0)) {\r\n head = other;\r\n }\r\n }\r\n return new Range(anchor, head);\r\n } else {\r\n return new Range(other || head, head);\r\n }\r\n }", "function extendRange(doc, range, head, other) {\n if (doc.cm && doc.cm.display.shift || doc.extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head);\n } else {\n return new Range(other || head, head);\n }\n }", "function extendRange(doc, range, head, other) {\n if (doc.cm && doc.cm.display.shift || doc.extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head);\n } else {\n return new Range(other || head, head);\n }\n }", "function extendRange(doc, range, head, other) {\n if (doc.cm && doc.cm.display.shift || doc.extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head);\n } else {\n return new Range(other || head, head);\n }\n }", "function extendRange(doc, range, head, other) {\n if (doc.cm && doc.cm.display.shift || doc.extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head);\n } else {\n return new Range(other || head, head);\n }\n }", "function extendRange(doc, range, head, other) {\n if (doc.cm && doc.cm.display.shift || doc.extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head);\n } else {\n return new Range(other || head, head);\n }\n }", "function extendRange(doc, range, head, other) {\n if (doc.cm && doc.cm.display.shift || doc.extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head);\n } else {\n return new Range(other || head, head);\n }\n }", "function extendRange(doc, range, head, other) {\n if (doc.cm && doc.cm.display.shift || doc.extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head);\n } else {\n return new Range(other || head, head);\n }\n }", "function extendRange(doc, range, head, other) {\n if (doc.cm && doc.cm.display.shift || doc.extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head);\n } else {\n return new Range(other || head, head);\n }\n }", "function extendRange(doc, range, head, other) {\n if (doc.cm && doc.cm.display.shift || doc.extend) {\n var anchor = range.anchor\n if (other) {\n var posBefore = cmp(head, anchor) < 0\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head\n head = other\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other\n }\n }\n return new Range(anchor, head)\n } else {\n return new Range(other || head, head)\n }\n}", "function extendRange(doc, range, head, other) {\n if (doc.cm && doc.cm.display.shift || doc.extend) {\n var anchor = range.anchor\n if (other) {\n var posBefore = cmp(head, anchor) < 0\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head\n head = other\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other\n }\n }\n return new Range(anchor, head)\n } else {\n return new Range(other || head, head)\n }\n}", "function extendRange(range, head, other, extend) {\n if (extend) {\n var anchor = range.anchor;\n\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n\n if (posBefore != cmp(other, anchor) < 0) {\n anchor = head;\n head = other;\n } else if (posBefore != cmp(head, other) < 0) {\n head = other;\n }\n }\n\n return new Range(anchor, head);\n } else {\n return new Range(other || head, head);\n }\n } // Extend the primary selection range, discard the rest.", "function extendRange(range, head, other, extend) {\n\t\t if (extend) {\n\t\t var anchor = range.anchor;\n\t\t if (other) {\n\t\t var posBefore = cmp(head, anchor) < 0;\n\t\t if (posBefore != (cmp(other, anchor) < 0)) {\n\t\t anchor = head;\n\t\t head = other;\n\t\t } else if (posBefore != (cmp(head, other) < 0)) {\n\t\t head = other;\n\t\t }\n\t\t }\n\t\t return new Range(anchor, head)\n\t\t } else {\n\t\t return new Range(other || head, head)\n\t\t }\n\t\t }", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n\n for (var i = 0; i < doc.sel.ranges.length; i++) {\n out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend);\n }\n\n var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n } // Updates a single range in the selection.", "function extendRange(range, head, other, extend) {\r\n if (extend) {\r\n var anchor = range.anchor;\r\n if (other) {\r\n var posBefore = cmp(head, anchor) < 0;\r\n if (posBefore != (cmp(other, anchor) < 0)) {\r\n anchor = head;\r\n head = other;\r\n } else if (posBefore != (cmp(head, other) < 0)) {\r\n head = other;\r\n }\r\n }\r\n return new Range(anchor, head)\r\n } else {\r\n return new Range(other || head, head)\r\n }\r\n}", "function extendRange(range, head, other, extend) {\n if (extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head)\n } else {\n return new Range(other || head, head)\n }\n}", "function extendRange(range, head, other, extend) {\n if (extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head)\n } else {\n return new Range(other || head, head)\n }\n}", "function extendRange(range, head, other, extend) {\n if (extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head)\n } else {\n return new Range(other || head, head)\n }\n}", "function extendRange(range, head, other, extend) {\n if (extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head)\n } else {\n return new Range(other || head, head)\n }\n}", "function extendRange(range, head, other, extend) {\n if (extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head)\n } else {\n return new Range(other || head, head)\n }\n}", "function extendRange(range, head, other, extend) {\n if (extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head)\n } else {\n return new Range(other || head, head)\n }\n}", "function extendRange(range, head, other, extend) {\n if (extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head)\n } else {\n return new Range(other || head, head)\n }\n}", "function extendRange(range, head, other, extend) {\n if (extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head)\n } else {\n return new Range(other || head, head)\n }\n}", "function extendRange(range, head, other, extend) {\n if (extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head)\n } else {\n return new Range(other || head, head)\n }\n}", "function extendRange(range, head, other, extend) {\n if (extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head)\n } else {\n return new Range(other || head, head)\n }\n}", "function extendRange(range, head, other, extend) {\n if (extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head)\n } else {\n return new Range(other || head, head)\n }\n}", "extend(from, to = from) {\n if (from <= this.anchor && to >= this.anchor)\n return EditorSelection.range(from, to);\n let head = Math.abs(from - this.anchor) > Math.abs(to - this.anchor) ? from : to;\n return EditorSelection.range(this.anchor, head);\n }", "function extendSelections(doc, heads, options) {\n\t\t var out = [];\n\t\t var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n\t\t for (var i = 0; i < doc.sel.ranges.length; i++)\n\t\t { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n\t\t var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex);\n\t\t setSelection(doc, newSel, options);\n\t\t }", "function extendSelection(doc, pos, other, bias) {\n if (doc.sel.shift || doc.sel.extend) {\n var anchor = doc.sel.anchor;\n if (other) {\n var posBefore = posLess(pos, anchor);\n if (posBefore != posLess(other, anchor)) {\n anchor = pos;\n pos = other;\n } else if (posBefore != posLess(pos, other)) {\n pos = other;\n }\n }\n setSelection(doc, anchor, pos, bias);\n } else {\n setSelection(doc, pos, other || pos, bias);\n }\n if (doc.cm) doc.cm.curOp.userSelChange = true;\n }", "function extendSelection(doc, pos, other, bias) {\n if (doc.sel.shift || doc.sel.extend) {\n var anchor = doc.sel.anchor;\n if (other) {\n var posBefore = posLess(pos, anchor);\n if (posBefore != posLess(other, anchor)) {\n anchor = pos;\n pos = other;\n } else if (posBefore != posLess(pos, other)) {\n pos = other;\n }\n }\n setSelection(doc, anchor, pos, bias);\n } else {\n setSelection(doc, pos, other || pos, bias);\n }\n if (doc.cm) doc.cm.curOp.userSelChange = true;\n }", "function extendSelection(doc, pos, other, bias) {\n if (doc.sel.shift || doc.sel.extend) {\n var anchor = doc.sel.anchor;\n if (other) {\n var posBefore = posLess(pos, anchor);\n if (posBefore != posLess(other, anchor)) {\n anchor = pos;\n pos = other;\n } else if (posBefore != posLess(pos, other)) {\n pos = other;\n }\n }\n setSelection(doc, anchor, pos, bias);\n } else {\n setSelection(doc, pos, other || pos, bias);\n }\n if (doc.cm) doc.cm.curOp.userSelChange = true;\n }", "function extendSelection(doc, pos, other, bias) {\n if (doc.sel.shift || doc.sel.extend) {\n var anchor = doc.sel.anchor;\n if (other) {\n var posBefore = posLess(pos, anchor);\n if (posBefore != posLess(other, anchor)) {\n anchor = pos;\n pos = other;\n } else if (posBefore != posLess(pos, other)) {\n pos = other;\n }\n }\n setSelection(doc, anchor, pos, bias);\n } else {\n setSelection(doc, pos, other || pos, bias);\n }\n if (doc.cm) doc.cm.curOp.userSelChange = true;\n }", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }", "function extendSelections(doc, heads, options) {\r\n var out = [];\r\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\r\n for (var i = 0; i < doc.sel.ranges.length; i++)\r\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\r\n var newSel = normalizeSelection(out, doc.sel.primIndex);\r\n setSelection(doc, newSel, options);\r\n}", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n}", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n}", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n}", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n}", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n}", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n}", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n}", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n}", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n}", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n}", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n}", "function extendSelection(cm, pos, other, bias) {\n var sel = cm.view.sel;\n if (sel.shift || sel.extend) {\n var anchor = sel.anchor;\n if (other) {\n var posBefore = posLess(pos, anchor);\n if (posBefore != posLess(other, anchor)) {\n anchor = pos;\n pos = other;\n } else if (posBefore != posLess(pos, other)) {\n pos = other;\n }\n }\n setSelection(cm, anchor, pos, bias);\n } else {\n setSelection(cm, pos, other || pos, bias);\n }\n cm.curOp.userSelChange = true;\n }", "function extendSelection(cm, pos, other, bias) {\n var sel = cm.view.sel;\n if (sel.shift || sel.extend) {\n var anchor = sel.anchor;\n if (other) {\n var posBefore = posLess(pos, anchor);\n if (posBefore != posLess(other, anchor)) {\n anchor = pos;\n pos = other;\n } else if (posBefore != posLess(pos, other)) {\n pos = other;\n }\n }\n setSelection(cm, anchor, pos, bias);\n } else {\n setSelection(cm, pos, other || pos, bias);\n }\n cm.curOp.userSelChange = true;\n }", "function extendSelection(cm, pos, other, bias) {\n var sel = cm.view.sel;\n if (sel.shift || sel.extend) {\n var anchor = sel.anchor;\n if (other) {\n var posBefore = posLess(pos, anchor);\n if (posBefore != posLess(other, anchor)) {\n anchor = pos;\n pos = other;\n } else if (posBefore != posLess(pos, other)) {\n pos = other;\n }\n }\n setSelection(cm, anchor, pos, bias);\n } else {\n setSelection(cm, pos, other || pos, bias);\n }\n cm.curOp.userSelChange = true;\n }", "function extendSelection(doc, head, other, options, extend) {\n\t\t if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n\t\t setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n\t\t }", "function wrapRange(editor, wsEdit, shifts, newSelections, i, shift, cursor, range, isSelected, startPtn, endPtn) {\n if (endPtn == undefined) {\n endPtn = startPtn;\n }\n let text = editor.document.getText(range);\n const prevSelection = newSelections[i];\n const ptnLength = (startPtn + endPtn).length;\n let newCursorPos = cursor.with({ character: cursor.character + shift });\n let newSelection;\n if (isWrapped(text, startPtn)) {\n // remove start/end patterns from range\n wsEdit.replace(editor.document.uri, range, text.substr(startPtn.length, text.length - ptnLength));\n shifts.push([range.end, -ptnLength]);\n // Fix cursor position\n if (!isSelected) {\n if (!range.isEmpty) { // means quick styling\n if (cursor.character == range.end.character) {\n newCursorPos = cursor.with({ character: cursor.character + shift - ptnLength });\n }\n else {\n newCursorPos = cursor.with({ character: cursor.character + shift - startPtn.length });\n }\n }\n else { // means `**|**` -> `|`\n newCursorPos = cursor.with({ character: cursor.character + shift + startPtn.length });\n }\n newSelection = new vscode_1.Selection(newCursorPos, newCursorPos);\n }\n else {\n newSelection = new vscode_1.Selection(prevSelection.start.with({ character: prevSelection.start.character + shift }), prevSelection.end.with({ character: prevSelection.end.character + shift - ptnLength }));\n }\n }\n else {\n // add start/end patterns around range\n wsEdit.replace(editor.document.uri, range, startPtn + text + endPtn);\n shifts.push([range.end, ptnLength]);\n // Fix cursor position\n if (!isSelected) {\n if (!range.isEmpty) { // means quick styling\n if (cursor.character == range.end.character) {\n newCursorPos = cursor.with({ character: cursor.character + shift + ptnLength });\n }\n else {\n newCursorPos = cursor.with({ character: cursor.character + shift + startPtn.length });\n }\n }\n else { // means `|` -> `**|**`\n newCursorPos = cursor.with({ character: cursor.character + shift + startPtn.length });\n }\n newSelection = new vscode_1.Selection(newCursorPos, newCursorPos);\n }\n else {\n newSelection = new vscode_1.Selection(prevSelection.start.with({ character: prevSelection.start.character + shift }), prevSelection.end.with({ character: prevSelection.end.character + shift + ptnLength }));\n }\n }\n newSelections[i] = newSelection;\n}", "extendRange(rangeToExtend, transform) {\n rangeToExtend.extendArray(this._points, transform);\n }", "function extendSelections(doc, heads, options) {\n\t\t for (var out = [], i = 0; i < doc.sel.ranges.length; i++)\n\t\t out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null);\n\t\t var newSel = normalizeSelection(out, doc.sel.primIndex);\n\t\t setSelection(doc, newSel, options);\n\t\t }", "function extendSelection(doc, head, other, options, extend) {\r\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\r\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\r\n}", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n }", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n }", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n }", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n }", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n }", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n }", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n }", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n }", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n }", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n }", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n }" ]
[ "0.64107454", "0.6394376", "0.6394376", "0.6394376", "0.63048786", "0.626854", "0.626854", "0.626854", "0.626854", "0.626854", "0.626854", "0.626854", "0.626854", "0.6225508", "0.6225508", "0.6140053", "0.5967149", "0.5950152", "0.5857598", "0.58396757", "0.58396757", "0.58396757", "0.58396757", "0.58396757", "0.58396757", "0.58396757", "0.58396757", "0.58396757", "0.58396757", "0.58396757", "0.5806445", "0.5696757", "0.5668662", "0.5668662", "0.5668662", "0.5668662", "0.5625039", "0.5625039", "0.5625039", "0.5625039", "0.5625039", "0.5625039", "0.5625039", "0.5625039", "0.5625039", "0.5625039", "0.5625039", "0.5625039", "0.5625039", "0.5625039", "0.5625039", "0.5625039", "0.5625039", "0.5588095", "0.55745226", "0.55745226", "0.55745226", "0.55745226", "0.55745226", "0.55745226", "0.55745226", "0.55745226", "0.55745226", "0.55745226", "0.55745226", "0.5513468", "0.5513468", "0.5513468", "0.54739934", "0.54179233", "0.5417551", "0.54163194", "0.5414794", "0.5381084", "0.5381084", "0.5381084", "0.5381084", "0.5381084", "0.5381084", "0.5381084", "0.5381084", "0.5381084", "0.5381084", "0.5381084" ]
0.58298576
41
Extend the primary selection range, discard the rest.
function extendSelection(doc, head, other, options, extend) { if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); } setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function extendRange(range, head, other, extend) {\n if (extend) {\n var anchor = range.anchor;\n\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n\n if (posBefore != cmp(other, anchor) < 0) {\n anchor = head;\n head = other;\n } else if (posBefore != cmp(head, other) < 0) {\n head = other;\n }\n }\n\n return new Range(anchor, head);\n } else {\n return new Range(other || head, head);\n }\n } // Extend the primary selection range, discard the rest.", "function extendSelection(doc, head, other, options) {\n\t\t setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);\n\t\t }", "function extendSelection(doc, head, other, options) {\n\t setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);\n\t }", "function extendSelection(doc, head, other, options) {\n\t setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);\n\t }", "function extendSelection(doc, head, other, options) {\n\t setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);\n\t }", "function extendSelection(doc, head, other, options, extend) {\n\t\t if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n\t\t setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n\t\t }", "function extendSelection(doc, head, other, options) {\r\n setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);\r\n }", "function extendSelection(doc, head, other, options) {\n setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);\n }", "function extendSelection(doc, head, other, options) {\n setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);\n }", "function extendSelection(doc, head, other, options) {\n setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);\n }", "function extendSelection(doc, head, other, options) {\n setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);\n }", "function extendSelection(doc, head, other, options) {\n setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);\n }", "function extendSelection(doc, head, other, options) {\n setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);\n }", "function extendSelection(doc, head, other, options) {\n setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);\n }", "function extendSelection(doc, head, other, options) {\n setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);\n }", "function extendSelection(doc, head, other, options) {\n setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options)\n}", "function extendSelection(doc, head, other, options) {\n setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options)\n}", "function extendSelection(doc, head, other, options, extend) {\r\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\r\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\r\n}", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n}", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n}", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n}", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n}", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n}", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n}", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n}", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n}", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n}", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n}", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n}", "function extendRange(doc, range, head, other) {\n\t\t if (doc.cm && doc.cm.display.shift || doc.extend) {\n\t\t var anchor = range.anchor;\n\t\t if (other) {\n\t\t var posBefore = cmp(head, anchor) < 0;\n\t\t if (posBefore != (cmp(other, anchor) < 0)) {\n\t\t anchor = head;\n\t\t head = other;\n\t\t } else if (posBefore != (cmp(head, other) < 0)) {\n\t\t head = other;\n\t\t }\n\t\t }\n\t\t return new Range(anchor, head);\n\t\t } else {\n\t\t return new Range(other || head, head);\n\t\t }\n\t\t }", "function extendRange(doc, range, head, other) {\n\t if (doc.cm && doc.cm.display.shift || doc.extend) {\n\t var anchor = range.anchor;\n\t if (other) {\n\t var posBefore = cmp(head, anchor) < 0;\n\t if (posBefore != (cmp(other, anchor) < 0)) {\n\t anchor = head;\n\t head = other;\n\t } else if (posBefore != (cmp(head, other) < 0)) {\n\t head = other;\n\t }\n\t }\n\t return new Range(anchor, head);\n\t } else {\n\t return new Range(other || head, head);\n\t }\n\t }", "function extendRange(doc, range, head, other) {\n\t if (doc.cm && doc.cm.display.shift || doc.extend) {\n\t var anchor = range.anchor;\n\t if (other) {\n\t var posBefore = cmp(head, anchor) < 0;\n\t if (posBefore != (cmp(other, anchor) < 0)) {\n\t anchor = head;\n\t head = other;\n\t } else if (posBefore != (cmp(head, other) < 0)) {\n\t head = other;\n\t }\n\t }\n\t return new Range(anchor, head);\n\t } else {\n\t return new Range(other || head, head);\n\t }\n\t }", "function extendRange(doc, range, head, other) {\n\t if (doc.cm && doc.cm.display.shift || doc.extend) {\n\t var anchor = range.anchor;\n\t if (other) {\n\t var posBefore = cmp(head, anchor) < 0;\n\t if (posBefore != (cmp(other, anchor) < 0)) {\n\t anchor = head;\n\t head = other;\n\t } else if (posBefore != (cmp(head, other) < 0)) {\n\t head = other;\n\t }\n\t }\n\t return new Range(anchor, head);\n\t } else {\n\t return new Range(other || head, head);\n\t }\n\t }", "function extendRange(doc, range, head, other) {\r\n if (doc.cm && doc.cm.display.shift || doc.extend) {\r\n var anchor = range.anchor;\r\n if (other) {\r\n var posBefore = cmp(head, anchor) < 0;\r\n if (posBefore != (cmp(other, anchor) < 0)) {\r\n anchor = head;\r\n head = other;\r\n } else if (posBefore != (cmp(head, other) < 0)) {\r\n head = other;\r\n }\r\n }\r\n return new Range(anchor, head);\r\n } else {\r\n return new Range(other || head, head);\r\n }\r\n }", "function extendRange(doc, range, head, other) {\n if (doc.cm && doc.cm.display.shift || doc.extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head);\n } else {\n return new Range(other || head, head);\n }\n }", "function extendRange(doc, range, head, other) {\n if (doc.cm && doc.cm.display.shift || doc.extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head);\n } else {\n return new Range(other || head, head);\n }\n }", "function extendRange(doc, range, head, other) {\n if (doc.cm && doc.cm.display.shift || doc.extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head);\n } else {\n return new Range(other || head, head);\n }\n }", "function extendRange(doc, range, head, other) {\n if (doc.cm && doc.cm.display.shift || doc.extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head);\n } else {\n return new Range(other || head, head);\n }\n }", "function extendRange(doc, range, head, other) {\n if (doc.cm && doc.cm.display.shift || doc.extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head);\n } else {\n return new Range(other || head, head);\n }\n }", "function extendRange(doc, range, head, other) {\n if (doc.cm && doc.cm.display.shift || doc.extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head);\n } else {\n return new Range(other || head, head);\n }\n }", "function extendRange(doc, range, head, other) {\n if (doc.cm && doc.cm.display.shift || doc.extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head);\n } else {\n return new Range(other || head, head);\n }\n }", "function extendRange(doc, range, head, other) {\n if (doc.cm && doc.cm.display.shift || doc.extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head);\n } else {\n return new Range(other || head, head);\n }\n }", "function extendRange(doc, range, head, other) {\n if (doc.cm && doc.cm.display.shift || doc.extend) {\n var anchor = range.anchor\n if (other) {\n var posBefore = cmp(head, anchor) < 0\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head\n head = other\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other\n }\n }\n return new Range(anchor, head)\n } else {\n return new Range(other || head, head)\n }\n}", "function extendRange(doc, range, head, other) {\n if (doc.cm && doc.cm.display.shift || doc.extend) {\n var anchor = range.anchor\n if (other) {\n var posBefore = cmp(head, anchor) < 0\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head\n head = other\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other\n }\n }\n return new Range(anchor, head)\n } else {\n return new Range(other || head, head)\n }\n}", "function extendSelection(doc, pos, other, bias) {\n if (doc.sel.shift || doc.sel.extend) {\n var anchor = doc.sel.anchor;\n if (other) {\n var posBefore = posLess(pos, anchor);\n if (posBefore != posLess(other, anchor)) {\n anchor = pos;\n pos = other;\n } else if (posBefore != posLess(pos, other)) {\n pos = other;\n }\n }\n setSelection(doc, anchor, pos, bias);\n } else {\n setSelection(doc, pos, other || pos, bias);\n }\n if (doc.cm) doc.cm.curOp.userSelChange = true;\n }", "function extendSelection(doc, pos, other, bias) {\n if (doc.sel.shift || doc.sel.extend) {\n var anchor = doc.sel.anchor;\n if (other) {\n var posBefore = posLess(pos, anchor);\n if (posBefore != posLess(other, anchor)) {\n anchor = pos;\n pos = other;\n } else if (posBefore != posLess(pos, other)) {\n pos = other;\n }\n }\n setSelection(doc, anchor, pos, bias);\n } else {\n setSelection(doc, pos, other || pos, bias);\n }\n if (doc.cm) doc.cm.curOp.userSelChange = true;\n }", "function extendSelection(doc, pos, other, bias) {\n if (doc.sel.shift || doc.sel.extend) {\n var anchor = doc.sel.anchor;\n if (other) {\n var posBefore = posLess(pos, anchor);\n if (posBefore != posLess(other, anchor)) {\n anchor = pos;\n pos = other;\n } else if (posBefore != posLess(pos, other)) {\n pos = other;\n }\n }\n setSelection(doc, anchor, pos, bias);\n } else {\n setSelection(doc, pos, other || pos, bias);\n }\n if (doc.cm) doc.cm.curOp.userSelChange = true;\n }", "function extendSelection(doc, pos, other, bias) {\n if (doc.sel.shift || doc.sel.extend) {\n var anchor = doc.sel.anchor;\n if (other) {\n var posBefore = posLess(pos, anchor);\n if (posBefore != posLess(other, anchor)) {\n anchor = pos;\n pos = other;\n } else if (posBefore != posLess(pos, other)) {\n pos = other;\n }\n }\n setSelection(doc, anchor, pos, bias);\n } else {\n setSelection(doc, pos, other || pos, bias);\n }\n if (doc.cm) doc.cm.curOp.userSelChange = true;\n }", "function extendSelections(doc, heads, options) {\n\t\t for (var out = [], i = 0; i < doc.sel.ranges.length; i++)\n\t\t out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null);\n\t\t var newSel = normalizeSelection(out, doc.sel.primIndex);\n\t\t setSelection(doc, newSel, options);\n\t\t }", "function extendSelections(doc, heads, options) {\n\t for (var out = [], i = 0; i < doc.sel.ranges.length; i++)\n\t out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null);\n\t var newSel = normalizeSelection(out, doc.sel.primIndex);\n\t setSelection(doc, newSel, options);\n\t }", "function extendSelections(doc, heads, options) {\n\t for (var out = [], i = 0; i < doc.sel.ranges.length; i++)\n\t out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null);\n\t var newSel = normalizeSelection(out, doc.sel.primIndex);\n\t setSelection(doc, newSel, options);\n\t }", "function extendSelections(doc, heads, options) {\n\t for (var out = [], i = 0; i < doc.sel.ranges.length; i++)\n\t out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null);\n\t var newSel = normalizeSelection(out, doc.sel.primIndex);\n\t setSelection(doc, newSel, options);\n\t }", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n\n for (var i = 0; i < doc.sel.ranges.length; i++) {\n out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend);\n }\n\n var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n } // Updates a single range in the selection.", "function extendRange(range, head, other, extend) {\n\t\t if (extend) {\n\t\t var anchor = range.anchor;\n\t\t if (other) {\n\t\t var posBefore = cmp(head, anchor) < 0;\n\t\t if (posBefore != (cmp(other, anchor) < 0)) {\n\t\t anchor = head;\n\t\t head = other;\n\t\t } else if (posBefore != (cmp(head, other) < 0)) {\n\t\t head = other;\n\t\t }\n\t\t }\n\t\t return new Range(anchor, head)\n\t\t } else {\n\t\t return new Range(other || head, head)\n\t\t }\n\t\t }", "function extendSelection(cm, pos, other, bias) {\n var sel = cm.view.sel;\n if (sel.shift || sel.extend) {\n var anchor = sel.anchor;\n if (other) {\n var posBefore = posLess(pos, anchor);\n if (posBefore != posLess(other, anchor)) {\n anchor = pos;\n pos = other;\n } else if (posBefore != posLess(pos, other)) {\n pos = other;\n }\n }\n setSelection(cm, anchor, pos, bias);\n } else {\n setSelection(cm, pos, other || pos, bias);\n }\n cm.curOp.userSelChange = true;\n }", "function extendSelection(cm, pos, other, bias) {\n var sel = cm.view.sel;\n if (sel.shift || sel.extend) {\n var anchor = sel.anchor;\n if (other) {\n var posBefore = posLess(pos, anchor);\n if (posBefore != posLess(other, anchor)) {\n anchor = pos;\n pos = other;\n } else if (posBefore != posLess(pos, other)) {\n pos = other;\n }\n }\n setSelection(cm, anchor, pos, bias);\n } else {\n setSelection(cm, pos, other || pos, bias);\n }\n cm.curOp.userSelChange = true;\n }", "function extendSelection(cm, pos, other, bias) {\n var sel = cm.view.sel;\n if (sel.shift || sel.extend) {\n var anchor = sel.anchor;\n if (other) {\n var posBefore = posLess(pos, anchor);\n if (posBefore != posLess(other, anchor)) {\n anchor = pos;\n pos = other;\n } else if (posBefore != posLess(pos, other)) {\n pos = other;\n }\n }\n setSelection(cm, anchor, pos, bias);\n } else {\n setSelection(cm, pos, other || pos, bias);\n }\n cm.curOp.userSelChange = true;\n }", "extend(from, to = from) {\n if (from <= this.anchor && to >= this.anchor)\n return EditorSelection.range(from, to);\n let head = Math.abs(from - this.anchor) > Math.abs(to - this.anchor) ? from : to;\n return EditorSelection.range(this.anchor, head);\n }", "function extendSelections(doc, heads, options) {\r\n for (var out = [], i = 0; i < doc.sel.ranges.length; i++)\r\n out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null);\r\n var newSel = normalizeSelection(out, doc.sel.primIndex);\r\n setSelection(doc, newSel, options);\r\n }", "function extendSelections(doc, heads, options) {\n\t\t var out = [];\n\t\t var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n\t\t for (var i = 0; i < doc.sel.ranges.length; i++)\n\t\t { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n\t\t var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex);\n\t\t setSelection(doc, newSel, options);\n\t\t }", "function extendSelections(doc, heads, options) {\n for (var out = [], i = 0; i < doc.sel.ranges.length; i++)\n out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null);\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }", "function extendSelections(doc, heads, options) {\n for (var out = [], i = 0; i < doc.sel.ranges.length; i++)\n out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null);\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }", "function extendSelections(doc, heads, options) {\n for (var out = [], i = 0; i < doc.sel.ranges.length; i++)\n out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null);\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }", "function extendSelections(doc, heads, options) {\n for (var out = [], i = 0; i < doc.sel.ranges.length; i++)\n out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null);\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }", "function extendSelections(doc, heads, options) {\n for (var out = [], i = 0; i < doc.sel.ranges.length; i++)\n out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null);\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }", "function extendSelections(doc, heads, options) {\n for (var out = [], i = 0; i < doc.sel.ranges.length; i++)\n out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null);\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }", "function extendSelections(doc, heads, options) {\n for (var out = [], i = 0; i < doc.sel.ranges.length; i++)\n out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null);\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }", "function extendSelections(doc, heads, options) {\n for (var out = [], i = 0; i < doc.sel.ranges.length; i++)\n out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null);\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }", "extendSelectionTo(index) {\n if('none' === this.selectionMode)\n return;\n\n if('single' !== this.selectionMode)\n return this.selectOne(index);\n\n let start, end;\n if(index < this._lastSelectedIndex) {\n start = index;\n end = this._lastSelectedIndex;\n } else {\n start = this._lastSelectedIndex + 1;\n end = index + 1;\n }\n\n for(let i = start; i < end; i++)\n this._items[i].selected = true;\n\n this._lastSelectedIndex = index;\n this.requestUpdate();\n }", "function extendRange(range, head, other, extend) {\n if (extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head)\n } else {\n return new Range(other || head, head)\n }\n }", "function extendRange(range, head, other, extend) {\n if (extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head)\n } else {\n return new Range(other || head, head)\n }\n }", "function extendRange(range, head, other, extend) {\n if (extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head)\n } else {\n return new Range(other || head, head)\n }\n }", "function extendRange(range, head, other, extend) {\n if (extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head)\n } else {\n return new Range(other || head, head)\n }\n }", "function extendRange(range, head, other, extend) {\n if (extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head)\n } else {\n return new Range(other || head, head)\n }\n }", "function extendRange(range, head, other, extend) {\n if (extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head)\n } else {\n return new Range(other || head, head)\n }\n }", "function extendRange(range, head, other, extend) {\n if (extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head)\n } else {\n return new Range(other || head, head)\n }\n }", "function extendRange(range, head, other, extend) {\n if (extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head)\n } else {\n return new Range(other || head, head)\n }\n }", "function extendRange(range, head, other, extend) {\n if (extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head)\n } else {\n return new Range(other || head, head)\n }\n }", "function extendRange(range, head, other, extend) {\n if (extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head)\n } else {\n return new Range(other || head, head)\n }\n }", "function extendRange(range, head, other, extend) {\n if (extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head)\n } else {\n return new Range(other || head, head)\n }\n }", "function extendRange(range, head, other, extend) {\n if (extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head)\n } else {\n return new Range(other || head, head)\n }\n }", "function extendRange(range, head, other, extend) {\n if (extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head)\n } else {\n return new Range(other || head, head)\n }\n }", "function extendRange(range, head, other, extend) {\n if (extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head)\n } else {\n return new Range(other || head, head)\n }\n }", "function extendRange(range, head, other, extend) {\n if (extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head)\n } else {\n return new Range(other || head, head)\n }\n }" ]
[ "0.7361317", "0.72121984", "0.71236956", "0.71236956", "0.71236956", "0.7040623", "0.7038878", "0.7036874", "0.7036874", "0.7036874", "0.7036874", "0.7036874", "0.7036874", "0.7036874", "0.7036874", "0.70040554", "0.70040554", "0.67941666", "0.6732129", "0.6732129", "0.6732129", "0.6732129", "0.6732129", "0.6732129", "0.6732129", "0.6732129", "0.6732129", "0.6732129", "0.6732129", "0.66573834", "0.66072845", "0.66072845", "0.66072845", "0.6571589", "0.6568893", "0.6568893", "0.6568893", "0.6568893", "0.6568893", "0.6568893", "0.6568893", "0.6568893", "0.6497658", "0.6497658", "0.64042383", "0.64042383", "0.64042383", "0.64042383", "0.63858736", "0.6382644", "0.6382644", "0.6382644", "0.6378762", "0.63384163", "0.6323664", "0.6323664", "0.6323664", "0.6312793", "0.6250646", "0.6246809", "0.6224545", "0.6224545", "0.6224545", "0.6224545", "0.6224545", "0.6224545", "0.6224545", "0.6224545", "0.62134635", "0.61998725", "0.61998725", "0.61998725", "0.61998725", "0.61998725", "0.61998725", "0.61998725", "0.61998725", "0.61998725", "0.61998725", "0.61998725", "0.61998725", "0.61998725", "0.61998725", "0.61998725" ]
0.6841599
28
Extend all selections (pos is an array of selections with length equal the number of selections)
function extendSelections(doc, heads, options) { var out = []; var extend = doc.cm && (doc.cm.display.shift || doc.extend); for (var i = 0; i < doc.sel.ranges.length; i++) { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); } var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex); setSelection(doc, newSel, options); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function extendSelections(doc, heads, options) {\n\t\t for (var out = [], i = 0; i < doc.sel.ranges.length; i++)\n\t\t out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null);\n\t\t var newSel = normalizeSelection(out, doc.sel.primIndex);\n\t\t setSelection(doc, newSel, options);\n\t\t }", "function extendSelections(doc, heads, options) {\n\t for (var out = [], i = 0; i < doc.sel.ranges.length; i++)\n\t out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null);\n\t var newSel = normalizeSelection(out, doc.sel.primIndex);\n\t setSelection(doc, newSel, options);\n\t }", "function extendSelections(doc, heads, options) {\n\t for (var out = [], i = 0; i < doc.sel.ranges.length; i++)\n\t out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null);\n\t var newSel = normalizeSelection(out, doc.sel.primIndex);\n\t setSelection(doc, newSel, options);\n\t }", "function extendSelections(doc, heads, options) {\n\t for (var out = [], i = 0; i < doc.sel.ranges.length; i++)\n\t out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null);\n\t var newSel = normalizeSelection(out, doc.sel.primIndex);\n\t setSelection(doc, newSel, options);\n\t }", "extendSelectionTo(index) {\n if('none' === this.selectionMode)\n return;\n\n if('single' !== this.selectionMode)\n return this.selectOne(index);\n\n let start, end;\n if(index < this._lastSelectedIndex) {\n start = index;\n end = this._lastSelectedIndex;\n } else {\n start = this._lastSelectedIndex + 1;\n end = index + 1;\n }\n\n for(let i = start; i < end; i++)\n this._items[i].selected = true;\n\n this._lastSelectedIndex = index;\n this.requestUpdate();\n }", "selectAll() {\n const that = this;\n\n if ((that.arrayIndexingMode === 'LabVIEW' && that._filledUpTo[0] === -1) ||\n (that.arrayIndexingMode === 'JavaScript' && that._filledUpTo[that._filledUpTo.length - 1] === -1)) {\n return;\n }\n\n const start = new Array(that.dimensions);\n\n start.fill(0);\n\n that._absoluteSelectionStart = start;\n that._absoluteSelectionEnd = that._filledUpTo.slice(0);\n that._refreshSelection();\n }", "function extendSelections(doc, heads, options) {\n for (var out = [], i = 0; i < doc.sel.ranges.length; i++)\n out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null);\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }", "function extendSelections(doc, heads, options) {\n for (var out = [], i = 0; i < doc.sel.ranges.length; i++)\n out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null);\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }", "function extendSelections(doc, heads, options) {\n for (var out = [], i = 0; i < doc.sel.ranges.length; i++)\n out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null);\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }", "function extendSelections(doc, heads, options) {\n for (var out = [], i = 0; i < doc.sel.ranges.length; i++)\n out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null);\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }", "function extendSelections(doc, heads, options) {\n for (var out = [], i = 0; i < doc.sel.ranges.length; i++)\n out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null);\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }", "function extendSelections(doc, heads, options) {\n for (var out = [], i = 0; i < doc.sel.ranges.length; i++)\n out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null);\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }", "function extendSelections(doc, heads, options) {\n for (var out = [], i = 0; i < doc.sel.ranges.length; i++)\n out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null);\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }", "function extendSelections(doc, heads, options) {\n for (var out = [], i = 0; i < doc.sel.ranges.length; i++)\n out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null);\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }", "function extendSelections(doc, heads, options) {\r\n for (var out = [], i = 0; i < doc.sel.ranges.length; i++)\r\n out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null);\r\n var newSel = normalizeSelection(out, doc.sel.primIndex);\r\n setSelection(doc, newSel, options);\r\n }", "function extendSelections(doc, heads, options) {\n var out = []\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null) }\n var newSel = normalizeSelection(out, doc.sel.primIndex)\n setSelection(doc, newSel, options)\n}", "function extendSelections(doc, heads, options) {\n var out = []\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null) }\n var newSel = normalizeSelection(out, doc.sel.primIndex)\n setSelection(doc, newSel, options)\n}", "function extendSelection(cm, pos, other, bias) {\n var sel = cm.view.sel;\n if (sel.shift || sel.extend) {\n var anchor = sel.anchor;\n if (other) {\n var posBefore = posLess(pos, anchor);\n if (posBefore != posLess(other, anchor)) {\n anchor = pos;\n pos = other;\n } else if (posBefore != posLess(pos, other)) {\n pos = other;\n }\n }\n setSelection(cm, anchor, pos, bias);\n } else {\n setSelection(cm, pos, other || pos, bias);\n }\n cm.curOp.userSelChange = true;\n }", "function extendSelection(cm, pos, other, bias) {\n var sel = cm.view.sel;\n if (sel.shift || sel.extend) {\n var anchor = sel.anchor;\n if (other) {\n var posBefore = posLess(pos, anchor);\n if (posBefore != posLess(other, anchor)) {\n anchor = pos;\n pos = other;\n } else if (posBefore != posLess(pos, other)) {\n pos = other;\n }\n }\n setSelection(cm, anchor, pos, bias);\n } else {\n setSelection(cm, pos, other || pos, bias);\n }\n cm.curOp.userSelChange = true;\n }", "function extendSelection(cm, pos, other, bias) {\n var sel = cm.view.sel;\n if (sel.shift || sel.extend) {\n var anchor = sel.anchor;\n if (other) {\n var posBefore = posLess(pos, anchor);\n if (posBefore != posLess(other, anchor)) {\n anchor = pos;\n pos = other;\n } else if (posBefore != posLess(pos, other)) {\n pos = other;\n }\n }\n setSelection(cm, anchor, pos, bias);\n } else {\n setSelection(cm, pos, other || pos, bias);\n }\n cm.curOp.userSelChange = true;\n }", "function extendSelection(doc, pos, other, bias) {\n if (doc.sel.shift || doc.sel.extend) {\n var anchor = doc.sel.anchor;\n if (other) {\n var posBefore = posLess(pos, anchor);\n if (posBefore != posLess(other, anchor)) {\n anchor = pos;\n pos = other;\n } else if (posBefore != posLess(pos, other)) {\n pos = other;\n }\n }\n setSelection(doc, anchor, pos, bias);\n } else {\n setSelection(doc, pos, other || pos, bias);\n }\n if (doc.cm) doc.cm.curOp.userSelChange = true;\n }", "function extendSelection(doc, pos, other, bias) {\n if (doc.sel.shift || doc.sel.extend) {\n var anchor = doc.sel.anchor;\n if (other) {\n var posBefore = posLess(pos, anchor);\n if (posBefore != posLess(other, anchor)) {\n anchor = pos;\n pos = other;\n } else if (posBefore != posLess(pos, other)) {\n pos = other;\n }\n }\n setSelection(doc, anchor, pos, bias);\n } else {\n setSelection(doc, pos, other || pos, bias);\n }\n if (doc.cm) doc.cm.curOp.userSelChange = true;\n }", "function extendSelection(doc, pos, other, bias) {\n if (doc.sel.shift || doc.sel.extend) {\n var anchor = doc.sel.anchor;\n if (other) {\n var posBefore = posLess(pos, anchor);\n if (posBefore != posLess(other, anchor)) {\n anchor = pos;\n pos = other;\n } else if (posBefore != posLess(pos, other)) {\n pos = other;\n }\n }\n setSelection(doc, anchor, pos, bias);\n } else {\n setSelection(doc, pos, other || pos, bias);\n }\n if (doc.cm) doc.cm.curOp.userSelChange = true;\n }", "function extendSelection(doc, pos, other, bias) {\n if (doc.sel.shift || doc.sel.extend) {\n var anchor = doc.sel.anchor;\n if (other) {\n var posBefore = posLess(pos, anchor);\n if (posBefore != posLess(other, anchor)) {\n anchor = pos;\n pos = other;\n } else if (posBefore != posLess(pos, other)) {\n pos = other;\n }\n }\n setSelection(doc, anchor, pos, bias);\n } else {\n setSelection(doc, pos, other || pos, bias);\n }\n if (doc.cm) doc.cm.curOp.userSelChange = true;\n }", "function extendSelections(doc, heads, options) {\n\t\t var out = [];\n\t\t var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n\t\t for (var i = 0; i < doc.sel.ranges.length; i++)\n\t\t { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n\t\t var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex);\n\t\t setSelection(doc, newSel, options);\n\t\t }", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n\n for (var i = 0; i < doc.sel.ranges.length; i++) {\n out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend);\n }\n\n var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n } // Updates a single range in the selection.", "function extendSelections(doc, heads, options) {\r\n var out = [];\r\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\r\n for (var i = 0; i < doc.sel.ranges.length; i++)\r\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\r\n var newSel = normalizeSelection(out, doc.sel.primIndex);\r\n setSelection(doc, newSel, options);\r\n}", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n}", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n}", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n}", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n}", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n}", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n}", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n}", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n}", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n}", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n}", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n}", "function selectAll() {\n\t\tvar newSelections = [];\n\t\tfor(var d = 0; d < 3; d++) {\n\t\t\tnewSelections.push([]);\n\t\t\tnewSelections[d].push({\"minVal\":0, \"maxVal\":dim[d] - 1});\n\t\t}\n\t\tselections = newSelections;\n\t\tdrawSelections();\n\t\tupdateLocalSelections(true);\n\t\tsaveSelectionsInSlot();\n\t}", "extendSelection(toKey) {\n toKey = this.getKey(toKey);\n let selection; // Only select the one key if coming from a select all.\n\n if (this.state.selectedKeys === 'all') {\n selection = new $cc81f14158b02e1e259a5a46d24f0c$export$Selection([toKey], toKey, toKey);\n } else {\n let selectedKeys = this.state.selectedKeys;\n let anchorKey = selectedKeys.anchorKey || toKey;\n selection = new $cc81f14158b02e1e259a5a46d24f0c$export$Selection(selectedKeys, anchorKey, toKey);\n\n for (let key of this.getKeyRange(anchorKey, selectedKeys.currentKey || toKey)) {\n selection.delete(key);\n }\n\n for (let key of this.getKeyRange(toKey, anchorKey)) {\n if (!this.state.disabledKeys.has(key)) {\n selection.add(key);\n }\n }\n }\n\n this.state.setSelectedKeys(selection);\n }", "function extendSelection(doc, head, other, options) {\n\t\t setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);\n\t\t }", "function extendSelection(doc, head, other, options) {\n\t setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);\n\t }", "function extendSelection(doc, head, other, options) {\n\t setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);\n\t }", "function extendSelection(doc, head, other, options) {\n\t setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);\n\t }", "function extendSelection(doc, head, other, options) {\n setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options)\n}", "function extendSelection(doc, head, other, options) {\n setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options)\n}", "function extendSelection(doc, head, other, options) {\r\n setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);\r\n }", "function extendSelection(doc, head, other, options) {\n setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);\n }", "function extendSelection(doc, head, other, options) {\n setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);\n }", "function extendSelection(doc, head, other, options) {\n setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);\n }", "function extendSelection(doc, head, other, options) {\n setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);\n }", "function extendSelection(doc, head, other, options) {\n setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);\n }", "function extendSelection(doc, head, other, options) {\n setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);\n }", "function extendSelection(doc, head, other, options) {\n setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);\n }", "function extendSelection(doc, head, other, options) {\n setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);\n }", "subSelect(selection) {\n this.setState({ disabledT: !this.state.disabledT, disabledG: !this.state.disabledG })\n this.state.subSel.push(selection);\n }", "function extendSelection(doc, head, other, options, extend) {\n\t\t if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n\t\t setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n\t\t }", "selectAll() {\n this.selection.selectAll();\n }", "selectItem (i) { this.toggSel(true, i); }", "extend(from, to = from) {\n if (from <= this.anchor && to >= this.anchor)\n return EditorSelection.range(from, to);\n let head = Math.abs(from - this.anchor) > Math.abs(to - this.anchor) ? from : to;\n return EditorSelection.range(this.anchor, head);\n }", "function extendSelection(doc, head, other, options, extend) {\r\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\r\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\r\n}", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n }", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n }", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n }", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n }", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n }", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n }", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n }", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n }", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n }", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n }", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n }", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n }", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n }", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n }", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n }", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n }", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n }", "selectAll () { this.toggSelAll(true); }", "unSelectItem (i) { this.toggSel(false, i); }", "_resetSelection() {\n this.__selectedRangeArr = [];\n this.__anchorSelectionIndex = -1;\n this.__leadSelectionIndex = -1;\n }", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n}", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n}", "function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n}" ]
[ "0.67251664", "0.66988546", "0.66988546", "0.66988546", "0.66708016", "0.6634704", "0.663125", "0.663125", "0.663125", "0.663125", "0.663125", "0.663125", "0.663125", "0.663125", "0.6623119", "0.65670156", "0.65670156", "0.6553308", "0.6553308", "0.6553308", "0.65335655", "0.65335655", "0.65335655", "0.65335655", "0.6485224", "0.63379115", "0.6329831", "0.632665", "0.632665", "0.632665", "0.632665", "0.632665", "0.632665", "0.632665", "0.632665", "0.632665", "0.632665", "0.632665", "0.6154455", "0.5894786", "0.58284986", "0.57353026", "0.57353026", "0.57353026", "0.57257557", "0.57257557", "0.5706558", "0.56944734", "0.56944734", "0.56944734", "0.56944734", "0.56944734", "0.56944734", "0.56944734", "0.56944734", "0.56714225", "0.56451243", "0.5612287", "0.5591133", "0.55077326", "0.5501804", "0.55009586", "0.55009586", "0.55009586", "0.55009586", "0.55009586", "0.55009586", "0.55009586", "0.55009586", "0.55009586", "0.55009586", "0.55009586", "0.55009586", "0.55009586", "0.55009586", "0.55009586", "0.55009586", "0.55009586", "0.54866445", "0.5480057", "0.54793835", "0.54665375", "0.54665375", "0.54665375" ]
0.6371589
36
Updates a single range in the selection.
function replaceOneSelection(doc, i, range, options) { var ranges = doc.sel.ranges.slice(0); ranges[i] = range; setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updateInRange(editor, range, offset = 0, updateFunc) {\n const baseRange = editor.getSelectedRange();\n editor.setSelectedRange(range);\n updateFunc();\n editor.setSelectedRange([baseRange[0] + offset, baseRange[1] + offset]);\n }", "updateRange(start, end) {\n this.range.start = start\n this.range.end = end\n this.range.paddingTop = this.getPaddingTop()\n this.range.paddingBottom = this.getPaddingBottom()\n this.callUpdate(this.getRange())\n }", "function replaceOneSelection(doc, i, range, options) {\n\t\t var ranges = doc.sel.ranges.slice(0);\n\t\t ranges[i] = range;\n\t\t setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n\t\t }", "function replaceOneSelection(doc, i, range, options) {\n\t var ranges = doc.sel.ranges.slice(0);\n\t ranges[i] = range;\n\t setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n\t }", "function replaceOneSelection(doc, i, range, options) {\n\t var ranges = doc.sel.ranges.slice(0);\n\t ranges[i] = range;\n\t setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n\t }", "function replaceOneSelection(doc, i, range, options) {\n\t var ranges = doc.sel.ranges.slice(0);\n\t ranges[i] = range;\n\t setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n\t }", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n }", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n }", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n }", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n }", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n }", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n }", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n }", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n }", "function replaceOneSelection(doc, i, range, options) {\r\n var ranges = doc.sel.ranges.slice(0);\r\n ranges[i] = range;\r\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\r\n }", "function replaceOneSelection(doc, i, range, options) {\n\t\t var ranges = doc.sel.ranges.slice(0);\n\t\t ranges[i] = range;\n\t\t setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options);\n\t\t }", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0)\n ranges[i] = range\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options)\n}", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0)\n ranges[i] = range\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options)\n}", "function updateRangeSelection() {\n\td3.selectAll('#details div.range').style('display', function() {\n\t\treturn (d3.select(this).classed(sn.runtime.energyBarOverlapParameters.aggregate.toLowerCase()) ? 'block' : 'none');\n\t});\n}", "function updateRangeSelection() {\n\td3.selectAll('#details div.range').style('display', function() {\n\t\treturn (d3.select(this).classed(sn.runtime.powerIOAreaParameters.aggregate.toLowerCase()) ? 'block' : 'none');\n\t});\n}", "function replaceOneSelection(doc, i, range, options) {\r\n var ranges = doc.sel.ranges.slice(0);\r\n ranges[i] = range;\r\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\r\n}", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n}", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n}", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n}", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n}", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n}", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n}", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n}", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n}", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n}", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n}", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n}", "function updateRangeInputValue() {\n \"use strict\";\n var id = this.id;\n var val = this.value;\n\n // Update Number Input with it's respective Sliders Range Input value\n var inputNumber = document.getElementsByClassName(id);\n inputNumber[0].value = val;\n renderView();\n}", "set range(range) {\n const me = this;\n me.firstResource = range.firstResource;\n me.lastResource = range.lastResource;\n me.refresh();\n }", "function updateRangeValues() {\n var currentPage = paginationService.getCurrentPage(paginationId),\n itemsPerPage = paginationService.getItemsPerPage(paginationId),\n totalItems = paginationService.getCollectionLength(paginationId);\n\n scope.range.lower = (currentPage - 1) * itemsPerPage + 1;\n scope.range.upper = Math.min(currentPage * itemsPerPage, totalItems);\n scope.range.total = totalItems;\n }", "function updateRangeValues() {\n var currentPage = paginationService.getCurrentPage(paginationId),\n itemsPerPage = paginationService.getItemsPerPage(paginationId),\n totalItems = paginationService.getCollectionLength(paginationId);\n\n scope.range.lower = (currentPage - 1) * itemsPerPage + 1;\n scope.range.upper = Math.min(currentPage * itemsPerPage, totalItems);\n scope.range.total = totalItems;\n }", "set range(range) {\n const me = this;\n\n me.firstResource = range.firstResource;\n me.lastResource = range.lastResource;\n\n me.refresh();\n }", "function updateRange(ui,rangeInfo)\r\n\t{\r\n\t\tif(ui.values[1] - ui.values[0] >= 2)\r\n\t\t{\r\n\t\t\tsetStartEndIndex(ui.values[0],ui.values[1]);\r\n\t\t\trangeInfo.html(toKm( g_data['kmstart']) + \" - \" + toKm(g_data['kmend']));\r\n\r\n\t\t\t$('#search-input .rangekm').html(toKm(g_data['kmstart'])+' - '+toKm(g_data['kmend']));\r\n\t\t//\tupdateBinding(['rangekm','kmstart','kmend']);\r\n\t\t\t//updateLinkVideoLightBox()\r\n\t\t}\r\n\t}", "function changeRangeValue(range) {\n var initMin = range.min;\n var initMax = range.max;\n var initStep = range.step;\n var initVal = Number(range.value);\n\n range.min = initVal;\n range.max = initVal + 1;\n range.step = 1;\n range.value = initVal + 1;\n deletePropertySafe(range, 'value');\n range.min = initMin;\n range.max = initMax;\n range.step = initStep;\n range.value = initVal;\n }", "set_range(newval) {\n this.liveFunc.set_range(newval);\n return this._yapi.SUCCESS;\n }", "async function changeRanges(req, res) {\n let range = req.params.range.slice(1)\n let update = req.body.update\n let doc = await Ranges.find({})\n doc[0].ranges[range]=update\n console.log(doc[0].ranges[range])\n await doc[0].save();\n res.type('application/json').send(JSON.stringify(doc[0]));\n}", "updateSelection(value, source) {\n this.selection = value;\n this._selectionChanged.next({ selection: value, source });\n }", "updateSelection(value, source) {\n this.selection = value;\n this._selectionChanged.next({ selection: value, source });\n }", "set range(range) {\n this.startDate = range.startDate;\n this.endDate = range.endDate;\n this.refresh();\n }", "SetRange() {\n\n }", "function updateRangeValues() {\n if (paginationService.isRegistered(paginationId)) {\n var currentPage = paginationService.getCurrentPage(paginationId),\n itemsPerPage = paginationService.getItemsPerPage(paginationId),\n totalItems = paginationService.getCollectionLength(paginationId);\n\n scope.range.lower = (currentPage - 1) * itemsPerPage + 1;\n scope.range.upper = Math.min(currentPage * itemsPerPage, totalItems);\n scope.range.total = totalItems;\n }\n }", "function updateRangeValues() {\n if (paginationService.isRegistered(paginationId)) {\n var currentPage = paginationService.getCurrentPage(paginationId),\n itemsPerPage = paginationService.getItemsPerPage(paginationId),\n totalItems = paginationService.getCollectionLength(paginationId);\n\n scope.range.lower = (currentPage - 1) * itemsPerPage + 1;\n scope.range.upper = Math.min(currentPage * itemsPerPage, totalItems);\n scope.range.total = totalItems;\n }\n }", "function updateRangeValues() {\n if (paginationService.isRegistered(paginationId)) {\n var currentPage = paginationService.getCurrentPage(paginationId),\n itemsPerPage = paginationService.getItemsPerPage(paginationId),\n totalItems = paginationService.getCollectionLength(paginationId);\n\n scope.range.lower = (currentPage - 1) * itemsPerPage + 1;\n scope.range.upper = Math.min(currentPage * itemsPerPage, totalItems);\n scope.range.total = totalItems;\n }\n }", "function updateRangeValues() {\n if (paginationService.isRegistered(paginationId)) {\n var currentPage = paginationService.getCurrentPage(paginationId),\n itemsPerPage = paginationService.getItemsPerPage(paginationId),\n totalItems = paginationService.getCollectionLength(paginationId);\n\n scope.range.lower = (currentPage - 1) * itemsPerPage + 1;\n scope.range.upper = Math.min(currentPage * itemsPerPage, totalItems);\n scope.range.total = totalItems;\n }\n }", "change(e) {\n this.props.setSelectedRange2(e);\n }", "function updateRangeText(event, ui){\n $(this).parent().parent().children().children('.allocText').val(ui.value);\n updateSum();\n }", "replaceRange(range, which = this.mainIndex) {\n let ranges = this.ranges.slice();\n ranges[which] = range;\n return EditorSelection.create(ranges, this.mainIndex);\n }", "function handleRange() {\n let selected = document.getElementById(\"selection\").value;\n document.getElementById(\"selectedYear\").innerHTML = selected;\n year = selected;\n redrawMap(getData(selected));\n}", "changeByRange(f) {\n let sel = this.selection;\n let result1 = f(sel.ranges[0]);\n let changes = this.changes(result1.changes), ranges = [result1.range];\n let effects = asArray(result1.effects);\n for (let i = 1; i < sel.ranges.length; i++) {\n let result = f(sel.ranges[i]);\n let newChanges = this.changes(result.changes), newMapped = newChanges.map(changes);\n for (let j = 0; j < i; j++)\n ranges[j] = ranges[j].map(newMapped);\n let mapBy = changes.mapDesc(newChanges, true);\n ranges.push(result.range.map(mapBy));\n changes = changes.compose(newMapped);\n effects = StateEffect.mapEffects(effects, newMapped).concat(StateEffect.mapEffects(asArray(result.effects), mapBy));\n }\n return {\n changes,\n selection: EditorSelection.create(ranges, sel.mainIndex),\n effects\n };\n }", "updateRange(event, value){ \n this.setState({rangeShort: value[0],\n rangeLong: value[1]}); \n }", "updateInstance(){\n this.getRange();\n }", "function updateRange(ui, rangeInfo) {\r\n if (ui.values[1] - ui.values[0] >= 2) {\r\n $('#slider-range').slider(\"enable\");\r\n setStartEndIndex(ui.values[0], ui.values[1]);\r\n rangeInfo.html(toKm(g_data['kmstart']) + \" - \" + toKm(g_data['kmend']));\r\n $('#search-input .rangekm').html(toKm(g_data['kmstart']) + ' - ' + toKm(g_data['kmend']));\r\n }\r\n\r\n }", "function updaterange(id) {\n console.log(id);\n var docid = id.split(\"-\")[1];\n var intid = parseInt(id.split(\"-\")[2]);\n var ret = false;\n if (range.start == -1 && range.end == -1) {\n range.start = intid;\n range.end = intid;\n range.id = docid;\n ret = true;\n }else if (range.end - intid < 0 && (range.start - intid) > -5 && (range.start - intid) <= 0) {\n range.end = intid;\n ret = true;\n }else if(range.end - intid > 0 && (range.start - intid) > -5 && (range.start - intid) <= 0){\n range.end = intid;\n ret = true;\n }\n\n highlightrange();\n\n return ret;\n }", "set range(range) {\n this.topDate = range.topDate;\n this.bottomDate = range.bottomDate;\n this.refresh();\n }", "function selectRange(range, window) {\n var selection = window.getSelection();\n selection.removeAllRanges();\n selection.addRange(range);\n }", "function changeRange() {\n\t\t\t\t// var v = range.max - range.value;\n\t\t\t\tvar v = range.value;\n\t\t\t\tdispatcher.fire('update.scale', v);\n\t\t\t}", "range(val) {\n this._range = val;\n return this;\n }", "toggleRange(item) {\n if (item === this.lastSelection) {\n this.clear();\n }\n else {\n let state = 0;\n this._selectionCount = 0;\n this._.forEach((value, key) => {\n if (state === 1) { // in progress\n if (item === key || this.lastSelection === key) { // signifies end of range choice\n state = -1;\n }\n if (this.lastSelection === undefined) {\n state = -1;\n value = { filtered: true, selected: false };\n }\n else {\n value = { filtered: false, selected: true };\n ++this._selectionCount;\n }\n }\n else if (state === 0) { // pending\n if (item === key || this.lastSelection === key) {\n state = 1;\n value = { filtered: false, selected: true };\n ++this._selectionCount;\n }\n else {\n value = { filtered: true, selected: false };\n }\n }\n else { // stopped\n value = { filtered: true, selected: false };\n }\n this._.set(key, value);\n });\n this.lastSelection = item;\n if (this._selectionCount === 0 || this._selectionCount === this._.size) {\n this.clear();\n }\n }\n return this;\n }", "setSelectionRange(range) {\n this.editor.selection = new vscode.Selection(range.start.row, range.start.column, range.end.row, range.end.column);\n }", "update({target} = {}) {\n let pivot; // unless otherwise acted on\n \n if (target === a) {\n\t\tif (a.valueAsNumber >= Number(a.max)) {\n\t pivot = Math.min(max - 1, Number(a.max) + 1);\n }\n }\n \n if (target === b) {\n\t\tif (b.valueAsNumber <= Number(b.min)) {\n \tpivot = Math.max(min, Number(b.min) - 2);\n }\n }\n \n if (pivot != null) {\n \ta.max = pivot;\n\t b.min = pivot + 1;\n }\n \n a.style.flexGrow = stepsIn(a);\n b.style.flexGrow = stepsIn(b);\n \n // Print selected range\n o.innerText = `${a.value} - ${b.value}`;\n}", "function updateSelection(){\n\t\t\tif(lastMousePos.pageX == null) return;\n\t\t\t\n\t\t\tsetSelectionPos(selection.second, lastMousePos);\n\t\t\tclearSelection();\n\t\t\t\n\t\t\tif(selectionIsSane()) drawSelection();\n\t\t}", "setRange() {\n /* if command is formatBlock expand selection to entire block */\n let block = this.rangeQuery();\n if (block) this.selectNode(block);\n }", "setRenderedRange(range) {\n if (!rangesEqual(this._renderedRange, range)) {\n if (this.appendOnly) {\n range = {\n start: 0,\n end: Math.max(this._renderedRange.end, range.end)\n };\n }\n\n this._renderedRangeSubject.next(this._renderedRange = range);\n\n this._markChangeDetectionNeeded(() => this._scrollStrategy.onContentRendered());\n }\n }", "function onEdit(event) {\n var { range } = event;\n const row = range.getRow();\n const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();\n var range = sheet.getRange(`A${row}:H${row}`);\n sheet.setActiveRange(range);\n}", "function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n\n for (var i = 0; i < doc.sel.ranges.length; i++) {\n out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend);\n }\n\n var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n } // Updates a single range in the selection.", "function handleRangeUpdate() {\n selectors.video[this.name] = this.value;\n}", "function replaceSelectedRangeWith(text) {\n var textNode = document.createTextNode(text);\n\n var selection = new scribe.api.Selection();\n selection.range.deleteContents();\n selection.range.insertNode(textNode);\n\n return textNode;\n }", "setSelectionRange(start, end, direction) {\n this.getInput().setSelectionRange(start, end, direction);\n }", "function setRangeValue(min, max) {\n minNumRange.value = min;\n maxNumRange.value = max;\n}", "function updateDrawSelectionRectangle(x, y, w, h) {\r\n d3.selectAll(\".selection\")\r\n .attr(\"x\", x)\r\n .attr(\"y\", y)\r\n .attr(\"width\", w)\r\n .attr(\"height\", h);\r\n return;\r\n}", "function updateRange(value) {\n highDiv.find('input').val(value);\n lowDiv.find('input').val(value);\n // Toogle all other buttons (but just the buttons on this fielset.\n fieldset.find('input[type=radio]').prop('checked', false);\n fieldset.find('#progress-button-' + value).prop('checked', true);\n }", "function updateRange() {\n video[this.name] = this.value;\n}", "function replaceRange(value, start, end) {\n\t\t\tvar byteAnchor = context.byteAnchor,\n\t\t\t\tbytePos = context.bytePos;\n\n\t\t\tcontext.anchor = start;\n\t\t\tcontext.pos = end;\n\t\t\t\n\t\t\tif (value == \"\\t\") {\n\t\t\t\tcommandInsertTab();\n\t\t\t} else {\n\t\t\t\tcontext.selection = value;\n\t\t\t}\n\n\t\t\tcontext.byteAnchor = byteAnchor;\n\t\t\tcontext.bytePos = bytePos;\n\n\t\t\tcacheContent = null;\n\t\t}", "changeRange(range) {\n this.setState({range: range});\n this.showChart(this.state.lastPortfolio, range);\n }", "function selectRangeByNewPosition(newOriginSelectionPosition, newFocusPosition) {\n\n //console.log('select new range', newOriginSelectionPosition, newFocusPosition);\n\n // Switch position references\n selModel.currentFocusPosition = newFocusPosition;\n selModel.originSelectionPosition = newOriginSelectionPosition;\n\n // Try selecting range\n selModel.selectFocusRange(true);\n }", "function onRangechanged(data){\n\tvar slider = document.getElementById('slider');\n\tslider.value = data.value;\n}", "_internalSetValue(ref, value) {\n const target = ref === this.refs.minRange ? 'min' : 'max';\n this._range[target] = value;\n this._emitChange();\n }", "function setSelectionRange(input, selectionStart, selectionEnd) {\n if (input.setSelectionRange) {\n input.focus();\n //input.setSelectionRange(selectionStart, selectionEnd);\n input.selectionStart=selectionStart;\n input.selectionEnd=selectionEnd;\n }\n else if (input.createTextRange) {\n var range = input.createTextRange();\n range.collapse(true);\n range.moveEnd('character', selectionEnd);\n range.moveStart('character', selectionStart);\n range.select();\n }\n}", "_rangeChanged() {\n this.dispatchEvent(new CustomEvent(\"range-changed\", {\n bubbles: true,\n cancelable: true,\n composed: true,\n detail: this\n }));\n }" ]
[ "0.7218381", "0.69966", "0.6366824", "0.6361162", "0.6361162", "0.6361162", "0.63484067", "0.63484067", "0.63484067", "0.63484067", "0.63484067", "0.63484067", "0.63484067", "0.63484067", "0.63363445", "0.63199526", "0.63136816", "0.63136816", "0.6311347", "0.6283103", "0.62680155", "0.6267025", "0.6267025", "0.6267025", "0.6267025", "0.6267025", "0.6267025", "0.6267025", "0.6267025", "0.6267025", "0.6267025", "0.6267025", "0.62410414", "0.62169135", "0.6197076", "0.6184239", "0.6178562", "0.61737674", "0.61411554", "0.61254203", "0.610145", "0.6089735", "0.6089735", "0.60508215", "0.6033459", "0.5974101", "0.5974101", "0.5974101", "0.5974101", "0.59177107", "0.5913594", "0.5882957", "0.58772916", "0.586354", "0.5845084", "0.5819766", "0.58069384", "0.57833004", "0.57028645", "0.56354487", "0.56338763", "0.5630193", "0.5604367", "0.5592343", "0.55804926", "0.54854053", "0.54715323", "0.5417441", "0.5408291", "0.5404842", "0.5403438", "0.53648037", "0.5358183", "0.5356027", "0.5351685", "0.53497505", "0.5335098", "0.53054494", "0.5296241", "0.5289586", "0.528258", "0.5274162", "0.5273583", "0.5273368" ]
0.62980735
30
Reset the selection to a single range.
function setSimpleSelection(doc, anchor, head, options) { setSelection(doc, simpleSelection(anchor, head), options); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_resetSelection() {\n this.__selectedRangeArr = [];\n this.__anchorSelectionIndex = -1;\n this.__leadSelectionIndex = -1;\n }", "restoreRange() {\n if (this.lastRange) {\n this.lastRange.select();\n this.focus();\n }\n }", "reset() {\n this._selection = -1;\n }", "function restoreSelection(range) {\n if (range) {\n if (window.getSelection) {\n sel = window.getSelection();\n sel.removeAllRanges();\n sel.addRange(range);\n } else if (document.selection && range.select) {\n range.select();\n }\n }\n }", "resetSelection () {\n this.currentSelection = null\n }", "resetSelection() {\n if (!this.isSelectionEmpty()) {\n this._resetSelection();\n this._fireChangeSelection();\n }\n }", "clearSelection() {\n this.selectionStart = undefined;\n this.selectionEnd = undefined;\n this.isSelectAllActive = false;\n this.selectionStartLength = 0;\n }", "clearSelection() {\n this._clearSelection();\n }", "function replaceOneSelection(doc, i, range, options) {\n\t var ranges = doc.sel.ranges.slice(0);\n\t ranges[i] = range;\n\t setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n\t }", "function replaceOneSelection(doc, i, range, options) {\n\t var ranges = doc.sel.ranges.slice(0);\n\t ranges[i] = range;\n\t setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n\t }", "function replaceOneSelection(doc, i, range, options) {\n\t var ranges = doc.sel.ranges.slice(0);\n\t ranges[i] = range;\n\t setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n\t }", "function replaceOneSelection(doc, i, range, options) {\n\t\t var ranges = doc.sel.ranges.slice(0);\n\t\t ranges[i] = range;\n\t\t setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n\t\t }", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n }", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n }", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n }", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n }", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n }", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n }", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n }", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n }", "function replaceOneSelection(doc, i, range, options) {\r\n var ranges = doc.sel.ranges.slice(0);\r\n ranges[i] = range;\r\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\r\n }", "function clearSelection() {\n activeSheet.clearSelectedMarksAsync();\n }", "function replaceOneSelection(doc, i, range, options) {\n\t\t var ranges = doc.sel.ranges.slice(0);\n\t\t ranges[i] = range;\n\t\t setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options);\n\t\t }", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options);\n }", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options);\n }", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options);\n }", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options);\n }", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options);\n }", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options);\n }", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options);\n }", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options);\n }", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options);\n }", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options);\n }", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options);\n }", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options);\n }", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options);\n }", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options);\n }", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options);\n }", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options);\n }", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options);\n }", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0)\n ranges[i] = range\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options)\n}", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0)\n ranges[i] = range\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options)\n}", "function replaceOneSelection(doc, i, range, options) {\r\n var ranges = doc.sel.ranges.slice(0);\r\n ranges[i] = range;\r\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\r\n}", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n}", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n}", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n}", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n}", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n}", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n}", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n}", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n}", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n}", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n}", "function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n}", "function clearSelection () {\n if (document.selection) {\n document.selection.empty();\n } else if (window.getSelection) {\n window.getSelection().removeAllRanges();\n }\n}", "function restoreRange(editor) {\n if (editor.range) {\n if (iege11)\n getSelection(editor).addRange(editor.range[0]);\n }\n }", "_clearRangeTable() {\n let range = this._range;\n let rows = this._rows;\n for (let i = range.low; i <= range.high; i++) {\n rows[i].classList.remove('selected');\n }\n range.low = -1;\n range.high = -1;\n }", "deselectAll() {\n if (document.selection) {\n document.selection.empty();\n } else if (window.getSelection) {\n window.getSelection().removeAllRanges();\n }\n }", "clearSelection(){\n this.selected = null\n }", "clearSelection() {\n this._model.clearSelection();\n this._removeMouseDownListeners();\n this.refresh();\n this._onSelectionChange.fire();\n }", "resetRange() {\n this._initAxisTags(true);\n this.draw();\n }", "function selectionRestore() {\n if (savedSelection) {\n rangy.restoreSelection(savedSelection);\n savedSelection = false;\n }\n}", "function clearPreviousSelection()\n {\n if ($.browser.msie) \n {\n document.selection.empty();\n }\n else\n {\n window.getSelection().removeAllRanges();\n }\n }", "function clearSelection()\n{\n if (window.getSelection) {window.getSelection().removeAllRanges();}\n else if (document.selection) {document.selection.empty();}\n}", "function selectionTrim() {\n if (selectionExists()) {\n var range = selectionRange();\n rangeTrim(range);\n selectionSet(range);\n }\n}", "function clearSelection() {\n if (window.getSelection) {\n if (window.getSelection().empty) { // Chrome\n window.getSelection().empty();\n } else if (window.getSelection().removeAllRanges) { // Firefox\n window.getSelection().removeAllRanges();\n }\n } else if (document.selection) { // IE?\n document.selection.empty();\n }\n }", "function resetSelection() {\n selectedHref = '#';\n selectedLi = -1;\n // remove all selected on reset\n $suggestionBox.find('li').removeClass('selected');\n }", "function removeAllSelections() {\r\n\tvar pos = getCaretPosition();\r\n\twindow.getSelection().removeAllRanges();\r\n\tsetCaretPosition(pos);\r\n}", "clearSelection() {\n var _a;\n (_a = this._selectionService) === null || _a === void 0 ? void 0 : _a.clearSelection();\n }", "function clearSelection() {\n\t\t\tif(prevSelection == null) return;\n\n\t\t\tvar x = Math.min(prevSelection.first.x, prevSelection.second.x),\n\t\t\t\ty = Math.min(prevSelection.first.y, prevSelection.second.y),\n\t\t\t\tw = Math.abs(prevSelection.second.x - prevSelection.first.x),\n\t\t\t\th = Math.abs(prevSelection.second.y - prevSelection.first.y);\n\t\t\t\n\t\t\toctx.clearRect(x + plotOffset.left - octx.lineWidth,\n\t\t\t\t\t\t y + plotOffset.top - octx.lineWidth,\n\t\t\t\t\t\t w + octx.lineWidth*2,\n\t\t\t\t\t\t h + octx.lineWidth*2);\n\t\t\t\n\t\t\tprevSelection = null;\n\t\t}", "restoreSelections() {\n if (!this.trackedSelections) {\n return;\n }\n const value = AppContext.getInstance().hash.getProp(AppConstants.HASH_PROPS.SELECTION, '');\n if (value === '') {\n return;\n }\n const ranges = value.split(';').map((s) => ParseRangeUtils.parseRangeLike(s));\n this.trackedSelections.select(ranges);\n }", "clearSelection() {\n this.currentlySelected = '';\n }", "function selectRange(range, window) {\n var selection = window.getSelection();\n selection.removeAllRanges();\n selection.addRange(range);\n }", "setSelectionRange(range) {\n this.editor.selection = new vscode.Selection(range.start.row, range.start.column, range.end.row, range.end.column);\n }", "function clearSelections() {\r\n var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;\r\n if (isFirefox) {\r\n document.selection.empty();\r\n } else {\r\n window.getSelection().removeAllRanges();\r\n }\r\n }", "resetSelectedRow() {\n\n this.selectedRowCoords.r = null\n this.selectedRowCoords.c = null\n this.editedRowCoords.r = null\n this.editedRowCoords.c = null\n this.validatedCell.r = null\n this.validatedCell.c = null\n\n this.hot.deselectCell();\n }", "clearSelection() {\n this._selected = null;\n // Immediately expand the table if it's collapsed.\n if (this._table.getAttribute(\"data-collapsed\") === \"true\") {\n this._table.style.height = null;\n this._table.setAttribute(\"data-collapsed\", \"false\")\n }\n }", "function resetSelectedTextElement() \n {\n element = this;\n clearPreviousSelection();\n }", "selectAll() {\n const that = this;\n\n if ((that.arrayIndexingMode === 'LabVIEW' && that._filledUpTo[0] === -1) ||\n (that.arrayIndexingMode === 'JavaScript' && that._filledUpTo[that._filledUpTo.length - 1] === -1)) {\n return;\n }\n\n const start = new Array(that.dimensions);\n\n start.fill(0);\n\n that._absoluteSelectionStart = start;\n that._absoluteSelectionEnd = that._filledUpTo.slice(0);\n that._refreshSelection();\n }", "clearSelection() {\n this.selectionModel.clear();\n this.buttonToggles.forEach((toggle) => toggle.checked = false);\n }", "function resetSelection(){\n\t$(\".document-list, #scrapPaperDiv, .scrap-keyword\").find(\"span\").each(function( index ){\n\t\tif($(this).hasClass('ent_highlighted')){\n\t\t\t$(this).removeClass('ent_highlighted');\n\t\t}\n\t\t\n\t\tif($(this).hasClass('highlighted')){\n\t\t\t$(this).parent().unhighlight({className:$(this).text().split(\" \")[0]});\t\t\n\t\t}\n\t});\n\tqueue = [];\n}", "setRange() {\n /* if command is formatBlock expand selection to entire block */\n let block = this.rangeQuery();\n if (block) this.selectNode(block);\n }", "function clearRange(maskCharData, selectionStart, selectionCount) {\n for (var i = 0; i < maskCharData.length; i++) {\n if (maskCharData[i].displayIndex >= selectionStart) {\n if (maskCharData[i].displayIndex >= selectionStart + selectionCount) {\n break;\n }\n maskCharData[i].value = undefined;\n }\n }\n return maskCharData;\n}", "function clearRange(maskCharData, selectionStart, selectionCount) {\n for (var i = 0; i < maskCharData.length; i++) {\n if (maskCharData[i].displayIndex >= selectionStart) {\n if (maskCharData[i].displayIndex >= selectionStart + selectionCount) {\n break;\n }\n maskCharData[i].value = undefined;\n }\n }\n return maskCharData;\n}", "resetDeviceSelection() {\n\t\tif ( this.deviceSelection && this.deviceSelection.defaultSelected ) {\n\t\t\tthis.deviceSelection.activate( this.deviceSelection.defaultSelected );\n\t\t} else if ( this.deviceSelection ) {\n\t\t\tthis.deviceSelection.activate( 'base' );\n\t\t}\n\t}", "SetRange() {\n\n }", "setRange() {\n /* if command is formatBlock expand selection to entire block */\n let block = this._getSelectedBlock();\n\n if (block) this.__selection.selectNode(block);\n }", "removeToLineStart() {\n if (this.selection.isEmpty())\n this.selection.selectLineStart();\n if (this.selection.isEmpty())\n this.selection.selectLeft();\n this.session.remove(this.getSelectionRange());\n this.clearSelection();\n }", "function reselect(myWindow, startOffset, endOffset, startIndex, endIndex) {\n //scroll to the position\n //myWindow.document.getElementById(\"document\").scrollTo(0, yPosition);\n\n //reselect the selection using startIndex and endIndex\n let documentNode = myWindow.document.getElementById(\"document\");\n let node = documentNode.firstElementChild;\n let i = 0;\n let startNode;\n let endNode;\n\n while (node) {\n if (i == startIndex) {\n startNode = node;\n }\n if (i == endIndex) {\n endNode = node;\n }\n i++;\n node = node.nextElementSibling || node.nextSibling;\n }\n console.log(startNode);\n console.log(endNode);\n\n //re-create the selection using offset\n const newRange = new Range();\n console.log(startNode.firstChild.firstChild);\n\n if (startNode.firstChild.nodeName == \"STRONG\") {\n console.log(\"start strong\");\n newRange.setStart(startNode.firstChild.firstChild, startOffset);\n } else {\n newRange.setStart(startNode.firstChild, startOffset);\n }\n\n if (endNode.firstChild.nodeName == \"STRONG\") {\n console.log(\"end strong\");\n newRange.setEnd(endNode.firstChild.firstChild, endOffset);\n } else {\n console.log(endNode.firstChild);\n newRange.setEnd(endNode.firstChild, endOffset);\n }\n\n let selection = myWindow.window.getSelection();\n selection.removeAllRanges();\n selection.addRange(newRange);\n}", "clearSelection() {\n this.table.find('td.selected').removeClass('selected');\n }", "clearSelection() {\n if (!this.disallowEmptySelection && (this.state.selectedKeys === 'all' || this.state.selectedKeys.size > 0)) {\n this.state.setSelectedKeys(new $cc81f14158b02e1e259a5a46d24f0c$export$Selection());\n }\n }", "replaceRange(range, which = this.mainIndex) {\n let ranges = this.ranges.slice();\n ranges[which] = range;\n return EditorSelection.create(ranges, this.mainIndex);\n }", "RemoveRange() {\n\n }", "function resetSelection(time=0) {\n d3.selectAll('.elm').transition().duration(time).style('opacity', 1)\n .style('stroke-width', 1);\n d3.selectAll('.navAlt').transition().duration(time).style('opacity', 1);\n d3.selectAll('.labels').transition().duration(time).style('font-size', \"9.5px\")\n .style(\"fill\", \"#B8CBED\").style(\"opacity\", 0.5);\n }", "function unselectAll() {\n d3.selectAll(\"#synoptic .selection\")\n .remove();\n }", "setSelection(selection) {\n if (selection.$from.doc != this.doc)\n throw new RangeError(\"Selection passed to setSelection must point at the current document\");\n this.curSelection = selection;\n this.curSelectionFor = this.steps.length;\n this.updated = (this.updated | UPDATED_SEL) & ~UPDATED_MARKS;\n this.storedMarks = null;\n return this;\n }", "function resetCursor() {\r\n if (t_input.setSelectionRange) { // Modern browsers\r\n t_input.focus();\r\n t_input.setSelectionRange(t_input.value.length, t_input.value.length);\r\n } else if (t_input.createTextRange) { // IE8 and below\r\n var range = t_input.createTextRange();\r\n range.collapse(true);\r\n range.moveEnd(\"character\", t_input.value.length);\r\n range.moveStart(\"character\", t_input.value.length);\r\n range.select();\r\n }\r\n}", "unselect() {\n this.selection = null;\n this.refreshSelection();\n return this;\n }", "function selectRange() {\n var frstSelect = selectedEles[0];\n var lstSelect = selectedEles[selectedEles.length - 1];\n if (cols) {\n var flipStart = flipFlipIdx(Math.min(flipIdx(selectionMinPivot), flipIdx(selectionMaxPivot),\n flipIdx(frstSelect), flipIdx(lstSelect)));\n var flipEnd = flipFlipIdx(Math.max(flipIdx(selectionMinPivot), flipIdx(selectionMaxPivot),\n flipIdx(frstSelect), flipIdx(lstSelect)));\n selectElemsDownRows(Math.min(flipStart, flipEnd), Math.max(flipStart, flipEnd));\n } else {\n var start = Math.min(selectionMinPivot, frstSelect);\n var end = Math.max(selectionMaxPivot, lstSelect);\n selectElemRange(start, end);\n }\n }", "clear()\n {\n this.set('selected', null);\n }", "unSelectAll () { this.toggSelAll(false); }" ]
[ "0.79783505", "0.76575625", "0.7616093", "0.74678564", "0.7437772", "0.72755456", "0.72359824", "0.71725357", "0.69074774", "0.69074774", "0.69074774", "0.68833935", "0.68802726", "0.68802726", "0.68802726", "0.68802726", "0.68802726", "0.68802726", "0.68802726", "0.68802726", "0.6857935", "0.68576014", "0.684324", "0.6829884", "0.6829884", "0.6829884", "0.6829884", "0.6829884", "0.6829884", "0.6829884", "0.6829884", "0.6829884", "0.6829884", "0.6829884", "0.6829884", "0.6829884", "0.6829884", "0.6829884", "0.6829884", "0.6829884", "0.6810402", "0.6810402", "0.67173856", "0.67108184", "0.67108184", "0.67108184", "0.67108184", "0.67108184", "0.67108184", "0.67108184", "0.67108184", "0.67108184", "0.67108184", "0.67108184", "0.6702653", "0.6654948", "0.6636192", "0.6626422", "0.65973914", "0.659037", "0.65266424", "0.6496611", "0.6489782", "0.64580435", "0.64287597", "0.64193535", "0.639028", "0.6381405", "0.63646936", "0.6346836", "0.6321621", "0.62977046", "0.625369", "0.6221292", "0.62190235", "0.62150663", "0.6195145", "0.61606234", "0.61014944", "0.6089249", "0.60654974", "0.60394454", "0.6038262", "0.6038262", "0.60280615", "0.60030365", "0.59990734", "0.5970322", "0.5954111", "0.5936261", "0.59341466", "0.5853964", "0.5853472", "0.58518374", "0.58506936", "0.5846378", "0.5835125", "0.58337677", "0.5828841", "0.5828087", "0.5823482" ]
0.0
-1
Give beforeSelectionChange handlers a change to influence a selection update.
function filterSelectionChange(doc, sel, options) { var obj = { ranges: sel.ranges, update: function(ranges) { this.ranges = []; for (var i = 0; i < ranges.length; i++) { this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor), clipPos(doc, ranges[i].head)); } }, origin: options && options.origin }; signal(doc, "beforeSelectionChange", doc, obj); if (doc.cm) { signal(doc.cm, "beforeSelectionChange", doc.cm, obj); } if (obj.ranges != sel.ranges) { return normalizeSelection(doc.cm, obj.ranges, obj.ranges.length - 1) } else { return sel } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function SelectionChange() {}", "function SelectionChange() {}", "function SelectionChange() {}", "function SelectionChange() {}", "function SelectionChange() { }", "function SelectionChange() { }", "beforeSelectRow(rowid, e){\n }", "selectionChanged(context, onContextChanged) {\n return this.selectionChangedImpl(context, onContextChanged);\n }", "onCursorChange() {\n this.$cursorChange();\n this._signal(\"changeSelection\");\n }", "function updateSelection(){\n\t\t\tif(lastMousePos.pageX == null) return;\n\t\t\t\n\t\t\tsetSelectionPos(selection.second, lastMousePos);\n\t\t\tclearSelection();\n\t\t\t\n\t\t\tif(selectionIsSane()) drawSelection();\n\t\t}", "_fireChangeSelection() {\n if (this.hasBatchMode()) {\n // In batch mode, remember event but do not throw (yet)\n this.__hadChangeEventInBatchMode = true;\n } else {\n // If not in batch mode, throw event\n this.fireEvent(\"changeSelection\");\n }\n }", "function selectionChange(e) {\n\t\t\t\tvar pointRng;\n\n\t\t\t\t// Check if the button is down or not\n\t\t\t\tif (e.button) {\n\t\t\t\t\t// Create range from mouse position\n\t\t\t\t\tpointRng = rngFromPoint(e.x, e.y);\n\n\t\t\t\t\tif (pointRng) {\n\t\t\t\t\t\t// Check if pointRange is before/after selection then change the endPoint\n\t\t\t\t\t\tif (pointRng.compareEndPoints('StartToStart', startRng) > 0) {\n\t\t\t\t\t\t\tpointRng.setEndPoint('StartToStart', startRng);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpointRng.setEndPoint('EndToEnd', startRng);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tpointRng.select();\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tendSelection();\n\t\t\t\t}\n\t\t\t}", "function selectionChange(e) {\n\t\t\t\tvar pointRng;\n\n\t\t\t\t// Check if the button is down or not\n\t\t\t\tif (e.button) {\n\t\t\t\t\t// Create range from mouse position\n\t\t\t\t\tpointRng = rngFromPoint(e.x, e.y);\n\n\t\t\t\t\tif (pointRng) {\n\t\t\t\t\t\t// Check if pointRange is before/after selection then change the endPoint\n\t\t\t\t\t\tif (pointRng.compareEndPoints('StartToStart', startRng) > 0) {\n\t\t\t\t\t\t\tpointRng.setEndPoint('StartToStart', startRng);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpointRng.setEndPoint('EndToEnd', startRng);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tpointRng.select();\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tendSelection();\n\t\t\t\t}\n\t\t\t}", "function selectionChange(e) {\n\t\t\t\tvar pointRng;\n\n\t\t\t\t// Check if the button is down or not\n\t\t\t\tif (e.button) {\n\t\t\t\t\t// Create range from mouse position\n\t\t\t\t\tpointRng = rngFromPoint(e.x, e.y);\n\n\t\t\t\t\tif (pointRng) {\n\t\t\t\t\t\t// Check if pointRange is before/after selection then change the endPoint\n\t\t\t\t\t\tif (pointRng.compareEndPoints('StartToStart', startRng) > 0) {\n\t\t\t\t\t\t\tpointRng.setEndPoint('StartToStart', startRng);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpointRng.setEndPoint('EndToEnd', startRng);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tpointRng.select();\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tendSelection();\n\t\t\t\t}\n\t\t\t}", "_beforeSelect (data, preserve) {\n if (this.callEvent(\"onStartWith\", [data.row, \"0$\"]) ||\n data.column == 'action' ||\n data.column == 'edit' ||\n data.column == 'checkbox') {\n return false;\n }\n }", "onSelectionRequested(e) {\n const previouslySelectedItems = this.getSelectedItems();\n let selectionChange = false;\n this._selectionRequested = true;\n if (this.mode !== _ListMode.default.None && this[`handle${this.mode}`]) {\n selectionChange = this[`handle${this.mode}`](e.detail.item, !!e.detail.selected);\n }\n if (selectionChange) {\n const changePrevented = !this.fireEvent(\"selection-change\", {\n selectedItems: this.getSelectedItems(),\n previouslySelectedItems,\n selectionComponentPressed: e.detail.selectionComponentPressed,\n targetItem: e.detail.item,\n key: e.detail.key\n }, true);\n if (changePrevented) {\n this._revertSelection(previouslySelectedItems);\n }\n }\n }", "handleSelectionChange(selection, emptySelection = false) {\n\t\tif (!emptySelection) {\n\t\t\tthis.triggerSelection(selection);\n\t\t} else {\n\t\t\tthis.sendEmptySelection();\n\t\t}\n\t}", "function selectionChanged(evt) {\n\t\tvar ctx = evt.data;\n\t\tvar $allSelected = $(this).find(':selected');\n\t\tvar value = $allSelected.attr('value');\n\t\tvar $selectedOptions = ctx.$options.find('[data-value=\"' + value + '\"]');\n\t\tselectUpdateValue(ctx, $selectedOptions, undefined, false);\n\t}", "updateSelection(value, source) {\n this.selection = value;\n this._selectionChanged.next({ selection: value, source });\n }", "updateSelection(value, source) {\n this.selection = value;\n this._selectionChanged.next({ selection: value, source });\n }", "function selectionChange(e) {\n var pointRng;\n\n // Check if the button is down or not\n if (e.button) {\n // Create range from mouse position\n pointRng = rngFromPoint(e.pageX, e.pageY);\n\n if (pointRng) {\n // Check if pointRange is before/after selection then change the endPoint\n if (pointRng.compareEndPoints('StartToStart', startRng) > 0)\n pointRng.setEndPoint('StartToStart', startRng);\n else\n pointRng.setEndPoint('EndToEnd', startRng);\n\n pointRng.select();\n }\n } else {\n endSelection();\n }\n }", "function filterSelectionChange(doc, sel, options) {\n\t var obj = {\n\t ranges: sel.ranges,\n\t update: function(ranges) {\n\t this.ranges = [];\n\t for (var i = 0; i < ranges.length; i++)\n\t this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n\t clipPos(doc, ranges[i].head));\n\t },\n\t origin: options && options.origin\n\t };\n\t signal(doc, \"beforeSelectionChange\", doc, obj);\n\t if (doc.cm) signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj);\n\t if (obj.ranges != sel.ranges) return normalizeSelection(obj.ranges, obj.ranges.length - 1);\n\t else return sel;\n\t }", "function filterSelectionChange(doc, sel, options) {\n\t var obj = {\n\t ranges: sel.ranges,\n\t update: function(ranges) {\n\t this.ranges = [];\n\t for (var i = 0; i < ranges.length; i++)\n\t this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n\t clipPos(doc, ranges[i].head));\n\t },\n\t origin: options && options.origin\n\t };\n\t signal(doc, \"beforeSelectionChange\", doc, obj);\n\t if (doc.cm) signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj);\n\t if (obj.ranges != sel.ranges) return normalizeSelection(obj.ranges, obj.ranges.length - 1);\n\t else return sel;\n\t }", "function filterSelectionChange(doc, sel, options) {\n\t var obj = {\n\t ranges: sel.ranges,\n\t update: function(ranges) {\n\t this.ranges = [];\n\t for (var i = 0; i < ranges.length; i++)\n\t this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n\t clipPos(doc, ranges[i].head));\n\t },\n\t origin: options && options.origin\n\t };\n\t signal(doc, \"beforeSelectionChange\", doc, obj);\n\t if (doc.cm) signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj);\n\t if (obj.ranges != sel.ranges) return normalizeSelection(obj.ranges, obj.ranges.length - 1);\n\t else return sel;\n\t }", "function filterSelectionChange(doc, sel, options) {\n\t\t var obj = {\n\t\t ranges: sel.ranges,\n\t\t update: function(ranges) {\n\t\t this.ranges = [];\n\t\t for (var i = 0; i < ranges.length; i++)\n\t\t this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n\t\t clipPos(doc, ranges[i].head));\n\t\t },\n\t\t origin: options && options.origin\n\t\t };\n\t\t signal(doc, \"beforeSelectionChange\", doc, obj);\n\t\t if (doc.cm) signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj);\n\t\t if (obj.ranges != sel.ranges) return normalizeSelection(obj.ranges, obj.ranges.length - 1);\n\t\t else return sel;\n\t\t }", "function optionChanged(newSelection) {\n console.log(newSelection);\n updateTable(newSelection);\n}", "function filterSelectionChange(doc, sel, options) {\n\t\t var obj = {\n\t\t ranges: sel.ranges,\n\t\t update: function(ranges) {\n\t\t this.ranges = [];\n\t\t for (var i = 0; i < ranges.length; i++)\n\t\t { this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n\t\t clipPos(doc, ranges[i].head)); }\n\t\t },\n\t\t origin: options && options.origin\n\t\t };\n\t\t signal(doc, \"beforeSelectionChange\", doc, obj);\n\t\t if (doc.cm) { signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj); }\n\t\t if (obj.ranges != sel.ranges) { return normalizeSelection(doc.cm, obj.ranges, obj.ranges.length - 1) }\n\t\t else { return sel }\n\t\t }", "resetSelection() {\n if (!this.isSelectionEmpty()) {\n this._resetSelection();\n this._fireChangeSelection();\n }\n }", "__$$triggerSelectionChange() {\n\t\tconst selected = this.state.selected\n\t\tthis.refs.headerCheckbox.indeterminate = this.__$$checkboxShouldBeIndeterminate(selected)\n\n\t\tconst fn = this.props.onChange || (() => { })\n\t\tfn(this, this.getSelectedIndices(selected))\n\t}", "function filterSelectionChange(doc, sel) {\r\n var obj = {\r\n ranges: sel.ranges,\r\n update: function(ranges) {\r\n this.ranges = [];\r\n for (var i = 0; i < ranges.length; i++)\r\n this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\r\n clipPos(doc, ranges[i].head));\r\n }\r\n };\r\n signal(doc, \"beforeSelectionChange\", doc, obj);\r\n if (doc.cm) signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj);\r\n if (obj.ranges != sel.ranges) return normalizeSelection(obj.ranges, obj.ranges.length - 1);\r\n else return sel;\r\n }", "function filterSelectionChange(doc, sel) {\n var obj = {\n ranges: sel.ranges,\n update: function(ranges) {\n this.ranges = [];\n for (var i = 0; i < ranges.length; i++)\n this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n clipPos(doc, ranges[i].head));\n }\n };\n signal(doc, \"beforeSelectionChange\", doc, obj);\n if (doc.cm) signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj);\n if (obj.ranges != sel.ranges) return normalizeSelection(obj.ranges, obj.ranges.length - 1);\n else return sel;\n }", "function filterSelectionChange(doc, sel) {\n var obj = {\n ranges: sel.ranges,\n update: function(ranges) {\n this.ranges = [];\n for (var i = 0; i < ranges.length; i++)\n this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n clipPos(doc, ranges[i].head));\n }\n };\n signal(doc, \"beforeSelectionChange\", doc, obj);\n if (doc.cm) signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj);\n if (obj.ranges != sel.ranges) return normalizeSelection(obj.ranges, obj.ranges.length - 1);\n else return sel;\n }", "function filterSelectionChange(doc, sel) {\n var obj = {\n ranges: sel.ranges,\n update: function(ranges) {\n this.ranges = [];\n for (var i = 0; i < ranges.length; i++)\n this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n clipPos(doc, ranges[i].head));\n }\n };\n signal(doc, \"beforeSelectionChange\", doc, obj);\n if (doc.cm) signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj);\n if (obj.ranges != sel.ranges) return normalizeSelection(obj.ranges, obj.ranges.length - 1);\n else return sel;\n }", "function filterSelectionChange(doc, sel) {\n var obj = {\n ranges: sel.ranges,\n update: function(ranges) {\n this.ranges = [];\n for (var i = 0; i < ranges.length; i++)\n this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n clipPos(doc, ranges[i].head));\n }\n };\n signal(doc, \"beforeSelectionChange\", doc, obj);\n if (doc.cm) signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj);\n if (obj.ranges != sel.ranges) return normalizeSelection(obj.ranges, obj.ranges.length - 1);\n else return sel;\n }", "function filterSelectionChange(doc, sel) {\n var obj = {\n ranges: sel.ranges,\n update: function(ranges) {\n this.ranges = [];\n for (var i = 0; i < ranges.length; i++)\n this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n clipPos(doc, ranges[i].head));\n }\n };\n signal(doc, \"beforeSelectionChange\", doc, obj);\n if (doc.cm) signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj);\n if (obj.ranges != sel.ranges) return normalizeSelection(obj.ranges, obj.ranges.length - 1);\n else return sel;\n }", "function filterSelectionChange(doc, sel) {\n var obj = {\n ranges: sel.ranges,\n update: function(ranges) {\n this.ranges = [];\n for (var i = 0; i < ranges.length; i++)\n this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n clipPos(doc, ranges[i].head));\n }\n };\n signal(doc, \"beforeSelectionChange\", doc, obj);\n if (doc.cm) signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj);\n if (obj.ranges != sel.ranges) return normalizeSelection(obj.ranges, obj.ranges.length - 1);\n else return sel;\n }", "function filterSelectionChange(doc, sel) {\n var obj = {\n ranges: sel.ranges,\n update: function(ranges) {\n this.ranges = [];\n for (var i = 0; i < ranges.length; i++)\n this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n clipPos(doc, ranges[i].head));\n }\n };\n signal(doc, \"beforeSelectionChange\", doc, obj);\n if (doc.cm) signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj);\n if (obj.ranges != sel.ranges) return normalizeSelection(obj.ranges, obj.ranges.length - 1);\n else return sel;\n }", "function setSelection(from, to, oldFrom, oldTo) {\n if (posEq(sel.from, from) && posEq(sel.to, to)) return;\n if (posLess(to, from)) {var tmp = to; to = from; from = tmp;}\n\n if (posEq(from, to)) sel.inverted = false;\n else if (posEq(from, sel.to)) sel.inverted = false;\n else if (posEq(to, sel.from)) sel.inverted = true;\n\n // Some ugly logic used to only mark the lines that actually did\n // see a change in selection as changed, rather than the whole\n // selected range.\n if (oldFrom == null) {oldFrom = sel.from.line; oldTo = sel.to.line;}\n if (posEq(from, to)) {\n if (!posEq(sel.from, sel.to))\n changes.push({from: oldFrom, to: oldTo + 1});\n }\n else if (posEq(sel.from, sel.to)) {\n changes.push({from: from.line, to: to.line + 1});\n }\n else {\n if (!posEq(from, sel.from)) {\n if (from.line < oldFrom)\n changes.push({from: from.line, to: Math.min(to.line, oldFrom) + 1});\n else\n changes.push({from: oldFrom, to: Math.min(oldTo, from.line) + 1});\n }\n if (!posEq(to, sel.to)) {\n if (to.line < oldTo)\n changes.push({from: Math.max(oldFrom, from.line), to: oldTo + 1});\n else\n changes.push({from: Math.max(from.line, oldTo), to: to.line + 1});\n }\n }\n sel.from = from; sel.to = to;\n selectionChanged = true;\n }", "function setSelection(from, to, oldFrom, oldTo) {\n if (posEq(sel.from, from) && posEq(sel.to, to)) return;\n if (posLess(to, from)) {var tmp = to; to = from; from = tmp;}\n\n if (posEq(from, to)) sel.inverted = false;\n else if (posEq(from, sel.to)) sel.inverted = false;\n else if (posEq(to, sel.from)) sel.inverted = true;\n\n // Some ugly logic used to only mark the lines that actually did\n // see a change in selection as changed, rather than the whole\n // selected range.\n if (oldFrom == null) {oldFrom = sel.from.line; oldTo = sel.to.line;}\n if (posEq(from, to)) {\n if (!posEq(sel.from, sel.to))\n changes.push({from: oldFrom, to: oldTo + 1});\n }\n else if (posEq(sel.from, sel.to)) {\n changes.push({from: from.line, to: to.line + 1});\n }\n else {\n if (!posEq(from, sel.from)) {\n if (from.line < oldFrom)\n changes.push({from: from.line, to: Math.min(to.line, oldFrom) + 1});\n else\n changes.push({from: oldFrom, to: Math.min(oldTo, from.line) + 1});\n }\n if (!posEq(to, sel.to)) {\n if (to.line < oldTo)\n changes.push({from: Math.max(oldFrom, from.line), to: oldTo + 1});\n else\n changes.push({from: Math.max(from.line, oldTo), to: to.line + 1});\n }\n }\n sel.from = from; sel.to = to;\n selectionChanged = true;\n }", "function setSelection(from, to, oldFrom, oldTo) {\n if (posEq(sel.from, from) && posEq(sel.to, to)) return;\n if (posLess(to, from)) {var tmp = to; to = from; from = tmp;}\n\n if (posEq(from, to)) sel.inverted = false;\n else if (posEq(from, sel.to)) sel.inverted = false;\n else if (posEq(to, sel.from)) sel.inverted = true;\n\n // Some ugly logic used to only mark the lines that actually did\n // see a change in selection as changed, rather than the whole\n // selected range.\n if (oldFrom == null) {oldFrom = sel.from.line; oldTo = sel.to.line;}\n if (posEq(from, to)) {\n if (!posEq(sel.from, sel.to))\n changes.push({from: oldFrom, to: oldTo + 1});\n }\n else if (posEq(sel.from, sel.to)) {\n changes.push({from: from.line, to: to.line + 1});\n }\n else {\n if (!posEq(from, sel.from)) {\n if (from.line < oldFrom)\n changes.push({from: from.line, to: Math.min(to.line, oldFrom) + 1});\n else\n changes.push({from: oldFrom, to: Math.min(oldTo, from.line) + 1});\n }\n if (!posEq(to, sel.to)) {\n if (to.line < oldTo)\n changes.push({from: Math.max(oldFrom, from.line), to: oldTo + 1});\n else\n changes.push({from: Math.max(from.line, oldTo), to: to.line + 1});\n }\n }\n sel.from = from; sel.to = to;\n selectionChanged = true;\n }", "function filterSelectionChange(doc, sel, options) {\n var obj = {\n ranges: sel.ranges,\n update: function(ranges) {\n this.ranges = [];\n for (var i = 0; i < ranges.length; i++)\n this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n clipPos(doc, ranges[i].head));\n },\n origin: options && options.origin\n };\n signal(doc, \"beforeSelectionChange\", doc, obj);\n if (doc.cm) signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj);\n if (obj.ranges != sel.ranges) return normalizeSelection(obj.ranges, obj.ranges.length - 1);\n else return sel;\n }", "click (event) {\n this.onSelectionChange([])\n }", "function ChangeSelectionWithoutContentLoad(event, tree, aSingleSelect) {\n var treeSelection = tree.view.selection;\n\n var row = tree.getRowAt(event.clientX, event.clientY);\n // Only do something if:\n // - the row is valid\n // - it's not already selected (or we want a single selection)\n if (row >= 0 && (aSingleSelect || !treeSelection.isSelected(row))) {\n // Check if the row is exactly the existing selection. In that case\n // there is no need to create a bogus selection.\n if (treeSelection.count == 1) {\n let minObj = {};\n treeSelection.getRangeAt(0, minObj, {});\n if (minObj.value == row) {\n event.stopPropagation();\n return;\n }\n }\n\n let transientSelection = new JSTreeSelection(tree);\n transientSelection.logAdjustSelectionForReplay();\n\n gRightMouseButtonSavedSelection = {\n // Need to clear out this reference later.\n view: tree.view,\n realSelection: treeSelection,\n transientSelection,\n };\n\n var saveCurrentIndex = treeSelection.currentIndex;\n\n // tell it to log calls to adjustSelection\n // attach it to the view\n tree.view.selection = transientSelection;\n // Don't generate any selection events! (we never set this to false, because\n // that would generate an event, and we never need one of those from this\n // selection object.\n transientSelection.selectEventsSuppressed = true;\n transientSelection.select(row);\n transientSelection.currentIndex = saveCurrentIndex;\n tree.ensureRowIsVisible(row);\n }\n event.stopPropagation();\n}", "selectionChangeHandler (event) {\n const target = this.activeElement;\n const handler = target && get(target, selectionChangeHandlerName);\n if (handler) { handler(event); }\n }", "_processInitialSelections() {\n if (this._selectionHandler && this._initialSelection) {\n var targets = DvtTreeUtils.getAllNodes(this._root);\n this._selectionHandler.processInitialSelections(this._initialSelection, targets);\n this._initialSelection = null;\n }\n }", "function filterSelectionChange(doc, sel, options) {\n var obj = {\n ranges: sel.ranges,\n update: function(ranges) {\n var this$1 = this;\n\n this.ranges = [];\n for (var i = 0; i < ranges.length; i++)\n { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n clipPos(doc, ranges[i].head)); }\n },\n origin: options && options.origin\n };\n signal(doc, \"beforeSelectionChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj); }\n if (obj.ranges != sel.ranges) { return normalizeSelection(doc.cm, obj.ranges, obj.ranges.length - 1) }\n else { return sel }\n }", "function filterSelectionChange(doc, sel, options) {\n var obj = {\n ranges: sel.ranges,\n update: function(ranges) {\n var this$1 = this;\n\n this.ranges = [];\n for (var i = 0; i < ranges.length; i++)\n { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n clipPos(doc, ranges[i].head)); }\n },\n origin: options && options.origin\n };\n signal(doc, \"beforeSelectionChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj); }\n if (obj.ranges != sel.ranges) { return normalizeSelection(doc.cm, obj.ranges, obj.ranges.length - 1) }\n else { return sel }\n }", "function filterSelectionChange(doc, sel, options) {\n var obj = {\n ranges: sel.ranges,\n update: function(ranges) {\n var this$1 = this;\n\n this.ranges = [];\n for (var i = 0; i < ranges.length; i++)\n { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n clipPos(doc, ranges[i].head)); }\n },\n origin: options && options.origin\n };\n signal(doc, \"beforeSelectionChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj); }\n if (obj.ranges != sel.ranges) { return normalizeSelection(doc.cm, obj.ranges, obj.ranges.length - 1) }\n else { return sel }\n }", "function filterSelectionChange(doc, sel, options) {\n var obj = {\n ranges: sel.ranges,\n update: function(ranges) {\n var this$1 = this;\n\n this.ranges = [];\n for (var i = 0; i < ranges.length; i++)\n { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n clipPos(doc, ranges[i].head)); }\n },\n origin: options && options.origin\n };\n signal(doc, \"beforeSelectionChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj); }\n if (obj.ranges != sel.ranges) { return normalizeSelection(doc.cm, obj.ranges, obj.ranges.length - 1) }\n else { return sel }\n }", "function filterSelectionChange(doc, sel, options) {\n var obj = {\n ranges: sel.ranges,\n update: function(ranges) {\n var this$1 = this;\n\n this.ranges = [];\n for (var i = 0; i < ranges.length; i++)\n { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n clipPos(doc, ranges[i].head)); }\n },\n origin: options && options.origin\n };\n signal(doc, \"beforeSelectionChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj); }\n if (obj.ranges != sel.ranges) { return normalizeSelection(doc.cm, obj.ranges, obj.ranges.length - 1) }\n else { return sel }\n }", "function filterSelectionChange(doc, sel, options) {\n var obj = {\n ranges: sel.ranges,\n update: function(ranges) {\n var this$1 = this;\n\n this.ranges = [];\n for (var i = 0; i < ranges.length; i++)\n { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n clipPos(doc, ranges[i].head)); }\n },\n origin: options && options.origin\n };\n signal(doc, \"beforeSelectionChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj); }\n if (obj.ranges != sel.ranges) { return normalizeSelection(doc.cm, obj.ranges, obj.ranges.length - 1) }\n else { return sel }\n }", "function filterSelectionChange(doc, sel, options) {\n var obj = {\n ranges: sel.ranges,\n update: function(ranges) {\n var this$1 = this;\n\n this.ranges = [];\n for (var i = 0; i < ranges.length; i++)\n { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n clipPos(doc, ranges[i].head)); }\n },\n origin: options && options.origin\n };\n signal(doc, \"beforeSelectionChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj); }\n if (obj.ranges != sel.ranges) { return normalizeSelection(doc.cm, obj.ranges, obj.ranges.length - 1) }\n else { return sel }\n }", "function filterSelectionChange(doc, sel, options) {\n var obj = {\n ranges: sel.ranges,\n update: function(ranges) {\n var this$1 = this;\n\n this.ranges = [];\n for (var i = 0; i < ranges.length; i++)\n { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n clipPos(doc, ranges[i].head)); }\n },\n origin: options && options.origin\n };\n signal(doc, \"beforeSelectionChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj); }\n if (obj.ranges != sel.ranges) { return normalizeSelection(doc.cm, obj.ranges, obj.ranges.length - 1) }\n else { return sel }\n }", "function filterSelectionChange(doc, sel, options) {\n var obj = {\n ranges: sel.ranges,\n update: function(ranges) {\n var this$1 = this;\n\n this.ranges = [];\n for (var i = 0; i < ranges.length; i++)\n { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n clipPos(doc, ranges[i].head)); }\n },\n origin: options && options.origin\n };\n signal(doc, \"beforeSelectionChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj); }\n if (obj.ranges != sel.ranges) { return normalizeSelection(doc.cm, obj.ranges, obj.ranges.length - 1) }\n else { return sel }\n }", "turnOnRecordSelectionChanges (e) {\n document.addEventListener('selectionchange', this.recordSelectionChange);\n }", "function fireSelectedEvent(){\n\t\t\tvar x1 = (selection.first.x <= selection.second.x) ? selection.first.x : selection.second.x;\n\t\t\tvar x2 = (selection.first.x <= selection.second.x) ? selection.second.x : selection.first.x;\n\t\t\tvar y1 = (selection.first.y >= selection.second.y) ? selection.first.y : selection.second.y;\n\t\t\tvar y2 = (selection.first.y >= selection.second.y) ? selection.second.y : selection.first.y;\n\t\t\t\n\t\t\tx1 = xaxis.min + x1 / hozScale;\n\t\t\tx2 = xaxis.min + x2 / hozScale;\n\t\t\ty1 = yaxis.max - y1 / vertScale;\n\t\t\ty2 = yaxis.max - y2 / vertScale;\n\n\t\t\ttarget.fire('flotr:select', [ { x1: x1, y1: y1, x2: x2, y2: y2 } ]);\n\t\t}", "selectedIndexChanged(prev, next) {\n super.selectedIndexChanged(prev, next);\n this.updateValue();\n }", "onDidChangeSelection(callback) {\n return this.emitter.on('did-change-path-selection', callback);\n }", "function handleSelectedItemChange(selectedItem,previousSelectedItem){selectedItemWatchers.forEach(function(watcher){watcher(selectedItem,previousSelectedItem);});}", "triggerSelectedEvent(selection){\n\t\tvar range, cfirange;\n\n\t\tif (selection && selection.rangeCount > 0) {\n\t\t\trange = selection.getRangeAt(0);\n\t\t\tif(!range.collapsed) {\n\t\t\t\t// cfirange = this.section.cfiFromRange(range);\n\t\t\t\tcfirange = new EpubCFI(range, this.cfiBase).toString();\n\t\t\t\tthis.emit(EVENTS.CONTENTS.SELECTED, cfirange);\n\t\t\t\tthis.emit(EVENTS.CONTENTS.SELECTED_RANGE, range);\n\t\t\t}\n\t\t}\n\t}", "function filterSelectionChange(doc, sel, options) {\n var obj = {\n ranges: sel.ranges,\n update: function(ranges) {\n var this$1 = this;\n\n this.ranges = []\n for (var i = 0; i < ranges.length; i++)\n { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n clipPos(doc, ranges[i].head)) }\n },\n origin: options && options.origin\n }\n signal(doc, \"beforeSelectionChange\", doc, obj)\n if (doc.cm) { signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj) }\n if (obj.ranges != sel.ranges) { return normalizeSelection(obj.ranges, obj.ranges.length - 1) }\n else { return sel }\n}", "function filterSelectionChange(doc, sel, options) {\n var obj = {\n ranges: sel.ranges,\n update: function(ranges) {\n var this$1 = this;\n\n this.ranges = []\n for (var i = 0; i < ranges.length; i++)\n { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n clipPos(doc, ranges[i].head)) }\n },\n origin: options && options.origin\n }\n signal(doc, \"beforeSelectionChange\", doc, obj)\n if (doc.cm) { signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj) }\n if (obj.ranges != sel.ranges) { return normalizeSelection(obj.ranges, obj.ranges.length - 1) }\n else { return sel }\n}", "onSelectionChange(e){\n\t\tif (this.selectionEndTimeout) {\n\t\t\tclearTimeout(this.selectionEndTimeout);\n\t\t}\n\t\tthis.selectionEndTimeout = setTimeout(function() {\n\t\t\tvar selection = this.window.getSelection();\n\t\t\tthis.triggerSelectedEvent(selection);\n\t\t}.bind(this), 250);\n\t}", "function filterSelectionChange(doc, sel, options) {\r\n var obj = {\r\n ranges: sel.ranges,\r\n update: function(ranges) {\r\n var this$1 = this;\r\n\r\n this.ranges = [];\r\n for (var i = 0; i < ranges.length; i++)\r\n { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\r\n clipPos(doc, ranges[i].head)); }\r\n },\r\n origin: options && options.origin\r\n };\r\n signal(doc, \"beforeSelectionChange\", doc, obj);\r\n if (doc.cm) { signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj); }\r\n if (obj.ranges != sel.ranges) { return normalizeSelection(obj.ranges, obj.ranges.length - 1) }\r\n else { return sel }\r\n}", "function filterSelectionChange(doc, sel, options) {\n var obj = {\n ranges: sel.ranges,\n update: function(ranges) {\n var this$1 = this;\n\n this.ranges = [];\n for (var i = 0; i < ranges.length; i++)\n { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n clipPos(doc, ranges[i].head)); }\n },\n origin: options && options.origin\n };\n signal(doc, \"beforeSelectionChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj); }\n if (obj.ranges != sel.ranges) { return normalizeSelection(obj.ranges, obj.ranges.length - 1) }\n else { return sel }\n}", "function filterSelectionChange(doc, sel, options) {\n var obj = {\n ranges: sel.ranges,\n update: function(ranges) {\n var this$1 = this;\n\n this.ranges = [];\n for (var i = 0; i < ranges.length; i++)\n { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n clipPos(doc, ranges[i].head)); }\n },\n origin: options && options.origin\n };\n signal(doc, \"beforeSelectionChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj); }\n if (obj.ranges != sel.ranges) { return normalizeSelection(obj.ranges, obj.ranges.length - 1) }\n else { return sel }\n}", "function filterSelectionChange(doc, sel, options) {\n var obj = {\n ranges: sel.ranges,\n update: function(ranges) {\n var this$1 = this;\n\n this.ranges = [];\n for (var i = 0; i < ranges.length; i++)\n { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n clipPos(doc, ranges[i].head)); }\n },\n origin: options && options.origin\n };\n signal(doc, \"beforeSelectionChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj); }\n if (obj.ranges != sel.ranges) { return normalizeSelection(obj.ranges, obj.ranges.length - 1) }\n else { return sel }\n}", "function filterSelectionChange(doc, sel, options) {\n var obj = {\n ranges: sel.ranges,\n update: function(ranges) {\n var this$1 = this;\n\n this.ranges = [];\n for (var i = 0; i < ranges.length; i++)\n { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n clipPos(doc, ranges[i].head)); }\n },\n origin: options && options.origin\n };\n signal(doc, \"beforeSelectionChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj); }\n if (obj.ranges != sel.ranges) { return normalizeSelection(obj.ranges, obj.ranges.length - 1) }\n else { return sel }\n}", "function filterSelectionChange(doc, sel, options) {\n var obj = {\n ranges: sel.ranges,\n update: function(ranges) {\n var this$1 = this;\n\n this.ranges = [];\n for (var i = 0; i < ranges.length; i++)\n { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n clipPos(doc, ranges[i].head)); }\n },\n origin: options && options.origin\n };\n signal(doc, \"beforeSelectionChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj); }\n if (obj.ranges != sel.ranges) { return normalizeSelection(obj.ranges, obj.ranges.length - 1) }\n else { return sel }\n}", "function filterSelectionChange(doc, sel, options) {\n var obj = {\n ranges: sel.ranges,\n update: function(ranges) {\n var this$1 = this;\n\n this.ranges = [];\n for (var i = 0; i < ranges.length; i++)\n { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n clipPos(doc, ranges[i].head)); }\n },\n origin: options && options.origin\n };\n signal(doc, \"beforeSelectionChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj); }\n if (obj.ranges != sel.ranges) { return normalizeSelection(obj.ranges, obj.ranges.length - 1) }\n else { return sel }\n}", "function filterSelectionChange(doc, sel, options) {\n var obj = {\n ranges: sel.ranges,\n update: function(ranges) {\n var this$1 = this;\n\n this.ranges = [];\n for (var i = 0; i < ranges.length; i++)\n { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n clipPos(doc, ranges[i].head)); }\n },\n origin: options && options.origin\n };\n signal(doc, \"beforeSelectionChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj); }\n if (obj.ranges != sel.ranges) { return normalizeSelection(obj.ranges, obj.ranges.length - 1) }\n else { return sel }\n}", "function filterSelectionChange(doc, sel, options) {\n var obj = {\n ranges: sel.ranges,\n update: function(ranges) {\n var this$1 = this;\n\n this.ranges = [];\n for (var i = 0; i < ranges.length; i++)\n { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n clipPos(doc, ranges[i].head)); }\n },\n origin: options && options.origin\n };\n signal(doc, \"beforeSelectionChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj); }\n if (obj.ranges != sel.ranges) { return normalizeSelection(obj.ranges, obj.ranges.length - 1) }\n else { return sel }\n}", "function filterSelectionChange(doc, sel, options) {\n var obj = {\n ranges: sel.ranges,\n update: function(ranges) {\n var this$1 = this;\n\n this.ranges = [];\n for (var i = 0; i < ranges.length; i++)\n { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n clipPos(doc, ranges[i].head)); }\n },\n origin: options && options.origin\n };\n signal(doc, \"beforeSelectionChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj); }\n if (obj.ranges != sel.ranges) { return normalizeSelection(obj.ranges, obj.ranges.length - 1) }\n else { return sel }\n}", "function filterSelectionChange(doc, sel, options) {\n var obj = {\n ranges: sel.ranges,\n update: function(ranges) {\n var this$1 = this;\n\n this.ranges = [];\n for (var i = 0; i < ranges.length; i++)\n { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n clipPos(doc, ranges[i].head)); }\n },\n origin: options && options.origin\n };\n signal(doc, \"beforeSelectionChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj); }\n if (obj.ranges != sel.ranges) { return normalizeSelection(obj.ranges, obj.ranges.length - 1) }\n else { return sel }\n}", "function filterSelectionChange(doc, sel, options) {\n var obj = {\n ranges: sel.ranges,\n update: function(ranges) {\n var this$1 = this;\n\n this.ranges = [];\n for (var i = 0; i < ranges.length; i++)\n { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n clipPos(doc, ranges[i].head)); }\n },\n origin: options && options.origin\n };\n signal(doc, \"beforeSelectionChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj); }\n if (obj.ranges != sel.ranges) { return normalizeSelection(obj.ranges, obj.ranges.length - 1) }\n else { return sel }\n}", "setInitialSelection() {\n var handler = this.chart.getSelectionHandler();\n if (!handler) return;\n\n var selected = DvtChartDataUtils.getInitialSelection(this.chart);\n var selectedIds = [];\n for (var i = 0; i < selected.length; i++) {\n for (var j = 0; j < this._slices.length; j++) {\n var peerId = this._slices[j].getId();\n if (\n peerId != null &&\n ((selected[i]['id'] != null && peerId.id == selected[i]['id']) ||\n (peerId.series == selected[i]['series'] && peerId.group == selected[i]['group']))\n ) {\n selectedIds.push(peerId);\n continue;\n }\n }\n }\n\n // Add other slice to the list if all series in the \"other\" slice is selected\n if (DvtChartPieUtils.isOtherSliceSelected(this.chart, selected)) {\n var otherPeerId = DvtChartPieUtils.getOtherSliceId(this.chart);\n selectedIds.push(otherPeerId);\n }\n\n handler.processInitialSelections(selectedIds, this._slices);\n }", "_selectStartHandler(event) {\n const that = this;\n\n if (that._reordering || that._resizing) {\n event.preventDefault();\n }\n }", "function OnGenChanged(gen) {\n selectionsGenerations = gen;\n OnFilterCriteriaChanged();\n}", "function selectionChangedHandler() {\n var flex = $scope.ctx.flex;\n var current = flex.collectionView ? flex.collectionView.currentItem : null;\n if (current != null) {\n // $scope.selectedCostCenterId = current.costCenterId;\n $scope.selectedStructureElementId = current.structureElementId;\n $scope.selectedDate = current.date;\n $scope.selectedBudgetCycleId = current.budgetCycleId;\n $scope.selectedDataEntryProfileId = current.dataEntryProfileId;\n $scope.selectedUserId = current.userId;\n } else {\n //$scope.selectedCostCenterId = 0;\n $scope.selectedStructureElementId = 0;\n $scope.selectedDate = \"\";\n $scope.selectedBudgetCycleId = 0;\n $scope.selectedDataEntryProfileId = 0;\n $scope.selectedUserId = 0;\n }\n manageActions();\n }", "function onSelectedChange() {\n if (onSelectedChange.queued) return;\n onSelectedChange.queued = true;\n\n $scope.$evalAsync(function() {\n $scope.$broadcast(EVENT.TABS_CHANGED, selected);\n onSelectedChange.queued = false;\n });\n }", "_dispatchSelectionChange(isUserInput = false) {\n this.selectionChange.emit({\n source: this,\n isUserInput,\n selected: this.selected\n });\n }", "function handleSelectionChange(event) {\n var selection = document.getSelection();\n if (selection.isCollapsed) {\n if (selectionLink) {\n selectionLink.parentNode.removeChild(selectionLink);\n selectionLink = null;\n }\n } else {\n var range = selection.getRangeAt(0);\n if (\n !currentRange ||\n range.compareBoundaryPoints(Range.START_TO_START, currentRange) !== 0 ||\n range.compareBoundaryPoints(Range.END_TO_END, currentRange) !== 0\n ) {\n currentRange = range;\n currentEncodedRange = encodeRange(currentRange);\n renderCurrentRange();\n }\n }\n}", "function onSelectionChanged(event) {\n\t\t\t\t\t\n\t\t\t\t\t// Don't trigger foundset selection if table is grouping\n\t\t\t\t\tif (isTableGrouped()) {\n\t\t\t\t\t\t\n // Trigger event on selection change in grouo mode\n if ($scope.handlers.onSelectedRowsChanged) {\n $scope.handlers.onSelectedRowsChanged();\n }\n\t\t\t\t\t\t\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t// set to true once the grid is ready and selection is set\n\t\t\t\t isSelectionReady = true;\n\t\t\t\t\n\t\t\t\t\tif(scrollToSelectionWhenSelectionReady) {\n\t\t\t\t\t\t$scope.api.scrollToSelection();\n\t\t\t\t\t}\n\n\t\t\t\t\t// rows are rendered, if there was an editCell request, now it is the time to apply it\n\t\t\t\t\tif(startEditFoundsetIndex > -1 && startEditColumnIndex > -1) {\n\t\t\t\t\t\tsetTimeout(function() {\n\t\t\t\t\t\t\t$scope.api.editCellAt(startEditFoundsetIndex, startEditColumnIndex);\n\t\t\t\t\t\t}, 200);\n\t\t\t\t\t}\n\n\t\t\t\t // when the grid is not ready yet set the value to the column index for which has been requested focus\n\t\t\t\t if (requestFocusColumnIndex > -1) {\n\t\t\t\t \t$scope.api.requestFocus(requestFocusColumnIndex);\n\t\t\t\t }\n\n\t\t\t\t\tvar selectedNodes = gridOptions.api.getSelectedNodes();\n\t\t\t\t\tif (selectedNodes.length > 0) {\n\t\t\t\t\t\tvar foundsetIndexes = new Array();\n\n\t\t\t\t\t\tfor(var i = 0; i < selectedNodes.length; i++) {\n\t\t\t\t\t\t\tvar node = selectedNodes[i];\n\t\t\t\t\t\t\tif(node) foundsetIndexes.push(node.rowIndex);\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(foundsetIndexes.length > 0) {\n\t\t\t\t\t\t\tfoundsetIndexes.sort(function(a, b){return a - b});\n\t\t\t\t\t\t\t// if single select don't send the old selection along with the new one, to the server\n\t\t\t\t\t\t\tif(!foundset.foundset.multiSelect && foundsetIndexes.length > 1 &&\n\t\t\t\t\t\t\t\tfoundset.foundset.selectedRowIndexes.length > 0) {\n\t\t\t\t\t\t\t\t\tif(foundset.foundset.selectedRowIndexes[0] == foundsetIndexes[0]) {\n\t\t\t\t\t\t\t\t\t\tfoundsetIndexes = foundsetIndexes.slice(-1);\n\t\t\t\t\t\t\t\t\t} else if(foundset.foundset.selectedRowIndexes[0] == foundsetIndexes[foundsetIndexes.length - 1]) {\n\t\t\t\t\t\t\t\t\t\tfoundsetIndexes = foundsetIndexes.slice(0, 1);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfoundset.foundset.requestSelectionUpdate(foundsetIndexes).then(\n\t\t\t\t\t\t\t\tfunction(serverRows){\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t // Trigger event on selection change\n\t\t\t\t if ($scope.handlers.onSelectedRowsChanged) {\n\t\t\t\t $scope.handlers.onSelectedRowsChanged();\n\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t//success\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tfunction(serverRows){\n\t\t\t\t\t\t\t\t\t//canceled \n\t\t\t\t\t\t\t\t\tif (typeof serverRows === 'string'){\n\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t//reject\n\t\t\t\t\t\t\t\t\tselectedRowIndexesChanged();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t\t$log.debug(\"table must always have a selected record\");\n\t\t\t\t\tselectedRowIndexesChanged();\n\n\t\t\t\t}", "_selectStartHandler(event) {\n const that = this;\n\n if (that.isScrolling || that.editing.isEditing) {\n return;\n }\n\n event.preventDefault();\n }", "_selectStartHandler(event) {\n const that = this;\n\n if (that.isScrolling || that.editing.isEditing) {\n return;\n }\n\n event.preventDefault();\n }", "function beforeselectHandler(sm, node, oldNode) {\n if (node === oldNode) {\n return false;\n }\n if ( Ext.getCmp('processForm').getForm().isDirty() ) {\n // the user made changes to the form make sure that they don't care\n // about losing those changes\n Zenoss.env.node = node;\n Ext.getCmp('dirtyDialog').show();\n return false;\n }\n return true;\n}", "function optionChanged (newSelection) {\n buildCharts(newSelection);\n buildMetadata(newSelection);\n}", "selectedIndexChanged(prev, next) {\n var _a;\n\n if (!this.hasSelectableOptions) {\n this.selectedIndex = -1;\n return;\n }\n\n if (((_a = this.options[this.selectedIndex]) === null || _a === void 0 ? void 0 : _a.disabled) && typeof prev === \"number\") {\n const selectableIndex = this.getSelectableIndex(prev, next);\n const newNext = selectableIndex > -1 ? selectableIndex : prev;\n this.selectedIndex = newNext;\n\n if (next === newNext) {\n this.selectedIndexChanged(next, newNext);\n }\n\n return;\n }\n\n this.setSelectedOptions();\n }", "function selectionChangedHandler() {\n var flex = $scope.ctx.flex;\n var current = flex.collectionView ? flex.collectionView.currentItem : null;\n if (current != null) {\n $scope.selectedTaskId = current.taskId;\n $scope.selectedUserName = current.userName;\n } else {\n $scope.selectedTaskId = -1;\n $scope.selectedUserName = \"\";\n }\n manageActions();\n }", "get newSelection() {\n return this.selection || this.startState.selection.map(this.changes);\n }", "updateSelectLocalEvent() {\n this.updateSelectLocal(this.menuView.loadView.existingSceneSelect);\n this.updateSelectLocal(this.menuView.saveView.existingSceneSelect);\n }", "getUpdatedSelection(){super.getUpdatedSelection();if(this.__breadcrumbs)this.__breadcrumbs.selection=this.selection}", "function onBeforeSelection(et, selecteElm, e){\r\n\t\t\t\tvar row = et.defaultSelection != 'row' ? selecteElm.parentNode : selecteElm;\r\n\t\t\t\tif(o.paging){\r\n\t\t\t\t\tif(o.nbPages>1){\r\n\t\t\t\t\t\tet.nbRowsPerPage = o.pagingLength; //page length is re-assigned in case it has changed\r\n\t\t\t\t\t\tvar pagingEndRow = parseInt(o.startPagingRow) + parseInt(o.pagingLength);\r\n\t\t\t\t\t\tvar rowIndex = row.rowIndex;\r\n\t\t\t\t\t\tif((rowIndex == o.validRowsIndex[o.validRowsIndex.length-1]) && o.currentPageNb!=o.nbPages) o.SetPage('last');\r\n\t\t\t\t\t\telse if((rowIndex == o.validRowsIndex[0]) && o.currentPageNb!=1) o.SetPage('first');\r\n\t\t\t\t\t\telse if(rowIndex > o.validRowsIndex[pagingEndRow-1] && rowIndex < o.validRowsIndex[o.validRowsIndex.length-1]) o.SetPage('next');\r\n\t\t\t\t\t\telse if(rowIndex < o.validRowsIndex[o.startPagingRow] && rowIndex > o.validRowsIndex[0]) o.SetPage('previous');\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}" ]
[ "0.7436134", "0.7436134", "0.7436134", "0.7436134", "0.7315609", "0.7315609", "0.64987767", "0.6486742", "0.64495426", "0.64479816", "0.6396452", "0.6395277", "0.6395277", "0.6395277", "0.6390618", "0.6350694", "0.63113916", "0.6283778", "0.6238949", "0.6238949", "0.61821294", "0.61214834", "0.61214834", "0.61214834", "0.61188114", "0.6112964", "0.6092425", "0.60868037", "0.6079741", "0.6072998", "0.6042602", "0.6042602", "0.6042602", "0.6042602", "0.6042602", "0.6042602", "0.6042602", "0.5992564", "0.5992564", "0.5992564", "0.5952798", "0.59494793", "0.5938451", "0.5935094", "0.59255683", "0.5919608", "0.5919608", "0.5919608", "0.5919608", "0.5919608", "0.5919608", "0.5919608", "0.5919608", "0.5919608", "0.588779", "0.58875453", "0.58718926", "0.5864995", "0.5857675", "0.58433765", "0.583065", "0.583065", "0.5826061", "0.58229876", "0.5815518", "0.5815518", "0.5815518", "0.5815518", "0.5815518", "0.5815518", "0.5815518", "0.5815518", "0.5815518", "0.5815518", "0.5815518", "0.58040774", "0.5783872", "0.57699674", "0.5737926", "0.5736582", "0.57294524", "0.57126987", "0.56947434", "0.56877625", "0.56877625", "0.5684657", "0.56845284", "0.5684282", "0.5663074", "0.5651249", "0.56459093", "0.5643444", "0.5635988" ]
0.5942009
49
Set a new selection.
function setSelection(doc, sel, options) { setSelectionNoUndo(doc, sel, options); addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setSelection(doc, sel, options) {\n\t\t setSelectionNoUndo(doc, sel, options);\n\t\t addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);\n\t\t }", "function setSelection(doc, sel, options) {\n\t\t setSelectionNoUndo(doc, sel, options);\n\t\t addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);\n\t\t }", "function setSelection(doc, sel, options) {\n\t setSelectionNoUndo(doc, sel, options);\n\t addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);\n\t }", "function setSelection(doc, sel, options) {\n\t setSelectionNoUndo(doc, sel, options);\n\t addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);\n\t }", "function setSelection(doc, sel, options) {\n\t setSelectionNoUndo(doc, sel, options);\n\t addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);\n\t }", "setSelection(selection) {\n if (selection.$from.doc != this.doc)\n throw new RangeError(\"Selection passed to setSelection must point at the current document\");\n this.curSelection = selection;\n this.curSelectionFor = this.steps.length;\n this.updated = (this.updated | UPDATED_SEL) & ~UPDATED_MARKS;\n this.storedMarks = null;\n return this;\n }", "function setSelection(doc, sel, options) {\n setSelectionNoUndo(doc, sel, options)\n addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options)\n}", "function setSelection(doc, sel, options) {\n setSelectionNoUndo(doc, sel, options)\n addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options)\n}", "function setSelection(doc, sel, options) {\r\n setSelectionNoUndo(doc, sel, options);\r\n addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);\r\n }", "function setSelection(doc, sel, options) {\n setSelectionNoUndo(doc, sel, options);\n addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);\n}", "function setSelection(doc, sel, options) {\n setSelectionNoUndo(doc, sel, options);\n addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);\n}", "function setSelection(doc, sel, options) {\n setSelectionNoUndo(doc, sel, options);\n addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);\n}", "function setSelection(doc, sel, options) {\n setSelectionNoUndo(doc, sel, options);\n addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);\n}", "function setSelection(doc, sel, options) {\n setSelectionNoUndo(doc, sel, options);\n addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);\n}", "function setSelection(doc, sel, options) {\n setSelectionNoUndo(doc, sel, options);\n addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);\n}", "function setSelection(doc, sel, options) {\n setSelectionNoUndo(doc, sel, options);\n addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);\n}", "function setSelection(doc, sel, options) {\n setSelectionNoUndo(doc, sel, options);\n addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);\n}", "function setSelection(doc, sel, options) {\n setSelectionNoUndo(doc, sel, options);\n addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);\n}", "function setSelection(doc, sel, options) {\n setSelectionNoUndo(doc, sel, options);\n addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);\n}", "function setSelection(doc, sel, options) {\n setSelectionNoUndo(doc, sel, options);\n addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);\n}", "function setSelection(doc, sel, options) {\r\n setSelectionNoUndo(doc, sel, options);\r\n addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);\r\n}", "function make_selection()\n{\n\t$(\"#mysel\").val(3);\n}", "function setElementSelection(that, start, end) {\n if (that.selectionStart === undefined) {\n that.focus();\n var r = that.createTextRange();\n r.collapse(true);\n r.moveEnd('character', end);\n r.moveStart('character', start);\n r.select();\n } else {\n that.selectionStart = start;\n that.selectionEnd = end;\n }\n }", "function setElementSelection(that, start, end) {\n if (that.selectionStart === undefined) {\n that.focus();\n var r = that.createTextRange();\n r.collapse(true);\n r.moveEnd('character', end);\n r.moveStart('character', start);\n r.select();\n } else {\n that.selectionStart = start;\n that.selectionEnd = end;\n }\n }", "function setElementSelection(that, start, end) {\n if (that.selectionStart === undefined) {\n that.focus();\n var r = that.createTextRange();\n r.collapse(true);\n r.moveEnd('character', end);\n r.moveStart('character', start);\n r.select();\n } else {\n that.selectionStart = start;\n that.selectionEnd = end;\n }\n }", "updateSelection(value, source) {\n this.selection = value;\n this._selectionChanged.next({ selection: value, source });\n }", "updateSelection(value, source) {\n this.selection = value;\n this._selectionChanged.next({ selection: value, source });\n }", "function selectionSet(addCommand, thirdParam) {\n var range,\n sel = selectionGet();\n\n // for webkit, mozilla, opera\n if (window.getSelection) {\n if (sel.anchorNode && sel.getRangeAt)\n range = sel.getRangeAt(0);\n\n if (range) {\n sel.removeAllRanges();\n sel.addRange(range);\n }\n\n\n document.execCommand(addCommand, false, thirdParam);\n }\n\n // for ie\n else if (document.selection && document.selection.createRange && document.selection.type != \"None\") {\n range = document.selection.createRange();\n range.execCommand(addCommand, false, thirdParam);\n }\n\n // change styles to around tags\n affectStyleAround(false, false);\n }", "function setSelection(area){\n\t\t\tclearSelection();\n\t\t\t\t\t\t\n\t\t\tselection.first.y = (options.selection.mode == \"x\") ? 0 : (yaxis.max - area.y1) * vertScale;\n\t\t\tselection.second.y = (options.selection.mode == \"x\") ? plotHeight : (yaxis.max - area.y2) * vertScale;\t\t\t\n\t\t\tselection.first.x = (options.selection.mode == \"y\") ? 0 : (area.x1 - xaxis.min) * hozScale;\n\t\t\tselection.second.x = (options.selection.mode == \"y\") ? plotWidth : (area.x2 - xaxis.min) * hozScale;\n\t\t\t\n\t\t\tdrawSelection();\n\t\t\tfireSelectedEvent();\n\t\t}", "select(editor, target) {\n var {\n selection\n } = editor;\n target = Editor.range(editor, target);\n\n if (selection) {\n Transforms.setSelection(editor, target);\n return;\n }\n\n if (!Range.isRange(target)) {\n throw new Error(\"When setting the selection and the current selection is `null` you must provide at least an `anchor` and `focus`, but you passed: \".concat(JSON.stringify(target)));\n }\n\n editor.apply({\n type: 'set_selection',\n properties: selection,\n newProperties: target\n });\n }", "select(editor, target) {\n var {\n selection\n } = editor;\n target = Editor.range(editor, target);\n\n if (selection) {\n Transforms.setSelection(editor, target);\n return;\n }\n\n if (!Range.isRange(target)) {\n throw new Error(\"When setting the selection and the current selection is `null` you must provide at least an `anchor` and `focus`, but you passed: \".concat(JSON.stringify(target)));\n }\n\n editor.apply({\n type: 'set_selection',\n properties: selection,\n newProperties: target\n });\n }", "select() { this.selected = true; }", "function setSelection() {\n var bbox = $('#bounding-box');\n \n optimalApp.selectionWidth = bbox.width();\n optimalApp.selectionHeight = bbox.height();\n \n optimalApp.selectionBaseWidth = bbox.width();\n optimalApp.selectionBaseHeight = bbox.height();\n \n optimalApp.selectionPosition[0] = bbox.position().left;\n optimalApp.selectionPosition[1] = bbox.position().top;\n \n optimalApp.selectionBasePosition[0] = bbox.position().left;\n optimalApp.selectionBasePosition[1] = bbox.position().top;\n \n optimalApp.selectionOffset[0] = event.offsetX;\n optimalApp.selectionOffset[1] = event.offsetY;\n \n optimalApp.selectionOrigin[0] = event.pageX;\n optimalApp.selectionOrigin[1] = event.pageY;\n \n optimalApp.selectionRotation = 0;\n // since the box is redrawn after being rotated, it should start vertically aligned\n \n optimalApp.resizingFrom = event.target.id;\n}", "function setSelection(){\r\n\t\t\tif (opts.idField){\r\n\t\t\t\tfor(var i=0; i<data.rows.length; i++){\r\n\t\t\t\t\tvar row = data.rows[i];\r\n\t\t\t\t\tif (contains(state.selectedRows, row)){\r\n\t\t\t\t\t\topts.finder.getTr(target, i).addClass('datagrid-row-selected');\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (contains(state.checkedRows, row)){\r\n\t\t\t\t\t\topts.finder.getTr(target, i).find('div.datagrid-cell-check input[type=checkbox]')._propAttr('checked', true);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tfunction contains(a,r){\r\n\t\t\t\tfor(var i=0; i<a.length; i++){\r\n\t\t\t\t\tif (a[i][opts.idField] == r[opts.idField]){\r\n\t\t\t\t\t\ta[i] = r;\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}", "select () {\n this.selected = true;\n }", "resetSelection () {\n this.currentSelection = null\n }", "function updateSelection(){\n\t\t\tif(lastMousePos.pageX == null) return;\n\t\t\t\n\t\t\tsetSelectionPos(selection.second, lastMousePos);\n\t\t\tclearSelection();\n\t\t\t\n\t\t\tif(selectionIsSane()) drawSelection();\n\t\t}", "function SelectionChange() {}", "function SelectionChange() {}", "function SelectionChange() {}", "function SelectionChange() {}", "_resetSelection() {\n this.__selectedRangeArr = [];\n this.__anchorSelectionIndex = -1;\n this.__leadSelectionIndex = -1;\n }", "function setSimpleSelection(doc, anchor, head, options) {\n\t\t setSelection(doc, simpleSelection(anchor, head), options);\n\t\t }", "function setSimpleSelection(doc, anchor, head, options) {\n\t\t setSelection(doc, simpleSelection(anchor, head), options);\n\t\t }", "function setSimpleSelection(doc, anchor, head, options) {\n\t setSelection(doc, simpleSelection(anchor, head), options);\n\t }", "function setSimpleSelection(doc, anchor, head, options) {\n\t setSelection(doc, simpleSelection(anchor, head), options);\n\t }", "function setSimpleSelection(doc, anchor, head, options) {\n\t setSelection(doc, simpleSelection(anchor, head), options);\n\t }", "function setSelection(context, layers) {\n context.document.currentPage().changeSelectionBySelectingLayers(null);\n layers.forEach(function (l) {\n return l.select_byExpandingSelection_(true, true);\n });\n}", "set selectedItem(aItem) {\n // A predicate is allowed to select a specific item.\n // If no item is matched, then the current selection is removed.\n if (typeof aItem == \"function\") {\n aItem = this.getItemForPredicate(aItem);\n }\n\n // A falsy item is allowed to invalidate the current selection.\n let targetElement = aItem ? aItem._target : null;\n let prevElement = this._widget.selectedItem;\n\n // Make sure the selected item's target element is focused and visible.\n if (this.autoFocusOnSelection && targetElement) {\n targetElement.focus();\n }\n if (this.maintainSelectionVisible && targetElement) {\n // Some methods are optional. See the WidgetMethods object documentation\n // for a comprehensive list.\n if (\"ensureElementIsVisible\" in this._widget) {\n this._widget.ensureElementIsVisible(targetElement);\n }\n }\n\n // Prevent selecting the same item again and avoid dispatching\n // a redundant selection event, so return early.\n if (targetElement != prevElement) {\n this._widget.selectedItem = targetElement;\n let dispTarget = targetElement || prevElement;\n let dispName = this.suppressSelectionEvents ? \"suppressed-select\" : \"select\";\n ViewHelpers.dispatchEvent(dispTarget, dispName, aItem);\n }\n }", "function setSelectMode(paramDocument, paramLine, paramColumn) {\r\n\tif ( !isSelectMode ) {\r\n\t\tif (paramLine == null) paramLine = cursorLine;\r\n\t\tif (paramColumn == null) paramColumn = cursorColumn;\r\n\t\t// kinda hackish\r\n\t\tvar returnValue = paramDocument.setCurrentSelection( paramLine, paramColumn, paramLine, paramColumn );\r\n\t\tif ( returnValue ) isSelectMode = true;\r\n\t}\r\n\telse return false;\r\n}", "function setSimpleSelection(doc, anchor, head, options) {\n setSelection(doc, simpleSelection(anchor, head), options)\n}", "function setSimpleSelection(doc, anchor, head, options) {\n setSelection(doc, simpleSelection(anchor, head), options)\n}", "select(column, row, length) {\n this._selectionService.setSelection(column, row, length);\n }", "set selected(value) {\n this._selected = value;\n this._selectedTimestamp = value ? new Date() : undefined;\n }", "function setSimpleSelection(doc, anchor, head, options) {\n setSelection(doc, simpleSelection(anchor, head), options);\n }", "function setSimpleSelection(doc, anchor, head, options) {\n setSelection(doc, simpleSelection(anchor, head), options);\n }", "function setSimpleSelection(doc, anchor, head, options) {\n setSelection(doc, simpleSelection(anchor, head), options);\n }", "function setSimpleSelection(doc, anchor, head, options) {\n setSelection(doc, simpleSelection(anchor, head), options);\n }", "function setSimpleSelection(doc, anchor, head, options) {\n setSelection(doc, simpleSelection(anchor, head), options);\n }", "function setSimpleSelection(doc, anchor, head, options) {\n setSelection(doc, simpleSelection(anchor, head), options);\n }", "function setSimpleSelection(doc, anchor, head, options) {\n setSelection(doc, simpleSelection(anchor, head), options);\n }", "function setSimpleSelection(doc, anchor, head, options) {\n setSelection(doc, simpleSelection(anchor, head), options);\n }", "function setSimpleSelection(doc, anchor, head, options) {\n setSelection(doc, simpleSelection(anchor, head), options);\n }", "function setSimpleSelection(doc, anchor, head, options) {\n setSelection(doc, simpleSelection(anchor, head), options);\n }", "function setSimpleSelection(doc, anchor, head, options) {\n setSelection(doc, simpleSelection(anchor, head), options);\n }", "function setSimpleSelection(doc, anchor, head, options) {\n setSelection(doc, simpleSelection(anchor, head), options);\n }", "function setSimpleSelection(doc, anchor, head, options) {\n setSelection(doc, simpleSelection(anchor, head), options);\n }", "function setSimpleSelection(doc, anchor, head, options) {\n setSelection(doc, simpleSelection(anchor, head), options);\n }", "function setSimpleSelection(doc, anchor, head, options) {\n setSelection(doc, simpleSelection(anchor, head), options);\n }", "function setSimpleSelection(doc, anchor, head, options) {\n setSelection(doc, simpleSelection(anchor, head), options);\n }", "function setSimpleSelection(doc, anchor, head, options) {\n setSelection(doc, simpleSelection(anchor, head), options);\n }", "function setSimpleSelection(doc, anchor, head, options) {\n setSelection(doc, simpleSelection(anchor, head), options);\n }", "function setSimpleSelection(doc, anchor, head, options) {\n setSelection(doc, simpleSelection(anchor, head), options);\n }", "function setSimpleSelection(doc, anchor, head, options) {\n setSelection(doc, simpleSelection(anchor, head), options);\n }", "function setSimpleSelection(doc, anchor, head, options) {\n setSelection(doc, simpleSelection(anchor, head), options);\n }", "function setSimpleSelection(doc, anchor, head, options) {\n setSelection(doc, simpleSelection(anchor, head), options);\n }" ]
[ "0.7453179", "0.7453179", "0.7395772", "0.7395772", "0.7395772", "0.7356902", "0.72738075", "0.72738075", "0.7272042", "0.724487", "0.724487", "0.724487", "0.724487", "0.724487", "0.724487", "0.724487", "0.724487", "0.724487", "0.724487", "0.724487", "0.7192502", "0.69129366", "0.6765945", "0.6765945", "0.6765945", "0.6702792", "0.6702792", "0.66895086", "0.664989", "0.6588489", "0.6588489", "0.65212125", "0.64910513", "0.64395", "0.63998514", "0.6395944", "0.63865906", "0.6384985", "0.6384985", "0.6384985", "0.6384985", "0.63340914", "0.6334083", "0.6334083", "0.6306919", "0.6306919", "0.6306919", "0.6305579", "0.630285", "0.6301989", "0.62968934", "0.62968934", "0.62692946", "0.6262723", "0.6241788", "0.6241788", "0.6241788", "0.6241788", "0.6241788", "0.6241788", "0.6241788", "0.6241788", "0.6241788", "0.6241788", "0.6241788", "0.6241788", "0.6241788", "0.6241788", "0.6241788", "0.6241788", "0.6241788", "0.6241788", "0.6241788", "0.6241788", "0.6241788", "0.6241788" ]
0.7300484
24
Verify that the selection does not partially select any atomic marked ranges.
function reCheckSelection(doc) { setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get hasSelection() {\n const start = this._model.finalSelectionStart;\n const end = this._model.finalSelectionEnd;\n if (!start || !end) {\n return false;\n }\n return start[0] !== end[0] || start[1] !== end[1];\n }", "function selectionIsSane() {\n\t\t\tvar minSize = 5;\n\t\t\treturn Math.abs(selection.second.x - selection.first.x) >= minSize &&\n\t\t\t\tMath.abs(selection.second.y - selection.first.y) >= minSize;\n\t\t}", "function isValidSelection(containerNode, range){\n if(range.getNodes().length !== 0\n && range.getNodes()[0].compareDocumentPosition(containerNode) === 10\n && (range.toCharacterRange().end - range.toCharacterRange().start) >= 5\n ){\n return true;\n }\n return false;\n }", "function isSelectionSpanAllowed(span) {\n\t\treturn isSpanAllowed(span, t.options.selectConstraint, t.options.selectOverlap);\n\t}", "function isSelectionSpanAllowed(span) {\n\t\treturn isSpanAllowed(span, options.selectConstraint, options.selectOverlap);\n\t}", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) out = sel.ranges.slice(0, i);\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel;\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) out = sel.ranges.slice(0, i);\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel;\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) out = sel.ranges.slice(0, i);\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel;\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) out = sel.ranges.slice(0, i);\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel;\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) out = sel.ranges.slice(0, i);\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel;\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) out = sel.ranges.slice(0, i);\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel;\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) out = sel.ranges.slice(0, i);\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel;\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\r\n var out;\r\n for (var i = 0; i < sel.ranges.length; i++) {\r\n var range = sel.ranges[i];\r\n var newAnchor = skipAtomic(doc, range.anchor, bias, mayClear);\r\n var newHead = skipAtomic(doc, range.head, bias, mayClear);\r\n if (out || newAnchor != range.anchor || newHead != range.head) {\r\n if (!out) out = sel.ranges.slice(0, i);\r\n out[i] = new Range(newAnchor, newHead);\r\n }\r\n }\r\n return out ? normalizeSelection(out, sel.primIndex) : sel;\r\n }", "function reCheckSelection(doc) {\n\t\t setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false));\n\t\t }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) out = sel.ranges.slice(0, i);\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel;\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i]\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i]\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear)\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear)\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i) }\n out[i] = new Range(newAnchor, newHead)\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel\n}", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i]\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i]\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear)\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear)\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i) }\n out[i] = new Range(newAnchor, newHead)\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel\n}", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n\t\t var out;\n\t\t for (var i = 0; i < sel.ranges.length; i++) {\n\t\t var range = sel.ranges[i];\n\t\t var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n\t\t var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n\t\t var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n\t\t if (out || newAnchor != range.anchor || newHead != range.head) {\n\t\t if (!out) out = sel.ranges.slice(0, i);\n\t\t out[i] = new Range(newAnchor, newHead);\n\t\t }\n\t\t }\n\t\t return out ? normalizeSelection(out, sel.primIndex) : sel;\n\t\t }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n\t var out;\n\t for (var i = 0; i < sel.ranges.length; i++) {\n\t var range = sel.ranges[i];\n\t var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n\t var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n\t var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n\t if (out || newAnchor != range.anchor || newHead != range.head) {\n\t if (!out) out = sel.ranges.slice(0, i);\n\t out[i] = new Range(newAnchor, newHead);\n\t }\n\t }\n\t return out ? normalizeSelection(out, sel.primIndex) : sel;\n\t }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n\t var out;\n\t for (var i = 0; i < sel.ranges.length; i++) {\n\t var range = sel.ranges[i];\n\t var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n\t var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n\t var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n\t if (out || newAnchor != range.anchor || newHead != range.head) {\n\t if (!out) out = sel.ranges.slice(0, i);\n\t out[i] = new Range(newAnchor, newHead);\n\t }\n\t }\n\t return out ? normalizeSelection(out, sel.primIndex) : sel;\n\t }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n\t var out;\n\t for (var i = 0; i < sel.ranges.length; i++) {\n\t var range = sel.ranges[i];\n\t var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n\t var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n\t var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n\t if (out || newAnchor != range.anchor || newHead != range.head) {\n\t if (!out) out = sel.ranges.slice(0, i);\n\t out[i] = new Range(newAnchor, newHead);\n\t }\n\t }\n\t return out ? normalizeSelection(out, sel.primIndex) : sel;\n\t }", "function _checkForCellScapeSelections(view_id) {\n\t\treturn (typeof _checkForSelections !== \"function\" || // if no cellScape, return true\n \t\t(typeof _checkForSelections === \"function\" && _checkForSelections(curVizObj.view_id))); // if cellScape, check for its selections\n\t}", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel\n}", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel\n}", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel\n}", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel\n}", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel\n}", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel\n}", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel\n}", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel\n}", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel\n}", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel\n}", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel\n}", "isRangeHaveSelector(range) {\n return range.names.some(({ mains }) => mains !== null);\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = range.head == range.anchor ? newAnchor : skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = range.head == range.anchor ? newAnchor : skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n\t\t var out;\n\t\t for (var i = 0; i < sel.ranges.length; i++) {\n\t\t var range = sel.ranges[i];\n\t\t var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n\t\t var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n\t\t var newHead = range.head == range.anchor ? newAnchor : skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n\t\t if (out || newAnchor != range.anchor || newHead != range.head) {\n\t\t if (!out) { out = sel.ranges.slice(0, i); }\n\t\t out[i] = new Range(newAnchor, newHead);\n\t\t }\n\t\t }\n\t\t return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel\n\t\t }", "get empty() {\n let ranges = this.ranges;\n for (let i = 0; i < ranges.length; i++)\n if (ranges[i].$from.pos != ranges[i].$to.pos)\n return false;\n return true;\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\r\n var out;\r\n for (var i = 0; i < sel.ranges.length; i++) {\r\n var range = sel.ranges[i];\r\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\r\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\r\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\r\n if (out || newAnchor != range.anchor || newHead != range.head) {\r\n if (!out) { out = sel.ranges.slice(0, i); }\r\n out[i] = new Range(newAnchor, newHead);\r\n }\r\n }\r\n return out ? normalizeSelection(out, sel.primIndex) : sel\r\n}", "function selectionCheck(selections, left, right) {\n for (var i = 0; i < selections.length; i++) {\n var sl = selections[i][0];\n var sr = selections[i][1];\n\n if (sl <= left && left <= sr && sl <= right && right <= sr) return [\"inside\", [sl, sr]];\n\n if (sr < left || sl > right) continue;\n\n return [\"invalid\"];\n }\n return [\"valid\"];\n}", "isComplete() {\n return this.selection.start != null && this.selection.end != null;\n }", "isComplete() {\n return this.selection.start != null && this.selection.end != null;\n }", "function reCheckSelection(doc) {\n\t\t setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false), sel_dontScroll);\n\t\t }", "function reCheckSelection(doc) {\n\t setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false), sel_dontScroll);\n\t }", "function reCheckSelection(doc) {\n\t setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false), sel_dontScroll);\n\t }", "function reCheckSelection(doc) {\n\t setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false), sel_dontScroll);\n\t }", "function reCheckSelection(doc) {\n setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false));\n}", "function reCheckSelection(doc) {\n setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false));\n}", "function reCheckSelection(doc) {\n setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false));\n}", "function reCheckSelection(doc) {\n setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false));\n}", "function reCheckSelection(doc) {\n setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false));\n}", "function reCheckSelection(doc) {\n setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false));\n}", "function reCheckSelection(doc) {\n setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false));\n}", "function reCheckSelection(doc) {\n setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false));\n}", "function reCheckSelection(doc) {\n setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false));\n}", "function reCheckSelection(doc) {\n setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false));\n}", "function reCheckSelection(doc) {\n setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false));\n}", "function reCheckSelection(doc) {\r\n setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false));\r\n}", "_validateSelectedDates(dates) {\n const that = this;\n let outOfRangeDates = [];\n\n if (!dates) {\n dates = that.selectedDates;\n }\n\n let selectedDates = dates.slice(0),\n filter = function (date) {\n if (date.getTime() >= that.min.getTime() && date.getTime() <= that.max.getTime() && !isRestrictedDate(date)) {\n return true;\n }\n\n outOfRangeDates.push(date);\n return;\n },\n isRestrictedDate = function (date) {\n for (let d = 0; d < that.restrictedDates.length; d++) {\n if (that.restrictedDates[d].getTime() === date.getTime()) {\n return true;\n }\n }\n }\n\n //Synchronize the attribute.\n that.selectedDates = selectedDates.filter(filter);\n\n //Unselects dates that are out of range.\n if (that._viewDates) {\n outOfRangeDates.map(date => that._selectDate(date));\n that._focusCell();\n }\n }", "checkOptionsWithinRange (e) {\n // helper function to create our of range list of options and it's min and max value\n let maxAndMinInput = (option) => {\n let currOptionIndex = _.findIndex(this.state.itemOptions, {'name': `${option}`});\n return ` ${option}: min = ${this.state.itemOptions[currOptionIndex].min} max = ${this.state.itemOptions[currOptionIndex].max}`;\n };\n\n let copySelectionStorage = Object.assign({}, this.state.selectionStorage);\n let inRangeItemList = [];\n let outOfRangeOptionList = [];\n for (let key in copySelectionStorage) {\n let currMainOption = this.state.itemOptions[_.findIndex(this.state.itemOptions, {'name': `${key}`})];\n // check each option selection if it is with-in range\n if (copySelectionStorage[key].length <= currMainOption.max && copySelectionStorage[key].length >= currMainOption.min) {\n // if with-in rage, create the items list\n while (!copySelectionStorage[key].isEmpty()) {\n inRangeItemList.push(copySelectionStorage[key].dequeue());\n }\n // otherwise create the out of range item list\n } else {\n outOfRangeOptionList.push(key);\n }\n }\n // if there are items in the out of range list, aleart out of range options, otherwise log all option's item list\n return outOfRangeOptionList.length === 0 ? window.alert(`These are your selected items: [${inRangeItemList.toString()}]`) : window.alert(`You are not with-in rage for these options: [${_.map(outOfRangeOptionList, maxAndMinInput)}]`);\n }", "function conflictingCollapsedRange(doc, lineNo$$1, from, to, marker) {\n var line = getLine(doc, lineNo$$1);\n var sps = sawCollapsedSpans && line.markedSpans;\n if (sps) { for (var i = 0; i < sps.length; ++i) {\n var sp = sps[i];\n if (!sp.marker.collapsed) { continue }\n var found = sp.marker.find(0);\n var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);\n var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);\n if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) { continue }\n if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||\n fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))\n { return true }\n } }\n }", "function conflictingCollapsedRange(doc, lineNo$$1, from, to, marker) {\n var line = getLine(doc, lineNo$$1);\n var sps = sawCollapsedSpans && line.markedSpans;\n if (sps) { for (var i = 0; i < sps.length; ++i) {\n var sp = sps[i];\n if (!sp.marker.collapsed) { continue }\n var found = sp.marker.find(0);\n var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);\n var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);\n if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) { continue }\n if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||\n fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))\n { return true }\n } }\n }", "function conflictingCollapsedRange(doc, lineNo$$1, from, to, marker) {\n var line = getLine(doc, lineNo$$1);\n var sps = sawCollapsedSpans && line.markedSpans;\n if (sps) { for (var i = 0; i < sps.length; ++i) {\n var sp = sps[i];\n if (!sp.marker.collapsed) { continue }\n var found = sp.marker.find(0);\n var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);\n var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);\n if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) { continue }\n if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||\n fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))\n { return true }\n } }\n }", "function conflictingCollapsedRange(doc, lineNo$$1, from, to, marker) {\n var line = getLine(doc, lineNo$$1);\n var sps = sawCollapsedSpans && line.markedSpans;\n if (sps) { for (var i = 0; i < sps.length; ++i) {\n var sp = sps[i];\n if (!sp.marker.collapsed) { continue }\n var found = sp.marker.find(0);\n var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);\n var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);\n if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) { continue }\n if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||\n fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))\n { return true }\n } }\n }", "function conflictingCollapsedRange(doc, lineNo$$1, from, to, marker) {\n var line = getLine(doc, lineNo$$1);\n var sps = sawCollapsedSpans && line.markedSpans;\n if (sps) { for (var i = 0; i < sps.length; ++i) {\n var sp = sps[i];\n if (!sp.marker.collapsed) { continue }\n var found = sp.marker.find(0);\n var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);\n var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);\n if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) { continue }\n if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||\n fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))\n { return true }\n } }\n }", "function conflictingCollapsedRange(doc, lineNo$$1, from, to, marker) {\n var line = getLine(doc, lineNo$$1);\n var sps = sawCollapsedSpans && line.markedSpans;\n if (sps) { for (var i = 0; i < sps.length; ++i) {\n var sp = sps[i];\n if (!sp.marker.collapsed) { continue }\n var found = sp.marker.find(0);\n var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);\n var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);\n if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) { continue }\n if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||\n fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))\n { return true }\n } }\n }", "function conflictingCollapsedRange(doc, lineNo$$1, from, to, marker) {\n var line = getLine(doc, lineNo$$1);\n var sps = sawCollapsedSpans && line.markedSpans;\n if (sps) { for (var i = 0; i < sps.length; ++i) {\n var sp = sps[i];\n if (!sp.marker.collapsed) { continue }\n var found = sp.marker.find(0);\n var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);\n var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);\n if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) { continue }\n if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||\n fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))\n { return true }\n } }\n }", "function conflictingCollapsedRange(doc, lineNo$$1, from, to, marker) {\n var line = getLine(doc, lineNo$$1);\n var sps = sawCollapsedSpans && line.markedSpans;\n if (sps) { for (var i = 0; i < sps.length; ++i) {\n var sp = sps[i];\n if (!sp.marker.collapsed) { continue }\n var found = sp.marker.find(0);\n var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);\n var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);\n if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) { continue }\n if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||\n fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))\n { return true }\n } }\n }", "function conflictingCollapsedRange(doc, lineNo$$1, from, to, marker) {\n var line = getLine(doc, lineNo$$1);\n var sps = sawCollapsedSpans && line.markedSpans;\n if (sps) { for (var i = 0; i < sps.length; ++i) {\n var sp = sps[i];\n if (!sp.marker.collapsed) { continue }\n var found = sp.marker.find(0);\n var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);\n var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);\n if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) { continue }\n if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||\n fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))\n { return true }\n } }\n }" ]
[ "0.6870172", "0.60677147", "0.6066715", "0.6055218", "0.60424894", "0.5962891", "0.5962891", "0.5962891", "0.5962891", "0.5962891", "0.5962891", "0.5962891", "0.596198", "0.5916995", "0.5891306", "0.5881634", "0.5881634", "0.5879924", "0.5879924", "0.5879924", "0.5879924", "0.5879924", "0.5879924", "0.5879924", "0.5879924", "0.5879924", "0.5879924", "0.5879924", "0.5879924", "0.5879924", "0.5879924", "0.5879924", "0.5867885", "0.58668435", "0.58668435", "0.58668435", "0.586325", "0.5851788", "0.5851788", "0.5851788", "0.5851788", "0.5851788", "0.5851788", "0.5851788", "0.5851788", "0.5851788", "0.5851788", "0.5851788", "0.58495075", "0.58283335", "0.58283335", "0.581373", "0.5811776", "0.5805065", "0.57721514", "0.5740285", "0.5740285", "0.5723079", "0.57010186", "0.57010186", "0.57010186", "0.564013", "0.564013", "0.564013", "0.564013", "0.564013", "0.564013", "0.564013", "0.564013", "0.564013", "0.564013", "0.564013", "0.5632622", "0.5632467", "0.5630636", "0.5606905", "0.5606905", "0.5606905", "0.5606905", "0.5606905", "0.5606905", "0.5606905", "0.5606905", "0.5606905" ]
0.57861257
69
Return a selection that does not partially select any atomic ranges.
function skipAtomicInSelection(doc, sel, bias, mayClear) { var out; for (var i = 0; i < sel.ranges.length; i++) { var range = sel.ranges[i]; var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i]; var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear); var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear); if (out || newAnchor != range.anchor || newHead != range.head) { if (!out) { out = sel.ranges.slice(0, i); } out[i] = new Range(newAnchor, newHead); } } return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "selection_excluding(cells) {\n const selection = new Set(this.selection);\n for (const cell of cells) {\n selection.delete(cell);\n }\n return selection;\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) out = sel.ranges.slice(0, i);\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel;\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) out = sel.ranges.slice(0, i);\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel;\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) out = sel.ranges.slice(0, i);\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel;\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) out = sel.ranges.slice(0, i);\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel;\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) out = sel.ranges.slice(0, i);\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel;\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) out = sel.ranges.slice(0, i);\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel;\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) out = sel.ranges.slice(0, i);\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel;\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\r\n var out;\r\n for (var i = 0; i < sel.ranges.length; i++) {\r\n var range = sel.ranges[i];\r\n var newAnchor = skipAtomic(doc, range.anchor, bias, mayClear);\r\n var newHead = skipAtomic(doc, range.head, bias, mayClear);\r\n if (out || newAnchor != range.anchor || newHead != range.head) {\r\n if (!out) out = sel.ranges.slice(0, i);\r\n out[i] = new Range(newAnchor, newHead);\r\n }\r\n }\r\n return out ? normalizeSelection(out, sel.primIndex) : sel;\r\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) out = sel.ranges.slice(0, i);\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel;\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i]\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i]\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear)\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear)\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i) }\n out[i] = new Range(newAnchor, newHead)\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel\n}", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i]\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i]\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear)\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear)\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i) }\n out[i] = new Range(newAnchor, newHead)\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel\n}", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel\n}", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel\n}", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel\n}", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel\n}", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel\n}", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel\n}", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel\n}", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel\n}", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel\n}", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel\n}", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel\n}", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\r\n var out;\r\n for (var i = 0; i < sel.ranges.length; i++) {\r\n var range = sel.ranges[i];\r\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\r\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\r\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\r\n if (out || newAnchor != range.anchor || newHead != range.head) {\r\n if (!out) { out = sel.ranges.slice(0, i); }\r\n out[i] = new Range(newAnchor, newHead);\r\n }\r\n }\r\n return out ? normalizeSelection(out, sel.primIndex) : sel\r\n}", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n\t\t var out;\n\t\t for (var i = 0; i < sel.ranges.length; i++) {\n\t\t var range = sel.ranges[i];\n\t\t var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n\t\t var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n\t\t var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n\t\t if (out || newAnchor != range.anchor || newHead != range.head) {\n\t\t if (!out) out = sel.ranges.slice(0, i);\n\t\t out[i] = new Range(newAnchor, newHead);\n\t\t }\n\t\t }\n\t\t return out ? normalizeSelection(out, sel.primIndex) : sel;\n\t\t }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n\t var out;\n\t for (var i = 0; i < sel.ranges.length; i++) {\n\t var range = sel.ranges[i];\n\t var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n\t var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n\t var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n\t if (out || newAnchor != range.anchor || newHead != range.head) {\n\t if (!out) out = sel.ranges.slice(0, i);\n\t out[i] = new Range(newAnchor, newHead);\n\t }\n\t }\n\t return out ? normalizeSelection(out, sel.primIndex) : sel;\n\t }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n\t var out;\n\t for (var i = 0; i < sel.ranges.length; i++) {\n\t var range = sel.ranges[i];\n\t var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n\t var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n\t var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n\t if (out || newAnchor != range.anchor || newHead != range.head) {\n\t if (!out) out = sel.ranges.slice(0, i);\n\t out[i] = new Range(newAnchor, newHead);\n\t }\n\t }\n\t return out ? normalizeSelection(out, sel.primIndex) : sel;\n\t }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n\t var out;\n\t for (var i = 0; i < sel.ranges.length; i++) {\n\t var range = sel.ranges[i];\n\t var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n\t var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n\t var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n\t if (out || newAnchor != range.anchor || newHead != range.head) {\n\t if (!out) out = sel.ranges.slice(0, i);\n\t out[i] = new Range(newAnchor, newHead);\n\t }\n\t }\n\t return out ? normalizeSelection(out, sel.primIndex) : sel;\n\t }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = range.head == range.anchor ? newAnchor : skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = range.head == range.anchor ? newAnchor : skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel\n }", "exclude(r) {\n r = cobalt.range(r); // make sure r has only nonconsecutive, nonoverlapping singlerange subranges, ordered\n var ri = 0;\n var si = 0;\n var result = this.ranges.slice().filter(function(CobaltSingleRange) {\n return CobaltSingleRange.start!=CobaltSingleRange.end;\n });\n while (ri<r.ranges.length && si<result.length) {\n if (r.ranges[ri].leftOf(result[si]) || r.ranges[ri].end==result[si].start) {\n ri++;\n } else if (r.ranges[ri].rightOf(result[si]) || r.ranges[ri].start==result[si].end) {\n si++;\n } else {\n var t1 = result[si].exclude(r.ranges[ri]);\n if (t1.length) {\n result = result.slice(0,si).concat(t1).concat(result.slice(si+1));\n //if (t1.size>1) {\n si++;\n //}\n } else {\n result.splice(si,1);\n }\n }\n }\n return new CobaltRange(result);\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n\t\t var out;\n\t\t for (var i = 0; i < sel.ranges.length; i++) {\n\t\t var range = sel.ranges[i];\n\t\t var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n\t\t var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n\t\t var newHead = range.head == range.anchor ? newAnchor : skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n\t\t if (out || newAnchor != range.anchor || newHead != range.head) {\n\t\t if (!out) { out = sel.ranges.slice(0, i); }\n\t\t out[i] = new Range(newAnchor, newHead);\n\t\t }\n\t\t }\n\t\t return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel\n\t\t }", "function normalizeSelection(ranges, primIndex) {\r\n var prim = ranges[primIndex];\r\n ranges.sort(function(a, b) { return cmp(a.from(), b.from()); });\r\n primIndex = indexOf(ranges, prim);\r\n for (var i = 1; i < ranges.length; i++) {\r\n var cur = ranges[i], prev = ranges[i - 1];\r\n if (cmp(prev.to(), cur.from()) >= 0) {\r\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\r\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\r\n if (i <= primIndex) --primIndex;\r\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\r\n }\r\n }\r\n return new Selection(ranges, primIndex);\r\n }", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function(a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) --primIndex;\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex);\n }", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function(a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) --primIndex;\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex);\n }", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function(a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) --primIndex;\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex);\n }", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function(a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) --primIndex;\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex);\n }", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function(a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) --primIndex;\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex);\n }", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function(a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) --primIndex;\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex);\n }", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function(a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) --primIndex;\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex);\n }", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function(a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) --primIndex;\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex);\n }", "function normalizeSelection(ranges, primIndex) {\r\n var prim = ranges[primIndex];\r\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\r\n primIndex = indexOf(ranges, prim);\r\n for (var i = 1; i < ranges.length; i++) {\r\n var cur = ranges[i], prev = ranges[i - 1];\r\n if (cmp(prev.to(), cur.from()) >= 0) {\r\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\r\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\r\n if (i <= primIndex) { --primIndex; }\r\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\r\n }\r\n }\r\n return new Selection(ranges, primIndex)\r\n}", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex]\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); })\n primIndex = indexOf(ranges, prim)\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1]\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to())\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head\n if (i <= primIndex) { --primIndex }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to))\n }\n }\n return new Selection(ranges, primIndex)\n}", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex]\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); })\n primIndex = indexOf(ranges, prim)\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1]\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to())\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head\n if (i <= primIndex) { --primIndex }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to))\n }\n }\n return new Selection(ranges, primIndex)\n}", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n}", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n}", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n}", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n}", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n}", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n}", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n}", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n}", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n}", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n}", "function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n}", "function normalizeSelection(ranges, primIndex) {\n\t\t var prim = ranges[primIndex];\n\t\t ranges.sort(function(a, b) { return cmp(a.from(), b.from()); });\n\t\t primIndex = indexOf(ranges, prim);\n\t\t for (var i = 1; i < ranges.length; i++) {\n\t\t var cur = ranges[i], prev = ranges[i - 1];\n\t\t if (cmp(prev.to(), cur.from()) >= 0) {\n\t\t var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n\t\t var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n\t\t if (i <= primIndex) --primIndex;\n\t\t ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n\t\t }\n\t\t }\n\t\t return new Selection(ranges, primIndex);\n\t\t }", "function normalizeSelection(ranges, primIndex) {\n\t var prim = ranges[primIndex];\n\t ranges.sort(function(a, b) { return cmp(a.from(), b.from()); });\n\t primIndex = indexOf(ranges, prim);\n\t for (var i = 1; i < ranges.length; i++) {\n\t var cur = ranges[i], prev = ranges[i - 1];\n\t if (cmp(prev.to(), cur.from()) >= 0) {\n\t var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n\t var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n\t if (i <= primIndex) --primIndex;\n\t ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n\t }\n\t }\n\t return new Selection(ranges, primIndex);\n\t }", "function normalizeSelection(ranges, primIndex) {\n\t var prim = ranges[primIndex];\n\t ranges.sort(function(a, b) { return cmp(a.from(), b.from()); });\n\t primIndex = indexOf(ranges, prim);\n\t for (var i = 1; i < ranges.length; i++) {\n\t var cur = ranges[i], prev = ranges[i - 1];\n\t if (cmp(prev.to(), cur.from()) >= 0) {\n\t var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n\t var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n\t if (i <= primIndex) --primIndex;\n\t ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n\t }\n\t }\n\t return new Selection(ranges, primIndex);\n\t }", "function normalizeSelection(ranges, primIndex) {\n\t var prim = ranges[primIndex];\n\t ranges.sort(function(a, b) { return cmp(a.from(), b.from()); });\n\t primIndex = indexOf(ranges, prim);\n\t for (var i = 1; i < ranges.length; i++) {\n\t var cur = ranges[i], prev = ranges[i - 1];\n\t if (cmp(prev.to(), cur.from()) >= 0) {\n\t var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n\t var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n\t if (i <= primIndex) --primIndex;\n\t ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n\t }\n\t }\n\t return new Selection(ranges, primIndex);\n\t }", "function select_non_corner_cell(){\n return select_available_cell_in_array([upper_center_cell, right_center_cell, left_center_cell, lower_center_cell]);\n }", "function normalizeSelection(cm, ranges, primIndex) {\n var mayTouch = cm && cm.options.selectionsMayTouch;\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n var diff = cmp(prev.to(), cur.from());\n if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n }", "function normalizeSelection(cm, ranges, primIndex) {\n var mayTouch = cm && cm.options.selectionsMayTouch;\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n var diff = cmp(prev.to(), cur.from());\n if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n }", "function normalizeSelection(cm, ranges, primIndex) {\n var mayTouch = cm && cm.options.selectionsMayTouch;\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n var diff = cmp(prev.to(), cur.from());\n if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n }", "function normalizeSelection(cm, ranges, primIndex) {\n var mayTouch = cm && cm.options.selectionsMayTouch;\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n var diff = cmp(prev.to(), cur.from());\n if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n }", "function normalizeSelection(cm, ranges, primIndex) {\n var mayTouch = cm && cm.options.selectionsMayTouch;\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n var diff = cmp(prev.to(), cur.from());\n if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n }", "function normalizeSelection(cm, ranges, primIndex) {\n var mayTouch = cm && cm.options.selectionsMayTouch;\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n var diff = cmp(prev.to(), cur.from());\n if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n }", "function normalizeSelection(cm, ranges, primIndex) {\n var mayTouch = cm && cm.options.selectionsMayTouch;\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n var diff = cmp(prev.to(), cur.from());\n if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n }", "function normalizeSelection(cm, ranges, primIndex) {\n var mayTouch = cm && cm.options.selectionsMayTouch;\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n var diff = cmp(prev.to(), cur.from());\n if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n }", "function normalizeSelection(cm, ranges, primIndex) {\n var mayTouch = cm && cm.options.selectionsMayTouch;\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n var diff = cmp(prev.to(), cur.from());\n if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n }", "function normalizeSelection(cm, ranges, primIndex) {\n var mayTouch = cm && cm.options.selectionsMayTouch;\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n var diff = cmp(prev.to(), cur.from());\n if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n }", "function normalizeSelection(cm, ranges, primIndex) {\n var mayTouch = cm && cm.options.selectionsMayTouch;\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n var diff = cmp(prev.to(), cur.from());\n if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n }", "function normalizeSelection(cm, ranges, primIndex) {\n var mayTouch = cm && cm.options.selectionsMayTouch;\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n var diff = cmp(prev.to(), cur.from());\n if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n }", "function normalizeSelection(cm, ranges, primIndex) {\n var mayTouch = cm && cm.options.selectionsMayTouch;\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n var diff = cmp(prev.to(), cur.from());\n if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n }", "function normalizeSelection(cm, ranges, primIndex) {\n var mayTouch = cm && cm.options.selectionsMayTouch;\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n var diff = cmp(prev.to(), cur.from());\n if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n }", "function normalizeSelection(cm, ranges, primIndex) {\n var mayTouch = cm && cm.options.selectionsMayTouch;\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n var diff = cmp(prev.to(), cur.from());\n if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n }", "function normalizeSelection(cm, ranges, primIndex) {\n var mayTouch = cm && cm.options.selectionsMayTouch;\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n var diff = cmp(prev.to(), cur.from());\n if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n }", "function normalizeSelection(cm, ranges, primIndex) {\n var mayTouch = cm && cm.options.selectionsMayTouch;\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n var diff = cmp(prev.to(), cur.from());\n if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n }", "function selectionTrim() {\n if (selectionExists()) {\n var range = selectionRange();\n rangeTrim(range);\n selectionSet(range);\n }\n}", "function normalizeSelection(cm, ranges, primIndex) {\n var mayTouch = cm && cm.options.selectionsMayTouch;\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) {\n return cmp(a.from(), b.from());\n });\n primIndex = indexOf(ranges, prim);\n\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i],\n prev = ranges[i - 1];\n var diff = cmp(prev.to(), cur.from());\n\n if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {\n var from = minPos(prev.from(), cur.from()),\n to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n\n if (i <= primIndex) {\n --primIndex;\n }\n\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n\n return new Selection(ranges, primIndex);\n }", "function Selection (ranges) {\n this.ranges = ranges || [];\n }", "static create(ranges, mainIndex = 0) {\n if (ranges.length == 0)\n throw new RangeError(\"A selection needs at least one range\");\n for (let pos = 0, i = 0; i < ranges.length; i++) {\n let range = ranges[i];\n if (range.empty ? range.from <= pos : range.from < pos)\n return EditorSelection.normalized(ranges.slice(), mainIndex);\n pos = range.to;\n }\n return new EditorSelection(ranges, mainIndex);\n }", "function normalizeSelection(cm, ranges, primIndex) {\n\t\t var mayTouch = cm && cm.options.selectionsMayTouch;\n\t\t var prim = ranges[primIndex];\n\t\t ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n\t\t primIndex = indexOf(ranges, prim);\n\t\t for (var i = 1; i < ranges.length; i++) {\n\t\t var cur = ranges[i], prev = ranges[i - 1];\n\t\t var diff = cmp(prev.to(), cur.from());\n\t\t if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {\n\t\t var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n\t\t var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n\t\t if (i <= primIndex) { --primIndex; }\n\t\t ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n\t\t }\n\t\t }\n\t\t return new Selection(ranges, primIndex)\n\t\t }", "restoreSelections() {\n if (!this.trackedSelections) {\n return;\n }\n const value = AppContext.getInstance().hash.getProp(AppConstants.HASH_PROPS.SELECTION, '');\n if (value === '') {\n return;\n }\n const ranges = value.split(';').map((s) => ParseRangeUtils.parseRangeLike(s));\n this.trackedSelections.select(ranges);\n }", "function selectedRange(document) {\n const selection = document.getSelection();\n if (!selection.rangeCount || selection.getRangeAt(0).collapsed) {\n return null;\n } else {\n return selection.getRangeAt(0);\n }\n}", "unselect() {\n this.selection = null;\n this.refreshSelection();\n return this;\n }", "function removeAllSelections() {\r\n\tvar pos = getCaretPosition();\r\n\twindow.getSelection().removeAllRanges();\r\n\tsetCaretPosition(pos);\r\n}" ]
[ "0.68471473", "0.6635531", "0.6635531", "0.6635531", "0.6635531", "0.6635531", "0.6635531", "0.6635531", "0.6594504", "0.6475148", "0.6474048", "0.6474048", "0.6436025", "0.6436025", "0.6436025", "0.6436025", "0.6436025", "0.6436025", "0.6436025", "0.6436025", "0.6436025", "0.6436025", "0.6436025", "0.6419438", "0.6402902", "0.63865066", "0.63865066", "0.63865066", "0.63612896", "0.63612896", "0.627803", "0.62563026", "0.6103766", "0.60681695", "0.60681695", "0.60681695", "0.60681695", "0.60681695", "0.60681695", "0.60681695", "0.60681695", "0.6058207", "0.605583", "0.605583", "0.6041058", "0.6041058", "0.6041058", "0.6041058", "0.6041058", "0.6041058", "0.6041058", "0.6041058", "0.6041058", "0.6041058", "0.6041058", "0.59968215", "0.59628546", "0.59628546", "0.59628546", "0.5775996", "0.5750699", "0.5750699", "0.5750699", "0.5750699", "0.5750699", "0.5750699", "0.5750699", "0.5750699", "0.5750699", "0.5750699", "0.5750699", "0.5750699", "0.5750699", "0.5750699", "0.5750699", "0.5750699", "0.5750699", "0.57291895", "0.5699387", "0.56901574", "0.56621176", "0.560478", "0.55990916", "0.558706", "0.5561577", "0.55428517" ]
0.64379954
22
Ensure a given position is not inside an atomic range.
function skipAtomic(doc, pos, oldPos, bias, mayClear) { var dir = bias || 1; var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) || (!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) || skipAtomicInner(doc, pos, oldPos, -dir, mayClear) || (!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true)); if (!found) { doc.cantEdit = true; return Pos(doc.first, 0) } return found }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static isInsideRange(position, range) {\n if (range.start.line === range.end.line) {\n return range.start.line === position.line\n && range.start.character <= position.character\n && position.character <= range.end.character;\n }\n else if (range.start.line === position.line) {\n return range.start.character <= position.character;\n }\n else if (range.end.line === position.line) {\n return position.character <= range.end.character;\n }\n return range.start.line < position.line && position.line < range.end.line;\n }", "function legalMove(globals, ui, start, end) {\n return (!(end == start) && end >= globals.leftBound && start >= globals.leftBound && end <= globals.rightBound && start <= globals.rightBound);\n}", "function illegalMove(position, amount) { // if we collide\n if (position.x < MIN_X || position.x > MAX_X) return true;\n if (position.y < MIN_Y || position.y > MAX_Y) return true;\n for (var i = 0; i < blocks.length; i++) {\n if (blocks[i].collision(position, amount, false)) {\n return true;\n }\n }\n\n return false;\n}", "_isOnSafeCell (position) {\n return position % 100 === 13 || position % 100 === 34\n }", "valid(index) { return (this.start<=index && index<this.end) }", "isValidPos(pos) {\n try {\n let x = pos[0];\n let y = pos[1];\n return ( (x > -1 && x < 8) && (y > -1 && y < 8) );\n } catch (error) {\n \n }\n }", "outOfBounds() {\n const minX = this.x >= 0;\n const maxX = this.x < tileSizeFull * cols;\n const minY = this.y >= 0;\n const maxY = this.y < tileSizeFull * rows;\n\n if (!(minX && maxX && minY && maxY)) {\n this.removeSelf();\n }\n }", "function checkRange(x, n, m) {\n if (x >= n && x <= m) { return x; }\n else { return !x; }\n }", "function isInRange(pos, start, end) {\n if (typeof pos != 'number') {\n // Assume it is a cursor position. Get the line number.\n pos = pos.line;\n }\n if (start instanceof Array) {\n return inArray(pos, start);\n } else {\n if (typeof end == 'number') {\n return (pos >= start && pos <= end);\n } else {\n return pos == start;\n }\n }\n }", "get empty() {\n let ranges = this.ranges;\n for (let i = 0; i < ranges.length; i++)\n if (ranges[i].$from.pos != ranges[i].$to.pos)\n return false;\n return true;\n }", "isValid(position) {\n\t\treturn position.x >= 0 && position.x < this.width\n\t\t && position.y >= 0 && position.y < this.height;\n\t}", "function isInRange(pos, start, end) {\n if (typeof pos != 'number') {\n // Assume it is a cursor position. Get the line number.\n pos = pos.line;\n }\n if (start instanceof Array) {\n return inArray(pos, start);\n } else {\n if (end) {\n return (pos >= start && pos <= end);\n } else {\n return pos == start;\n }\n }\n }", "function checkCoordinates (startCoordinate, direction, length) {\n let noOverlap = true\n for (let i = 0; i < length; i++) {\n let newCoordinate = [startCoordinate[0] + i * direction[0], startCoordinate[1] + i * direction[1]]\n this.reservedCoordinates.forEach(coordinate => {\n let reservedX = coordinate[0]\n let reservedY = coordinate[1]\n let newX = newCoordinate[0]\n let newY = newCoordinate[1]\n if (reservedX === newX && reservedY === newY) {\n noOverlap = false\n } \n })\n }\n return noOverlap\n}", "function validPosition(row, col) {\r\n //set boundary\r\n if (row < NUM_ROWS && col < NUM_COLS && row >= 0 && col >= 0) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }", "function isFailX(elFuturePos,elRegion,visibleRect){return elFuturePos.left<visibleRect.left||elFuturePos.left+elRegion.width>visibleRect.right;}", "function outsideRange(a, b, c) {\n var out;\n if (b < c) {\n out = a < b || a > c;\n } else if (b > c) {\n out = a > b || a < c;\n } else {\n out = a != b;\n }\n return out;\n }", "inRange (number, start, end){\r\n // if end is undefined, start = 0 and end = start, then check if in range\r\n if (typeof end === 'undefined'){\r\n end = start;\r\n start = 0;\r\n } else if ( start > end ){\r\n // swap the two values around\r\n let temp = start;\r\n start = end;\r\n end = temp;\r\n }\r\n if ((number > start) && (number < end)){\r\n return true;\r\n }\r\n else\r\n return false;\r\n }", "function outsideBounds(position, world) {\n return position.x > world.length - 1 || position.x < 0 || position.y > world[0].length - 1|| position.y < 0\n}", "_safeCell(x, y) {\r\n if (x < 0 || x >= this.grid.length) return false\r\n if (y < 0 || y >= this.grid[x].length) return false\r\n return true\r\n }", "isValidPosition(pos){\n return pos.x >=0 && pos.y >= 0 && pos.x < this.props.width && pos.y < this.props.height; \n }", "function positionIsTaken(x_pos, y_pos) {\n var value = board[y_pos][x_pos];\n return value === 0 ? false : true;\n}", "check_d_range(space) {\r\n const xd = Math.abs(this.x - space.x);\r\n\r\n if(xd <= this.straight) {\r\n return true;\r\n } else {\r\n return false;\r\n };\r\n }", "function checkAvailable(pos) {\n return board[pos] !== 'X' && board[pos] !== 'O';\n}", "contains_exclusive(dat_or_drange){\n return this.starts_before(dat_or_drange) && this.ends_after(dat_or_drange) ;\n }", "function checkIfCardPositionValid(position) {\n if(position >= 0) return position;\n else return 0;\n }", "function validatePositions(start, end) {\n if (!start || start === 'none' || !end || end === 'none') {\n return 'Start or end position is unassigned.';\n }\n\n if (start === end) {\n return 'Start and end positions can\\'t be the same.'\n }\n\n if (start > end) {\n return 'Start position can\\'t be after end position.';\n }\n\n return null;\n}", "isCoveredBy(ranges: Interval[]): boolean {\n var remaining = this.clone();\n for (var i = 0; i < ranges.length; i++) {\n var r = ranges[i];\n if (i && r.start < ranges[i - 1].start) {\n throw 'isCoveredBy must be called with sorted ranges';\n }\n if (r.start > remaining.start) {\n return false; // A position has been missed and there's no going back.\n }\n remaining.start = r.stop + 1;\n if (remaining.length() <= 0) {\n return true;\n }\n }\n return false;\n }", "function isPositionNotReached() {\n\tfor(var i=ABSCISSA.length;i--;) {\n\t\tif(!positionReached[i] || !rotationReached[i]) return true;\n\t}\n\treturn false;\n}", "function isFree(position, coord) {\n return coord.isValid() && position.board[coord.offset] == null;\n}", "function outOfRange(col, row){\r\n\treturn (col<0 || row<0 || col>=field_width || row >= field_height); \r\n}", "_safeCell(x, y) {\n if (x < 0 || x >= this.width) return false\n if (y < 0 || y >= this.height) return false\n return true\n }", "get isRangeInScope() {\n return (\n this.range &&\n this.target &&\n this.rangeNodeOrParentNode(this.range) &&\n this.target.contains(this.rangeNodeOrParentNode(this.range))\n );\n }", "inRange(position, range) {\n let found = false;\n for (let i = 0; i < range.length; i++) {\n if (position[0] === range[i][0] && position[1] === range[i][1]) { found = true }\n }\n return found;\n }", "function rangeIn(range, i) {\n return range.reduce((isIn, [a, b]) => isIn || (i >= a && i <= b), false);\n}", "function unUsedInBox(solutionGrid, rowStart, colStart, num) \n { \n for (let i = 0; i<3; i++) \n for (let j = 0; j<3; j++) \n if (solutionGrid[rowStart+i][colStart+j]==num) \n return false; \n\n return true; \n }", "function isOccupied(position) {\n let div = document.getElementById(position)\n // if (div == null)\n // return false;\n console.log(position)\n if (div.firstChild.className === 'none') {\n return false\n } else {\n return true\n }\n }", "function testRangeCAS(a) {\n dprint(\"Range: \" + a.constructor.name);\n\n var msg = /out-of-range index/; // A generic message\n\n assertErrorMessage(() => Atomics.compareExchange(a, -1, 0, 1), RangeError, msg);\n assertEq(a[0], 0);\n\n assertErrorMessage(() => Atomics.compareExchange(a, \"hi\", 0, 1), RangeError, msg);\n assertEq(a[0], 0);\n\n assertErrorMessage(() => Atomics.compareExchange(a, a.length + 5, 0, 1), RangeError, msg);\n assertEq(a[0], 0);\n\n assertErrorMessage(() => Atomics.compareExchange(a, globlength, 0, 1), RangeError, msg);\n assertEq(a[0], 0);\n}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n}", "function validatePosition()\n{\n this.p = collisionWithWallsInSector(this.p, this.prev_p, this.sector, DO_NOT_UPDATE_WALL_DIR);\n this.p = collisionWithSectorsInSector(this.p, this.prev_p, this.sector, DO_NOT_UPDATE_WALL_DIR);\n}", "function checkRange(value) {\n if (value == DOT_INDEX || value == COMMA_INDEX || (value >= NUM_LOW && value <= NUM_HI) || (value >= LET_HI_LOW && value <= LET_HI_HI) || (value >= LET_LOW_LOW && value <= LET_LOW_HI)) {\n return true;\n }\n return false;\n}", "function checkBounds(posn, leftBound, rightBound) {\n var x = posn[0];\n return x > leftBound && x < rightBound;\n }", "function isFailX(elFuturePos, elRegion, visibleRect) {\n return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n }", "function validateCoord(x, y){\n x = Number(x);\n y = Number(y);\n let length = game.grid.length;\n return x >= 0 && x < length && y >= 0 && y < length;\n}", "inBounds() {\n if (this.pos.x <= -50 || this.pos.x > 690 || this.pos.y <= -50 || this.pos.y > 690) {\n this.active = false;\n }\n }", "function cell_valid(row, col) {\n return row >= 0 && row < 12 && col >= 0 && col < 12;\n}", "rangeCheck(index) {\n if (index >= this.sizeNum || index < 0) {\n throw new Error(\"is no index--->\" + index);\n }\n }", "function verifyVacancy(direction, goBack) {\r\n\tif(currentRow < maxRow && currentColl + direction >= minColl && currentColl + direction <= maxColl) {\r\n\t\tif(isPositionOpen(direction, goBack)) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}\r\n\treturn false;\r\n}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n\t return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n\t}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n\t return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n\t}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n\t return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n\t}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n\t return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n\t}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n\t return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n\t}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n\t return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n\t}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n\t return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n\t}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n\t return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n\t}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n\t return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n\t}", "function isFailX(elFuturePos, elRegion, visibleRect) {\n\t return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;\n\t}", "function validateRange(activity, xValue, yValue) {\n\n}", "isSafe(grid, row, col, num) {\n // Check if 'num' is not already placed in current row,\n // current column and current 3x3 box\n return (\n !this.usedInRow(grid, row, num) &&\n !this.usedInCol(grid, col, num) &&\n !this.usedInBox(grid, row - (row % 3), col - (col % 3), num)\n );\n }", "function outOfBound(newMove) {\n if (newMove > 410 || newMove < 10) {\n promptError(\"You shall not pass!\");\n return true;\n } else return false;\n}", "function validRange(potentialRange) {\n if (potentialRange.indexOf(`:`) !== -1)\n return null;\n let range = rangesCache.get(potentialRange);\n if (typeof range !== `undefined`)\n return range;\n try {\n range = new semver_1.default.Range(potentialRange);\n }\n catch (_a) {\n range = null;\n }\n rangesCache.set(potentialRange, range);\n return range;\n}", "function outOfBoard(position) {\n charPart = String.fromCharCode(position.charCodeAt(0))\n intPart = parseInt(position.charAt(1))\n if (alpha.includes(charPart) && intPart > 0 && intPart < 9)\n return false\n else\n return true\n }", "function checkState(el, val) {\n // if the value does not fall in the range of the current state, update that shit.\n if (!_.contains(currentState.range, parseInt(val))) {\n updateState(el, val);\n }\n}", "function isSafe(rooms, currRow, currColumn) {\n return currColumn >= 0 && currColumn < rooms[0].length && currRow >= 0 && currRow < rooms.length\n}", "function checkValidMove(position_1, position_2) { \n if ((position_1[0] == position_2[0] && Math.abs(position_1[1] - position_2[1]) <= 1) || \n (position_1[1] == position_2[1] && Math.abs(position_1[0] - position_2[0]) <= 1)) {\n return true\n } else return false\n}", "function validPos(inpt,position)\r\n{\r\n\tif(pos>inpt.length)\r\n\t{\r\n\t\tdocument.write(\"Invalid Position!\");\r\n\t\treturn;\r\n\t}\r\n\telse\r\n\t\treturn 1;\r\n\r\n}", "function inRangeCheck(intervalIdx, currIdx) {\n if (cleanedLineInterval.length !== 0\n && cleanedLineInterval[intervalIdx].left <= currIdx\n && cleanedLineInterval[intervalIdx].right >= currIdx) {\n return true;\n } else {\n return false;\n }\n }", "function conflictingCollapsedRange(doc, lineNo, from, to, marker) {\n var line = getLine(doc, lineNo);\n var sps = sawCollapsedSpans && line.markedSpans;\n if (sps) for (var i = 0; i < sps.length; ++i) {\n var sp = sps[i];\n if (!sp.marker.collapsed) continue;\n var found = sp.marker.find(0);\n var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);\n var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);\n if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) continue;\n if (fromCmp <= 0 && (cmp(found.to, from) > 0 || (sp.marker.inclusiveRight && marker.inclusiveLeft)) ||\n fromCmp >= 0 && (cmp(found.from, to) < 0 || (sp.marker.inclusiveLeft && marker.inclusiveRight)))\n return true;\n }\n }" ]
[ "0.59879375", "0.5966708", "0.59146243", "0.562402", "0.56166", "0.5598513", "0.5584527", "0.5547357", "0.5532226", "0.5531274", "0.5508034", "0.54775023", "0.547714", "0.5409574", "0.54091066", "0.5399065", "0.5388472", "0.5386206", "0.53633547", "0.5344547", "0.5343511", "0.53342277", "0.5320871", "0.5320809", "0.5317828", "0.53163046", "0.53135747", "0.5307237", "0.529403", "0.5291769", "0.52887774", "0.52703065", "0.5266512", "0.52522707", "0.52518874", "0.52486473", "0.52431226", "0.5226431", "0.5226431", "0.5226431", "0.5226431", "0.5226431", "0.5226431", "0.5226431", "0.5226431", "0.5226431", "0.5226431", "0.5226431", "0.5226431", "0.5226431", "0.5226431", "0.5226431", "0.5226431", "0.5226431", "0.5226431", "0.5226431", "0.5226431", "0.5226431", "0.5226431", "0.5226431", "0.5226431", "0.5226431", "0.5226431", "0.5226431", "0.5226431", "0.5226431", "0.5226431", "0.5226431", "0.5226431", "0.5226431", "0.5226431", "0.52203625", "0.5189437", "0.5169552", "0.5169187", "0.5160598", "0.51578045", "0.5146155", "0.5142654", "0.5138981", "0.51359576", "0.51359576", "0.51359576", "0.51359576", "0.51359576", "0.51359576", "0.51359576", "0.51359576", "0.51359576", "0.51359576", "0.51301646", "0.5129398", "0.5111556", "0.51093125", "0.508969", "0.5086018", "0.508359", "0.50655913", "0.5059344", "0.50549275", "0.5049984" ]
0.0
-1